diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-11-28 19:22:47 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-11-28 19:22:47 +0000 |
commit | 9cc00f40a38c9b2beed17ecfe0e5f71c127d2ea4 (patch) | |
tree | 238c88bfadf134f378bb0deaecf34aaa86d870eb /core/fxcodec/jbig2/JBig2_Context.cpp | |
parent | 0f1ca17e45bee4f1cb04d33437eba010b1afcd72 (diff) | |
download | pdfium-9cc00f40a38c9b2beed17ecfe0e5f71c127d2ea4.tar.xz |
Remove CollectionSize from JBig2_Context
Bug: pdfium:774
Change-Id: Ie7674ac55dea6284a0d974cef107ef357197a06b
Reviewed-on: https://pdfium-review.googlesource.com/19610
Commit-Queue: dsinclair <dsinclair@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fxcodec/jbig2/JBig2_Context.cpp')
-rw-r--r-- | core/fxcodec/jbig2/JBig2_Context.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/fxcodec/jbig2/JBig2_Context.cpp b/core/fxcodec/jbig2/JBig2_Context.cpp index f4be12e889..30e4aab78c 100644 --- a/core/fxcodec/jbig2/JBig2_Context.cpp +++ b/core/fxcodec/jbig2/JBig2_Context.cpp @@ -25,7 +25,6 @@ #include "core/fxcodec/jbig2/JBig2_TrdProc.h" #include "core/fxcrt/ifx_pauseindicator.h" #include "third_party/base/ptr_util.h" -#include "third_party/base/stl_util.h" namespace { @@ -46,7 +45,9 @@ size_t GetRefAggContextSize(bool val) { // list keeps track of the freshness of entries, with freshest ones // at the front. Even a tiny cache size like 2 makes a dramatic // difference for typical JBIG2 documents. -static const int kSymbolDictCacheMaxSize = 2; +static const size_t kSymbolDictCacheMaxSize = 2; +static_assert(kSymbolDictCacheMaxSize > 0, + "Symbol Dictionary Cache must have non-zero size"); CJBig2_Context::CJBig2_Context(const RetainPtr<CPDF_StreamAcc>& pGlobalStream, const RetainPtr<CPDF_StreamAcc>& pSrcStream, @@ -611,7 +612,7 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment) { if (m_bIsGlobal) { std::unique_ptr<CJBig2_SymbolDict> value = pSegment->m_SymbolDict->DeepCopy(); - int size = pdfium::CollectionSize<int>(*m_pSymbolDictCache); + size_t size = m_pSymbolDictCache->size(); while (size >= kSymbolDictCacheMaxSize) { m_pSymbolDictCache->pop_back(); --size; |