diff options
author | thestig <thestig@chromium.org> | 2016-10-28 11:54:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-28 11:54:23 -0700 |
commit | 5bca5ca83624d2ba8df064cb888c2f27ab248097 (patch) | |
tree | 69893d13b0ac8fe706eb674b82236d779ad327dc | |
parent | 95e5834ab6b6e5aa370cacd6266cecbd82c4c155 (diff) | |
download | pdfium-5bca5ca83624d2ba8df064cb888c2f27ab248097.tar.xz |
Change some ints to bools in JBIG2 code.
Review-Url: https://codereview.chromium.org/2450393004
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Context.cpp | 15 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_GrrdProc.cpp | 2 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_GrrdProc.h | 2 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_SddProc.h | 2 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_TrdProc.h | 2 |
5 files changed, 11 insertions, 12 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index 4239223669..c0e40e325d 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; diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp index 7ddb522ebc..669fed68e9 100644 --- a/core/fxcodec/jbig2/JBig2_GrrdProc.cpp +++ b/core/fxcodec/jbig2/JBig2_GrrdProc.cpp @@ -17,7 +17,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode(CJBig2_ArithDecoder* pArithDecoder, if (GRW == 0 || GRH == 0) return new CJBig2_Image(GRW, GRH); - if (GRTEMPLATE == 0) { + if (!GRTEMPLATE) { if ((GRAT[0] == -1) && (GRAT[1] == -1) && (GRAT[2] == -1) && (GRAT[3] == -1) && (GRREFERENCEDX == 0) && (GRW == (uint32_t)GRREFERENCE->width())) { diff --git a/core/fxcodec/jbig2/JBig2_GrrdProc.h b/core/fxcodec/jbig2/JBig2_GrrdProc.h index 389c760ed9..1ba0d6add0 100644 --- a/core/fxcodec/jbig2/JBig2_GrrdProc.h +++ b/core/fxcodec/jbig2/JBig2_GrrdProc.h @@ -32,7 +32,7 @@ class CJBig2_GRRDProc { uint32_t GRW; uint32_t GRH; - int GRTEMPLATE; + bool GRTEMPLATE; CJBig2_Image* GRREFERENCE; int32_t GRREFERENCEDX; int32_t GRREFERENCEDY; diff --git a/core/fxcodec/jbig2/JBig2_SddProc.h b/core/fxcodec/jbig2/JBig2_SddProc.h index b01b2ea4dd..fa799cb83f 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.h +++ b/core/fxcodec/jbig2/JBig2_SddProc.h @@ -42,7 +42,7 @@ class CJBig2_SDDProc { CJBig2_HuffmanTable* SDHUFFAGGINST; uint8_t SDTEMPLATE; int8_t SDAT[8]; - int SDRTEMPLATE; + bool SDRTEMPLATE; int8_t SDRAT[4]; }; diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.h b/core/fxcodec/jbig2/JBig2_TrdProc.h index 94f54442fb..9429a6a738 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.h +++ b/core/fxcodec/jbig2/JBig2_TrdProc.h @@ -74,7 +74,7 @@ class CJBig2_TRDProc { CJBig2_HuffmanTable* SBHUFFRDX; CJBig2_HuffmanTable* SBHUFFRDY; CJBig2_HuffmanTable* SBHUFFRSIZE; - int SBRTEMPLATE; + bool SBRTEMPLATE; int8_t SBRAT[4]; }; |