Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1159)

Unified Diff: core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp

Issue 1400773002: Fix a bad refactoring error from commit 8a9ce57. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp
diff --git a/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp b/core/src/fxcodec/jbig2/JBig2_HuffmanTable.cpp
index 4effbfadefde864dece6ec8607a0c99f788ee98a..9d7cd2aee1ae7c7ec1680d3ca312da37b0871bef 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) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698