diff options
author | Nicolas Pena <npm@chromium.org> | 2017-07-14 13:24:12 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-07-17 14:59:48 +0000 |
commit | 18531230381465592e1a037e6dfc39d4a6fb5def (patch) | |
tree | 34403ecdb01f38df91cab9fc3071c8878b561179 /core/fxcodec/jbig2/JBig2_SddProc.cpp | |
parent | f768baf129fcafc4342193477e0c41c082ef5ca5 (diff) | |
download | pdfium-18531230381465592e1a037e6dfc39d4a6fb5def.tar.xz |
Simplify CJBig2_Context::huffman_assign_code
This CL removes duplicate huffman_assign_code()s and changes some
return values and members to std::vector.
Change-Id: I47a1e0e2e88ff54ec799c97e92ec9ff5ca87c6c7
Reviewed-on: https://pdfium-review.googlesource.com/7910
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_SddProc.cpp')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_SddProc.cpp | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/core/fxcodec/jbig2/JBig2_SddProc.cpp b/core/fxcodec/jbig2/JBig2_SddProc.cpp index d23fb049b1..1a98b17d34 100644 --- a/core/fxcodec/jbig2/JBig2_SddProc.cpp +++ b/core/fxcodec/jbig2/JBig2_SddProc.cpp @@ -279,7 +279,6 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( uint32_t nTmp; uint32_t SBNUMSYMS; uint8_t SBSYMCODELEN; - std::vector<JBig2HuffmanCode> SBSYMCODES; uint32_t IDI; int32_t RDXI, RDYI; uint32_t BMSIZE; @@ -345,16 +344,15 @@ std::unique_ptr<CJBig2_SymbolDict> CJBig2_SDDProc::decode_Huffman( pDecoder->SBSTRIPS = 1; pDecoder->SBNUMSYMS = SDNUMINSYMS + NSYMSDECODED; SBNUMSYMS = pDecoder->SBNUMSYMS; - SBSYMCODES.resize(SBNUMSYMS); + std::vector<JBig2HuffmanCode> SBSYMCODES(SBNUMSYMS); nTmp = 1; - while ((uint32_t)(1 << nTmp) < SBNUMSYMS) { - nTmp++; - } - for (I = 0; I < SBNUMSYMS; I++) { + while (static_cast<uint32_t>(1 << nTmp) < SBNUMSYMS) + ++nTmp; + for (I = 0; I < SBNUMSYMS; ++I) { SBSYMCODES[I].codelen = nTmp; SBSYMCODES[I].code = I; } - pDecoder->SBSYMCODES = SBSYMCODES.data(); + pDecoder->SBSYMCODES = std::move(SBSYMCODES); SBSYMS.resize(SBNUMSYMS); std::copy(SDINSYMS, SDINSYMS + SDNUMINSYMS, SBSYMS.begin()); for (size_t i = 0; i < NSYMSDECODED; ++i) |