From 6087a2f18e0c779c1bae62812801cee98fe8a09d Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 3 Sep 2015 18:00:27 -0700 Subject: Remove CJBig2_Module::JBig2_Error and friends. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1327983003 . --- core/src/fxcodec/jbig2/JBig2_Context.cpp | 90 ---------------- core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp | 138 ------------------------ core/src/fxcodec/jbig2/JBig2_Module.h | 8 -- 3 files changed, 236 deletions(-) diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp index 46ed6f081e..142611dff5 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -85,24 +85,20 @@ int32_t CJBig2_Context::decodeFile(IFX_Pause* pPause) { const uint8_t fileID[] = {0x97, 0x4A, 0x42, 0x32, 0x0D, 0x0A, 0x1A, 0x0A}; int32_t nRet; if (m_pStream->getByteLeft() < 8) { - m_pModule->JBig2_Error("file header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } if (JBIG2_memcmp(m_pStream->getPointer(), fileID, 8) != 0) { - m_pModule->JBig2_Error("not jbig2 file"); nRet = JBIG2_ERROR_FILE_FORMAT; goto failed; } m_pStream->offset(8); if (m_pStream->read1Byte(&cFlags) != 0) { - m_pModule->JBig2_Error("file header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } if (!(cFlags & 0x02)) { if (m_pStream->readInteger(&dwTemp) != 0) { - m_pModule->JBig2_Error("file header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } @@ -349,7 +345,6 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { pSegment->m_nReferred_to_segment_count &= 0x1fffffff; if (pSegment->m_nReferred_to_segment_count > JBIG2_MAX_REFERRED_SEGMENT_COUNT) { - m_pModule->JBig2_Error("Too many referred segments."); return JBIG2_ERROR_LIMIT; } dwTemp = 5 + 4 + (pSegment->m_nReferred_to_segment_count + 1) / 8; @@ -389,8 +384,6 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { break; } if (pSegment->m_pReferred_to_segment_numbers[i] >= pSegment->m_dwNumber) { - m_pModule->JBig2_Error( - "The referred segment number is greater than this segment number."); goto failed; } } @@ -412,7 +405,6 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { pSegment->m_State = JBIG2_SEGMENT_DATA_UNPARSED; return JBIG2_SUCCESS; failed: - m_pModule->JBig2_Error("header too short."); return JBIG2_ERROR_TOO_SHORT; } int32_t CJBig2_Context::parseSegmentData(CJBig2_Segment* pSegment, @@ -478,7 +470,6 @@ int32_t CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment* pSegment, pPageInfo->m_wMaxStripeSize = wTemp & 0x7fff; if ((pPageInfo->m_dwHeight == 0xffffffff) && (pPageInfo->m_bIsStriped != TRUE)) { - m_pModule->JBig2_Warn("page height = 0xffffffff buf stripe field is 0"); pPageInfo->m_bIsStriped = TRUE; } if (!m_bBufSpecified) { @@ -517,10 +508,8 @@ int32_t CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment* pSegment, } return JBIG2_SUCCESS; failed1: - m_pModule->JBig2_Error("segment data too short."); return JBIG2_ERROR_TOO_SHORT; failed2: - m_pModule->JBig2_Error("segment syntax error."); return JBIG2_ERROR_FATAL; } int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, @@ -541,8 +530,6 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, uint8_t* key = pSegment->m_pData; FX_BOOL cache_hit = false; if (m_pStream->readShortInteger(&wFlags) != 0) { - m_pModule->JBig2_Error( - "symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } @@ -562,8 +549,6 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } for (i = 0; i < (int32_t)dwTemp; i++) { if (m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDAT[i]) != 0) { - m_pModule->JBig2_Error( - "symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } @@ -573,8 +558,6 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, (pSymbolDictDecoder->SDRTEMPLATE == 0)) { for (i = 0; i < 4; i++) { if (m_pStream->read1Byte((uint8_t*)&pSymbolDictDecoder->SDRAT[i]) != 0) { - m_pModule->JBig2_Error( - "symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } @@ -582,22 +565,16 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } if ((m_pStream->readInteger(&pSymbolDictDecoder->SDNUMEXSYMS) != 0) || (m_pStream->readInteger(&pSymbolDictDecoder->SDNUMNEWSYMS) != 0)) { - m_pModule->JBig2_Error( - "symbol dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } if (pSymbolDictDecoder->SDNUMEXSYMS > JBIG2_MAX_EXPORT_SYSMBOLS || pSymbolDictDecoder->SDNUMNEWSYMS > JBIG2_MAX_NEW_SYSMBOLS) { - m_pModule->JBig2_Error( - "symbol dictionary segment : too many export/new symbols."); nRet = JBIG2_ERROR_LIMIT; goto failed; } for (i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { if (!findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i])) { - m_pModule->JBig2_Error( - "symbol dictionary segment : can't find refered to segments"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -628,9 +605,6 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, pSymbolDictDecoder->SDINSYMS = SDINSYMS; if (pSymbolDictDecoder->SDHUFF == 1) { if ((cSDHUFFDH == 2) || (cSDHUFFDW == 2)) { - m_pModule->JBig2_Error( - "symbol dictionary segment : SDHUFFDH=2 or SDHUFFDW=2 is not " - "permitted."); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -648,9 +622,6 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "symbol dictionary segment : SDHUFFDH can't find user supplied " - "table."); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -669,9 +640,6 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "symbol dictionary segment : SDHUFFDW can't find user supplied " - "table."); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -685,9 +653,6 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "symbol dictionary segment : SDHUFFBMSIZE can't find user supplied " - "table."); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -704,9 +669,6 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "symbol dictionary segment : SDHUFFAGGINST can't find user " - "supplied table."); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -857,7 +819,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { JBIG2_ALLOC(pTRD, CJBig2_TRDProc()); if ((parseRegionInfo(&ri) != JBIG2_SUCCESS) || (m_pStream->readShortInteger(&wFlags) != 0)) { - m_pModule->JBig2_Error("text region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } @@ -878,7 +839,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pTRD->SBRTEMPLATE = (wFlags >> 15) & 0x0001; if (pTRD->SBHUFF == 1) { if (m_pStream->readShortInteger(&wFlags) != 0) { - m_pModule->JBig2_Error("text region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } @@ -894,21 +854,17 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { if ((pTRD->SBREFINE == 1) && (pTRD->SBRTEMPLATE == 0)) { for (i = 0; i < 4; i++) { if (m_pStream->read1Byte((uint8_t*)&pTRD->SBRAT[i]) != 0) { - m_pModule->JBig2_Error("text region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } } } if (m_pStream->readInteger(&pTRD->SBNUMINSTANCES) != 0) { - m_pModule->JBig2_Error("text region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } for (i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { if (!findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i])) { - m_pModule->JBig2_Error( - "text region segment : can't find refered to segments"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -939,8 +895,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { if (pTRD->SBHUFF == 1) { SBSYMCODES = decodeSymbolIDHuffmanTable(m_pStream, pTRD->SBNUMSYMS); if (SBSYMCODES == NULL) { - m_pModule->JBig2_Error( - "text region segment: symbol ID huffman table decode failure!"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -956,9 +910,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { if (pTRD->SBHUFF == 1) { if ((cSBHUFFFS == 2) || (cSBHUFFRDW == 2) || (cSBHUFFRDH == 2) || (cSBHUFFRDX == 2) || (cSBHUFFRDY == 2)) { - m_pModule->JBig2_Error( - "text region segment : SBHUFFFS=2 or SBHUFFRDW=2 or " - "SBHUFFRDH=2 or SBHUFFRDX=2 or SBHUFFRDY=2 is not permitted"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -976,8 +927,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "text region segment : SBHUFFFS can't find user supplied table"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -1001,8 +950,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "text region segment : SBHUFFDS can't find user supplied table"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -1026,8 +973,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "text region segment : SBHUFFDT can't find user supplied table"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -1046,8 +991,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "text region segment : SBHUFFRDW can't find user supplied table"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -1070,8 +1013,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "text region segment : SBHUFFRDH can't find user supplied table"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -1094,8 +1035,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "text region segment : SBHUFFRDX can't find user supplied table"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -1118,8 +1057,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "text region segment : SBHUFFRDY can't find user supplied table"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -1133,8 +1070,6 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } else { pSeg = findReferredSegmentByTypeAndIndex(pSegment, 53, nIndex++); if (!pSeg) { - m_pModule->JBig2_Error( - "text region segment : SBHUFFRSIZE can't find user supplied table"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -1240,13 +1175,10 @@ int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, (m_pStream->read1Byte(&pPDD->HDPW) != 0) || (m_pStream->read1Byte(&pPDD->HDPH) != 0) || (m_pStream->readInteger(&pPDD->GRAYMAX) != 0)) { - m_pModule->JBig2_Error( - "pattern dictionary segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } if (pPDD->GRAYMAX > JBIG2_MAX_PATTERN_INDEX) { - m_pModule->JBig2_Error("pattern dictionary segment : too max gray max."); nRet = JBIG2_ERROR_LIMIT; goto failed; } @@ -1305,7 +1237,6 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, (m_pStream->readInteger((FX_DWORD*)&pHRD->HGY) != 0) || (m_pStream->readShortInteger(&pHRD->HRX) != 0) || (m_pStream->readShortInteger(&pHRD->HRY) != 0)) { - m_pModule->JBig2_Error("halftone region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } @@ -1317,21 +1248,16 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, pHRD->HCOMBOP = (JBig2ComposeOp)((cFlags >> 4) & 0x07); pHRD->HDEFPIXEL = (cFlags >> 7) & 0x01; if (pSegment->m_nReferred_to_segment_count != 1) { - m_pModule->JBig2_Error( - "halftone region segment : refered to segment count not equals 1"); nRet = JBIG2_ERROR_FATAL; goto failed; } pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[0]); if ((pSeg == NULL) || (pSeg->m_cFlags.s.type != 16)) { - m_pModule->JBig2_Error( - "halftone region segment : refered to segment is not pattern dict"); nRet = JBIG2_ERROR_FATAL; goto failed; } pPatternDict = pSeg->m_Result.pd; if ((pPatternDict == NULL) || (pPatternDict->NUMPATS == 0)) { - m_pModule->JBig2_Error("halftone region segment : has no patterns input"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -1394,12 +1320,10 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, JBIG2_ALLOC(m_pGRD, CJBig2_GRDProc()); if ((parseRegionInfo(&m_ri) != JBIG2_SUCCESS) || (m_pStream->read1Byte(&cFlags) != 0)) { - m_pModule->JBig2_Error("generic region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } if (m_ri.height < 0 || m_ri.width < 0) { - m_pModule->JBig2_Error("generic region segment : wrong data."); nRet = JBIG2_FAILED; goto failed; } @@ -1412,8 +1336,6 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, if (m_pGRD->GBTEMPLATE == 0) { for (i = 0; i < 8; i++) { if (m_pStream->read1Byte((uint8_t*)&m_pGRD->GBAT[i]) != 0) { - m_pModule->JBig2_Error( - "generic region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } @@ -1421,8 +1343,6 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, } else { for (i = 0; i < 2; i++) { if (m_pStream->read1Byte((uint8_t*)&m_pGRD->GBAT[i]) != 0) { - m_pModule->JBig2_Error( - "generic region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } @@ -1527,8 +1447,6 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { JBIG2_ALLOC(pGRRD, CJBig2_GRRDProc()); if ((parseRegionInfo(&ri) != JBIG2_SUCCESS) || (m_pStream->read1Byte(&cFlags) != 0)) { - m_pModule->JBig2_Error( - "generic refinement region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } @@ -1539,8 +1457,6 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { if (pGRRD->GRTEMPLATE == 0) { for (i = 0; i < 4; i++) { if (m_pStream->read1Byte((uint8_t*)&pGRRD->GRAT[i]) != 0) { - m_pModule->JBig2_Error( - "generic refinement region segment : data header too short."); nRet = JBIG2_ERROR_TOO_SHORT; goto failed; } @@ -1551,9 +1467,6 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { for (i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[0]); if (pSeg == NULL) { - m_pModule->JBig2_Error( - "generic refinement region segment : can't find refered to " - "segments"); nRet = JBIG2_ERROR_FATAL; goto failed; } @@ -1563,9 +1476,6 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { } } if (i >= pSegment->m_nReferred_to_segment_count) { - m_pModule->JBig2_Error( - "generic refinement region segment : can't find refered to " - "intermediate region"); nRet = JBIG2_ERROR_FATAL; goto failed; } diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp index cd03424295..5278e45a68 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp @@ -80,10 +80,6 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3( JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { delete GBREG; - m_pModule->JBig2_Error( - "Generic region decoding procedure: Create Image Failed with width = " - "%d, height = %d\n", - GBW, GBH); return NULL; } pLine = GBREG->m_pData; @@ -223,10 +219,6 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3( JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { delete GBREG; - m_pModule->JBig2_Error( - "Generic region decoding procedure: Create Image Failed with width = " - "%d, height = %d\n", - GBW, GBH); return NULL; } pLine = GBREG->m_pData; @@ -363,10 +355,6 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3( JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { delete GBREG; - m_pModule->JBig2_Error( - "Generic region decoding procedure: Create Image Failed with width = " - "%d, height = %d\n", - GBW, GBH); return NULL; } pLine = GBREG->m_pData; @@ -501,10 +489,6 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3( JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); if (GBREG->m_pData == NULL) { delete GBREG; - m_pModule->JBig2_Error( - "Generic region decoding procedure: Create Image Failed with width = " - "%d, height = %d\n", - GBW, GBH); return NULL; } pLine = GBREG->m_pData; @@ -763,10 +747,6 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt( JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); if (GRREG->m_pData == NULL) { delete GRREG; - m_pModule->JBig2_Error( - "Generic refinement region decoding procedure: Create Image Failed " - "with width = %d, height = %d\n", - GRW, GRH); return NULL; } pLine = GRREG->m_pData; @@ -1003,10 +983,6 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt( JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); if (GRREG->m_pData == NULL) { delete GRREG; - m_pModule->JBig2_Error( - "Generic refinement region decoding procedure: Create Image Failed " - "with width = %d, height = %d\n", - GRW, GRH); return NULL; } pLine = GRREG->m_pData; @@ -1144,8 +1120,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, JBIG2_ALLOC(SBREG, CJBig2_Image(SBW, SBH)); SBREG->fill(SBDEFPIXEL); if (pHuffmanDecoder->decodeAValue(SBHUFFDT, &STRIPT) != 0) { - m_pModule->JBig2_Error( - "text region decoding procedure (huffman): too short."); goto failed; } STRIPT *= SBSTRIPS; @@ -1154,8 +1128,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, NINSTANCES = 0; while (NINSTANCES < SBNUMINSTANCES) { if (pHuffmanDecoder->decodeAValue(SBHUFFDT, &DT) != 0) { - m_pModule->JBig2_Error( - "text region decoding procedure (huffman): too short."); goto failed; } DT *= SBSTRIPS; @@ -1164,8 +1136,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, for (;;) { if (bFirst) { if (pHuffmanDecoder->decodeAValue(SBHUFFFS, &DFS) != 0) { - m_pModule->JBig2_Error( - "text region decoding procedure (huffman): too short."); goto failed; } FIRSTS = FIRSTS + DFS; @@ -1176,8 +1146,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, if (nVal == JBIG2_OOB) { break; } else if (nVal != 0) { - m_pModule->JBig2_Error( - "text region decoding procedure (huffman): too short."); goto failed; } else { CURS = CURS + IDS + SBDSOFFSET; @@ -1191,8 +1159,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, nTmp++; } if (pStream->readNBits(nTmp, &nVal) != 0) { - m_pModule->JBig2_Error( - "text region decoding procedure (huffman): too short."); goto failed; } CURT = nVal; @@ -1202,8 +1168,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, nBits = 0; for (;;) { if (pStream->read1Bit(&nTmp) != 0) { - m_pModule->JBig2_Error( - "text region decoding procedure (huffman): too short."); goto failed; } nVal = (nVal << 1) | nTmp; @@ -1222,8 +1186,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, RI = 0; } else { if (pStream->read1Bit(&RI) != 0) { - m_pModule->JBig2_Error( - "text region decoding procedure (huffman): too short."); goto failed; } } @@ -1235,8 +1197,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, (pHuffmanDecoder->decodeAValue(SBHUFFRDX, &RDXI) != 0) || (pHuffmanDecoder->decodeAValue(SBHUFFRDY, &RDYI) != 0) || (pHuffmanDecoder->decodeAValue(SBHUFFRSIZE, &nVal) != 0)) { - m_pModule->JBig2_Error( - "text region decoding procedure (huffman): too short."); goto failed; } pStream->alignByte(); @@ -1248,9 +1208,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, WOI = IBOI->m_nWidth; HOI = IBOI->m_nHeight; if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) { - m_pModule->JBig2_Error( - "text region decoding procedure (huffman): Invalid RDWI or RDHI " - "value."); goto failed; } JBIG2_ALLOC(pGRRD, CJBig2_GRRDProc()); @@ -1278,10 +1235,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, if ((FX_DWORD)nVal != (pStream->getOffset() - nTmp)) { delete IBI; delete pGRRD; - m_pModule->JBig2_Error( - "text region decoding procedure (huffman):" - "bytes processed by generic refinement region decoding procedure " - "doesn't equal SBHUFFRSIZE."); goto failed; } delete pGRRD; @@ -1402,8 +1355,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBIG2_ALLOC(SBREG, CJBig2_Image(SBW, SBH)); SBREG->fill(SBDEFPIXEL); if (IADT->decode(pArithDecoder, &STRIPT) == -1) { - m_pModule->JBig2_Error( - "text region decoding procedure (arith): too short."); goto failed; } STRIPT *= SBSTRIPS; @@ -1412,8 +1363,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, NINSTANCES = 0; while (NINSTANCES < SBNUMINSTANCES) { if (IADT->decode(pArithDecoder, &DT) == -1) { - m_pModule->JBig2_Error( - "text region decoding procedure (arith): too short."); goto failed; } DT *= SBSTRIPS; @@ -1422,8 +1371,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, for (;;) { if (bFirst) { if (IAFS->decode(pArithDecoder, &DFS) == -1) { - m_pModule->JBig2_Error( - "text region decoding procedure (arith): too short."); goto failed; } FIRSTS = FIRSTS + DFS; @@ -1434,8 +1381,6 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, if (nRet == JBIG2_OOB) { break; } else if (nRet != 0) { - m_pModule->JBig2_Error( - "text region decoding procedure (arith): too short."); goto failed; } else { CURS = CURS + IDS + SBDSOFFSET; @@ -1448,32 +1393,22 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, CURT = 0; } else { if (IAIT->decode(pArithDecoder, &nVal) == -1) { - m_pModule->JBig2_Error( - "text region decoding procedure (arith): too short."); goto failed; } CURT = nVal; } TI = STRIPT + CURT; if (IAID->decode(pArithDecoder, &nVal) == -1) { - m_pModule->JBig2_Error( - "text region decoding procedure (arith): too short."); goto failed; } IDI = nVal; if (IDI >= SBNUMSYMS) { - m_pModule->JBig2_Error( - "text region decoding procedure (arith): symbol id out of " - "range.(%d/%d)", - IDI, SBNUMSYMS); goto failed; } if (SBREFINE == 0) { RI = 0; } else { if (IARI->decode(pArithDecoder, &RI) == -1) { - m_pModule->JBig2_Error( - "text region decoding procedure (arith): too short."); goto failed; } } @@ -1487,17 +1422,12 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, (IARDH->decode(pArithDecoder, &RDHI) == -1) || (IARDX->decode(pArithDecoder, &RDXI) == -1) || (IARDY->decode(pArithDecoder, &RDYI) == -1)) { - m_pModule->JBig2_Error( - "text region decoding procedure (arith): too short."); goto failed; } IBOI = SBSYMS[IDI]; WOI = IBOI->m_nWidth; HOI = IBOI->m_nHeight; if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) { - m_pModule->JBig2_Error( - "text region decoding procedure (arith): Invalid RDWI or RDHI " - "value."); goto failed; } JBIG2_ALLOC(pGRRD, CJBig2_GRRDProc()); @@ -1658,15 +1588,10 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( while (NSYMSDECODED < SDNUMNEWSYMS) { BS = NULL; if (IADH->decode(pArithDecoder, &HCDH) == -1) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith): too short."); goto failed; } HCHEIGHT = HCHEIGHT + HCDH; if ((int)HCHEIGHT < 0 || (int)HCHEIGHT > JBIG2_MAX_IMAGE_SIZE) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith): invalid HCHEIGHT " - "value."); goto failed; } SYMWIDTH = 0; @@ -1676,21 +1601,13 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( if (nVal == JBIG2_OOB) { break; } else if (nVal != 0) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith): too short."); goto failed; } else { if (NSYMSDECODED >= SDNUMNEWSYMS) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith): NSYMSDECODED >= " - "SDNUMNEWSYMS."); goto failed; } SYMWIDTH = SYMWIDTH + DW; if ((int)SYMWIDTH < 0 || (int)SYMWIDTH > JBIG2_MAX_IMAGE_SIZE) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith): invalid SYMWIDTH " - "value."); goto failed; } else if (HCHEIGHT == 0 || SYMWIDTH == 0) { TOTWIDTH = TOTWIDTH + SYMWIDTH; @@ -1724,8 +1641,6 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( delete pGRD; } else { if (IAAI->decode(pArithDecoder, (int*)&REFAGGNINST) == -1) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith): too short."); goto failed; } if (REFAGGNINST > 1) { @@ -1831,21 +1746,13 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( } else if (REFAGGNINST == 1) { SBNUMSYMS = SDNUMINSYMS + NSYMSDECODED; if (IAID->decode(pArithDecoder, (int*)&IDI) == -1) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith): too short."); goto failed; } if ((IARDX->decode(pArithDecoder, &RDXI) == -1) || (IARDY->decode(pArithDecoder, &RDYI) == -1)) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith): too short."); goto failed; } if (IDI >= SBNUMSYMS) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith):" - " refinement references unknown symbol %d", - IDI); goto failed; } SBSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( @@ -1891,15 +1798,10 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { if (IAEX->decode(pArithDecoder, (int*)&EXRUNLENGTH) == -1) { m_pModule->JBig2_Free(EXFLAGS); - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith): too short."); goto failed; } if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) { m_pModule->JBig2_Free(EXFLAGS); - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith): Invalid EXRUNLENGTH " - "value."); goto failed; } if (EXRUNLENGTH != 0) { @@ -2020,15 +1922,10 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, BS = NULL; while (NSYMSDECODED < SDNUMNEWSYMS) { if (pHuffmanDecoder->decodeAValue(SDHUFFDH, &HCDH) != 0) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman): too short."); goto failed; } HCHEIGHT = HCHEIGHT + HCDH; if ((int)HCHEIGHT < 0 || (int)HCHEIGHT > JBIG2_MAX_IMAGE_SIZE) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman): invalid HCHEIGHT " - "value."); goto failed; } SYMWIDTH = 0; @@ -2039,21 +1936,13 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, if (nVal == JBIG2_OOB) { break; } else if (nVal != 0) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman): too short."); goto failed; } else { if (NSYMSDECODED >= SDNUMNEWSYMS) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman): NSYMSDECODED >= " - "SDNUMNEWSYMS."); goto failed; } SYMWIDTH = SYMWIDTH + DW; if ((int)SYMWIDTH < 0 || (int)SYMWIDTH > JBIG2_MAX_IMAGE_SIZE) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman): invalid " - "SYMWIDTH value."); goto failed; } else if (HCHEIGHT == 0 || SYMWIDTH == 0) { TOTWIDTH = TOTWIDTH + SYMWIDTH; @@ -2066,8 +1955,6 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, if (SDREFAGG == 1) { if (pHuffmanDecoder->decodeAValue(SDHUFFAGGINST, (int*)&REFAGGNINST) != 0) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman): too short."); goto failed; } BS = NULL; @@ -2185,8 +2072,6 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, for (;;) { if (pStream->read1Bit(&nTmp) != 0) { m_pModule->JBig2_Free(SBSYMCODES); - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman): too short."); goto failed; } nVal = (nVal << 1) | nTmp; @@ -2212,8 +2097,6 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, (pHuffmanDecoder->decodeAValue(SBHUFFRSIZE, &nVal) != 0)) { delete SBHUFFRDX; delete SBHUFFRSIZE; - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman): too short."); goto failed; } delete SBHUFFRDX; @@ -2252,10 +2135,6 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, m_pModule->JBig2_Free(SBSYMS); delete pGRRD; delete pArithDecoder; - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman):" - "bytes processed by generic refinement region decoding " - "procedure doesn't equal SBHUFFRSIZE."); goto failed; } m_pModule->JBig2_Free(SBSYMS); @@ -2271,8 +2150,6 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, } if (SDREFAGG == 0) { if (pHuffmanDecoder->decodeAValue(SDHUFFBMSIZE, (int32_t*)&BMSIZE) != 0) { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman): too short."); goto failed; } pStream->alignByte(); @@ -2286,8 +2163,6 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, pStream->offset(stride); } } else { - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman): too short."); goto failed; } } else { @@ -2324,16 +2199,11 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, if (pHuffmanDecoder->decodeAValue(pTable, (int*)&EXRUNLENGTH) != 0) { delete pTable; m_pModule->JBig2_Free(EXFLAGS); - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (huffman): too short."); goto failed; } if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) { delete pTable; m_pModule->JBig2_Free(EXFLAGS); - m_pModule->JBig2_Error( - "symbol dictionary decoding procedure (arith): Invalid EXRUNLENGTH " - "value."); goto failed; } if (EXRUNLENGTH != 0) { @@ -2749,10 +2619,6 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith( if ((*pImage)->m_pData == NULL) { delete *pImage; *pImage = NULL; - m_pModule->JBig2_Error( - "Generic region decoding procedure: Create Image Failed with width = " - "%d, height = %d\n", - GBW, GBH); m_ProssiveStatus = FXCODEC_STATUS_ERROR; return FXCODEC_STATUS_ERROR; } @@ -2821,10 +2687,6 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR(CJBig2_Image** pImage, if ((*pImage)->m_pData == NULL) { delete (*pImage); (*pImage) = NULL; - m_pModule->JBig2_Error( - "Generic region decoding procedure: Create Image Failed with width = " - "%d, height = %d\n", - GBW, GBH); m_ProssiveStatus = FXCODEC_STATUS_ERROR; return m_ProssiveStatus; } diff --git a/core/src/fxcodec/jbig2/JBig2_Module.h b/core/src/fxcodec/jbig2/JBig2_Module.h index 53e47605ba..bb06c8a0b3 100644 --- a/core/src/fxcodec/jbig2/JBig2_Module.h +++ b/core/src/fxcodec/jbig2/JBig2_Module.h @@ -22,13 +22,5 @@ class CJBig2_Module { virtual void* JBig2_Realloc(void* pMem, FX_DWORD dwSize) = 0; virtual void JBig2_Free(void* pMem) = 0; - - virtual void JBig2_Assert(int32_t nExpression) {} - - virtual void JBig2_Error(const FX_CHAR* format, ...) {} - - virtual void JBig2_Warn(const FX_CHAR* format, ...) {} - - virtual void JBig2_Log(const FX_CHAR* format, ...) {} }; #endif -- cgit v1.2.3