diff options
author | Lei Zhang <thestig@chromium.org> | 2015-10-09 10:04:37 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-10-09 10:04:37 -0700 |
commit | c9952e66c588aad6a5996796fb0c96b202e6de0a (patch) | |
tree | d96661a09f508e37196da352a245a3f8c3122eed /core | |
parent | 3ea79bbba24a1c0918ea42368e746097dab40663 (diff) | |
download | pdfium-c9952e66c588aad6a5996796fb0c96b202e6de0a.tar.xz |
Fix a bad refactoring error from commit 8a9ce57.
BUG=541323
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1400773002 .
Diffstat (limited to 'core')
-rw-r--r-- | core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp index 4effbfadef..9d7cd2aee1 100644 --- a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp +++ b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp @@ -146,11 +146,8 @@ int CJBig2_HuffmanTable::parseFromCodedBuffer(CJBig2_BitStream* pStream) { } CODES = FX_Alloc(int, NTEMP); int LENMAX = 0; - for (FX_DWORD i = 0; i < NTEMP; ++i) { - if (PREFLEN[i] > LENMAX) { - LENMAX = PREFLEN[i]; - } - } + for (FX_DWORD i = 0; i < NTEMP; ++i) + LENMAX = std::max(PREFLEN[i], LENMAX); std::vector<int> LENCOUNT(LENMAX + 1); for (FX_DWORD i = 0; i < NTEMP; ++i) @@ -159,7 +156,7 @@ int CJBig2_HuffmanTable::parseFromCodedBuffer(CJBig2_BitStream* pStream) { std::vector<int> FIRSTCODE(LENMAX + 1); FIRSTCODE[0] = 0; - for (int i = 0; i <= LENMAX; ++i) { + for (int i = 1; i <= LENMAX; ++i) { FIRSTCODE[i] = (FIRSTCODE[i - 1] + LENCOUNT[i - 1]) << 1; int CURCODE = FIRSTCODE[i]; for (FX_DWORD j = 0; j < NTEMP; ++j) { |