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

Side by Side Diff: core/fpdfapi/fpdf_edit/fpdf_edit_create.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 "core/fpdfapi/fpdf_edit/editint.h" 7 #include "core/fpdfapi/fpdf_edit/editint.h"
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 return -1; 90 return -1;
91 offset += len + 6; 91 offset += len + 6;
92 break; 92 break;
93 } 93 }
94 case CPDF_Object::ARRAY: { 94 case CPDF_Object::ARRAY: {
95 if (pFile->AppendString("[") < 0) { 95 if (pFile->AppendString("[") < 0) {
96 return -1; 96 return -1;
97 } 97 }
98 offset += 1; 98 offset += 1;
99 const CPDF_Array* p = pObj->AsArray(); 99 const CPDF_Array* p = pObj->AsArray();
100 for (uint32_t i = 0; i < p->GetCount(); i++) { 100 for (size_t i = 0; i < p->GetCount(); i++) {
101 CPDF_Object* pElement = p->GetObjectAt(i); 101 CPDF_Object* pElement = p->GetObjectAt(i);
102 if (pElement->GetObjNum()) { 102 if (pElement->GetObjNum()) {
103 if (pFile->AppendString(" ") < 0) { 103 if (pFile->AppendString(" ") < 0) {
104 return -1; 104 return -1;
105 } 105 }
106 if ((len = pFile->AppendDWord(pElement->GetObjNum())) < 0) { 106 if ((len = pFile->AppendDWord(pElement->GetObjNum())) < 0) {
107 return -1; 107 return -1;
108 } 108 }
109 if (pFile->AppendString(" 0 R") < 0) { 109 if (pFile->AppendString(" 0 R") < 0) {
110 return -1; 110 return -1;
(...skipping 1085 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 return -1; 1196 return -1;
1197 m_Offset += len + 5; 1197 m_Offset += len + 5;
1198 break; 1198 break;
1199 } 1199 }
1200 case CPDF_Object::ARRAY: { 1200 case CPDF_Object::ARRAY: {
1201 if (m_File.AppendString("[") < 0) { 1201 if (m_File.AppendString("[") < 0) {
1202 return -1; 1202 return -1;
1203 } 1203 }
1204 m_Offset += 1; 1204 m_Offset += 1;
1205 const CPDF_Array* p = pObj->AsArray(); 1205 const CPDF_Array* p = pObj->AsArray();
1206 for (uint32_t i = 0; i < p->GetCount(); i++) { 1206 for (size_t i = 0; i < p->GetCount(); i++) {
1207 CPDF_Object* pElement = p->GetObjectAt(i); 1207 CPDF_Object* pElement = p->GetObjectAt(i);
1208 if (pElement->GetObjNum()) { 1208 if (pElement->GetObjNum()) {
1209 if (m_File.AppendString(" ") < 0) { 1209 if (m_File.AppendString(" ") < 0) {
1210 return -1; 1210 return -1;
1211 } 1211 }
1212 if ((len = m_File.AppendDWord(pElement->GetObjNum())) < 0) { 1212 if ((len = m_File.AppendDWord(pElement->GetObjNum())) < 0) {
1213 return -1; 1213 return -1;
1214 } 1214 }
1215 if (m_File.AppendString(" 0 R") < 0) { 1215 if (m_File.AppendString(" 0 R") < 0) {
1216 return -1; 1216 return -1;
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 m_bNewCrypto = FALSE; 2075 m_bNewCrypto = FALSE;
2076 if (!m_bStandardSecurity) { 2076 if (!m_bStandardSecurity) {
2077 return; 2077 return;
2078 } 2078 }
2079 if (m_pEncryptDict) { 2079 if (m_pEncryptDict) {
2080 m_pEncryptDict->Release(); 2080 m_pEncryptDict->Release();
2081 m_pEncryptDict = NULL; 2081 m_pEncryptDict = NULL;
2082 } 2082 }
2083 m_bStandardSecurity = FALSE; 2083 m_bStandardSecurity = FALSE;
2084 } 2084 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698