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

Side by Side Diff: core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp

Issue 1520063002: Get rid of most instance of 'foo == NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@bstr_isnull
Patch Set: rebase 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 "pageint.h" 7 #include "pageint.h"
8 8
9 #include "core/include/fpdfapi/fpdf_module.h" 9 #include "core/include/fpdfapi/fpdf_module.h"
10 #include "core/include/fpdfapi/fpdf_page.h" 10 #include "core/include/fpdfapi/fpdf_page.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 rect.Intersect(path_rect); 96 rect.Intersect(path_rect);
97 } 97 }
98 bStarted = TRUE; 98 bStarted = TRUE;
99 } 99 }
100 count = GetTextCount(); 100 count = GetTextCount();
101 if (count) { 101 if (count) {
102 CPDF_Rect layer_rect; 102 CPDF_Rect layer_rect;
103 FX_BOOL bLayerStarted = FALSE; 103 FX_BOOL bLayerStarted = FALSE;
104 for (int i = 0; i < count; i++) { 104 for (int i = 0; i < count; i++) {
105 CPDF_TextObject* pTextObj = GetText(i); 105 CPDF_TextObject* pTextObj = GetText(i);
106 if (pTextObj == NULL) { 106 if (!pTextObj) {
107 if (!bStarted) { 107 if (!bStarted) {
108 rect = layer_rect; 108 rect = layer_rect;
109 bStarted = TRUE; 109 bStarted = TRUE;
110 } else { 110 } else {
111 rect.Intersect(layer_rect); 111 rect.Intersect(layer_rect);
112 } 112 }
113 bLayerStarted = FALSE; 113 bLayerStarted = FALSE;
114 } else { 114 } else {
115 if (!bLayerStarted) { 115 if (!bLayerStarted) {
116 layer_rect = pTextObj->GetBBox(NULL); 116 layer_rect = pTextObj->GetBBox(NULL);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 } 630 }
631 } 631 }
632 } 632 }
633 return -1; 633 return -1;
634 } 634 }
635 void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name, 635 void CPDF_ContentMarkData::AddMark(const CFX_ByteString& name,
636 CPDF_Dictionary* pDict, 636 CPDF_Dictionary* pDict,
637 FX_BOOL bDirect) { 637 FX_BOOL bDirect) {
638 CPDF_ContentMarkItem& item = m_Marks.Add(); 638 CPDF_ContentMarkItem& item = m_Marks.Add();
639 item.SetName(name); 639 item.SetName(name);
640 if (pDict == NULL) { 640 if (!pDict) {
641 return; 641 return;
642 } 642 }
643 item.SetParam(bDirect ? CPDF_ContentMarkItem::DirectDict 643 item.SetParam(bDirect ? CPDF_ContentMarkItem::DirectDict
644 : CPDF_ContentMarkItem::PropertiesDict, 644 : CPDF_ContentMarkItem::PropertiesDict,
645 bDirect ? pDict->Clone() : pDict); 645 bDirect ? pDict->Clone() : pDict);
646 } 646 }
647 void CPDF_ContentMarkData::DeleteLastMark() { 647 void CPDF_ContentMarkData::DeleteLastMark() {
648 int size = m_Marks.GetSize(); 648 int size = m_Marks.GetSize();
649 if (size == 0) { 649 if (size == 0) {
650 return; 650 return;
651 } 651 }
652 m_Marks.RemoveAt(size - 1); 652 m_Marks.RemoveAt(size - 1);
653 } 653 }
654 FX_BOOL CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const { 654 FX_BOOL CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const {
655 if (m_pObject == NULL) { 655 if (!m_pObject) {
656 return FALSE; 656 return FALSE;
657 } 657 }
658 for (int i = 0; i < m_pObject->CountItems(); i++) { 658 for (int i = 0; i < m_pObject->CountItems(); i++) {
659 CPDF_ContentMarkItem& item = m_pObject->GetItem(i); 659 CPDF_ContentMarkItem& item = m_pObject->GetItem(i);
660 if (item.GetName() == mark) { 660 if (item.GetName() == mark) {
661 return TRUE; 661 return TRUE;
662 } 662 }
663 } 663 }
664 return FALSE; 664 return FALSE;
665 } 665 }
666 FX_BOOL CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark, 666 FX_BOOL CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark,
667 CPDF_Dictionary*& pDict) const { 667 CPDF_Dictionary*& pDict) const {
668 if (m_pObject == NULL) { 668 if (!m_pObject) {
669 return FALSE; 669 return FALSE;
670 } 670 }
671 for (int i = 0; i < m_pObject->CountItems(); i++) { 671 for (int i = 0; i < m_pObject->CountItems(); i++) {
672 CPDF_ContentMarkItem& item = m_pObject->GetItem(i); 672 CPDF_ContentMarkItem& item = m_pObject->GetItem(i);
673 if (item.GetName() == mark) { 673 if (item.GetName() == mark) {
674 pDict = NULL; 674 pDict = NULL;
675 if (item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict || 675 if (item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict ||
676 item.GetParamType() == CPDF_ContentMarkItem::DirectDict) { 676 item.GetParamType() == CPDF_ContentMarkItem::DirectDict) {
677 pDict = ToDictionary(static_cast<CPDF_Object*>(item.GetParam())); 677 pDict = ToDictionary(static_cast<CPDF_Object*>(item.GetParam()));
678 } 678 }
679 return TRUE; 679 return TRUE;
680 } 680 }
681 } 681 }
682 return FALSE; 682 return FALSE;
683 } 683 }
OLDNEW
« no previous file with comments | « core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698