diff options
author | Lei Zhang <thestig@chromium.org> | 2018-04-27 20:22:58 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-27 20:22:58 +0000 |
commit | e3c44e1403906a88d500089c934bc034b8025ae2 (patch) | |
tree | c6f69be1737498aa7ca03f73a3c71401969e8445 /core/fxcodec/jbig2 | |
parent | 01148da03a7d2950515b540582cc05e2f9b16140 (diff) | |
download | pdfium-e3c44e1403906a88d500089c934bc034b8025ae2.tar.xz |
Simplify CJBig2_Context::DecodeSymbolIDHuffmanTable().
One of its parameters is a member variable.
Change-Id: I0dcb78275d9ea5b05a77e211d178a0efb8699395
Reviewed-on: https://pdfium-review.googlesource.com/31535
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Context.cpp | 13 | ||||
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Context.h | 4 |
2 files changed, 7 insertions, 10 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index 9b866d75d0..ef5f05ba5a 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -732,7 +732,7 @@ int32_t CJBig2_Context::ParseTextRegion(CJBig2_Segment* pSegment) { if (pTRD->SBHUFF == 1) { std::vector<JBig2HuffmanCode> SBSYMCODES = - DecodeSymbolIDHuffmanTable(m_pStream.get(), pTRD->SBNUMSYMS); + DecodeSymbolIDHuffmanTable(pTRD->SBNUMSYMS); if (SBSYMCODES.empty()) return JBIG2_ERROR_FATAL; @@ -1250,12 +1250,11 @@ int32_t CJBig2_Context::ParseRegionInfo(JBig2RegionInfo* pRI) { } std::vector<JBig2HuffmanCode> CJBig2_Context::DecodeSymbolIDHuffmanTable( - CJBig2_BitStream* pStream, uint32_t SBNUMSYMS) { const size_t kRunCodesSize = 35; JBig2HuffmanCode huffman_codes[kRunCodesSize]; for (size_t i = 0; i < kRunCodesSize; ++i) { - if (pStream->readNBits(4, &huffman_codes[i].codelen) != 0) + if (m_pStream->readNBits(4, &huffman_codes[i].codelen) != 0) return std::vector<JBig2HuffmanCode>(); } HuffmanAssignCode(huffman_codes, kRunCodesSize); @@ -1270,7 +1269,7 @@ std::vector<JBig2HuffmanCode> CJBig2_Context::DecodeSymbolIDHuffmanTable( uint32_t nTemp; while (true) { if (nVal > std::numeric_limits<int32_t>::max() / 2 || - pStream->read1Bit(&nTemp) != 0) { + m_pStream->read1Bit(&nTemp) != 0) { return std::vector<JBig2HuffmanCode>(); } @@ -1288,15 +1287,15 @@ std::vector<JBig2HuffmanCode> CJBig2_Context::DecodeSymbolIDHuffmanTable( SBSYMCODES[i].codelen = runcode; run = 0; } else if (runcode == 32) { - if (pStream->readNBits(2, &nTemp) != 0) + if (m_pStream->readNBits(2, &nTemp) != 0) return std::vector<JBig2HuffmanCode>(); run = nTemp + 3; } else if (runcode == 33) { - if (pStream->readNBits(3, &nTemp) != 0) + if (m_pStream->readNBits(3, &nTemp) != 0) return std::vector<JBig2HuffmanCode>(); run = nTemp + 3; } else if (runcode == 34) { - if (pStream->readNBits(7, &nTemp) != 0) + if (m_pStream->readNBits(7, &nTemp) != 0) return std::vector<JBig2HuffmanCode>(); run = nTemp + 11; } diff --git a/core/fxcodec/jbig2/JBig2_Context.h b/core/fxcodec/jbig2/JBig2_Context.h index d5dbbd22a6..3c0e5b6e2b 100644 --- a/core/fxcodec/jbig2/JBig2_Context.h +++ b/core/fxcodec/jbig2/JBig2_Context.h @@ -80,9 +80,7 @@ class CJBig2_Context { int32_t ParseTable(CJBig2_Segment* pSegment); int32_t ParseRegionInfo(JBig2RegionInfo* pRI); - std::vector<JBig2HuffmanCode> DecodeSymbolIDHuffmanTable( - CJBig2_BitStream* pStream, - uint32_t SBNUMSYMS); + std::vector<JBig2HuffmanCode> DecodeSymbolIDHuffmanTable(uint32_t SBNUMSYMS); void HuffmanAssignCode(JBig2HuffmanCode* SBSYMCODES, int NTEMP); |