summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-04-11 10:02:09 -0700
committerWei Li <weili@chromium.org>2016-04-11 10:02:09 -0700
commite1aebd43b0c75133f94f8b141b33d12e2e715524 (patch)
tree863aded8c706db162eb3f69d6482100f9d61b842 /fpdfsdk
parent2d4a4fc372159ac7562abea48498b6ab72c2f321 (diff)
downloadpdfium-e1aebd43b0c75133f94f8b141b33d12e2e715524.tar.xz
Use std::vector as internal storage for CPDF_Array
Replace the usage of CFX_ArrayTemplate inside CPDF_Array, which has non-standard APIs such as GetSize() returns int. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1867183002 .
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/fpdf_ext.cpp3
-rw-r--r--fpdfsdk/fpdfdoc.cpp13
-rw-r--r--fpdfsdk/fpdfppo.cpp3
-rw-r--r--fpdfsdk/fsdk_actionhandler.cpp2
-rw-r--r--fpdfsdk/fsdk_baseannot.cpp8
-rw-r--r--fpdfsdk/pdfwindow/PWL_Icon.cpp2
6 files changed, 14 insertions, 17 deletions
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index 3ac1262fc1..8a45a13e12 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -163,8 +163,7 @@ void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) {
CPDF_Dictionary* pJSDict = pNameDict->GetDictBy("JavaScript");
CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayBy("Names") : NULL;
if (pArray) {
- int nCount = pArray->GetCount();
- for (int i = 0; i < nCount; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CFX_ByteString cbStr = pArray->GetStringAt(i);
if (cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0) {
FPDF_UnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW);
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index c9030e5035..7473cb0671 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);
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index 1dbd10c1f7..777310bb2b 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -238,8 +238,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
}
case CPDF_Object::ARRAY: {
CPDF_Array* pArray = pObj->AsArray();
- uint32_t count = pArray->GetCount();
- for (uint32_t i = 0; i < count; ++i) {
+ for (size_t i = 0; i < pArray->GetCount(); ++i) {
CPDF_Object* pNextObj = pArray->GetObjectAt(i);
if (!pNextObj)
return FALSE;
diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp
index ebcaf354ad..0bbdbab137 100644
--- a/fpdfsdk/fsdk_actionhandler.cpp
+++ b/fpdfsdk/fsdk_actionhandler.cpp
@@ -439,7 +439,7 @@ void CPDFSDK_ActionHandler::DoAction_GoTo(CPDFSDK_Document* pDocument,
if (pMyArray) {
pPosAry = new float[pMyArray->GetCount()];
int j = 0;
- for (int i = 2; i < (int)pMyArray->GetCount(); i++) {
+ for (size_t i = 2; i < pMyArray->GetCount(); i++) {
pPosAry[j++] = pMyArray->GetFloatAt(i);
}
sizeOfAry = j;
diff --git a/fpdfsdk/fsdk_baseannot.cpp b/fpdfsdk/fsdk_baseannot.cpp
index 68d99e8ae5..51f87d8c4e 100644
--- a/fpdfsdk/fsdk_baseannot.cpp
+++ b/fpdfsdk/fsdk_baseannot.cpp
@@ -739,9 +739,8 @@ void CPDFSDK_BAAnnot::SetBorderDash(const CFX_IntArray& array) {
}
CPDF_Array* pArray = new CPDF_Array;
- for (int i = 0, sz = array.GetSize(); i < sz; i++) {
+ for (size_t i = 0, sz = array.GetSize(); i < sz; i++)
pArray->AddInteger(array[i]);
- }
pBSDict->SetAt("D", pArray);
}
@@ -760,9 +759,8 @@ void CPDFSDK_BAAnnot::GetBorderDash(CFX_IntArray& array) const {
}
if (pDash) {
- for (int i = 0, sz = pDash->GetCount(); i < sz; i++) {
+ for (size_t i = 0, sz = pDash->GetCount(); i < sz; i++)
array.Add(pDash->GetIntegerAt(i));
- }
}
}
@@ -780,7 +778,7 @@ void CPDFSDK_BAAnnot::RemoveColor() {
FX_BOOL CPDFSDK_BAAnnot::GetColor(FX_COLORREF& color) const {
if (CPDF_Array* pEntry = m_pAnnot->GetAnnotDict()->GetArrayBy("C")) {
- int nCount = pEntry->GetCount();
+ size_t nCount = pEntry->GetCount();
if (nCount == 1) {
FX_FLOAT g = pEntry->GetNumberAt(0) * 255;
diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp
index bae5dc8a56..d4635f6ecd 100644
--- a/fpdfsdk/pdfwindow/PWL_Icon.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp
@@ -133,7 +133,7 @@ void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
CPDF_Array* pA =
m_pIconFit->GetDict() ? m_pIconFit->GetDict()->GetArrayBy("A") : NULL;
if (pA) {
- uint32_t dwCount = pA->GetCount();
+ size_t dwCount = pA->GetCount();
if (dwCount > 0)
fLeft = pA->GetNumberAt(0);
if (dwCount > 1)