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

Unified Diff: fpdfsdk/fpdfdoc.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: fpdfsdk/fpdfdoc.cpp
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index c9030e503505d17bb56a8623e32da3d65f2d98e4..7473cb06711dce26a731c5e17bf492862e1ad4e2 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -286,14 +286,14 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page,
CPDF_Array* pAnnots = pPage->m_pFormDict->GetArrayBy("Annots");
if (!pAnnots)
return FALSE;
- for (int i = *startPos; i < (int)pAnnots->GetCount(); i++) {
+ for (size_t i = *startPos; i < pAnnots->GetCount(); i++) {
CPDF_Dictionary* pDict =
ToDictionary(static_cast<CPDF_Object*>(pAnnots->GetDirectObjectAt(i)));
if (!pDict)
continue;
if (pDict->GetStringBy("Subtype") == "Link") {
- *startPos = i + 1;
- *linkAnnot = (FPDF_LINK)pDict;
+ *startPos = static_cast<int>(i + 1);
+ *linkAnnot = static_cast<FPDF_LINK>(pDict);
return TRUE;
}
}
@@ -322,7 +322,7 @@ DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) {
CPDF_Array* pArray = pAnnotDict->GetArrayBy("QuadPoints");
if (!pArray)
return 0;
- return pArray->GetCount() / 8;
+ return static_cast<int>(pArray->GetCount() / 8);
}
DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
@@ -334,8 +334,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
ToDictionary(static_cast<CPDF_Object*>(linkAnnot));
CPDF_Array* pArray = pAnnotDict->GetArrayBy("QuadPoints");
if (pArray) {
- if (quadIndex < 0 || quadIndex >= (int)pArray->GetCount() / 8 ||
- ((quadIndex * 8 + 7) >= (int)pArray->GetCount()))
+ if (quadIndex < 0 ||
+ static_cast<size_t>(quadIndex) >= pArray->GetCount() / 8 ||
+ (static_cast<size_t>(quadIndex * 8 + 7) >= pArray->GetCount()))
return FALSE;
quadPoints->x1 = pArray->GetNumberAt(quadIndex * 8);
quadPoints->y1 = pArray->GetNumberAt(quadIndex * 8 + 1);

Powered by Google App Engine
This is Rietveld 408576698