summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_Context.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-27 21:33:58 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-27 21:33:58 +0000
commit1279579430dfd1e57c1df05605535876d402be49 (patch)
tree9f95db6235cfad2fc5df6f08b2b94801b5aac846 /core/fxcodec/jbig2/JBig2_Context.cpp
parent74c8b8e6e561b4ff1059441d70f7f1476494dfbb (diff)
downloadpdfium-1279579430dfd1e57c1df05605535876d402be49.tar.xz
Remove CJBig2_HuffmanTable::InitCodes().
Use CJBig2_Context::HuffmanAssignCode() instead. Change-Id: Ief187420494a8cefa26eeedb98a55683caf7807b Reviewed-on: https://pdfium-review.googlesource.com/31538 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_Context.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_Context.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp
index 6cb94872c6..8d416ffc3c 100644
--- a/core/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/fxcodec/jbig2/JBig2_Context.cpp
@@ -1319,9 +1319,9 @@ std::vector<JBig2HuffmanCode> CJBig2_Context::DecodeSymbolIDHuffmanTable(
return SBSYMCODES;
}
+// static
bool CJBig2_Context::HuffmanAssignCode(JBig2HuffmanCode* SBSYMCODES,
uint32_t NTEMP) {
- // TODO(thestig): CJBig2_HuffmanTable::InitCodes() has similar code.
int LENMAX = 0;
for (uint32_t i = 0; i < NTEMP; ++i)
LENMAX = std::max(SBSYMCODES[i].codelen, LENMAX);
@@ -1331,7 +1331,6 @@ bool CJBig2_Context::HuffmanAssignCode(JBig2HuffmanCode* SBSYMCODES,
for (uint32_t i = 0; i < NTEMP; ++i)
++LENCOUNT[SBSYMCODES[i].codelen];
- LENCOUNT[0] = 0;
for (int i = 1; i <= LENMAX; ++i) {
pdfium::base::CheckedNumeric<int> shifted = FIRSTCODE[i - 1];
shifted += LENCOUNT[i - 1];
@@ -1342,9 +1341,8 @@ bool CJBig2_Context::HuffmanAssignCode(JBig2HuffmanCode* SBSYMCODES,
FIRSTCODE[i] = shifted.ValueOrDie();
int CURCODE = FIRSTCODE[i];
for (uint32_t j = 0; j < NTEMP; ++j) {
- if (SBSYMCODES[j].codelen == i) {
+ if (SBSYMCODES[j].codelen == i)
SBSYMCODES[j].code = CURCODE++;
- }
}
}
return true;