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

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

Issue 1420973002: Add type cast definitions for CPDF_Reference. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 5 years, 2 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 "../../../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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 if ((len = pFile->AppendString(PDF_NameEncode(str))) < 0) { 57 if ((len = pFile->AppendString(PDF_NameEncode(str))) < 0) {
58 return -1; 58 return -1;
59 } 59 }
60 offset += len + 1; 60 offset += len + 1;
61 break; 61 break;
62 } 62 }
63 case PDFOBJ_REFERENCE: { 63 case PDFOBJ_REFERENCE: {
64 if (pFile->AppendString(FX_BSTRC(" ")) < 0) { 64 if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
65 return -1; 65 return -1;
66 } 66 }
67 CPDF_Reference* p = (CPDF_Reference*)pObj; 67 const CPDF_Reference* p = pObj->AsReference();
Lei Zhang 2015/10/22 21:26:51 I think you can just fold |p| into the next line.
dsinclair 2015/10/26 13:55:44 Done.
68 if ((len = pFile->AppendDWord(p->GetRefObjNum())) < 0) { 68 if ((len = pFile->AppendDWord(p->GetRefObjNum())) < 0) {
69 return -1; 69 return -1;
70 } 70 }
71 if (pFile->AppendString(FX_BSTRC(" 0 R ")) < 0) { 71 if (pFile->AppendString(FX_BSTRC(" 0 R ")) < 0) {
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: {
(...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 if ((len = m_File.AppendString(PDF_NameEncode(str))) < 0) { 1164 if ((len = m_File.AppendString(PDF_NameEncode(str))) < 0) {
1165 return -1; 1165 return -1;
1166 } 1166 }
1167 m_Offset += len + 1; 1167 m_Offset += len + 1;
1168 break; 1168 break;
1169 } 1169 }
1170 case PDFOBJ_REFERENCE: { 1170 case PDFOBJ_REFERENCE: {
1171 if (m_File.AppendString(FX_BSTRC(" ")) < 0) { 1171 if (m_File.AppendString(FX_BSTRC(" ")) < 0) {
1172 return -1; 1172 return -1;
1173 } 1173 }
1174 CPDF_Reference* p = (CPDF_Reference*)pObj; 1174 const CPDF_Reference* p = pObj->AsReference();
1175 if ((len = m_File.AppendDWord(p->GetRefObjNum())) < 0) { 1175 if ((len = m_File.AppendDWord(p->GetRefObjNum())) < 0) {
1176 return -1; 1176 return -1;
1177 } 1177 }
1178 if (m_File.AppendString(FX_BSTRC(" 0 R")) < 0) { 1178 if (m_File.AppendString(FX_BSTRC(" 0 R")) < 0) {
1179 return -1; 1179 return -1;
1180 } 1180 }
1181 m_Offset += len + 5; 1181 m_Offset += len + 5;
1182 break; 1182 break;
1183 } 1183 }
1184 case PDFOBJ_ARRAY: { 1184 case PDFOBJ_ARRAY: {
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 m_bNewCrypto = FALSE; 2119 m_bNewCrypto = FALSE;
2120 if (!m_bStandardSecurity) { 2120 if (!m_bStandardSecurity) {
2121 return; 2121 return;
2122 } 2122 }
2123 if (m_pEncryptDict) { 2123 if (m_pEncryptDict) {
2124 m_pEncryptDict->Release(); 2124 m_pEncryptDict->Release();
2125 m_pEncryptDict = NULL; 2125 m_pEncryptDict = NULL;
2126 } 2126 }
2127 m_bStandardSecurity = FALSE; 2127 m_bStandardSecurity = FALSE;
2128 } 2128 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698