summaryrefslogtreecommitdiff
path: root/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
diff options
context:
space:
mode:
authorNicolas Pena <npm@chromium.org>2018-05-24 14:37:40 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-24 14:37:40 +0000
commit5bf772bade615d8cb3388f677d85785fe0c01824 (patch)
tree2fcdee842d114cd8dd298dd25b334bc0ce4fdeea /core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
parent18f7fbca461254cc0df1af2ca586df42b7fd6c17 (diff)
downloadpdfium-5bf772bade615d8cb3388f677d85785fe0c01824.tar.xz
Do some variable cleanup in CJBig2_Context
This CL cleans up variables in CJBig2_Context. It moves some declarations further, to when the variables are actually used. It also caches huffman tables in a vector of unique_ptr. Change-Id: Id3af96f9526b1000f681e4e2b174bba07b45ee55 Reviewed-on: https://pdfium-review.googlesource.com/32715 Commit-Queue: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_HuffmanTable.cpp')
-rw-r--r--core/fxcodec/jbig2/JBig2_HuffmanTable.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp b/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
index 97740a55fe..392b718660 100644
--- a/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
+++ b/core/fxcodec/jbig2/JBig2_HuffmanTable.cpp
@@ -123,11 +123,15 @@ constexpr HuffmanTable kHuffmanTables[16] = {
{false, kTableLine14, FX_ArraySize(kTableLine14)},
{false, kTableLine15, FX_ArraySize(kTableLine15)}};
+static_assert(CJBig2_HuffmanTable::kNumHuffmanTables ==
+ FX_ArraySize(kHuffmanTables),
+ "kNumHuffmanTables must be equal to the size of kHuffmanTables");
+
} // namespace
CJBig2_HuffmanTable::CJBig2_HuffmanTable(size_t idx) {
ASSERT(idx > 0);
- ASSERT(idx < FX_ArraySize(kHuffmanTables));
+ ASSERT(idx < kNumHuffmanTables);
const HuffmanTable& table = kHuffmanTables[idx];
HTOOB = table.HTOOB;
NTEMP = table.size;