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

Unified Diff: core/src/fpdfapi/fpdf_page/fpdf_page.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/src/fpdfapi/fpdf_font/ttgsubtable.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfapi/fpdf_page/fpdf_page.cpp
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index f37dd770ca3dd356b74eda500dc6d88bc02086be..1fef74b99b35a8ce21bfca73584120813a822ba0 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -689,7 +689,7 @@ CPDF_PageObjects::~CPDF_PageObjects() {
}
}
void CPDF_PageObjects::ContinueParse(IFX_Pause* pPause) {
- if (m_pParser == NULL) {
+ if (!m_pParser) {
return;
}
m_pParser->Continue(pPause);
@@ -720,10 +720,7 @@ int CPDF_PageObjects::GetObjectIndex(CPDF_PageObject* pObj) const {
}
CPDF_PageObject* CPDF_PageObjects::GetObjectByIndex(int index) const {
FX_POSITION pos = m_ObjectList.FindIndex(index);
- if (pos == NULL) {
- return NULL;
- }
- return (CPDF_PageObject*)m_ObjectList.GetAt(pos);
+ return pos ? static_cast<CPDF_PageObject*>(m_ObjectList.GetAt(pos)) : nullptr;
}
void CPDF_PageObjects::Transform(const CFX_Matrix& matrix) {
FX_POSITION pos = m_ObjectList.GetHeadPosition();
@@ -758,11 +755,11 @@ CFX_FloatRect CPDF_PageObjects::CalcBoundingBox() const {
return CFX_FloatRect(left, bottom, right, top);
}
void CPDF_PageObjects::LoadTransInfo() {
- if (m_pFormDict == NULL) {
+ if (!m_pFormDict) {
return;
}
CPDF_Dictionary* pGroup = m_pFormDict->GetDict("Group");
- if (pGroup == NULL) {
+ if (!pGroup) {
return;
}
if (pGroup->GetString("S") != "Transparency") {
@@ -800,7 +797,7 @@ void CPDF_Page::Load(CPDF_Document* pDocument,
m_pPageRender =
CPDF_ModuleMgr::Get()->GetRenderModule()->CreatePageCache(this);
}
- if (pPageDict == NULL) {
+ if (!pPageDict) {
m_PageWidth = m_PageHeight = 100 * 1.0f;
m_pPageResources = m_pResources = NULL;
return;
@@ -912,10 +909,10 @@ CPDF_Form::CPDF_Form(CPDF_Document* pDoc,
m_pFormDict = pFormStream ? pFormStream->GetDict() : NULL;
m_pResources = m_pFormDict->GetDict("Resources");
m_pPageResources = pPageResources;
- if (m_pResources == NULL) {
+ if (!m_pResources) {
m_pResources = pParentResources;
}
- if (m_pResources == NULL) {
+ if (!m_pResources) {
m_pResources = pPageResources;
}
m_Transparency = 0;
« no previous file with comments | « core/src/fpdfapi/fpdf_font/ttgsubtable.cpp ('k') | core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698