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

Side by Side Diff: fpdfsdk/src/fpdfsave.cpp

Issue 1422113003: Fix XFA compilation noise, part 1. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Nits. 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
« no previous file with comments | « fpdfsdk/include/fsdk_baseform.h ('k') | fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "../../public/fpdf_edit.h" 7 #include "../../public/fpdf_edit.h"
8 #include "../../public/fpdf_formfill.h" 8 #include "../../public/fpdf_formfill.h"
9 #include "../../public/fpdf_save.h" 9 #include "../../public/fpdf_save.h"
10 #include "../include/fsdk_define.h" 10 #include "../include/fsdk_define.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 pContext->UpdateChecksum((IFX_FileRead*)pTemplate); 128 pContext->UpdateChecksum((IFX_FileRead*)pTemplate);
129 pTemplate->Release(); 129 pTemplate->Release();
130 } 130 }
131 #endif 131 #endif
132 CPDF_Stream* pFormStream = NULL; 132 CPDF_Stream* pFormStream = NULL;
133 CPDF_Stream* pDataSetsStream = NULL; 133 CPDF_Stream* pDataSetsStream = NULL;
134 if (iFormIndex != -1) { 134 if (iFormIndex != -1) {
135 // Get form CPDF_Stream 135 // Get form CPDF_Stream
136 CPDF_Object* pFormPDFObj = pArray->GetElement(iFormIndex); 136 CPDF_Object* pFormPDFObj = pArray->GetElement(iFormIndex);
137 if (pFormPDFObj->GetType() == PDFOBJ_REFERENCE) { 137 if (pFormPDFObj->GetType() == PDFOBJ_REFERENCE) {
138 CPDF_Reference* pFormRefObj = (CPDF_Reference*)pFormPDFObj;
139 CPDF_Object* pFormDircetObj = pFormPDFObj->GetDirect(); 138 CPDF_Object* pFormDircetObj = pFormPDFObj->GetDirect();
140 if (NULL != pFormDircetObj && 139 if (NULL != pFormDircetObj &&
141 pFormDircetObj->GetType() == PDFOBJ_STREAM) { 140 pFormDircetObj->GetType() == PDFOBJ_STREAM) {
142 pFormStream = (CPDF_Stream*)pFormDircetObj; 141 pFormStream = (CPDF_Stream*)pFormDircetObj;
143 } 142 }
144 } else if (pFormPDFObj->GetType() == PDFOBJ_STREAM) { 143 } else if (pFormPDFObj->GetType() == PDFOBJ_STREAM) {
145 pFormStream = (CPDF_Stream*)pFormPDFObj; 144 pFormStream = (CPDF_Stream*)pFormPDFObj;
146 } 145 }
147 } 146 }
148 147
(...skipping 29 matching lines...) Expand all
178 pContext->UpdateChecksum((IFX_FileRead*)pDsfileWrite); 177 pContext->UpdateChecksum((IFX_FileRead*)pDsfileWrite);
179 pContext->FinishChecksum(); 178 pContext->FinishChecksum();
180 #endif 179 #endif
181 CPDF_Dictionary* pDataDict = new CPDF_Dictionary; 180 CPDF_Dictionary* pDataDict = new CPDF_Dictionary;
182 if (iDataSetsIndex != -1) { 181 if (iDataSetsIndex != -1) {
183 if (pDataSetsStream) 182 if (pDataSetsStream)
184 pDataSetsStream->InitStream(pDsfileWrite, pDataDict); 183 pDataSetsStream->InitStream(pDsfileWrite, pDataDict);
185 } else { 184 } else {
186 CPDF_Stream* pData = new CPDF_Stream(NULL, 0, NULL); 185 CPDF_Stream* pData = new CPDF_Stream(NULL, 0, NULL);
187 pData->InitStream(pDsfileWrite, pDataDict); 186 pData->InitStream(pDsfileWrite, pDataDict);
188 FX_DWORD AppStreamobjnum = pPDFDocument->AddIndirectObject(pData); 187 pPDFDocument->AddIndirectObject(pData);
189 CPDF_Reference* pRef = 188 iLast = pArray->GetCount() - 2;
190 (CPDF_Reference*)pPDFDocument->GetIndirectObject(AppStreamobjnum); 189 pArray->InsertAt(iLast, CPDF_String::Create("datasets"));
191 { 190 pArray->InsertAt(iLast + 1, pData, pPDFDocument);
192 iLast = pArray->GetCount() - 2;
193 pArray->InsertAt(iLast, CPDF_String::Create("datasets"));
194 pArray->InsertAt(iLast + 1, pData, pPDFDocument);
195 }
196 } 191 }
197 fileList.Add(pDsfileWrite); 192 fileList.Add(pDsfileWrite);
198 } 193 }
199 } 194 }
200 195
201 // L"form" 196 // L"form"
202 { 197 {
203 IFX_FileStream* pfileWrite = FX_CreateMemoryStream(); 198 IFX_FileStream* pfileWrite = FX_CreateMemoryStream();
204 if (NULL == pfileWrite) { 199 if (NULL == pfileWrite) {
205 pContext->Release(); 200 pContext->Release();
206 return FALSE; 201 return FALSE;
207 } 202 }
208 if (pXFADocHandler->SavePackage(pXFADocView->GetDoc(), 203 if (pXFADocHandler->SavePackage(pXFADocView->GetDoc(),
209 CFX_WideStringC(L"form"), pfileWrite, 204 CFX_WideStringC(L"form"), pfileWrite,
210 pContext) && 205 pContext) &&
211 pfileWrite > 0) { 206 pfileWrite > 0) {
212 CPDF_Dictionary* pDataDict = new CPDF_Dictionary; 207 CPDF_Dictionary* pDataDict = new CPDF_Dictionary;
213 if (iFormIndex != -1) { 208 if (iFormIndex != -1) {
214 if (pFormStream) 209 if (pFormStream)
215 pFormStream->InitStream(pfileWrite, pDataDict); 210 pFormStream->InitStream(pfileWrite, pDataDict);
216 } else { 211 } else {
217 CPDF_Stream* pData = new CPDF_Stream(NULL, 0, NULL); 212 CPDF_Stream* pData = new CPDF_Stream(NULL, 0, NULL);
218 pData->InitStream(pfileWrite, pDataDict); 213 pData->InitStream(pfileWrite, pDataDict);
219 FX_DWORD AppStreamobjnum = pPDFDocument->AddIndirectObject(pData); 214 pPDFDocument->AddIndirectObject(pData);
220 CPDF_Reference* pRef = 215 iLast = pArray->GetCount() - 2;
221 (CPDF_Reference*)pPDFDocument->GetIndirectObject(AppStreamobjnum); 216 pArray->InsertAt(iLast, CPDF_String::Create("form"));
222 { 217 pArray->InsertAt(iLast + 1, pData, pPDFDocument);
223 iLast = pArray->GetCount() - 2;
224 pArray->InsertAt(iLast, CPDF_String::Create("form"));
225 pArray->InsertAt(iLast + 1, pData, pPDFDocument);
226 }
227 } 218 }
228 fileList.Add(pfileWrite); 219 fileList.Add(pfileWrite);
229 } 220 }
230 } 221 }
231 pContext->Release(); 222 pContext->Release();
232 #endif // PDF_ENABLE_XFA 223 #endif // PDF_ENABLE_XFA
233 224
234 return TRUE; 225 return TRUE;
235 } 226 }
236 227
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 FPDF_DWORD flags) { 327 FPDF_DWORD flags) {
337 return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0); 328 return _FPDF_Doc_Save(document, pFileWrite, flags, FALSE, 0);
338 } 329 }
339 330
340 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document, 331 DLLEXPORT FPDF_BOOL STDCALL FPDF_SaveWithVersion(FPDF_DOCUMENT document,
341 FPDF_FILEWRITE* pFileWrite, 332 FPDF_FILEWRITE* pFileWrite,
342 FPDF_DWORD flags, 333 FPDF_DWORD flags,
343 int fileVersion) { 334 int fileVersion) {
344 return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion); 335 return _FPDF_Doc_Save(document, pFileWrite, flags, TRUE, fileVersion);
345 } 336 }
OLDNEW
« no previous file with comments | « fpdfsdk/include/fsdk_baseform.h ('k') | fpdfsdk/src/fpdfxfa/fpdfxfa_page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698