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

Unified Diff: core/fpdfapi/fpdf_parser/cpdf_parser.cpp

Issue 1867183002: Use std::vector as internal storage for CPDF_Array (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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
Index: core/fpdfapi/fpdf_parser/cpdf_parser.cpp
diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
index 15af1ca5c7603264b291d6b87b144a62d5f03300..fa74459eeddf33789cb68e9d24524131f0a379d8 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
@@ -988,8 +988,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
std::vector<std::pair<int32_t, int32_t>> arrIndex;
CPDF_Array* pArray = pStream->GetDict()->GetArrayBy("Index");
if (pArray) {
- uint32_t nPairSize = pArray->GetCount() / 2;
- for (uint32_t i = 0; i < nPairSize; i++) {
+ for (size_t i = 0; i < pArray->GetCount() / 2; i++) {
CPDF_Object* pStartNumObj = pArray->GetObjectAt(i * 2);
CPDF_Object* pCountObj = pArray->GetObjectAt(i * 2 + 1);
@@ -1013,7 +1012,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
CFX_ArrayTemplate<uint32_t> WidthArray;
FX_SAFE_UINT32 dwAccWidth = 0;
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
WidthArray.Add(pArray->GetIntegerAt(i));
dwAccWidth += WidthArray[i];
}

Powered by Google App Engine
This is Rietveld 408576698