From 862520506e75e1129d3ae86d96f60facf287296e Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Wed, 13 Jun 2018 20:11:07 +0000 Subject: Make CJBig2_Context::GetHuffmanTable return const MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL changes GetHuffmanTable() to return a const pointer and fixes other members / functions accordingly. Change-Id: Ie62fe044b3156f67885dd4fa1f6512cbd35a83d3 Reviewed-on: https://pdfium-review.googlesource.com/35116 Reviewed-by: Henrique Nakashima Commit-Queue: Nicolás Peña Moreno --- core/fxcodec/jbig2/JBig2_Context.cpp | 2 +- core/fxcodec/jbig2/JBig2_Context.h | 2 +- core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp | 2 +- core/fxcodec/jbig2/JBig2_HuffmanDecoder.h | 2 +- core/fxcodec/jbig2/JBig2_SddProc.h | 8 ++++---- core/fxcodec/jbig2/JBig2_TrdProc.h | 16 ++++++++-------- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index ef0cb95600..ec81990662 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -1240,7 +1240,7 @@ std::vector CJBig2_Context::DecodeSymbolIDHuffmanTable( return SBSYMCODES; } -CJBig2_HuffmanTable* CJBig2_Context::GetHuffmanTable(size_t idx) { +const CJBig2_HuffmanTable* CJBig2_Context::GetHuffmanTable(size_t idx) { ASSERT(idx > 0); ASSERT(idx < CJBig2_HuffmanTable::kNumHuffmanTables); if (!m_HuffmanTables[idx].get()) diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index 3113cce063..20828a23b5 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -79,7 +79,7 @@ class CJBig2_Context { std::vector DecodeSymbolIDHuffmanTable(uint32_t SBNUMSYMS); - CJBig2_HuffmanTable* GetHuffmanTable(size_t idx); + const CJBig2_HuffmanTable* GetHuffmanTable(size_t idx); std::unique_ptr m_pGlobalContext; std::unique_ptr m_pStream; diff --git a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp index 7f250a5d08..bea2b09042 100644 --- a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp +++ b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.cpp @@ -14,7 +14,7 @@ CJBig2_HuffmanDecoder::CJBig2_HuffmanDecoder(CJBig2_BitStream* pStream) CJBig2_HuffmanDecoder::~CJBig2_HuffmanDecoder() {} -int CJBig2_HuffmanDecoder::DecodeAValue(CJBig2_HuffmanTable* pTable, +int CJBig2_HuffmanDecoder::DecodeAValue(const CJBig2_HuffmanTable* pTable, int* nResult) { FX_SAFE_INT32 nSafeVal = 0; int nBits = 0; diff --git a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.h b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.h index 5daf1fc812..48f8d0fbbf 100644 --- a/core/fxcodec/jbig2/JBig2_HuffmanDecoder.h +++ b/core/fxcodec/jbig2/JBig2_HuffmanDecoder.h @@ -16,7 +16,7 @@ class CJBig2_HuffmanDecoder { explicit CJBig2_HuffmanDecoder(CJBig2_BitStream* pStream); ~CJBig2_HuffmanDecoder(); - int DecodeAValue(CJBig2_HuffmanTable* pTable, int* nResult); + int DecodeAValue(const CJBig2_HuffmanTable* pTable, int* nResult); private: UnownedPtr const m_pStream; diff --git a/core/fxcodec/jbig2/JBig2_SddProc.h b/core/fxcodec/jbig2/JBig2_SddProc.h index 672c2c3e6a..a6fb039cac 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.h +++ b/core/fxcodec/jbig2/JBig2_SddProc.h @@ -36,10 +36,10 @@ class CJBig2_SDDProc { CJBig2_Image** SDINSYMS; uint32_t SDNUMNEWSYMS; uint32_t SDNUMEXSYMS; - CJBig2_HuffmanTable* SDHUFFDH; - CJBig2_HuffmanTable* SDHUFFDW; - CJBig2_HuffmanTable* SDHUFFBMSIZE; - CJBig2_HuffmanTable* SDHUFFAGGINST; + const CJBig2_HuffmanTable* SDHUFFDH; + const CJBig2_HuffmanTable* SDHUFFDW; + const CJBig2_HuffmanTable* SDHUFFBMSIZE; + const CJBig2_HuffmanTable* SDHUFFAGGINST; uint8_t SDTEMPLATE; int8_t SDAT[8]; bool SDRTEMPLATE; diff --git a/core/fxcodec/jbig2/JBig2_TrdProc.h b/core/fxcodec/jbig2/JBig2_TrdProc.h index 3db3121d3e..1d90bf4bd6 100644 --- a/core/fxcodec/jbig2/JBig2_TrdProc.h +++ b/core/fxcodec/jbig2/JBig2_TrdProc.h @@ -72,14 +72,14 @@ class CJBig2_TRDProc { JBig2Corner REFCORNER; int8_t SBDSOFFSET; - CJBig2_HuffmanTable* SBHUFFFS; - CJBig2_HuffmanTable* SBHUFFDS; - CJBig2_HuffmanTable* SBHUFFDT; - CJBig2_HuffmanTable* SBHUFFRDW; - CJBig2_HuffmanTable* SBHUFFRDH; - CJBig2_HuffmanTable* SBHUFFRDX; - CJBig2_HuffmanTable* SBHUFFRDY; - CJBig2_HuffmanTable* SBHUFFRSIZE; + const CJBig2_HuffmanTable* SBHUFFFS; + const CJBig2_HuffmanTable* SBHUFFDS; + const CJBig2_HuffmanTable* SBHUFFDT; + const CJBig2_HuffmanTable* SBHUFFRDW; + const CJBig2_HuffmanTable* SBHUFFRDH; + const CJBig2_HuffmanTable* SBHUFFRDX; + const CJBig2_HuffmanTable* SBHUFFRDY; + const CJBig2_HuffmanTable* SBHUFFRSIZE; bool SBRTEMPLATE; int8_t SBRAT[4]; -- cgit v1.2.3