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

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

Issue 1383933003: XFA: Remove checks for new returning NULL in fpdfsdk. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: rebase 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
« no previous file with comments | « fpdfsdk/src/fpdf_dataavail.cpp ('k') | fpdfsdk/src/fpdfeditpage.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_flatten.h" 7 #include "../../public/fpdf_flatten.h"
8 #include "../include/fsdk_define.h" 8 #include "../include/fsdk_define.h"
9 #include "../include/fpdfxfa/fpdfxfa_doc.h" 9 #include "../include/fpdfxfa/fpdfxfa_doc.h"
10 #include "../include/fpdfxfa/fpdfxfa_page.h" 10 #include "../include/fpdfxfa/fpdfxfa_page.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 CPDF_Document* pDocument) { 190 CPDF_Document* pDocument) {
191 CPDF_Object* pContentsObj = pPage->GetStream("Contents"); 191 CPDF_Object* pContentsObj = pPage->GetStream("Contents");
192 if (!pContentsObj) { 192 if (!pContentsObj) {
193 pContentsObj = pPage->GetArray("Contents"); 193 pContentsObj = pPage->GetArray("Contents");
194 } 194 }
195 195
196 if (!pContentsObj) { 196 if (!pContentsObj) {
197 // Create a new contents dictionary 197 // Create a new contents dictionary
198 if (!key.IsEmpty()) { 198 if (!key.IsEmpty()) {
199 CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, new CPDF_Dictionary); 199 CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, new CPDF_Dictionary);
200 if (!pNewContents)
201 return;
202 pPage->SetAtReference("Contents", pDocument, 200 pPage->SetAtReference("Contents", pDocument,
203 pDocument->AddIndirectObject(pNewContents)); 201 pDocument->AddIndirectObject(pNewContents));
204 202
205 CFX_ByteString sStream; 203 CFX_ByteString sStream;
206 sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str()); 204 sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str());
207 pNewContents->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, 205 pNewContents->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE,
208 FALSE); 206 FALSE);
209 } 207 }
210 return; 208 return;
211 } 209 }
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE, 525 pNewXObject->SetData((const uint8_t*)sStream, sStream.GetLength(), FALSE,
528 FALSE); 526 FALSE);
529 } 527 }
530 pPageDict->RemoveAt("Annots"); 528 pPageDict->RemoveAt("Annots");
531 529
532 ObjectArray.RemoveAll(); 530 ObjectArray.RemoveAll();
533 RectArray.RemoveAll(); 531 RectArray.RemoveAll();
534 532
535 return FLATTEN_SUCCESS; 533 return FLATTEN_SUCCESS;
536 } 534 }
OLDNEW
« no previous file with comments | « fpdfsdk/src/fpdf_dataavail.cpp ('k') | fpdfsdk/src/fpdfeditpage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698