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

Side by Side Diff: core/fpdfapi/fpdf_edit/fpdf_edit_doc.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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include <limits.h> 7 #include <limits.h>
8 8
9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" 9 #include "core/fpdfapi/fpdf_font/include/cpdf_font.h"
10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h" 10 #include "core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h"
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 static int InsertDeletePDFPage(CPDF_Document* pDoc, 1026 static int InsertDeletePDFPage(CPDF_Document* pDoc,
1027 CPDF_Dictionary* pPages, 1027 CPDF_Dictionary* pPages,
1028 int nPagesToGo, 1028 int nPagesToGo,
1029 CPDF_Dictionary* pPage, 1029 CPDF_Dictionary* pPage,
1030 FX_BOOL bInsert, 1030 FX_BOOL bInsert,
1031 CFX_ArrayTemplate<CPDF_Dictionary*>& stackList) { 1031 CFX_ArrayTemplate<CPDF_Dictionary*>& stackList) {
1032 CPDF_Array* pKidList = pPages->GetArrayBy("Kids"); 1032 CPDF_Array* pKidList = pPages->GetArrayBy("Kids");
1033 if (!pKidList) { 1033 if (!pKidList) {
1034 return -1; 1034 return -1;
1035 } 1035 }
1036 int nKids = pKidList->GetCount(); 1036 for (size_t i = 0; i < pKidList->GetCount(); i++) {
1037 for (int i = 0; i < nKids; i++) {
1038 CPDF_Dictionary* pKid = pKidList->GetDictAt(i); 1037 CPDF_Dictionary* pKid = pKidList->GetDictAt(i);
1039 if (pKid->GetStringBy("Type") == "Page") { 1038 if (pKid->GetStringBy("Type") == "Page") {
1040 if (nPagesToGo == 0) { 1039 if (nPagesToGo == 0) {
1041 if (bInsert) { 1040 if (bInsert) {
1042 pKidList->InsertAt(i, new CPDF_Reference(pDoc, pPage->GetObjNum())); 1041 pKidList->InsertAt(i, new CPDF_Reference(pDoc, pPage->GetObjNum()));
1043 pPage->SetAtReference("Parent", pDoc, pPages->GetObjNum()); 1042 pPage->SetAtReference("Parent", pDoc, pPages->GetObjNum());
1044 } else { 1043 } else {
1045 pKidList->RemoveAt(i); 1044 pKidList->RemoveAt(i);
1046 } 1045 }
1047 pPages->SetAtInteger( 1046 pPages->SetAtInteger(
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict, 1150 void FPDFAPI_FlatPageAttr(CPDF_Dictionary* pPageDict,
1152 const CFX_ByteStringC& name) { 1151 const CFX_ByteStringC& name) {
1153 if (pPageDict->KeyExist(name)) { 1152 if (pPageDict->KeyExist(name)) {
1154 return; 1153 return;
1155 } 1154 }
1156 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name); 1155 CPDF_Object* pObj = FPDFAPI_GetPageAttr(pPageDict, name);
1157 if (pObj) { 1156 if (pObj) {
1158 pPageDict->SetAt(name, pObj->Clone()); 1157 pPageDict->SetAt(name, pObj->Clone());
1159 } 1158 }
1160 } 1159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698