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

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

Issue 1761993002: Remove other remaining use of std::list::size() from loop body. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 10 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_Context.cpp
diff --git a/core/src/fxcodec/jbig2/JBig2_Context.cpp b/core/src/fxcodec/jbig2/JBig2_Context.cpp
index 958c4a63e2b93a589ed5bca92871b2db19165e5b..399ff6865760115941c8b7bebd879c701f53d9eb 100644
--- a/core/src/fxcodec/jbig2/JBig2_Context.cpp
+++ b/core/src/fxcodec/jbig2/JBig2_Context.cpp
@@ -20,6 +20,7 @@
#include "core/src/fxcodec/jbig2/JBig2_PddProc.h"
#include "core/src/fxcodec/jbig2/JBig2_SddProc.h"
#include "core/src/fxcodec/jbig2/JBig2_TrdProc.h"
+#include "third_party/base/stl_util.h"
namespace {
@@ -637,9 +638,11 @@ int32_t CJBig2_Context::parseSymbolDict(CJBig2_Segment* pSegment,
if (m_bIsGlobal && kSymbolDictCacheMaxSize > 0) {
std::unique_ptr<CJBig2_SymbolDict> value =
pSegment->m_Result.sd->DeepCopy();
- while (m_pSymbolDictCache->size() >= kSymbolDictCacheMaxSize) {
+ int size = pdfium::CollectionSize<int>(*m_pSymbolDictCache);
+ while (size >= kSymbolDictCacheMaxSize) {
delete m_pSymbolDictCache->back().second;
m_pSymbolDictCache->pop_back();
+ --size;
}
m_pSymbolDictCache->push_front(CJBig2_CachePair(key, value.release()));
}
« 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