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

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

Issue 1529553003: Merge to XFA: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years 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/include/fpdfapi/fpdf_module.h" 7 #include "core/include/fpdfapi/fpdf_module.h"
8 #include "core/include/fpdfapi/fpdf_page.h" 8 #include "core/include/fpdfapi/fpdf_page.h"
9 #include "core/include/fpdfapi/fpdf_serial.h" 9 #include "core/include/fpdfapi/fpdf_serial.h"
10 #include "core/src/fpdfapi/fpdf_page/pageint.h" 10 #include "core/src/fpdfapi/fpdf_page/pageint.h"
(...skipping 27 matching lines...) Expand all
38 CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict; 38 CPDF_Dictionary* pPageDict = m_pPage->m_pFormDict;
39 for (int i = 0; i < m_pageObjects.GetSize(); ++i) { 39 for (int i = 0; i < m_pageObjects.GetSize(); ++i) {
40 CPDF_PageObject* pPageObj = m_pageObjects[i]; 40 CPDF_PageObject* pPageObj = m_pageObjects[i];
41 if (!pPageObj || pPageObj->m_Type != PDFPAGE_IMAGE) { 41 if (!pPageObj || pPageObj->m_Type != PDFPAGE_IMAGE) {
42 continue; 42 continue;
43 } 43 }
44 ProcessImage(buf, (CPDF_ImageObject*)pPageObj); 44 ProcessImage(buf, (CPDF_ImageObject*)pPageObj);
45 } 45 }
46 CPDF_Object* pContent = 46 CPDF_Object* pContent =
47 pPageDict ? pPageDict->GetElementValue("Contents") : NULL; 47 pPageDict ? pPageDict->GetElementValue("Contents") : NULL;
48 if (pContent != NULL) { 48 if (pContent) {
49 pPageDict->RemoveAt("Contents"); 49 pPageDict->RemoveAt("Contents");
50 } 50 }
51 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); 51 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL);
52 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); 52 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE);
53 m_pDocument->AddIndirectObject(pStream); 53 m_pDocument->AddIndirectObject(pStream);
54 pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum()); 54 pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum());
55 } 55 }
56 CFX_ByteString CPDF_PageContentGenerate::RealizeResource( 56 CFX_ByteString CPDF_PageContentGenerate::RealizeResource(
57 CPDF_Object* pResourceObj, 57 CPDF_Object* pResourceObj,
58 const FX_CHAR* szType) { 58 const FX_CHAR* szType) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 CPDF_StreamAcc contentStream; 156 CPDF_StreamAcc contentStream;
157 contentStream.LoadAllData(pStream); 157 contentStream.LoadAllData(pStream);
158 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); 158 ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix);
159 } 159 }
160 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); 160 CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL);
161 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); 161 pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE);
162 m_pDocument->AddIndirectObject(pStream); 162 m_pDocument->AddIndirectObject(pStream);
163 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, 163 m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument,
164 pStream->GetObjNum()); 164 pStream->GetObjNum());
165 } 165 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698