diff options
author | Lei Zhang <thestig@chromium.org> | 2015-09-10 16:40:49 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-09-10 16:40:49 -0700 |
commit | 536486822a5550de975293f7586598be5f29aaad (patch) | |
tree | c854dc8c38baae7acfb820f70913b3653b131f51 | |
parent | bffb53e526205df6c6313677270044cfcdd1abde (diff) | |
download | pdfium-536486822a5550de975293f7586598be5f29aaad.tar.xz |
Merge to XFA: Remove CJBig2_Object, CJBig2_Module, and friends.
TBR=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1326953006 .
(cherry picked from commit 70f4404e9a9e69afdfdd07715aa946f6561ce0cb)
Review URL: https://codereview.chromium.org/1336783002 .
22 files changed, 247 insertions, 523 deletions
@@ -408,9 +408,6 @@ static_library("fxcodec") { "core/src/fxcodec/jbig2/JBig2_Image.cpp", "core/src/fxcodec/jbig2/JBig2_Image.h", "core/src/fxcodec/jbig2/JBig2_List.h", - "core/src/fxcodec/jbig2/JBig2_Module.h", - "core/src/fxcodec/jbig2/JBig2_Object.cpp", - "core/src/fxcodec/jbig2/JBig2_Object.h", "core/src/fxcodec/jbig2/JBig2_Page.h", "core/src/fxcodec/jbig2/JBig2_PatternDict.cpp", "core/src/fxcodec/jbig2/JBig2_PatternDict.h", diff --git a/core/src/fxcodec/codec/codec_int.h b/core/src/fxcodec/codec/codec_int.h index ee7fe3ba6f..a37f7bd7b8 100644 --- a/core/src/fxcodec/codec/codec_int.h +++ b/core/src/fxcodec/codec/codec_int.h @@ -347,33 +347,6 @@ class CCodec_TiffModule : public ICodec_TiffModule { ~CCodec_TiffModule() override {} }; -class CPDF_Jbig2Interface : public CJBig2_Module { - public: - virtual void* JBig2_Malloc(FX_DWORD dwSize) { - return FX_Alloc(uint8_t, dwSize); - } - virtual void* JBig2_Malloc2(FX_DWORD num, FX_DWORD dwSize) { - if (dwSize && num >= UINT_MAX / dwSize) { - return NULL; - } - return FX_Alloc(uint8_t, num * dwSize); - } - virtual void* JBig2_Malloc3(FX_DWORD num, FX_DWORD dwSize, FX_DWORD dwSize2) { - if (dwSize2 && dwSize >= UINT_MAX / dwSize2) { - return NULL; - } - FX_DWORD size = dwSize2 * dwSize; - if (size && num >= UINT_MAX / size) { - return NULL; - } - return FX_Alloc(uint8_t, num * size); - } - virtual void* JBig2_Realloc(void* pMem, FX_DWORD dwSize) { - return FX_Realloc(uint8_t, pMem, dwSize); - } - virtual void JBig2_Free(void* pMem) { FX_Free(pMem); } -}; - class CCodec_Jbig2Context { public: CCodec_Jbig2Context(); @@ -414,7 +387,6 @@ class CCodec_Jbig2Module : public ICodec_Jbig2Module { void DestroyJbig2Context(void* pJbig2Context) override; private: - CPDF_Jbig2Interface m_Module; std::list<CJBig2_CachePair> m_SymbolDictCache; }; class CFX_DIBAttributeExif : public IFX_DIBAttributeExif { diff --git a/core/src/fxcodec/codec/fx_codec_fax.cpp b/core/src/fxcodec/codec/fx_codec_fax.cpp index 63a45c7aea..394e22b013 100644 --- a/core/src/fxcodec/codec/fx_codec_fax.cpp +++ b/core/src/fxcodec/codec/fx_codec_fax.cpp @@ -590,8 +590,7 @@ FX_DWORD CCodec_FaxDecoder::GetSrcOffset() { return ret; } extern "C" { -void _FaxG4Decode(void*, - const uint8_t* src_buf, +void _FaxG4Decode(const uint8_t* src_buf, FX_DWORD src_size, int* pbitpos, uint8_t* dest_buf, diff --git a/core/src/fxcodec/codec/fx_codec_jbig.cpp b/core/src/fxcodec/codec/fx_codec_jbig.cpp index b95461b3e5..9361604b9d 100644 --- a/core/src/fxcodec/codec/fx_codec_jbig.cpp +++ b/core/src/fxcodec/codec/fx_codec_jbig.cpp @@ -48,8 +48,8 @@ FXCODEC_STATUS CCodec_Jbig2Module::StartDecode(void* pJbig2Context, m_pJbig2Context->m_bFileReader = FALSE; FXSYS_memset(dest_buf, 0, height * dest_pitch); m_pJbig2Context->m_pContext = CJBig2_Context::CreateContext( - &m_Module, (uint8_t*)global_data, global_size, (uint8_t*)src_buf, - src_size, JBIG2_EMBED_STREAM, &m_SymbolDictCache, pPause); + global_data, global_size, src_buf, src_size, JBIG2_EMBED_STREAM, + &m_SymbolDictCache, pPause); if (!m_pJbig2Context->m_pContext) { return FXCODEC_STATUS_ERROR; } diff --git a/core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.h b/core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.h index 4bcaa1b8a5..ca8e181da7 100644 --- a/core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.h +++ b/core/src/fxcodec/jbig2/JBig2_ArithIntDecoder.h @@ -6,8 +6,9 @@ #ifndef _JBIG2_ARITH_INT_DECODER_H_ #define _JBIG2_ARITH_INT_DECODER_H_ -#include "JBig2_Module.h" + #include "JBig2_ArithDecoder.h" + class CJBig2_ArithIntDecoder { public: CJBig2_ArithIntDecoder(); diff --git a/core/src/fxcodec/jbig2/JBig2_BitStream.h b/core/src/fxcodec/jbig2/JBig2_BitStream.h index 78a9dfe677..85c992f4ff 100644 --- a/core/src/fxcodec/jbig2/JBig2_BitStream.h +++ b/core/src/fxcodec/jbig2/JBig2_BitStream.h @@ -11,7 +11,7 @@ class CJBig2_BitStream { public: - CJBig2_BitStream(uint8_t* pBuffer, FX_DWORD dwLength); + CJBig2_BitStream(const uint8_t* pBuffer, FX_DWORD dwLength); CJBig2_BitStream(CJBig2_BitStream& bs); @@ -55,18 +55,18 @@ class CJBig2_BitStream { void setBitPos(FX_DWORD dwBitPos); - uint8_t* getBuf(); + const uint8_t* getBuf(); FX_DWORD getLength() { return m_dwLength; } - uint8_t* getPointer(); + const uint8_t* getPointer(); void offset(FX_DWORD dwOffset); FX_DWORD getByteLeft(); private: - uint8_t* m_pBuf; + const uint8_t* m_pBuf; FX_DWORD m_dwLength; @@ -74,7 +74,8 @@ class CJBig2_BitStream { FX_DWORD m_dwBitIdx; }; -inline CJBig2_BitStream::CJBig2_BitStream(uint8_t* pBuffer, FX_DWORD dwLength) { +inline CJBig2_BitStream::CJBig2_BitStream(const uint8_t* pBuffer, + FX_DWORD dwLength) { m_pBuf = pBuffer; m_dwLength = dwLength; m_dwByteIdx = 0; @@ -274,10 +275,10 @@ inline void CJBig2_BitStream::setBitPos(FX_DWORD dwBitPos) { m_dwByteIdx = dwBitPos >> 3; m_dwBitIdx = dwBitPos & 7; } -inline uint8_t* CJBig2_BitStream::getBuf() { +inline const uint8_t* CJBig2_BitStream::getBuf() { return m_pBuf; } -inline uint8_t* CJBig2_BitStream::getPointer() { +inline const uint8_t* CJBig2_BitStream::getPointer() { return m_pBuf + m_dwByteIdx; } inline void CJBig2_BitStream::offset(FX_DWORD dwOffset) { diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp index 142611dff5..f045dbb20d 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp @@ -17,32 +17,30 @@ const int kSymbolDictCacheMaxSize = 2; CJBig2_Context* CJBig2_Context::CreateContext( - CJBig2_Module* pModule, - uint8_t* pGlobalData, + const uint8_t* pGlobalData, FX_DWORD dwGlobalLength, - uint8_t* pData, + const uint8_t* pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) { - return new (pModule) - CJBig2_Context(pGlobalData, dwGlobalLength, pData, dwLength, nStreamType, - pSymbolDictCache, pPause); + return new CJBig2_Context(pGlobalData, dwGlobalLength, pData, dwLength, + nStreamType, pSymbolDictCache, pPause); } void CJBig2_Context::DestroyContext(CJBig2_Context* pContext) { delete pContext; } -CJBig2_Context::CJBig2_Context(uint8_t* pGlobalData, +CJBig2_Context::CJBig2_Context(const uint8_t* pGlobalData, FX_DWORD dwGlobalLength, - uint8_t* pData, + const uint8_t* pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, IFX_Pause* pPause) { if (pGlobalData && (dwGlobalLength > 0)) { - JBIG2_ALLOC(m_pGlobalContext, - CJBig2_Context(NULL, 0, pGlobalData, dwGlobalLength, - JBIG2_EMBED_STREAM, pSymbolDictCache, pPause)); + m_pGlobalContext = + new CJBig2_Context(NULL, 0, pGlobalData, dwGlobalLength, + JBIG2_EMBED_STREAM, pSymbolDictCache, pPause); } else { m_pGlobalContext = NULL; } @@ -66,9 +64,7 @@ CJBig2_Context::~CJBig2_Context() { m_pArithDecoder = NULL; delete m_pGRD; m_pGRD = NULL; - if (m_gbContext) { - m_pModule->JBig2_Free(m_gbContext); - } + FX_Free(m_gbContext); m_gbContext = NULL; delete m_pGlobalContext; m_pGlobalContext = NULL; @@ -219,7 +215,7 @@ int32_t CJBig2_Context::getFirstPage(uint8_t* pBuf, m_bFirstPage = TRUE; m_PauseStep = 0; delete m_pPage; - JBIG2_ALLOC(m_pPage, CJBig2_Image(width, height, stride, pBuf)); + m_pPage = new CJBig2_Image(width, height, stride, pBuf); m_bBufSpecified = TRUE; if (m_pPage && pPause && pPause->NeedToPauseNow()) { m_PauseStep = 1; @@ -360,8 +356,7 @@ int32_t CJBig2_Context::parseSegmentHeader(CJBig2_Segment* pSegment) { cPSize = pSegment->m_cFlags.s.page_association_size ? 4 : 1; if (pSegment->m_nReferred_to_segment_count) { pSegment->m_pReferred_to_segment_numbers = - (FX_DWORD*)m_pModule->JBig2_Malloc2( - sizeof(FX_DWORD), pSegment->m_nReferred_to_segment_count); + FX_Alloc(FX_DWORD, pSegment->m_nReferred_to_segment_count); for (int32_t i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { switch (cSSize) { case 1: @@ -475,11 +470,11 @@ int32_t CJBig2_Context::ProcessiveParseSegmentData(CJBig2_Segment* pSegment, if (!m_bBufSpecified) { delete m_pPage; if (pPageInfo->m_dwHeight == 0xffffffff) { - JBIG2_ALLOC(m_pPage, CJBig2_Image(pPageInfo->m_dwWidth, - pPageInfo->m_wMaxStripeSize)); + m_pPage = new CJBig2_Image(pPageInfo->m_dwWidth, + pPageInfo->m_wMaxStripeSize); } else { - JBIG2_ALLOC(m_pPage, CJBig2_Image(pPageInfo->m_dwWidth, - pPageInfo->m_dwHeight)); + m_pPage = + new CJBig2_Image(pPageInfo->m_dwWidth, pPageInfo->m_dwHeight); } } m_pPage->fill((pPageInfo->m_cFlags & 4) ? 1 : 0); @@ -523,11 +518,10 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, CJBig2_Segment *pSeg = NULL, *pLRSeg = NULL; FX_BOOL bUsed; CJBig2_Image** SDINSYMS = NULL; - CJBig2_SDDProc* pSymbolDictDecoder; JBig2ArithCtx *gbContext = NULL, *grContext = NULL; CJBig2_ArithDecoder* pArithDecoder; - JBIG2_ALLOC(pSymbolDictDecoder, CJBig2_SDDProc()); - uint8_t* key = pSegment->m_pData; + CJBig2_SDDProc* pSymbolDictDecoder = new CJBig2_SDDProc(); + const uint8_t* key = pSegment->m_pData; FX_BOOL cache_hit = false; if (m_pStream->readShortInteger(&wFlags) != 0) { nRet = JBIG2_ERROR_TOO_SHORT; @@ -590,8 +584,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, if (pSymbolDictDecoder->SDNUMINSYMS == 0) { SDINSYMS = NULL; } else { - SDINSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( - sizeof(CJBig2_Image*), pSymbolDictDecoder->SDNUMINSYMS); + SDINSYMS = FX_Alloc(CJBig2_Image*, pSymbolDictDecoder->SDNUMINSYMS); dwTemp = 0; for (i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]); @@ -681,15 +674,13 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, dwTemp = pSymbolDictDecoder->SDTEMPLATE == 0 ? 65536 : pSymbolDictDecoder->SDTEMPLATE == 1 ? 8192 : 1024; - gbContext = (JBig2ArithCtx*)m_pModule->JBig2_Malloc2( - sizeof(JBig2ArithCtx), dwTemp); + gbContext = FX_Alloc(JBig2ArithCtx, dwTemp); JBIG2_memcpy(gbContext, pLRSeg->m_Result.sd->m_gbContext, sizeof(JBig2ArithCtx) * dwTemp); } if (pSymbolDictDecoder->SDREFAGG == 1) { dwTemp = pSymbolDictDecoder->SDRTEMPLATE ? 1 << 10 : 1 << 13; - grContext = (JBig2ArithCtx*)m_pModule->JBig2_Malloc2( - sizeof(JBig2ArithCtx), dwTemp); + grContext = FX_Alloc(JBig2ArithCtx, dwTemp); JBIG2_memcpy(grContext, pLRSeg->m_Result.sd->m_grContext, sizeof(JBig2ArithCtx) * dwTemp); } @@ -698,14 +689,12 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, dwTemp = pSymbolDictDecoder->SDTEMPLATE == 0 ? 65536 : pSymbolDictDecoder->SDTEMPLATE == 1 ? 8192 : 1024; - gbContext = (JBig2ArithCtx*)m_pModule->JBig2_Malloc2( - sizeof(JBig2ArithCtx), dwTemp); + gbContext = FX_Alloc(JBig2ArithCtx, dwTemp); JBIG2_memset(gbContext, 0, sizeof(JBig2ArithCtx) * dwTemp); } if (pSymbolDictDecoder->SDREFAGG == 1) { dwTemp = pSymbolDictDecoder->SDRTEMPLATE ? 1 << 10 : 1 << 13; - grContext = (JBig2ArithCtx*)m_pModule->JBig2_Malloc2( - sizeof(JBig2ArithCtx), dwTemp); + grContext = FX_Alloc(JBig2ArithCtx, dwTemp); JBIG2_memset(grContext, 0, sizeof(JBig2ArithCtx) * dwTemp); } } @@ -763,39 +752,27 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment, bUsed = FALSE; } delete pSymbolDictDecoder; - if (SDINSYMS) { - m_pModule->JBig2_Free(SDINSYMS); - } + FX_Free(SDINSYMS); delete Table_B1; delete Table_B2; delete Table_B3; delete Table_B4; delete Table_B5; if (bUsed == FALSE) { - if (gbContext) { - m_pModule->JBig2_Free(gbContext); - } - if (grContext) { - m_pModule->JBig2_Free(grContext); - } + FX_Free(gbContext); + FX_Free(grContext); } return JBIG2_SUCCESS; failed: delete pSymbolDictDecoder; - if (SDINSYMS) { - m_pModule->JBig2_Free(SDINSYMS); - } + FX_Free(SDINSYMS); delete Table_B1; delete Table_B2; delete Table_B3; delete Table_B4; delete Table_B5; - if (gbContext) { - m_pModule->JBig2_Free(gbContext); - } - if (grContext) { - m_pModule->JBig2_Free(grContext); - } + FX_Free(gbContext); + FX_Free(grContext); return nRet; } @@ -815,8 +792,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { *Table_B14 = NULL, *Table_B15 = NULL; JBig2ArithCtx* grContext = NULL; CJBig2_ArithDecoder* pArithDecoder; - CJBig2_TRDProc* pTRD; - JBIG2_ALLOC(pTRD, CJBig2_TRDProc()); + CJBig2_TRDProc* pTRD = new CJBig2_TRDProc(); if ((parseRegionInfo(&ri) != JBIG2_SUCCESS) || (m_pStream->readShortInteger(&wFlags) != 0)) { nRet = JBIG2_ERROR_TOO_SHORT; @@ -877,8 +853,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } } if (pTRD->SBNUMSYMS > 0) { - SBSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(sizeof(CJBig2_Image*), - pTRD->SBNUMSYMS); + SBSYMS = FX_Alloc(CJBig2_Image*, pTRD->SBNUMSYMS); dwTemp = 0; for (i = 0; i < pSegment->m_nReferred_to_segment_count; i++) { pSeg = findSegmentByNumber(pSegment->m_pReferred_to_segment_numbers[i]); @@ -1078,8 +1053,7 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { } if (pTRD->SBREFINE == 1) { dwTemp = pTRD->SBRTEMPLATE ? 1 << 10 : 1 << 13; - grContext = - (JBig2ArithCtx*)m_pModule->JBig2_Malloc2(sizeof(JBig2ArithCtx), dwTemp); + grContext = FX_Alloc(JBig2ArithCtx, dwTemp); JBIG2_memset(grContext, 0, sizeof(JBig2ArithCtx) * dwTemp); } if (pTRD->SBHUFF == 0) { @@ -1116,15 +1090,9 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { pSegment->m_Result.im = NULL; } delete pTRD; - if (SBSYMS) { - m_pModule->JBig2_Free(SBSYMS); - } - if (SBSYMCODES) { - m_pModule->JBig2_Free(SBSYMCODES); - } - if (grContext) { - m_pModule->JBig2_Free(grContext); - } + FX_Free(SBSYMS); + FX_Free(SBSYMCODES); + FX_Free(grContext); delete Table_B1; delete Table_B6; delete Table_B7; @@ -1139,15 +1107,9 @@ int32_t CJBig2_Context::parseTextRegion(CJBig2_Segment* pSegment) { return JBIG2_SUCCESS; failed: delete pTRD; - if (SBSYMS) { - m_pModule->JBig2_Free(SBSYMS); - } - if (SBSYMCODES) { - m_pModule->JBig2_Free(SBSYMCODES); - } - if (grContext) { - m_pModule->JBig2_Free(grContext); - } + FX_Free(SBSYMS); + FX_Free(SBSYMCODES); + FX_Free(grContext); delete Table_B1; delete Table_B6; delete Table_B7; @@ -1168,9 +1130,8 @@ int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, uint8_t cFlags; JBig2ArithCtx* gbContext; CJBig2_ArithDecoder* pArithDecoder; - CJBig2_PDDProc* pPDD; int32_t nRet; - JBIG2_ALLOC(pPDD, CJBig2_PDDProc()); + CJBig2_PDDProc* pPDD = new CJBig2_PDDProc(); if ((m_pStream->read1Byte(&cFlags) != 0) || (m_pStream->read1Byte(&pPDD->HDPW) != 0) || (m_pStream->read1Byte(&pPDD->HDPH) != 0) || @@ -1188,19 +1149,18 @@ int32_t CJBig2_Context::parsePatternDict(CJBig2_Segment* pSegment, if (pPDD->HDMMR == 0) { dwTemp = pPDD->HDTEMPLATE == 0 ? 65536 : pPDD->HDTEMPLATE == 1 ? 8192 : 1024; - gbContext = - (JBig2ArithCtx*)m_pModule->JBig2_Malloc2(sizeof(JBig2ArithCtx), dwTemp); + gbContext = FX_Alloc(JBig2ArithCtx, dwTemp); JBIG2_memset(gbContext, 0, sizeof(JBig2ArithCtx) * dwTemp); pArithDecoder = new CJBig2_ArithDecoder(m_pStream); pSegment->m_Result.pd = pPDD->decode_Arith(pArithDecoder, gbContext, pPause); delete pArithDecoder; if (pSegment->m_Result.pd == NULL) { - m_pModule->JBig2_Free(gbContext); + FX_Free(gbContext); nRet = JBIG2_ERROR_FATAL; goto failed; } - m_pModule->JBig2_Free(gbContext); + FX_Free(gbContext); m_pStream->alignByte(); m_pStream->offset(2); } else { @@ -1226,9 +1186,8 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, CJBig2_PatternDict* pPatternDict; JBig2ArithCtx* gbContext; CJBig2_ArithDecoder* pArithDecoder; - CJBig2_HTRDProc* pHRD; int32_t nRet; - JBIG2_ALLOC(pHRD, CJBig2_HTRDProc()); + CJBig2_HTRDProc* pHRD = new CJBig2_HTRDProc(); if ((parseRegionInfo(&ri) != JBIG2_SUCCESS) || (m_pStream->read1Byte(&cFlags) != 0) || (m_pStream->readInteger(&pHRD->HGW) != 0) || @@ -1268,19 +1227,18 @@ int32_t CJBig2_Context::parseHalftoneRegion(CJBig2_Segment* pSegment, pSegment->m_nResultType = JBIG2_IMAGE_POINTER; if (pHRD->HMMR == 0) { dwTemp = pHRD->HTEMPLATE == 0 ? 65536 : pHRD->HTEMPLATE == 1 ? 8192 : 1024; - gbContext = - (JBig2ArithCtx*)m_pModule->JBig2_Malloc2(sizeof(JBig2ArithCtx), dwTemp); + gbContext = FX_Alloc(JBig2ArithCtx, dwTemp); JBIG2_memset(gbContext, 0, sizeof(JBig2ArithCtx) * dwTemp); pArithDecoder = new CJBig2_ArithDecoder(m_pStream); pSegment->m_Result.im = pHRD->decode_Arith(pArithDecoder, gbContext, pPause); delete pArithDecoder; if (pSegment->m_Result.im == NULL) { - m_pModule->JBig2_Free(gbContext); + FX_Free(gbContext); nRet = JBIG2_ERROR_FATAL; goto failed; } - m_pModule->JBig2_Free(gbContext); + FX_Free(gbContext); m_pStream->alignByte(); m_pStream->offset(2); } else { @@ -1317,7 +1275,7 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, uint8_t cFlags; int32_t i, nRet; if (m_pGRD == NULL) { - JBIG2_ALLOC(m_pGRD, CJBig2_GRDProc()); + m_pGRD = new CJBig2_GRDProc(); if ((parseRegionInfo(&m_ri) != JBIG2_SUCCESS) || (m_pStream->read1Byte(&cFlags) != 0)) { nRet = JBIG2_ERROR_TOO_SHORT; @@ -1356,8 +1314,7 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, dwTemp = m_pGRD->GBTEMPLATE == 0 ? 65536 : m_pGRD->GBTEMPLATE == 1 ? 8192 : 1024; if (m_gbContext == NULL) { - m_gbContext = (JBig2ArithCtx*)m_pModule->JBig2_Malloc( - sizeof(JBig2ArithCtx) * dwTemp); + m_gbContext = FX_Alloc(JBig2ArithCtx, dwTemp); JBIG2_memset(m_gbContext, 0, sizeof(JBig2ArithCtx) * dwTemp); } if (m_pArithDecoder == NULL) { @@ -1387,13 +1344,13 @@ int32_t CJBig2_Context::parseGenericRegion(CJBig2_Segment* pSegment, delete m_pArithDecoder; m_pArithDecoder = NULL; if (pSegment->m_Result.im == NULL) { - m_pModule->JBig2_Free(m_gbContext); + FX_Free(m_gbContext); nRet = JBIG2_ERROR_FATAL; m_gbContext = NULL; m_ProcessiveStatus = FXCODEC_STATUS_ERROR; goto failed; } - m_pModule->JBig2_Free(m_gbContext); + FX_Free(m_gbContext); m_gbContext = NULL; m_pStream->alignByte(); m_pStream->offset(2); @@ -1442,9 +1399,8 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { int32_t i, nRet; uint8_t cFlags; JBig2ArithCtx* grContext; - CJBig2_GRRDProc* pGRRD; CJBig2_ArithDecoder* pArithDecoder; - JBIG2_ALLOC(pGRRD, CJBig2_GRRDProc()); + CJBig2_GRRDProc* pGRRD = new CJBig2_GRRDProc(); if ((parseRegionInfo(&ri) != JBIG2_SUCCESS) || (m_pStream->read1Byte(&cFlags) != 0)) { nRet = JBIG2_ERROR_TOO_SHORT; @@ -1486,19 +1442,18 @@ int32_t CJBig2_Context::parseGenericRefinementRegion(CJBig2_Segment* pSegment) { pGRRD->GRREFERENCEDX = 0; pGRRD->GRREFERENCEDY = 0; dwTemp = pGRRD->GRTEMPLATE ? 1 << 10 : 1 << 13; - grContext = - (JBig2ArithCtx*)m_pModule->JBig2_Malloc2(sizeof(JBig2ArithCtx), dwTemp); + grContext = FX_Alloc(JBig2ArithCtx, dwTemp); JBIG2_memset(grContext, 0, sizeof(JBig2ArithCtx) * dwTemp); pArithDecoder = new CJBig2_ArithDecoder(m_pStream); pSegment->m_nResultType = JBIG2_IMAGE_POINTER; pSegment->m_Result.im = pGRRD->decode(pArithDecoder, grContext); delete pArithDecoder; if (pSegment->m_Result.im == NULL) { - m_pModule->JBig2_Free(grContext); + FX_Free(grContext); nRet = JBIG2_ERROR_FATAL; goto failed; } - m_pModule->JBig2_Free(grContext); + FX_Free(grContext); m_pStream->alignByte(); m_pStream->offset(2); if (pSegment->m_cFlags.s.type != 40) { @@ -1554,8 +1509,7 @@ JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( int32_t nBits; int32_t run; FX_DWORD nTemp; - SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2( - sizeof(JBig2HuffmanCode), SBNUMSYMS); + SBSYMCODES = FX_Alloc(JBig2HuffmanCode, SBNUMSYMS); for (i = 0; i < 35; i++) { if (pStream->readNBits(4, &runcodes_len[i]) != 0) { goto failed; @@ -1620,7 +1574,7 @@ JBig2HuffmanCode* CJBig2_Context::decodeSymbolIDHuffmanTable( huffman_assign_code(SBSYMCODES, SBNUMSYMS); return SBSYMCODES; failed: - m_pModule->JBig2_Free(SBSYMCODES); + FX_Free(SBSYMCODES); return NULL; } void CJBig2_Context::huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP) { @@ -1633,9 +1587,9 @@ void CJBig2_Context::huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP) { LENMAX = PREFLEN[i]; } } - LENCOUNT = (int*)m_pModule->JBig2_Malloc2(sizeof(int), (LENMAX + 1)); + LENCOUNT = FX_Alloc(int, LENMAX + 1); JBIG2_memset(LENCOUNT, 0, sizeof(int) * (LENMAX + 1)); - FIRSTCODE = (int*)m_pModule->JBig2_Malloc2(sizeof(int), (LENMAX + 1)); + FIRSTCODE = FX_Alloc(int, LENMAX + 1); for (i = 0; i < NTEMP; i++) { LENCOUNT[PREFLEN[i]]++; } @@ -1655,8 +1609,8 @@ void CJBig2_Context::huffman_assign_code(int* CODES, int* PREFLEN, int NTEMP) { } CURLEN = CURLEN + 1; } - m_pModule->JBig2_Free(LENCOUNT); - m_pModule->JBig2_Free(FIRSTCODE); + FX_Free(LENCOUNT); + FX_Free(FIRSTCODE); } void CJBig2_Context::huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, int NTEMP) { @@ -1669,9 +1623,9 @@ void CJBig2_Context::huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, LENMAX = SBSYMCODES[i].codelen; } } - LENCOUNT = (int*)m_pModule->JBig2_Malloc2(sizeof(int), (LENMAX + 1)); + LENCOUNT = FX_Alloc(int, (LENMAX + 1)); JBIG2_memset(LENCOUNT, 0, sizeof(int) * (LENMAX + 1)); - FIRSTCODE = (int*)m_pModule->JBig2_Malloc2(sizeof(int), (LENMAX + 1)); + FIRSTCODE = FX_Alloc(int, (LENMAX + 1)); for (i = 0; i < NTEMP; i++) { LENCOUNT[SBSYMCODES[i].codelen]++; } @@ -1691,6 +1645,6 @@ void CJBig2_Context::huffman_assign_code(JBig2HuffmanCode* SBSYMCODES, } CURLEN = CURLEN + 1; } - m_pModule->JBig2_Free(LENCOUNT); - m_pModule->JBig2_Free(FIRSTCODE); + FX_Free(LENCOUNT); + FX_Free(FIRSTCODE); } diff --git a/core/src/fxcodec/jbig2/JBig2_Context.h b/core/src/fxcodec/jbig2/JBig2_Context.h index 0590fd157b..5ae6897bab 100644 --- a/core/src/fxcodec/jbig2/JBig2_Context.h +++ b/core/src/fxcodec/jbig2/JBig2_Context.h @@ -14,11 +14,10 @@ #include "../../../include/fxcodec/fx_codec_def.h" #include "JBig2_GeneralDecoder.h" #include "JBig2_List.h" -#include "JBig2_Module.h" #include "JBig2_Page.h" #include "JBig2_Segment.h" -using CJBig2_CachePair = std::pair<uint8_t*, CJBig2_SymbolDict*>; +using CJBig2_CachePair = std::pair<const uint8_t*, CJBig2_SymbolDict*>; #define JBIG2_SUCCESS 0 #define JBIG2_FAILED -1 @@ -35,13 +34,12 @@ using CJBig2_CachePair = std::pair<uint8_t*, CJBig2_SymbolDict*>; #define JBIG2_EMBED_STREAM 3 #define JBIG2_MIN_SEGMENT_SIZE 11 -class CJBig2_Context : public CJBig2_Object { +class CJBig2_Context { public: static CJBig2_Context* CreateContext( - CJBig2_Module* pModule, - uint8_t* pGlobalData, + const uint8_t* pGlobalData, FX_DWORD dwGlobalLength, - uint8_t* pData, + const uint8_t* pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, @@ -66,9 +64,9 @@ class CJBig2_Context : public CJBig2_Object { JBIG2_IN_PAGE, }; - CJBig2_Context(uint8_t* pGlobalData, + CJBig2_Context(const uint8_t* pGlobalData, FX_DWORD dwGlobalLength, - uint8_t* pData, + const uint8_t* pData, FX_DWORD dwLength, int32_t nStreamType, std::list<CJBig2_CachePair>* pSymbolDictCache, diff --git a/core/src/fxcodec/jbig2/JBig2_Define.h b/core/src/fxcodec/jbig2/JBig2_Define.h index 3cca6acfd9..50516f5798 100644 --- a/core/src/fxcodec/jbig2/JBig2_Define.h +++ b/core/src/fxcodec/jbig2/JBig2_Define.h @@ -6,24 +6,28 @@ #ifndef _JBIG2_DEFINE_H_ #define _JBIG2_DEFINE_H_ + #include "../../../include/fxcrt/fx_system.h" #define JBIG2_memset FXSYS_memset #define JBIG2_memcmp FXSYS_memcmp #define JBIG2_memcpy FXSYS_memcpy -#include "JBig2_Object.h" #define JBIG2_OOB 1 -typedef struct { - int32_t width, height; - int32_t x, y; + +struct JBig2RegionInfo { + int32_t width; + int32_t height; + int32_t x; + int32_t y; uint8_t flags; -} JBig2RegionInfo; -typedef struct { +}; + +struct JBig2HuffmanCode { int32_t codelen; int32_t code; -} JBig2HuffmanCode; +}; + extern "C" { -void _FaxG4Decode(void* pModule, - const uint8_t* src_buf, +void _FaxG4Decode(const uint8_t* src_buf, FX_DWORD src_size, int* pbitpos, uint8_t* dest_buf, @@ -31,9 +35,11 @@ void _FaxG4Decode(void* pModule, int height, int pitch = 0); }; + #define JBIG2_MAX_REFERRED_SEGMENT_COUNT 64 #define JBIG2_MAX_EXPORT_SYSMBOLS 65535 #define JBIG2_MAX_NEW_SYSMBOLS 65535 #define JBIG2_MAX_PATTERN_INDEX 65535 #define JBIG2_MAX_IMAGE_SIZE 65535 + #endif diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp index 5278e45a68..2e558ee7e8 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.cpp @@ -34,9 +34,7 @@ extern const unsigned int JBIG2_QE_NUM = FX_ArraySize(QeTable); CJBig2_Image* CJBig2_GRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext) { if (GBW == 0 || GBH == 0) { - CJBig2_Image* pImage; - JBIG2_ALLOC(pImage, CJBig2_Image(GBW, GBH)); - return pImage; + return new CJBig2_Image(GBW, GBH); } if (GBTEMPLATE == 0) { if ((GBAT[0] == 3) && (GBAT[1] == (int8_t)-1) && (GBAT[2] == (int8_t)-3) && @@ -71,13 +69,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_opt3( JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GBREG; FX_DWORD line1, line2; uint8_t *pLine, *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); + CJBig2_Image* GBREG = new CJBig2_Image(GBW, GBH); if (GBREG->m_pData == NULL) { delete GBREG; return NULL; @@ -162,10 +159,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template0_unopt( JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GBREG; FX_DWORD line1, line2, line3; LTP = 0; - JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); + CJBig2_Image* GBREG = new CJBig2_Image(GBW, GBH); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { @@ -210,13 +206,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_opt3( JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GBREG; FX_DWORD line1, line2; uint8_t *pLine, *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); + CJBig2_Image* GBREG = new CJBig2_Image(GBW, GBH); if (GBREG->m_pData == NULL) { delete GBREG; return NULL; @@ -300,10 +295,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template1_unopt( JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GBREG; FX_DWORD line1, line2, line3; LTP = 0; - JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); + CJBig2_Image* GBREG = new CJBig2_Image(GBW, GBH); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { @@ -346,13 +340,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_opt3( JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GBREG; FX_DWORD line1, line2; uint8_t *pLine, *pLine1, *pLine2, cVal; int32_t nStride, nStride2, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); + CJBig2_Image* GBREG = new CJBig2_Image(GBW, GBH); if (GBREG->m_pData == NULL) { delete GBREG; return NULL; @@ -436,10 +429,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template2_unopt( JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GBREG; FX_DWORD line1, line2, line3; LTP = 0; - JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); + CJBig2_Image* GBREG = new CJBig2_Image(GBW, GBH); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { @@ -480,13 +472,12 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_opt3( JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GBREG; FX_DWORD line1; uint8_t *pLine, *pLine1, cVal; int32_t nStride, k; int32_t nLineBytes, nBitsLeft, cc; LTP = 0; - JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); + CJBig2_Image* GBREG = new CJBig2_Image(GBW, GBH); if (GBREG->m_pData == NULL) { delete GBREG; return NULL; @@ -556,10 +547,9 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt( JBig2ArithCtx* gbContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GBREG; FX_DWORD line1, line2; LTP = 0; - JBIG2_ALLOC(GBREG, CJBig2_Image(GBW, GBH)); + CJBig2_Image* GBREG = new CJBig2_Image(GBW, GBH); GBREG->fill(0); for (FX_DWORD h = 0; h < GBH; h++) { if (TPGDON) { @@ -594,9 +584,7 @@ CJBig2_Image* CJBig2_GRDProc::decode_Arith_Template3_unopt( CJBig2_Image* CJBig2_GRRDProc::decode(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext) { if (GRW == 0 || GRH == 0) { - CJBig2_Image* pImage; - JBIG2_ALLOC(pImage, CJBig2_Image(GRW, GRH)); - return pImage; + return new CJBig2_Image(GRW, GRH); } if (GRTEMPLATE == 0) { if ((GRAT[0] == (int8_t)-1) && (GRAT[1] == (int8_t)-1) && @@ -619,10 +607,9 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_unopt( JBig2ArithCtx* grContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GRREG; FX_DWORD line1, line2, line3, line4, line5; LTP = 0; - JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); + CJBig2_Image* GRREG = new CJBig2_Image(GRW, GRH); GRREG->fill(0); for (FX_DWORD h = 0; h < GRH; h++) { if (TPGRON) { @@ -734,7 +721,6 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt( JBig2ArithCtx* grContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; uint8_t *pLine, *pLineR, cVal; intptr_t nStride, nStrideR, nOffset; @@ -744,7 +730,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template0_opt( GRW = (int32_t)CJBig2_GRRDProc::GRW; GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; - JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); + CJBig2_Image* GRREG = new CJBig2_Image(GRW, GRH); if (GRREG->m_pData == NULL) { delete GRREG; return NULL; @@ -869,10 +855,9 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_unopt( JBig2ArithCtx* grContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GRREG; FX_DWORD line1, line2, line3, line4, line5; LTP = 0; - JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); + CJBig2_Image* GRREG = new CJBig2_Image(GRW, GRH); GRREG->fill(0); for (FX_DWORD h = 0; h < GRH; h++) { if (TPGRON) { @@ -970,7 +955,6 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt( JBig2ArithCtx* grContext) { FX_BOOL LTP, SLTP, bVal; FX_DWORD CONTEXT; - CJBig2_Image* GRREG; FX_DWORD line1, line1_r, line2_r, line3_r; uint8_t *pLine, *pLineR, cVal; intptr_t nStride, nStrideR, nOffset; @@ -980,7 +964,7 @@ CJBig2_Image* CJBig2_GRRDProc::decode_Template1_opt( GRW = (int32_t)CJBig2_GRRDProc::GRW; GRH = (int32_t)CJBig2_GRRDProc::GRH; LTP = 0; - JBIG2_ALLOC(GRREG, CJBig2_Image(GRW, GRH)); + CJBig2_Image* GRREG = new CJBig2_Image(GRW, GRH); if (GRREG->m_pData == NULL) { delete GRREG; return NULL; @@ -1110,14 +1094,13 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, int32_t RDWI, RDHI, RDXI, RDYI; CJBig2_Image* IBOI; FX_DWORD WOI, HOI; - CJBig2_Image* SBREG; FX_BOOL bFirst; FX_DWORD nTmp; int32_t nVal, nBits; CJBig2_GRRDProc* pGRRD; CJBig2_ArithDecoder* pArithDecoder; CJBig2_HuffmanDecoder* pHuffmanDecoder = new CJBig2_HuffmanDecoder(pStream); - JBIG2_ALLOC(SBREG, CJBig2_Image(SBW, SBH)); + CJBig2_Image* SBREG = new CJBig2_Image(SBW, SBH); SBREG->fill(SBDEFPIXEL); if (pHuffmanDecoder->decodeAValue(SBHUFFDT, &STRIPT) != 0) { goto failed; @@ -1210,7 +1193,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Huffman(CJBig2_BitStream* pStream, if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) { goto failed; } - JBIG2_ALLOC(pGRRD, CJBig2_GRRDProc()); + pGRRD = new CJBig2_GRRDProc(); pGRRD->GRW = WOI + RDWI; pGRRD->GRH = HOI + RDHI; pGRRD->GRTEMPLATE = SBRTEMPLATE; @@ -1352,7 +1335,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, IAID = new CJBig2_ArithIaidDecoder(SBSYMCODELEN); bRetained = FALSE; } - JBIG2_ALLOC(SBREG, CJBig2_Image(SBW, SBH)); + SBREG = new CJBig2_Image(SBW, SBH); SBREG->fill(SBDEFPIXEL); if (IADT->decode(pArithDecoder, &STRIPT) == -1) { goto failed; @@ -1430,7 +1413,7 @@ CJBig2_Image* CJBig2_TRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, if ((int)(WOI + RDWI) < 0 || (int)(HOI + RDHI) < 0) { goto failed; } - JBIG2_ALLOC(pGRRD, CJBig2_GRRDProc()); + pGRRD = new CJBig2_GRRDProc(); pGRRD->GRW = WOI + RDWI; pGRRD->GRH = HOI + RDHI; pGRRD->GRTEMPLATE = SBRTEMPLATE; @@ -1580,8 +1563,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( nTmp++; } IAID = new CJBig2_ArithIaidDecoder((uint8_t)nTmp); - SDNEWSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(SDNUMNEWSYMS, - sizeof(CJBig2_Image*)); + SDNEWSYMS = FX_Alloc(CJBig2_Image*, SDNUMNEWSYMS); FXSYS_memset(SDNEWSYMS, 0, SDNUMNEWSYMS * sizeof(CJBig2_Image*)); HCHEIGHT = 0; NSYMSDECODED = 0; @@ -1618,7 +1600,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( TOTWIDTH = TOTWIDTH + SYMWIDTH; } if (SDREFAGG == 0) { - JBIG2_ALLOC(pGRD, CJBig2_GRDProc()); + pGRD = new CJBig2_GRDProc(); pGRD->MMR = 0; pGRD->GBW = SYMWIDTH; pGRD->GBH = HCHEIGHT; @@ -1645,7 +1627,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( } if (REFAGGNINST > 1) { CJBig2_TRDProc* pDecoder; - JBIG2_ALLOC(pDecoder, CJBig2_TRDProc()); + pDecoder = new CJBig2_TRDProc(); pDecoder->SBHUFF = SDHUFF; pDecoder->SBREFINE = 1; pDecoder->SBW = SYMWIDTH; @@ -1660,8 +1642,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( } SBSYMCODELEN = (uint8_t)nTmp; pDecoder->SBSYMCODELEN = SBSYMCODELEN; - SBSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( - SBNUMSYMS, sizeof(CJBig2_Image*)); + SBSYMS = FX_Alloc(CJBig2_Image*, SBNUMSYMS); JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*)); JBIG2_memcpy(SBSYMS + SDNUMINSYMS, SDNEWSYMS, NSYMSDECODED * sizeof(CJBig2_Image*)); @@ -1721,7 +1702,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( ids.IAID = IAID; BS = pDecoder->decode_Arith(pArithDecoder, grContext, &ids); if (BS == NULL) { - m_pModule->JBig2_Free(SBSYMS); + FX_Free(SBSYMS); delete SBHUFFFS; delete SBHUFFDS; delete SBHUFFDT; @@ -1733,7 +1714,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( delete pDecoder; goto failed; } - m_pModule->JBig2_Free(SBSYMS); + FX_Free(SBSYMS); delete SBHUFFFS; delete SBHUFFDS; delete SBHUFFDT; @@ -1755,16 +1736,15 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( if (IDI >= SBNUMSYMS) { goto failed; } - SBSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( - SBNUMSYMS, sizeof(CJBig2_Image*)); + SBSYMS = FX_Alloc(CJBig2_Image*, SBNUMSYMS); JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*)); JBIG2_memcpy(SBSYMS + SDNUMINSYMS, SDNEWSYMS, NSYMSDECODED * sizeof(CJBig2_Image*)); if (!SBSYMS[IDI]) { - m_pModule->JBig2_Free(SBSYMS); + FX_Free(SBSYMS); goto failed; } - JBIG2_ALLOC(pGRRD, CJBig2_GRRDProc()); + pGRRD = new CJBig2_GRRDProc(); pGRRD->GRW = SYMWIDTH; pGRRD->GRH = HCHEIGHT; pGRRD->GRTEMPLATE = SDRTEMPLATE; @@ -1778,11 +1758,11 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( pGRRD->GRAT[3] = SDRAT[3]; BS = pGRRD->decode(pArithDecoder, grContext); if (BS == NULL) { - m_pModule->JBig2_Free(SBSYMS); + FX_Free(SBSYMS); delete pGRRD; goto failed; } - m_pModule->JBig2_Free(SBSYMS); + FX_Free(SBSYMS); delete pGRRD; } } @@ -1793,15 +1773,14 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( } EXINDEX = 0; CUREXFLAG = 0; - EXFLAGS = (FX_BOOL*)m_pModule->JBig2_Malloc2(sizeof(FX_BOOL), - (SDNUMINSYMS + SDNUMNEWSYMS)); + EXFLAGS = FX_Alloc(FX_BOOL, SDNUMINSYMS + SDNUMNEWSYMS); while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { if (IAEX->decode(pArithDecoder, (int*)&EXRUNLENGTH) == -1) { - m_pModule->JBig2_Free(EXFLAGS); + FX_Free(EXFLAGS); goto failed; } if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) { - m_pModule->JBig2_Free(EXFLAGS); + FX_Free(EXFLAGS); goto failed; } if (EXRUNLENGTH != 0) { @@ -1812,15 +1791,14 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( EXINDEX = EXINDEX + EXRUNLENGTH; CUREXFLAG = !CUREXFLAG; } - JBIG2_ALLOC(pDict, CJBig2_SymbolDict()); + pDict = new CJBig2_SymbolDict(); pDict->SDNUMEXSYMS = SDNUMEXSYMS; - pDict->SDEXSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( - sizeof(CJBig2_Image*), SDNUMEXSYMS); + pDict->SDEXSYMS = FX_Alloc(CJBig2_Image*, SDNUMEXSYMS); I = J = 0; for (I = 0; I < SDNUMINSYMS + SDNUMNEWSYMS; I++) { if (EXFLAGS[I] && J < SDNUMEXSYMS) { if (I < SDNUMINSYMS) { - JBIG2_ALLOC(pDict->SDEXSYMS[J], CJBig2_Image(*SDINSYMS[I])); + pDict->SDEXSYMS[J] = new CJBig2_Image(*SDINSYMS[I]); } else { pDict->SDEXSYMS[J] = SDNEWSYMS[I - SDNUMINSYMS]; } @@ -1832,8 +1810,8 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Arith( if (J < SDNUMEXSYMS) { pDict->SDNUMEXSYMS = J; } - m_pModule->JBig2_Free(EXFLAGS); - m_pModule->JBig2_Free(SDNEWSYMS); + FX_Free(EXFLAGS); + FX_Free(SDNEWSYMS); delete IADH; delete IADW; delete IAAI; @@ -1856,7 +1834,7 @@ failed: SDNEWSYMS[I] = NULL; } } - m_pModule->JBig2_Free(SDNEWSYMS); + FX_Free(SDNEWSYMS); delete IADH; delete IADW; delete IAAI; @@ -1907,14 +1885,12 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, CJBig2_GRDProc* pGRD; CJBig2_SymbolDict* pDict; pHuffmanDecoder = new CJBig2_HuffmanDecoder(pStream); - SDNEWSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2(SDNUMNEWSYMS, - sizeof(CJBig2_Image*)); + SDNEWSYMS = FX_Alloc(CJBig2_Image*, SDNUMNEWSYMS); FXSYS_memset(SDNEWSYMS, 0, SDNUMNEWSYMS * sizeof(CJBig2_Image*)); SDNEWSYMWIDTHS = NULL; BHC = NULL; if (SDREFAGG == 0) { - SDNEWSYMWIDTHS = - (FX_DWORD*)m_pModule->JBig2_Malloc2(SDNUMNEWSYMS, sizeof(FX_DWORD)); + SDNEWSYMWIDTHS = FX_Alloc(FX_DWORD, SDNUMNEWSYMS); FXSYS_memset(SDNEWSYMWIDTHS, 0, SDNUMNEWSYMS * sizeof(FX_DWORD)); } HCHEIGHT = 0; @@ -1959,8 +1935,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, } BS = NULL; if (REFAGGNINST > 1) { - CJBig2_TRDProc* pDecoder; - JBIG2_ALLOC(pDecoder, CJBig2_TRDProc()); + CJBig2_TRDProc* pDecoder = new CJBig2_TRDProc(); pDecoder->SBHUFF = SDHUFF; pDecoder->SBREFINE = 1; pDecoder->SBW = SYMWIDTH; @@ -1969,8 +1944,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, pDecoder->SBSTRIPS = 1; pDecoder->SBNUMSYMS = SDNUMINSYMS + NSYMSDECODED; SBNUMSYMS = pDecoder->SBNUMSYMS; - SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2( - SBNUMSYMS, sizeof(JBig2HuffmanCode)); + SBSYMCODES = FX_Alloc(JBig2HuffmanCode, SBNUMSYMS); nTmp = 1; while ((FX_DWORD)(1 << nTmp) < SBNUMSYMS) { nTmp++; @@ -1980,8 +1954,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, SBSYMCODES[I].code = I; } pDecoder->SBSYMCODES = SBSYMCODES; - SBSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( - SBNUMSYMS, sizeof(CJBig2_Image*)); + SBSYMS = FX_Alloc(CJBig2_Image*, SBNUMSYMS); JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*)); JBIG2_memcpy(SBSYMS + SDNUMINSYMS, SDNEWSYMS, NSYMSDECODED * sizeof(CJBig2_Image*)); @@ -2030,8 +2003,8 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, pDecoder->SBRAT[3] = SDRAT[3]; BS = pDecoder->decode_Huffman(pStream, grContext); if (BS == NULL) { - m_pModule->JBig2_Free(SBSYMCODES); - m_pModule->JBig2_Free(SBSYMS); + FX_Free(SBSYMCODES); + FX_Free(SBSYMS); delete SBHUFFFS; delete SBHUFFDS; delete SBHUFFDT; @@ -2043,8 +2016,8 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, delete pDecoder; goto failed; } - m_pModule->JBig2_Free(SBSYMCODES); - m_pModule->JBig2_Free(SBSYMS); + FX_Free(SBSYMCODES); + FX_Free(SBSYMS); delete SBHUFFFS; delete SBHUFFDS; delete SBHUFFDT; @@ -2061,8 +2034,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, nTmp++; } SBSYMCODELEN = (uint8_t)nTmp; - SBSYMCODES = (JBig2HuffmanCode*)m_pModule->JBig2_Malloc2( - SBNUMSYMS, sizeof(JBig2HuffmanCode)); + SBSYMCODES = FX_Alloc(JBig2HuffmanCode, SBNUMSYMS); for (I = 0; I < SBNUMSYMS; I++) { SBSYMCODES[I].codelen = SBSYMCODELEN; SBSYMCODES[I].code = I; @@ -2071,7 +2043,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, nBits = 0; for (;;) { if (pStream->read1Bit(&nTmp) != 0) { - m_pModule->JBig2_Free(SBSYMCODES); + FX_Free(SBSYMCODES); goto failed; } nVal = (nVal << 1) | nTmp; @@ -2085,7 +2057,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, break; } } - m_pModule->JBig2_Free(SBSYMCODES); + FX_Free(SBSYMCODES); SBHUFFRDX = new CJBig2_HuffmanTable(HuffmanTable_B15, FX_ArraySize(HuffmanTable_B15), HuffmanTable_HTOOB_B15); @@ -2103,12 +2075,11 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, delete SBHUFFRSIZE; pStream->alignByte(); nTmp = pStream->getOffset(); - SBSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( - SBNUMSYMS, sizeof(CJBig2_Image*)); + SBSYMS = FX_Alloc(CJBig2_Image*, SBNUMSYMS); JBIG2_memcpy(SBSYMS, SDINSYMS, SDNUMINSYMS * sizeof(CJBig2_Image*)); JBIG2_memcpy(SBSYMS + SDNUMINSYMS, SDNEWSYMS, NSYMSDECODED * sizeof(CJBig2_Image*)); - JBIG2_ALLOC(pGRRD, CJBig2_GRRDProc()); + pGRRD = new CJBig2_GRRDProc(); pGRRD->GRW = SYMWIDTH; pGRRD->GRH = HCHEIGHT; pGRRD->GRTEMPLATE = SDRTEMPLATE; @@ -2123,7 +2094,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, pArithDecoder = new CJBig2_ArithDecoder(pStream); BS = pGRRD->decode(pArithDecoder, grContext); if (BS == NULL) { - m_pModule->JBig2_Free(SBSYMS); + FX_Free(SBSYMS); delete pGRRD; delete pArithDecoder; goto failed; @@ -2132,12 +2103,12 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, pStream->offset(2); if ((FX_DWORD)nVal != (pStream->getOffset() - nTmp)) { delete BS; - m_pModule->JBig2_Free(SBSYMS); + FX_Free(SBSYMS); delete pGRRD; delete pArithDecoder; goto failed; } - m_pModule->JBig2_Free(SBSYMS); + FX_Free(SBSYMS); delete pGRRD; delete pArithDecoder; } @@ -2156,7 +2127,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, if (BMSIZE == 0) { stride = (TOTWIDTH + 7) >> 3; if (pStream->getByteLeft() >= stride * HCHEIGHT) { - JBIG2_ALLOC(BHC, CJBig2_Image(TOTWIDTH, HCHEIGHT)); + BHC = new CJBig2_Image(TOTWIDTH, HCHEIGHT); for (I = 0; I < HCHEIGHT; I++) { JBIG2_memcpy(BHC->m_pData + I * BHC->m_nStride, pStream->getPointer(), stride); @@ -2166,7 +2137,7 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, goto failed; } } else { - JBIG2_ALLOC(pGRD, CJBig2_GRDProc()); + pGRD = new CJBig2_GRDProc(); pGRD->MMR = 1; pGRD->GBW = TOTWIDTH; pGRD->GBH = HCHEIGHT; @@ -2193,17 +2164,16 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, CUREXFLAG = 0; pTable = new CJBig2_HuffmanTable( HuffmanTable_B1, FX_ArraySize(HuffmanTable_B1), HuffmanTable_HTOOB_B1); - EXFLAGS = (FX_BOOL*)m_pModule->JBig2_Malloc2(sizeof(FX_BOOL), - (SDNUMINSYMS + SDNUMNEWSYMS)); + EXFLAGS = FX_Alloc(FX_BOOL, SDNUMINSYMS + SDNUMNEWSYMS); while (EXINDEX < SDNUMINSYMS + SDNUMNEWSYMS) { if (pHuffmanDecoder->decodeAValue(pTable, (int*)&EXRUNLENGTH) != 0) { delete pTable; - m_pModule->JBig2_Free(EXFLAGS); + FX_Free(EXFLAGS); goto failed; } if (EXINDEX + EXRUNLENGTH > SDNUMINSYMS + SDNUMNEWSYMS) { delete pTable; - m_pModule->JBig2_Free(EXFLAGS); + FX_Free(EXFLAGS); goto failed; } if (EXRUNLENGTH != 0) { @@ -2215,15 +2185,14 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, CUREXFLAG = !CUREXFLAG; } delete pTable; - JBIG2_ALLOC(pDict, CJBig2_SymbolDict()); + pDict = new CJBig2_SymbolDict(); pDict->SDNUMEXSYMS = SDNUMEXSYMS; - pDict->SDEXSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( - sizeof(CJBig2_Image*), SDNUMEXSYMS); + pDict->SDEXSYMS = FX_Alloc(CJBig2_Image*, SDNUMEXSYMS); I = J = 0; for (I = 0; I < SDNUMINSYMS + SDNUMNEWSYMS; I++) { if (EXFLAGS[I] && J < SDNUMEXSYMS) { if (I < SDNUMINSYMS) { - JBIG2_ALLOC(pDict->SDEXSYMS[J], CJBig2_Image(*SDINSYMS[I])); + pDict->SDEXSYMS[J] = new CJBig2_Image(*SDINSYMS[I]); } else { pDict->SDEXSYMS[J] = SDNEWSYMS[I - SDNUMINSYMS]; } @@ -2235,10 +2204,10 @@ CJBig2_SymbolDict* CJBig2_SDDProc::decode_Huffman(CJBig2_BitStream* pStream, if (J < SDNUMEXSYMS) { pDict->SDNUMEXSYMS = J; } - m_pModule->JBig2_Free(EXFLAGS); - m_pModule->JBig2_Free(SDNEWSYMS); + FX_Free(EXFLAGS); + FX_Free(SDNEWSYMS); if (SDREFAGG == 0) { - m_pModule->JBig2_Free(SDNEWSYMWIDTHS); + FX_Free(SDNEWSYMWIDTHS); } delete pHuffmanDecoder; return pDict; @@ -2246,9 +2215,9 @@ failed: for (I = 0; I < NSYMSDECODED; I++) { delete SDNEWSYMS[I]; } - m_pModule->JBig2_Free(SDNEWSYMS); + FX_Free(SDNEWSYMS); if (SDREFAGG == 0) { - m_pModule->JBig2_Free(SDNEWSYMWIDTHS); + FX_Free(SDNEWSYMWIDTHS); } delete pHuffmanDecoder; return NULL; @@ -2258,16 +2227,13 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, IFX_Pause* pPause) { FX_DWORD ng, mg; int32_t x, y; - CJBig2_Image* HSKIP; FX_DWORD HBPP; FX_DWORD* GI; - CJBig2_Image* HTREG; - CJBig2_GSIDProc* pGID; - JBIG2_ALLOC(HTREG, CJBig2_Image(HBW, HBH)); + CJBig2_Image* HSKIP = nullptr; + CJBig2_Image* HTREG = new CJBig2_Image(HBW, HBH); HTREG->fill(HDEFPIXEL); - HSKIP = NULL; if (HENABLESKIP == 1) { - JBIG2_ALLOC(HSKIP, CJBig2_Image(HGW, HGH)); + HSKIP = new CJBig2_Image(HGW, HGH); for (mg = 0; mg < HGH; mg++) { for (ng = 0; ng < HGW; ng++) { x = (HGX + mg * HRY + ng * HRX) >> 8; @@ -2285,7 +2251,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, while ((FX_DWORD)(1 << HBPP) < HNUMPATS) { HBPP++; } - JBIG2_ALLOC(pGID, CJBig2_GSIDProc()); + CJBig2_GSIDProc* pGID = new CJBig2_GSIDProc(); pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; @@ -2308,7 +2274,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, HTREG->composeFrom(x, y, HPATS[pat_index], HCOMBOP); } } - m_pModule->JBig2_Free(GI); + FX_Free(GI); delete HSKIP; delete pGID; return HTREG; @@ -2322,17 +2288,14 @@ CJBig2_Image* CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { FX_DWORD ng, mg; int32_t x, y; - FX_DWORD HBPP; FX_DWORD* GI; - CJBig2_Image* HTREG; - CJBig2_GSIDProc* pGID; - JBIG2_ALLOC(HTREG, CJBig2_Image(HBW, HBH)); + CJBig2_Image* HTREG = new CJBig2_Image(HBW, HBH); HTREG->fill(HDEFPIXEL); - HBPP = 1; + FX_DWORD HBPP = 1; while ((FX_DWORD)(1 << HBPP) < HNUMPATS) { HBPP++; } - JBIG2_ALLOC(pGID, CJBig2_GSIDProc()); + CJBig2_GSIDProc* pGID = new CJBig2_GSIDProc(); pGID->GSMMR = HMMR; pGID->GSW = HGW; pGID->GSH = HGH; @@ -2353,7 +2316,7 @@ CJBig2_Image* CJBig2_HTRDProc::decode_MMR(CJBig2_BitStream* pStream, HTREG->composeFrom(x, y, HPATS[pat_index], HCOMBOP); } } - m_pModule->JBig2_Free(GI); + FX_Free(GI); delete pGID; return HTREG; failed: @@ -2367,14 +2330,11 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_Arith( IFX_Pause* pPause) { FX_DWORD GRAY; CJBig2_Image* BHDC = NULL; - CJBig2_PatternDict* pDict; - CJBig2_GRDProc* pGRD; - pDict = new CJBig2_PatternDict(); + CJBig2_PatternDict* pDict = new CJBig2_PatternDict(); pDict->NUMPATS = GRAYMAX + 1; - pDict->HDPATS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( - sizeof(CJBig2_Image*), pDict->NUMPATS); + pDict->HDPATS = FX_Alloc(CJBig2_Image*, pDict->NUMPATS); JBIG2_memset(pDict->HDPATS, 0, sizeof(CJBig2_Image*) * pDict->NUMPATS); - JBIG2_ALLOC(pGRD, CJBig2_GRDProc()); + CJBig2_GRDProc* pGRD = new CJBig2_GRDProc(); pGRD->MMR = HDMMR; pGRD->GBW = (GRAYMAX + 1) * HDPW; pGRD->GBH = HDPH; @@ -2417,13 +2377,11 @@ CJBig2_PatternDict* CJBig2_PDDProc::decode_MMR(CJBig2_BitStream* pStream, IFX_Pause* pPause) { FX_DWORD GRAY; CJBig2_Image* BHDC = NULL; - CJBig2_GRDProc* pGRD; CJBig2_PatternDict* pDict = new CJBig2_PatternDict(); pDict->NUMPATS = GRAYMAX + 1; - pDict->HDPATS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( - sizeof(CJBig2_Image*), pDict->NUMPATS); + pDict->HDPATS = FX_Alloc(CJBig2_Image*, pDict->NUMPATS); JBIG2_memset(pDict->HDPATS, 0, sizeof(CJBig2_Image*) * pDict->NUMPATS); - JBIG2_ALLOC(pGRD, CJBig2_GRDProc()); + CJBig2_GRDProc* pGRD = new CJBig2_GRDProc(); pGRD->MMR = HDMMR; pGRD->GBW = (GRAYMAX + 1) * HDPW; pGRD->GBH = HDPH; @@ -2454,20 +2412,18 @@ FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, int32_t J, K; FX_DWORD x, y; FX_DWORD* GSVALS; - CJBig2_GRDProc* pGRD; - GSPLANES = - (CJBig2_Image**)m_pModule->JBig2_Malloc2(sizeof(CJBig2_Image*), GSBPP); + GSPLANES = FX_Alloc(CJBig2_Image*, GSBPP); if (!GSPLANES) { return NULL; } - GSVALS = (FX_DWORD*)m_pModule->JBig2_Malloc3(sizeof(FX_DWORD), GSW, GSH); + GSVALS = FX_Alloc2D(FX_DWORD, GSW, GSH); if (!GSVALS) { - m_pModule->JBig2_Free(GSPLANES); + FX_Free(GSPLANES); return NULL; } JBIG2_memset(GSPLANES, 0, sizeof(CJBig2_Image*) * GSBPP); JBIG2_memset(GSVALS, 0, sizeof(FX_DWORD) * GSW * GSH); - JBIG2_ALLOC(pGRD, CJBig2_GRDProc()); + CJBig2_GRDProc* pGRD = new CJBig2_GRDProc(); pGRD->MMR = GSMMR; pGRD->GBW = GSW; pGRD->GBH = GSH; @@ -2523,13 +2479,13 @@ FX_DWORD* CJBig2_GSIDProc::decode_Arith(CJBig2_ArithDecoder* pArithDecoder, for (J = 0; J < GSBPP; J++) { delete GSPLANES[J]; } - m_pModule->JBig2_Free(GSPLANES); + FX_Free(GSPLANES); delete pGRD; return GSVALS; failed: - m_pModule->JBig2_Free(GSPLANES); + FX_Free(GSPLANES); delete pGRD; - m_pModule->JBig2_Free(GSVALS); + FX_Free(GSVALS); return NULL; } FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, @@ -2538,22 +2494,18 @@ FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, int32_t J, K; FX_DWORD x, y; FX_DWORD* GSVALS; - CJBig2_GRDProc* pGRD; - GSPLANES = - (CJBig2_Image**)m_pModule->JBig2_Malloc2(sizeof(CJBig2_Image*), GSBPP); + GSPLANES = FX_Alloc(CJBig2_Image*, GSBPP); if (!GSPLANES) { return NULL; } - GSVALS = (FX_DWORD*)m_pModule->JBig2_Malloc3(sizeof(FX_DWORD), GSW, GSH); + GSVALS = FX_Alloc2D(FX_DWORD, GSW, GSH); if (!GSVALS) { - if (GSPLANES) { - m_pModule->JBig2_Free(GSPLANES); - } + FX_Free(GSPLANES); return NULL; } JBIG2_memset(GSPLANES, 0, sizeof(CJBig2_Image*) * GSBPP); JBIG2_memset(GSVALS, 0, sizeof(FX_DWORD) * GSW * GSH); - JBIG2_ALLOC(pGRD, CJBig2_GRDProc()); + CJBig2_GRDProc* pGRD = new CJBig2_GRDProc(); pGRD->MMR = GSMMR; pGRD->GBW = GSW; pGRD->GBH = GSH; @@ -2593,13 +2545,13 @@ FX_DWORD* CJBig2_GSIDProc::decode_MMR(CJBig2_BitStream* pStream, for (J = 0; J < GSBPP; J++) { delete GSPLANES[J]; } - m_pModule->JBig2_Free(GSPLANES); + FX_Free(GSPLANES); delete pGRD; return GSVALS; failed: - m_pModule->JBig2_Free(GSPLANES); + FX_Free(GSPLANES); delete pGRD; - m_pModule->JBig2_Free(GSVALS); + FX_Free(GSVALS); return NULL; } FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith( @@ -2613,9 +2565,8 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_Arith( } m_ProssiveStatus = FXCODEC_STATUS_DECODE_READY; m_pPause = pPause; - if (*pImage == NULL) { - JBIG2_ALLOC((*pImage), CJBig2_Image(GBW, GBH)); - } + if (!*pImage) + *pImage = new CJBig2_Image(GBW, GBH); if ((*pImage)->m_pData == NULL) { delete *pImage; *pImage = NULL; @@ -2683,7 +2634,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR(CJBig2_Image** pImage, CJBig2_BitStream* pStream, IFX_Pause* pPause) { int bitpos, i; - JBIG2_ALLOC((*pImage), CJBig2_Image(GBW, GBH)); + *pImage = new CJBig2_Image(GBW, GBH); if ((*pImage)->m_pData == NULL) { delete (*pImage); (*pImage) = NULL; @@ -2691,7 +2642,7 @@ FXCODEC_STATUS CJBig2_GRDProc::Start_decode_MMR(CJBig2_Image** pImage, return m_ProssiveStatus; } bitpos = (int)pStream->getBitPos(); - _FaxG4Decode(m_pModule, pStream->getBuf(), pStream->getLength(), &bitpos, + _FaxG4Decode(pStream->getBuf(), pStream->getLength(), &bitpos, (*pImage)->m_pData, GBW, GBH, (*pImage)->m_nStride); pStream->setBitPos(bitpos); for (i = 0; (FX_DWORD)i < (*pImage)->m_nStride * GBH; i++) { diff --git a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h index 36839100fa..24ac467afa 100644 --- a/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h +++ b/core/src/fxcodec/jbig2/JBig2_GeneralDecoder.h @@ -25,7 +25,7 @@ enum JBig2Corner { JBIG2_CORNER_TOPRIGHT = 3 }; -class CJBig2_GRDProc : public CJBig2_Object { +class CJBig2_GRDProc { public: CJBig2_GRDProc() { m_loopIndex = 0; @@ -135,7 +135,7 @@ class CJBig2_GRDProc : public CJBig2_Object { FX_RECT m_ReplaceRect; }; -class CJBig2_GRRDProc : public CJBig2_Object { +class CJBig2_GRRDProc { public: CJBig2_Image* decode(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* grContext); @@ -168,7 +168,7 @@ typedef struct { CJBig2_ArithIaidDecoder* IAID; } JBig2IntDecoderState; -class CJBig2_TRDProc : public CJBig2_Object { +class CJBig2_TRDProc { public: CJBig2_Image* decode_Huffman(CJBig2_BitStream* pStream, JBig2ArithCtx* grContext); @@ -202,7 +202,7 @@ class CJBig2_TRDProc : public CJBig2_Object { FX_BOOL SBRTEMPLATE; int8_t SBRAT[4]; }; -class CJBig2_SDDProc : public CJBig2_Object { +class CJBig2_SDDProc { public: CJBig2_SymbolDict* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -226,7 +226,7 @@ class CJBig2_SDDProc : public CJBig2_Object { FX_BOOL SDRTEMPLATE; int8_t SDRAT[4]; }; -class CJBig2_HTRDProc : public CJBig2_Object { +class CJBig2_HTRDProc { public: CJBig2_Image* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -248,7 +248,7 @@ class CJBig2_HTRDProc : public CJBig2_Object { FX_WORD HRX, HRY; uint8_t HPW, HPH; }; -class CJBig2_PDDProc : public CJBig2_Object { +class CJBig2_PDDProc { public: CJBig2_PatternDict* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, @@ -262,7 +262,7 @@ class CJBig2_PDDProc : public CJBig2_Object { FX_DWORD GRAYMAX; uint8_t HDTEMPLATE; }; -class CJBig2_GSIDProc : public CJBig2_Object { +class CJBig2_GSIDProc { public: FX_DWORD* decode_Arith(CJBig2_ArithDecoder* pArithDecoder, JBig2ArithCtx* gbContext, diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h index b954b4d30d..7c843cf91b 100644 --- a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h +++ b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.h @@ -6,9 +6,10 @@ #ifndef _JBIG2_HUFFMAN_TABLE_H_ #define _JBIG2_HUFFMAN_TABLE_H_ -#include "JBig2_Module.h" + #include "JBig2_HuffmanTable_Standard.h" #include "JBig2_BitStream.h" + class CJBig2_HuffmanTable { public: CJBig2_HuffmanTable(const JBig2TableLine* pTable, int nLines, FX_BOOL bHTOOB); diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h b/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h index aa29258f07..28d8ae3564 100644 --- a/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h +++ b/core/src/fxcodec/jbig2/JBig2_HuffmanTable_Standard.h @@ -6,11 +6,15 @@ #ifndef _JBIG2_HUFFMAN_TABLE_STANDARD_H_ #define _JBIG2_HUFFMAN_TABLE_STANDARD_H_ -typedef struct { + +#include "../../../../core/include/fxcrt/fx_system.h" + +struct JBig2TableLine { int PREFLEN; int RANDELEN; int RANGELOW; -} JBig2TableLine; +}; + const FX_BOOL HuffmanTable_HTOOB_B1 = FALSE; const JBig2TableLine HuffmanTable_B1[] = {{1, 4, 0}, {2, 8, 16}, diff --git a/core/src/fxcodec/jbig2/JBig2_Image.cpp b/core/src/fxcodec/jbig2/JBig2_Image.cpp index f1adfc6152..4cb467427c 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.cpp +++ b/core/src/fxcodec/jbig2/JBig2_Image.cpp @@ -20,7 +20,7 @@ CJBig2_Image::CJBig2_Image(int32_t w, int32_t h) { } m_nStride = ((w + 31) >> 5) << 2; if (m_nStride * m_nHeight > 0 && 104857600 / (int)m_nStride > m_nHeight) { - m_pData = (uint8_t*)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); + m_pData = FX_Alloc2D(uint8_t, m_nStride, m_nHeight); } else { m_pData = NULL; } @@ -37,12 +37,11 @@ CJBig2_Image::CJBig2_Image(int32_t w, m_bNeedFree = FALSE; } CJBig2_Image::CJBig2_Image(CJBig2_Image& im) { - m_pModule = im.m_pModule; m_nWidth = im.m_nWidth; m_nHeight = im.m_nHeight; m_nStride = im.m_nStride; if (im.m_pData) { - m_pData = (uint8_t*)m_pModule->JBig2_Malloc2(m_nStride, m_nHeight); + m_pData = FX_Alloc2D(uint8_t, m_nStride, m_nHeight); JBIG2_memcpy(m_pData, im.m_pData, m_nStride * m_nHeight); } else { m_pData = NULL; @@ -50,8 +49,8 @@ CJBig2_Image::CJBig2_Image(CJBig2_Image& im) { m_bNeedFree = TRUE; } CJBig2_Image::~CJBig2_Image() { - if (m_bNeedFree && m_pData) { - m_pModule->JBig2_Free(m_pData); + if (m_bNeedFree) { + FX_Free(m_pData); } } FX_BOOL CJBig2_Image::getPixel(int32_t x, int32_t y) { @@ -155,7 +154,6 @@ CJBig2_Image* CJBig2_Image::subImage(int32_t x, int32_t y, int32_t w, int32_t h) { - CJBig2_Image* pImage; int32_t m, n, j; uint8_t *pLineSrc, *pLineDst; FX_DWORD wTmp; @@ -163,7 +161,7 @@ CJBig2_Image* CJBig2_Image::subImage(int32_t x, if (w == 0 || h == 0) { return NULL; } - JBIG2_ALLOC(pImage, CJBig2_Image(w, h)); + CJBig2_Image* pImage = new CJBig2_Image(w, h); if (!m_pData) { pImage->fill(0); return pImage; @@ -224,8 +222,8 @@ void CJBig2_Image::expand(int32_t h, FX_BOOL v) { return; } // The guaranteed reallocated memory is to be < 4GB (unsigned int). - m_pData = - (uint8_t*)m_pModule->JBig2_Realloc(m_pData, safeMemSize.ValueOrDie()); + m_pData = FX_Realloc(uint8_t, m_pData, safeMemSize.ValueOrDie()); + // The result of dwHeight * dwStride doesn't overflow after the // checking of safeMemSize. // The same as the result of (dwH - dwHeight) * dwStride) because diff --git a/core/src/fxcodec/jbig2/JBig2_Image.h b/core/src/fxcodec/jbig2/JBig2_Image.h index c5d27f36b5..e77da9059c 100644 --- a/core/src/fxcodec/jbig2/JBig2_Image.h +++ b/core/src/fxcodec/jbig2/JBig2_Image.h @@ -6,17 +6,19 @@ #ifndef _JBIG2_IMAGE_H_ #define _JBIG2_IMAGE_H_ + #include "JBig2_Define.h" -#include "JBig2_Module.h" -typedef enum { + +enum JBig2ComposeOp { JBIG2_COMPOSE_OR = 0, JBIG2_COMPOSE_AND = 1, JBIG2_COMPOSE_XOR = 2, JBIG2_COMPOSE_XNOR = 3, JBIG2_COMPOSE_REPLACE = 4 -} JBig2ComposeOp; +}; + struct FX_RECT; -class CJBig2_Image : public CJBig2_Object { +class CJBig2_Image { public: CJBig2_Image(int32_t w, int32_t h); diff --git a/core/src/fxcodec/jbig2/JBig2_Module.h b/core/src/fxcodec/jbig2/JBig2_Module.h deleted file mode 100644 index bb06c8a0b3..0000000000 --- a/core/src/fxcodec/jbig2/JBig2_Module.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef _JBIG2_MODULE_H_ -#define _JBIG2_MODULE_H_ -#include "JBig2_Define.h" -class CJBig2_Module { - public: - virtual ~CJBig2_Module() {} - - virtual void* JBig2_Malloc(FX_DWORD dwSize) = 0; - - virtual void* JBig2_Malloc2(FX_DWORD num, FX_DWORD dwSize) = 0; - - virtual void* JBig2_Malloc3(FX_DWORD num, - FX_DWORD dwSize, - FX_DWORD dwSize2) = 0; - - virtual void* JBig2_Realloc(void* pMem, FX_DWORD dwSize) = 0; - - virtual void JBig2_Free(void* pMem) = 0; -}; -#endif diff --git a/core/src/fxcodec/jbig2/JBig2_Object.cpp b/core/src/fxcodec/jbig2/JBig2_Object.cpp deleted file mode 100644 index f1e894321c..0000000000 --- a/core/src/fxcodec/jbig2/JBig2_Object.cpp +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "JBig2_Object.h" -#include "JBig2_Module.h" -void* CJBig2_Object::operator new(size_t size, - CJBig2_Module* pModule, - const FX_CHAR* filename, - int line) { - CJBig2_Object* p; - p = (CJBig2_Object*)pModule->JBig2_Malloc((FX_DWORD)size); - p->m_pModule = pModule; - return p; -} -void CJBig2_Object::operator delete(void* p, - CJBig2_Module* pModule, - const FX_CHAR* filename, - int line) { - pModule->JBig2_Free(p); -} -void* CJBig2_Object::operator new(size_t size, CJBig2_Module* pModule) { - CJBig2_Object* p; - p = (CJBig2_Object*)pModule->JBig2_Malloc((FX_DWORD)size); - p->m_pModule = pModule; - return p; -} -void CJBig2_Object::operator delete(void* p) { - ((CJBig2_Object*)p)->m_pModule->JBig2_Free(p); -} -void CJBig2_Object::operator delete(void* p, CJBig2_Module* pModule) { - pModule->JBig2_Free(p); -} -void* CJBig2_Object::operator new[](size_t size, - CJBig2_Module* pModule, - size_t unit_size, - const FX_CHAR* filename, - int line) { - void* p; - uint8_t *pCur, *pEnd; - p = (uint8_t*)pModule->JBig2_Malloc((FX_DWORD)size); - pCur = (uint8_t*)p; - pEnd = pCur + size; - for (; pCur < pEnd; pCur += unit_size) { - ((CJBig2_Object*)pCur)->m_pModule = pModule; - } - return p; -} -void CJBig2_Object::operator delete[](void* p, - CJBig2_Module* pModule, - size_t unit_size, - const FX_CHAR* filename, - int line) { - pModule->JBig2_Free(p); -} -void* CJBig2_Object::operator new[](size_t size, - CJBig2_Module* pModule, - size_t unit_size) { - void* p; - uint8_t *pCur, *pEnd; - p = (uint8_t*)pModule->JBig2_Malloc((FX_DWORD)size); - pCur = (uint8_t*)p; - pEnd = pCur + size; - for (; pCur < pEnd; pCur += unit_size) { - ((CJBig2_Object*)pCur)->m_pModule = pModule; - } - return p; -} -void CJBig2_Object::operator delete[](void* p) { - ((CJBig2_Object*)p)->m_pModule->JBig2_Free(p); -} -void CJBig2_Object::operator delete[](void* p, - CJBig2_Module* pModule, - size_t unit_size) { - pModule->JBig2_Free(p); -} diff --git a/core/src/fxcodec/jbig2/JBig2_Object.h b/core/src/fxcodec/jbig2/JBig2_Object.h deleted file mode 100644 index bab1a16231..0000000000 --- a/core/src/fxcodec/jbig2/JBig2_Object.h +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef _JBIG2_OBJECT_H_ -#define _JBIG2_OBJECT_H_ -#include "JBig2_Define.h" -class CJBig2_Module; -#define _JBIG2_NO_EXPECTION_ -class CJBig2_Object { - public: - void* operator new(size_t size, - CJBig2_Module* pModule, - const FX_CHAR* filename, - int line); - - void operator delete(void* p, - CJBig2_Module* pModule, - const FX_CHAR* filename, - int line); - - void* operator new(size_t size, CJBig2_Module* pModule); - - void operator delete(void* p); - - void operator delete(void* p, CJBig2_Module* pModule); - - void* operator new[](size_t size, - CJBig2_Module* pModule, - size_t unit_size, - const FX_CHAR* filename, - int line); - - void operator delete[](void* p, - CJBig2_Module* pModule, - size_t unit_size, - const FX_CHAR* filename, - int line); - - void* operator new[](size_t size, CJBig2_Module* pModule, size_t unit_size); - - void operator delete[](void* p); - - void operator delete[](void* p, CJBig2_Module* pModule, size_t unit_size); - - public: - CJBig2_Module* m_pModule; -}; -#define JBIG2_NEW new (m_pModule) -#define JBIG2_ALLOC(p, a) \ - p = JBIG2_NEW a; \ - p->m_pModule = m_pModule; -#endif diff --git a/core/src/fxcodec/jbig2/JBig2_Segment.h b/core/src/fxcodec/jbig2/JBig2_Segment.h index 5c1c585939..b80a5d282f 100644 --- a/core/src/fxcodec/jbig2/JBig2_Segment.h +++ b/core/src/fxcodec/jbig2/JBig2_Segment.h @@ -6,11 +6,12 @@ #ifndef _JBIG2_SEGMENT_H_ #define _JBIG2_SEGMENT_H_ + #include "JBig2_Define.h" -#include "JBig2_SymbolDict.h" -#include "JBig2_PatternDict.h" -#include "JBig2_Module.h" #include "JBig2_HuffmanTable.h" +#include "JBig2_PatternDict.h" +#include "JBig2_SymbolDict.h" + #define JBIG2_GET_INT32(buf) \ (((buf)[0] << 24) | ((buf)[1] << 16) | ((buf)[2] << 8) | (buf)[3]) #define JBIG2_GET_INT16(buf) (((buf)[0] << 8) | (buf)[1]) @@ -49,7 +50,7 @@ class CJBig2_Segment { FX_DWORD m_dwData_length; FX_DWORD m_dwHeader_Length; - uint8_t* m_pData; + const uint8_t* m_pData; JBig2_SegmentState m_State; JBig2_ResultType m_nResultType; union { diff --git a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp index 2287b91840..ef02df1072 100644 --- a/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp +++ b/core/src/fxcodec/jbig2/JBig2_SymbolDict.cpp @@ -5,6 +5,9 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "JBig2_SymbolDict.h" + +#include "../../../include/fxcrt/fx_memory.h" + CJBig2_SymbolDict::CJBig2_SymbolDict() { SDNUMEXSYMS = 0; SDEXSYMS = NULL; @@ -13,18 +16,16 @@ CJBig2_SymbolDict::CJBig2_SymbolDict() { } CJBig2_SymbolDict* CJBig2_SymbolDict::DeepCopy() { - CJBig2_SymbolDict* dst = NULL; CJBig2_SymbolDict* src = this; if (src->m_bContextRetained || src->m_gbContext || src->m_grContext) { return NULL; } - JBIG2_ALLOC(dst, CJBig2_SymbolDict()); + CJBig2_SymbolDict* dst = new CJBig2_SymbolDict; dst->SDNUMEXSYMS = src->SDNUMEXSYMS; - dst->SDEXSYMS = (CJBig2_Image**)m_pModule->JBig2_Malloc2( - sizeof(CJBig2_Image*), src->SDNUMEXSYMS); + dst->SDEXSYMS = FX_Alloc(CJBig2_Image*, src->SDNUMEXSYMS); for (FX_DWORD i = 0; i < src->SDNUMEXSYMS; i++) { if (src->SDEXSYMS[i]) { - JBIG2_ALLOC(dst->SDEXSYMS[i], CJBig2_Image(*(src->SDEXSYMS[i]))); + dst->SDEXSYMS[i] = new CJBig2_Image(*(src->SDEXSYMS[i])); } else { dst->SDEXSYMS[i] = NULL; } @@ -37,14 +38,10 @@ CJBig2_SymbolDict::~CJBig2_SymbolDict() { for (FX_DWORD i = 0; i < SDNUMEXSYMS; i++) { delete SDEXSYMS[i]; } - m_pModule->JBig2_Free(SDEXSYMS); + FX_Free(SDEXSYMS); } if (m_bContextRetained) { - if (m_gbContext) { - m_pModule->JBig2_Free(m_gbContext); - } - if (m_grContext) { - m_pModule->JBig2_Free(m_grContext); - } + FX_Free(m_gbContext); + FX_Free(m_grContext); } } diff --git a/core/src/fxcodec/jbig2/JBig2_SymbolDict.h b/core/src/fxcodec/jbig2/JBig2_SymbolDict.h index 1a074415bf..19d0f606a5 100644 --- a/core/src/fxcodec/jbig2/JBig2_SymbolDict.h +++ b/core/src/fxcodec/jbig2/JBig2_SymbolDict.h @@ -6,10 +6,12 @@ #ifndef _JBIG2_SYMBOL_DICT_H_ #define _JBIG2_SYMBOL_DICT_H_ -#include "JBig2_Define.h" + #include "JBig2_ArithDecoder.h" +#include "JBig2_Define.h" #include "JBig2_Image.h" -class CJBig2_SymbolDict : public CJBig2_Object { + +class CJBig2_SymbolDict { public: CJBig2_SymbolDict(); CJBig2_SymbolDict* DeepCopy(); @@ -19,6 +21,8 @@ class CJBig2_SymbolDict : public CJBig2_Object { FX_DWORD SDNUMEXSYMS; CJBig2_Image** SDEXSYMS; FX_BOOL m_bContextRetained; - JBig2ArithCtx *m_gbContext, *m_grContext; + JBig2ArithCtx* m_gbContext; + JBig2ArithCtx* m_grContext; }; + #endif diff --git a/pdfium.gyp b/pdfium.gyp index 0c7319015d..ade3db5506 100644 --- a/pdfium.gyp +++ b/pdfium.gyp @@ -424,9 +424,6 @@ 'core/src/fxcodec/jbig2/JBig2_Image.cpp', 'core/src/fxcodec/jbig2/JBig2_Image.h', 'core/src/fxcodec/jbig2/JBig2_List.h', - 'core/src/fxcodec/jbig2/JBig2_Module.h', - 'core/src/fxcodec/jbig2/JBig2_Object.cpp', - 'core/src/fxcodec/jbig2/JBig2_Object.h', 'core/src/fxcodec/jbig2/JBig2_Page.h', 'core/src/fxcodec/jbig2/JBig2_PatternDict.cpp', 'core/src/fxcodec/jbig2/JBig2_PatternDict.h', |