summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_edit
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 /core/fpdfapi/fpdf_edit
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 'core/fpdfapi/fpdf_edit')
-rw-r--r--core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp9
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp4
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp3
3 files changed, 7 insertions, 9 deletions
diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
index a484edd6b9..28cbdfc02e 100644
--- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
@@ -129,11 +129,10 @@ void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) {
CFX_ByteTextBuf buf;
if (CPDF_Array* pArray = pContent->AsArray()) {
- int iCount = pArray->GetCount();
+ size_t iCount = pArray->GetCount();
CPDF_StreamAcc** pContentArray = FX_Alloc(CPDF_StreamAcc*, iCount);
- int size = 0;
- int i = 0;
- for (i = 0; i < iCount; ++i) {
+ size_t size = 0;
+ for (size_t i = 0; i < iCount; ++i) {
pContent = pArray->GetObjectAt(i);
CPDF_Stream* pStream = ToStream(pContent);
if (!pStream)
@@ -146,7 +145,7 @@ void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) {
}
int pos = 0;
uint8_t* pBuf = FX_Alloc(uint8_t, size);
- for (i = 0; i < iCount; ++i) {
+ for (size_t i = 0; i < iCount; ++i) {
FXSYS_memcpy(pBuf + pos, pContentArray[i]->GetData(),
pContentArray[i]->GetSize());
pos += pContentArray[i]->GetSize() + 1;
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index a337cf59ff..c2e556c3a7 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -96,7 +96,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
}
offset += 1;
const CPDF_Array* p = pObj->AsArray();
- for (uint32_t i = 0; i < p->GetCount(); i++) {
+ for (size_t i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetObjectAt(i);
if (pElement->GetObjNum()) {
if (pFile->AppendString(" ") < 0) {
@@ -1199,7 +1199,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
}
m_Offset += 1;
const CPDF_Array* p = pObj->AsArray();
- for (uint32_t i = 0; i < p->GetCount(); i++) {
+ for (size_t i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetObjectAt(i);
if (pElement->GetObjNum()) {
if (m_File.AppendString(" ") < 0) {
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 04ab9ea863..379e75938e 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -1033,8 +1033,7 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc,
if (!pKidList) {
return -1;
}
- int nKids = pKidList->GetCount();
- for (int i = 0; i < nKids; i++) {
+ for (size_t i = 0; i < pKidList->GetCount(); i++) {
CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
if (pKid->GetStringBy("Type") == "Page") {
if (nPagesToGo == 0) {