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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp

Issue 361553002: Remove "this==NULL" and adjust corresponding callers (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: change tab to spaces Created 6 years, 5 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/fpdfapi/fpdf_parser.h" 7 #include "../../../include/fpdfapi/fpdf_parser.h"
8 #include "../../../include/fpdfapi/fpdf_module.h" 8 #include "../../../include/fpdfapi/fpdf_module.h"
9 extern FX_LPVOID PDFPreviewInitCache(CPDF_Document* pDoc); 9 extern FX_LPVOID PDFPreviewInitCache(CPDF_Document* pDoc);
10 extern void PDFPreviewClearCache(FX_LPVOID pCache); 10 extern void PDFPreviewClearCache(FX_LPVOID pCache);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 if (pIDArray) { 54 if (pIDArray) {
55 m_ID1 = pIDArray->GetString(0); 55 m_ID1 = pIDArray->GetString(0);
56 m_ID2 = pIDArray->GetString(1); 56 m_ID2 = pIDArray->GetString(1);
57 } 57 }
58 m_PageList.SetSize(_GetPageCount()); 58 m_PageList.SetSize(_GetPageCount());
59 } 59 }
60 void CPDF_Document::LoadAsynDoc(CPDF_Dictionary *pLinearized) 60 void CPDF_Document::LoadAsynDoc(CPDF_Dictionary *pLinearized)
61 { 61 {
62 m_bLinearized = TRUE; 62 m_bLinearized = TRUE;
63 m_LastObjNum = m_pParser->GetLastObjNum(); 63 m_LastObjNum = m_pParser->GetLastObjNum();
64 m_pRootDict = GetIndirectObject(m_pParser->GetRootObjNum())->GetDict(); 64 CPDF_Object* indirectObj = GetIndirectObject(m_pParser->GetRootObjNum());
65 m_pRootDict = indirectObj ? indirectObj->GetDict() : NULL;
65 if (m_pRootDict == NULL) { 66 if (m_pRootDict == NULL) {
66 return; 67 return;
67 } 68 }
68 m_pInfoDict = GetIndirectObject(m_pParser->GetInfoObjNum())->GetDict(); 69 indirectObj = GetIndirectObject(m_pParser->GetInfoObjNum());
70 m_pInfoDict = indirectObj ? indirectObj->GetDict() : NULL;
69 CPDF_Array* pIDArray = m_pParser->GetIDArray(); 71 CPDF_Array* pIDArray = m_pParser->GetIDArray();
70 if (pIDArray) { 72 if (pIDArray) {
71 m_ID1 = pIDArray->GetString(0); 73 m_ID1 = pIDArray->GetString(0);
72 m_ID2 = pIDArray->GetString(1); 74 m_ID2 = pIDArray->GetString(1);
73 } 75 }
74 FX_DWORD dwPageCount = 0; 76 FX_DWORD dwPageCount = 0;
75 CPDF_Object *pCount = pLinearized->GetElement(FX_BSTRC("N")); 77 CPDF_Object *pCount = pLinearized->GetElement(FX_BSTRC("N"));
76 if (pCount && pCount->GetType() == PDFOBJ_NUMBER) { 78 if (pCount && pCount->GetType() == PDFOBJ_NUMBER) {
77 dwPageCount = pCount->GetInteger(); 79 dwPageCount = pCount->GetInteger();
78 } 80 }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 } 331 }
330 _EnumPages(pPages, pHandler); 332 _EnumPages(pPages, pHandler);
331 } 333 }
332 FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary* pThisPageDict) 334 FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum, CPDF_Dictionary* pThisPageDict)
333 { 335 {
334 for (int i = 0; i < m_PageList.GetSize(); i ++) { 336 for (int i = 0; i < m_PageList.GetSize(); i ++) {
335 CPDF_Dictionary* pPageDict = GetPage(i); 337 CPDF_Dictionary* pPageDict = GetPage(i);
336 if (pPageDict == pThisPageDict) { 338 if (pPageDict == pThisPageDict) {
337 continue; 339 continue;
338 } 340 }
339 CPDF_Object* pContents = pPageDict->GetElement(FX_BSTRC("Contents")); 341 CPDF_Object* pContents = pPageDict ? pPageDict->GetElement(FX_BSTRC("Con tents")) : NULL;
340 if (pContents == NULL) { 342 if (pContents == NULL) {
341 continue; 343 continue;
342 } 344 }
343 if (pContents->GetDirectType() == PDFOBJ_ARRAY) { 345 if (pContents->GetDirectType() == PDFOBJ_ARRAY) {
344 CPDF_Array* pArray = (CPDF_Array*)pContents->GetDirect(); 346 CPDF_Array* pArray = (CPDF_Array*)pContents->GetDirect();
345 for (FX_DWORD j = 0; j < pArray->GetCount(); j ++) { 347 for (FX_DWORD j = 0; j < pArray->GetCount(); j ++) {
346 CPDF_Reference* pRef = (CPDF_Reference*)pArray->GetElement(j); 348 CPDF_Reference* pRef = (CPDF_Reference*)pArray->GetElement(j);
347 if (pRef->GetRefObjNum() == objnum) { 349 if (pRef->GetRefObjNum() == objnum) {
348 return TRUE; 350 return TRUE;
349 } 351 }
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 if (m_pDocPage) { 391 if (m_pDocPage) {
390 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this); 392 CPDF_ModuleMgr::Get()->GetPageModule()->ClearDoc(this);
391 } 393 }
392 } 394 }
393 void CPDF_Document::ClearRenderData() 395 void CPDF_Document::ClearRenderData()
394 { 396 {
395 if (m_pDocRender) { 397 if (m_pDocRender) {
396 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender); 398 CPDF_ModuleMgr::Get()->GetRenderModule()->ClearDocData(m_pDocRender);
397 } 399 }
398 } 400 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698