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

Unified Diff: core/src/fpdfdoc/doc_form.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 side-by-side diff with in-line comments
Download patch
Index: core/src/fpdfdoc/doc_form.cpp
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 0201b5c85a31fe6a69c411a7a41234858b555030..0617609fc278dd30f94238f175ecf999ca1a7ab1 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -328,7 +328,7 @@ static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEXA* lpelfe,
NEWTEXTMETRICEX* lpntme,
DWORD FontType,
LPARAM lParam) {
- if (FontType != 0x004 || strchr(lpelfe->elfLogFont.lfFaceName, '@') != NULL) {
+ if (FontType != 0x004 || strchr(lpelfe->elfLogFont.lfFaceName, '@')) {
return 1;
}
LPDF_FONTDATA pData = (LPDF_FONTDATA)lParam;
@@ -355,7 +355,7 @@ static FX_BOOL RetrieveSpecificFont(uint8_t charSet,
memset(&lf, 0, sizeof(LOGFONTA));
lf.lfCharSet = charSet;
lf.lfPitchAndFamily = pitchAndFamily;
- if (pcsFontName != NULL) {
+ if (pcsFontName) {
strcpy(lf.lfFaceName, pcsFontName);
}
return RetrieveSpecificFont(lf);
@@ -421,7 +421,7 @@ CFX_ByteString CPDF_InterForm::GetNativeFont(uint8_t charSet, void* pLogFont) {
bRet = RetrieveSpecificFont(charSet, DEFAULT_PITCH | FF_DONTCARE, NULL, lf);
}
if (bRet) {
- if (pLogFont != NULL) {
+ if (pLogFont) {
memcpy(pLogFont, &lf, sizeof(LOGFONTA));
}
csFontName = lf.lfFaceName;
@@ -555,7 +555,7 @@ FX_BOOL CPDF_InterForm::ValidateFieldName(
continue;
}
if (pField == pExcludedField) {
- if (pExcludedControl != NULL) {
+ if (pExcludedControl) {
if (pField->CountControls() < 2) {
continue;
}
@@ -919,10 +919,9 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) {
}
}
FX_BOOL CPDF_InterForm::HasXFAForm() const {
- return m_pFormDict && m_pFormDict->GetArray("XFA") != NULL;
+ return m_pFormDict && m_pFormDict->GetArray("XFA");
}
void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
- ASSERT(pPage != NULL);
CPDF_Dictionary* pPageDict = pPage->m_pFormDict;
if (pPageDict == NULL) {
return;
@@ -934,7 +933,7 @@ void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
int iAnnotCount = pAnnots->GetCount();
for (int i = 0; i < iAnnotCount; i++) {
CPDF_Dictionary* pAnnot = pAnnots->GetDict(i);
- if (pAnnot != NULL && pAnnot->GetString("Subtype") == "Widget") {
+ if (pAnnot && pAnnot->GetString("Subtype") == "Widget") {
LoadField(pAnnot);
}
}
@@ -1142,7 +1141,6 @@ const struct _SupportFieldEncoding {
static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary* pFieldDict,
CFX_WideString& csValue,
CFX_ByteString& bsEncoding) {
- ASSERT(pFieldDict != NULL);
CFX_ByteString csBValue = pFieldDict->GetString("V");
int32_t iCount = sizeof(g_fieldEncoding) / sizeof(g_fieldEncoding[0]);
int32_t i = 0;
@@ -1153,7 +1151,7 @@ static void FPDFDOC_FDF_GetFieldValue(CPDF_Dictionary* pFieldDict,
if (i < iCount) {
CFX_CharMap* pCharMap =
CFX_CharMap::GetDefaultMapper(g_fieldEncoding[i].m_codePage);
- FXSYS_assert(pCharMap != NULL);
+ FXSYS_assert(pCharMap);
csValue.ConvertFrom(csBValue, pCharMap);
return;
}
@@ -1196,7 +1194,7 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
CFX_WideString csWValue;
FPDFDOC_FDF_GetFieldValue(pFieldDict, csWValue, m_bsEncoding);
int iType = pField->GetFieldType();
- if (bNotify && m_pFormNotify != NULL) {
+ if (bNotify && m_pFormNotify) {
int iRet = 0;
if (iType == FIELDTYPE_LISTBOX) {
iRet = m_pFormNotify->BeforeSelectionChange(pField, csWValue);
@@ -1218,7 +1216,7 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
pField->m_pDict->SetAt("Opt",
pFieldDict->GetElementValue("Opt")->Clone(TRUE));
}
- if (bNotify && m_pFormNotify != NULL) {
+ if (bNotify && m_pFormNotify) {
if (iType == FIELDTYPE_CHECKBOX || iType == FIELDTYPE_RADIOBUTTON) {
m_pFormNotify->AfterCheckedStatusChange(pField, statusArray);
} else if (iType == FIELDTYPE_LISTBOX) {
@@ -1245,7 +1243,7 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF,
return FALSE;
}
m_bsEncoding = pMainDict->GetString("Encoding");
- if (bNotify && m_pFormNotify != NULL) {
+ if (bNotify && m_pFormNotify) {
int iRet = m_pFormNotify->BeforeFormImportData(this);
if (iRet < 0) {
return FALSE;
@@ -1258,7 +1256,7 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF,
}
FDF_ImportField(pField, L"", bNotify);
}
- if (bNotify && m_pFormNotify != NULL) {
+ if (bNotify && m_pFormNotify) {
m_pFormNotify->AfterFormImportData(this);
}
return TRUE;

Powered by Google App Engine
This is Rietveld 408576698