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

Side by Side Diff: core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp

Issue 1419643005: Merge to XFA: Add type cast definitions for CPDF_Array. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month 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 "../../../include/fxcrt/fx_ext.h" 7 #include "../../../include/fxcrt/fx_ext.h"
8 #include "../../../include/fpdfapi/fpdf_serial.h" 8 #include "../../../include/fpdfapi/fpdf_serial.h"
9 #include "../../../include/fpdfapi/fpdf_parser.h" 9 #include "../../../include/fpdfapi/fpdf_parser.h"
10 #include "editint.h" 10 #include "editint.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 return -1; 72 return -1;
73 } 73 }
74 offset += len + 6; 74 offset += len + 6;
75 break; 75 break;
76 } 76 }
77 case PDFOBJ_ARRAY: { 77 case PDFOBJ_ARRAY: {
78 if (pFile->AppendString(FX_BSTRC("[")) < 0) { 78 if (pFile->AppendString(FX_BSTRC("[")) < 0) {
79 return -1; 79 return -1;
80 } 80 }
81 offset += 1; 81 offset += 1;
82 CPDF_Array* p = (CPDF_Array*)pObj; 82 const CPDF_Array* p = pObj->AsArray();
83 for (FX_DWORD i = 0; i < p->GetCount(); i++) { 83 for (FX_DWORD i = 0; i < p->GetCount(); i++) {
84 CPDF_Object* pElement = p->GetElement(i); 84 CPDF_Object* pElement = p->GetElement(i);
85 if (pElement->GetObjNum()) { 85 if (pElement->GetObjNum()) {
86 if (pFile->AppendString(FX_BSTRC(" ")) < 0) { 86 if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
87 return -1; 87 return -1;
88 } 88 }
89 if ((len = pFile->AppendDWord(pElement->GetObjNum())) < 0) { 89 if ((len = pFile->AppendDWord(pElement->GetObjNum())) < 0) {
90 return -1; 90 return -1;
91 } 91 }
92 if (pFile->AppendString(FX_BSTRC(" 0 R")) < 0) { 92 if (pFile->AppendString(FX_BSTRC(" 0 R")) < 0) {
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 return -1; 1188 return -1;
1189 } 1189 }
1190 m_Offset += len + 5; 1190 m_Offset += len + 5;
1191 break; 1191 break;
1192 } 1192 }
1193 case PDFOBJ_ARRAY: { 1193 case PDFOBJ_ARRAY: {
1194 if (m_File.AppendString(FX_BSTRC("[")) < 0) { 1194 if (m_File.AppendString(FX_BSTRC("[")) < 0) {
1195 return -1; 1195 return -1;
1196 } 1196 }
1197 m_Offset += 1; 1197 m_Offset += 1;
1198 CPDF_Array* p = (CPDF_Array*)pObj; 1198 const CPDF_Array* p = pObj->AsArray();
1199 for (FX_DWORD i = 0; i < p->GetCount(); i++) { 1199 for (FX_DWORD i = 0; i < p->GetCount(); i++) {
1200 CPDF_Object* pElement = p->GetElement(i); 1200 CPDF_Object* pElement = p->GetElement(i);
1201 if (pElement->GetObjNum()) { 1201 if (pElement->GetObjNum()) {
1202 if (m_File.AppendString(FX_BSTRC(" ")) < 0) { 1202 if (m_File.AppendString(FX_BSTRC(" ")) < 0) {
1203 return -1; 1203 return -1;
1204 } 1204 }
1205 if ((len = m_File.AppendDWord(pElement->GetObjNum())) < 0) { 1205 if ((len = m_File.AppendDWord(pElement->GetObjNum())) < 0) {
1206 return -1; 1206 return -1;
1207 } 1207 }
1208 if (m_File.AppendString(FX_BSTRC(" 0 R")) < 0) { 1208 if (m_File.AppendString(FX_BSTRC(" 0 R")) < 0) {
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 m_bNewCrypto = FALSE; 2128 m_bNewCrypto = FALSE;
2129 if (!m_bStandardSecurity) { 2129 if (!m_bStandardSecurity) {
2130 return; 2130 return;
2131 } 2131 }
2132 if (m_pEncryptDict) { 2132 if (m_pEncryptDict) {
2133 m_pEncryptDict->Release(); 2133 m_pEncryptDict->Release();
2134 m_pEncryptDict = NULL; 2134 m_pEncryptDict = NULL;
2135 } 2135 }
2136 m_bStandardSecurity = FALSE; 2136 m_bStandardSecurity = FALSE;
2137 } 2137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698