Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2083)

Unified Diff: core/fxcodec/jbig2/JBig2_Context.cpp

Issue 2450393004: Change some ints to bools in JBIG2 code. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | core/fxcodec/jbig2/JBig2_GrrdProc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fxcodec/jbig2/JBig2_Context.cpp
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index 42392236696a8da063b9ab47c07a261fb4268793..c0e40e325d5565e5b37f445c325769d90c7dfdf4 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -30,7 +30,7 @@ size_t GetHuffContextSize(uint8_t val) {
return val == 0 ? 65536 : val == 1 ? 8192 : 1024;
}
-size_t GetRefAggContextSize(FX_BOOL val) {
+size_t GetRefAggContextSize(bool val) {
return val ? 1024 : 8192;
}
@@ -428,7 +428,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment,
pSymbolDictDecoder->SDHUFF = wFlags & 0x0001;
pSymbolDictDecoder->SDREFAGG = (wFlags >> 1) & 0x0001;
pSymbolDictDecoder->SDTEMPLATE = (wFlags >> 10) & 0x0003;
- pSymbolDictDecoder->SDRTEMPLATE = (wFlags >> 12) & 0x0003;
+ pSymbolDictDecoder->SDRTEMPLATE = !!((wFlags >> 12) & 0x0003);
uint8_t cSDHUFFDH = (wFlags >> 2) & 0x0003;
uint8_t cSDHUFFDW = (wFlags >> 4) & 0x0003;
uint8_t cSDHUFFBMSIZE = (wFlags >> 6) & 0x0001;
@@ -440,8 +440,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment,
return JBIG2_ERROR_TOO_SHORT;
}
}
- if (pSymbolDictDecoder->SDREFAGG == 1 &&
- pSymbolDictDecoder->SDRTEMPLATE == 0) {
+ if (pSymbolDictDecoder->SDREFAGG == 1 && !pSymbolDictDecoder->SDRTEMPLATE) {
for (int32_t i = 0; i < 4; ++i) {
if (m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDRAT[i]) != 0)
return JBIG2_ERROR_TOO_SHORT;
@@ -660,7 +659,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) {
if (pTRD->SBDSOFFSET >= 0x0010) {
pTRD->SBDSOFFSET = pTRD->SBDSOFFSET - 0x0020;
}
- pTRD->SBRTEMPLATE = (wFlags >> 15) & 0x0001;
+ pTRD->SBRTEMPLATE = !!((wFlags >> 15) & 0x0001);
uint8_t cSBHUFFFS = 0;
uint8_t cSBHUFFDS = 0;
@@ -683,7 +682,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) {
cSBHUFFRDY = (wFlags >> 12) & 0x0003;
cSBHUFFRSIZE = (wFlags >> 14) & 0x0001;
}
- if (pTRD->SBREFINE == 1 && pTRD->SBRTEMPLATE == 0) {
+ if (pTRD->SBREFINE == 1 && !pTRD->SBRTEMPLATE) {
for (int32_t i = 0; i < 4; ++i) {
if (m_pStream->read1Byte((uint8_t*)&pTRD->SBRAT[i]) != 0)
return JBIG2_ERROR_TOO_SHORT;
@@ -1168,9 +1167,9 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) {
std::unique_ptr<CJBig2_GRRDProc> pGRRD(new CJBig2_GRRDProc);
pGRRD->GRW = ri.width;
pGRRD->GRH = ri.height;
- pGRRD->GRTEMPLATE = cFlags & 0x01;
+ pGRRD->GRTEMPLATE = !!(cFlags & 0x01);
pGRRD->TPGRON = (cFlags >> 1) & 0x01;
- if (pGRRD->GRTEMPLATE == 0) {
+ if (!pGRRD->GRTEMPLATE) {
for (int32_t i = 0; i < 4; ++i) {
if (m_pStream->read1Byte((uint8_t*)&pGRRD->GRAT[i]) != 0)
return JBIG2_ERROR_TOO_SHORT;
« no previous file with comments | « no previous file | core/fxcodec/jbig2/JBig2_GrrdProc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698