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

Unified Diff: core/src/fpdfdoc/doc_formcontrol.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/fpdfdoc/doc_form.cpp ('k') | core/src/fpdfdoc/doc_formfield.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_formcontrol.cpp
diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp
index 0d2f9905d9e8009cc2ce197dfabfd2395585fcbf..fa0441cf7973d3add617f1748d6e18188bfc6057 100644
--- a/core/src/fpdfdoc/doc_formcontrol.cpp
+++ b/core/src/fpdfdoc/doc_formcontrol.cpp
@@ -20,11 +20,11 @@ CFX_ByteString CPDF_FormControl::GetOnStateName() {
GetType() == CPDF_FormField::RadioButton);
CFX_ByteString csOn;
CPDF_Dictionary* pAP = m_pWidgetDict->GetDict("AP");
- if (pAP == NULL) {
+ if (!pAP) {
return csOn;
}
CPDF_Dictionary* pN = pAP->GetDict("N");
- if (pN == NULL) {
+ if (!pN) {
return csOn;
}
FX_POSITION pos = pN->GetStartPos();
@@ -51,14 +51,14 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
m_pWidgetDict->SetAtName("AS", csValue);
}
CPDF_Dictionary* pAP = m_pWidgetDict->GetDict("AP");
- if (pAP == NULL) {
+ if (!pAP) {
return;
}
FX_POSITION pos1 = pAP->GetStartPos();
while (pos1) {
CFX_ByteString csKey1;
CPDF_Object* pObj1 = pAP->GetNextElement(pos1, csKey1);
- if (pObj1 == NULL) {
+ if (!pObj1) {
continue;
}
CPDF_Object* pObjDirect1 = pObj1->GetDirect();
@@ -70,7 +70,7 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
while (pos2) {
CFX_ByteString csKey2;
CPDF_Object* pObj2 = pSubDict->GetNextElement(pos2, csKey2);
- if (pObj2 == NULL) {
+ if (!pObj2) {
continue;
}
if (csKey2 != "Off") {
@@ -124,7 +124,7 @@ FX_BOOL CPDF_FormControl::IsDefaultChecked() {
ASSERT(GetType() == CPDF_FormField::CheckBox ||
GetType() == CPDF_FormField::RadioButton);
CPDF_Object* pDV = FPDF_GetFieldAttr(m_pField->m_pDict, "DV");
- if (pDV == NULL) {
+ if (!pDV) {
return FALSE;
}
CFX_ByteString csDV = pDV->GetString();
@@ -157,7 +157,7 @@ void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice,
return;
}
CPDF_Stream* pStream = FPDFDOC_GetAnnotAP(m_pWidgetDict, mode);
- if (pStream == NULL) {
+ if (!pStream) {
return;
}
CFX_FloatRect form_bbox = pStream->GetDict()->GetRect("BBox");
@@ -176,7 +176,7 @@ void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice,
}
const FX_CHAR* g_sHighlightingMode[] = {"N", "I", "O", "P", "T", ""};
CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() {
- if (m_pWidgetDict == NULL) {
+ if (!m_pWidgetDict) {
return Invert;
}
CFX_ByteString csH = m_pWidgetDict->GetString("H", "I");
@@ -317,10 +317,9 @@ int CPDF_FormControl::GetControlAlignment() {
return m_pWidgetDict->GetInteger("Q", 0);
}
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pField->m_pDict, "Q");
- if (pObj == NULL) {
- return m_pField->m_pForm->GetFormAlignment();
- }
- return pObj->GetInteger();
+ if (pObj)
+ return pObj->GetInteger();
+ return m_pField->m_pForm->GetFormAlignment();
}
CPDF_ApSettings::CPDF_ApSettings(CPDF_Dictionary* pDict) : m_pDict(pDict) {}
@@ -386,11 +385,11 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType,
for (int i = 0; i < 4; i++) {
fc[i] = 0;
}
- if (m_pDict == NULL) {
+ if (!m_pDict) {
return;
}
CPDF_Array* pEntry = m_pDict->GetArray(csEntry);
- if (pEntry == NULL) {
+ if (!pEntry) {
return;
}
FX_DWORD dwCount = pEntry->GetCount();
« no previous file with comments | « core/src/fpdfdoc/doc_form.cpp ('k') | core/src/fpdfdoc/doc_formfield.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698