summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r--core/src/fpdfdoc/doc_action.cpp17
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp2
-rw-r--r--core/src/fpdfdoc/doc_ap.cpp2
-rw-r--r--core/src/fpdfdoc/doc_basic.cpp12
-rw-r--r--core/src/fpdfdoc/doc_form.cpp24
-rw-r--r--core/src/fpdfdoc/doc_formfield.cpp58
-rw-r--r--core/src/fpdfdoc/doc_ocg.cpp6
-rw-r--r--core/src/fpdfdoc/doc_utils.cpp16
-rw-r--r--core/src/fpdfdoc/doc_vt.cpp34
9 files changed, 77 insertions, 94 deletions
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp
index 3ad746067d..87cfe7e642 100644
--- a/core/src/fpdfdoc/doc_action.cpp
+++ b/core/src/fpdfdoc/doc_action.cpp
@@ -34,7 +34,7 @@ const FX_CHAR* g_sATypes[] = {
"SetOCGState", "Rendition", "Trans", "GoTo3DView", ""};
CPDF_Action::ActionType CPDF_Action::GetType() const {
ActionType eType = Unknown;
- if (m_pDict != NULL) {
+ if (m_pDict) {
CFX_ByteString csType = m_pDict->GetString("S");
if (!csType.IsEmpty()) {
int i = 0;
@@ -80,7 +80,7 @@ CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const {
csURI = m_pDict->GetString("URI");
CPDF_Dictionary* pRoot = pDoc->GetRoot();
CPDF_Dictionary* pURI = pRoot->GetDict("URI");
- if (pURI != NULL) {
+ if (pURI) {
if (csURI.Find(":", 0) < 1) {
csURI = pURI->GetString("Base") + csURI;
}
@@ -179,10 +179,7 @@ CFX_WideString CPDF_Action::GetJavaScript() const {
return csJS;
}
CPDF_Object* pJS = m_pDict->GetElementValue("JS");
- if (pJS != NULL) {
- return pJS->GetUnicodeText();
- }
- return csJS;
+ return pJS ? pJS->GetUnicodeText() : csJS;
}
CPDF_Dictionary* CPDF_Action::GetAnnot() const {
if (!m_pDict) {
@@ -298,13 +295,13 @@ CPDF_Action CPDF_AAction::GetNextAction(FX_POSITION& pos,
CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
int CPDF_DocJSActions::CountJSActions() const {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument, "JavaScript");
return name_tree.GetCount();
}
CPDF_Action CPDF_DocJSActions::GetJSAction(int index,
CFX_ByteString& csName) const {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument, "JavaScript");
CPDF_Object* pAction = name_tree.LookupValue(index, csName);
if (!ToDictionary(pAction)) {
@@ -313,7 +310,7 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(int index,
return CPDF_Action(pAction->GetDict());
}
CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument, "JavaScript");
CPDF_Object* pAction = name_tree.LookupValue(csName);
if (!ToDictionary(pAction)) {
@@ -322,7 +319,7 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const {
return CPDF_Action(pAction->GetDict());
}
int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
CPDF_NameTree name_tree(m_pDocument, "JavaScript");
return name_tree.GetIndex(csName);
}
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index cacd650dde..0871b357cf 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -304,7 +304,7 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
}
CPDF_Array* pColor = m_pAnnotDict->GetArray("C");
FX_DWORD argb = 0xff000000;
- if (pColor != NULL) {
+ if (pColor) {
int R = (int32_t)(pColor->GetNumber(0) * 255);
int G = (int32_t)(pColor->GetNumber(1) * 255);
int B = (int32_t)(pColor->GetNumber(2) * 255);
diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp
index effe587090..1392ae6e2e 100644
--- a/core/src/fpdfdoc/doc_ap.cpp
+++ b/core/src/fpdfdoc/doc_ap.cpp
@@ -123,7 +123,7 @@ CFX_ByteString CPVT_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
return "";
}
CPVT_Provider::CPVT_Provider(IPVT_FontMap* pFontMap) : m_pFontMap(pFontMap) {
- ASSERT(m_pFontMap != NULL);
+ ASSERT(m_pFontMap);
}
CPVT_Provider::~CPVT_Provider() {}
int32_t CPVT_Provider::GetCharWidth(int32_t nFontIndex,
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp
index 904ccf7c1f..c58e10b779 100644
--- a/core/src/fpdfdoc/doc_basic.cpp
+++ b/core/src/fpdfdoc/doc_basic.cpp
@@ -77,7 +77,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
return NULL;
}
CPDF_Array* pLimits = pNode->GetArray("Limits");
- if (pLimits != NULL) {
+ if (pLimits) {
CFX_ByteString csLeft = pLimits->GetString(0);
CFX_ByteString csRight = pLimits->GetString(1);
if (csLeft.Compare(csRight) > 0) {
@@ -96,7 +96,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
CFX_ByteString csValue = pNames->GetString(i * 2);
int32_t iCompare = csValue.Compare(csName);
if (iCompare <= 0) {
- if (ppFind != NULL) {
+ if (ppFind) {
*ppFind = pNames;
}
if (iCompare < 0) {
@@ -144,7 +144,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
nCurIndex += nCount;
return NULL;
}
- if (ppFind != NULL) {
+ if (ppFind) {
*ppFind = pNames;
}
csName = pNames->GetString((nIndex - nCurIndex) * 2);
@@ -389,7 +389,6 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const {
static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj,
const CFX_WideStringC& wsFileName,
FX_BOOL bURL) {
- ASSERT(pObj != NULL);
CFX_WideString wsStr;
if (bURL) {
wsStr = wsFileName;
@@ -405,7 +404,6 @@ static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj,
}
void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName,
FX_BOOL bURL) {
- ASSERT(m_pObj != NULL);
if (bURL) {
if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
pDict->SetAtName("FS", "URL");
@@ -483,12 +481,12 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
int n = nPage;
while (n >= 0) {
pValue = numberTree.LookupValue(n);
- if (pValue != NULL) {
+ if (pValue) {
break;
}
n--;
}
- if (pValue != NULL) {
+ if (pValue) {
pValue = pValue->GetDirect();
if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) {
if (pLabel->KeyExist("P")) {
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 26857dd2af..80938f47c0 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);
@@ -406,7 +406,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;
@@ -540,7 +540,7 @@ FX_BOOL CPDF_InterForm::ValidateFieldName(
continue;
}
if (pField == pExcludedField) {
- if (pExcludedControl != NULL) {
+ if (pExcludedControl) {
if (pField->CountControls() < 2) {
continue;
}
@@ -904,10 +904,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;
@@ -919,7 +918,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);
}
}
@@ -1127,7 +1126,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;
@@ -1138,7 +1136,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;
}
@@ -1181,7 +1179,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);
@@ -1203,7 +1201,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) {
@@ -1230,7 +1228,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;
@@ -1243,7 +1241,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;
diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp
index e840665385..767b31b1d5 100644
--- a/core/src/fpdfdoc/doc_formfield.cpp
+++ b/core/src/fpdfdoc/doc_formfield.cpp
@@ -103,7 +103,7 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
case CPDF_FormField::CheckBox:
case CPDF_FormField::RadioButton: {
CFX_ByteArray statusArray;
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
SaveCheckedFieldStatus(this, statusArray);
}
int iCount = CountControls();
@@ -120,7 +120,7 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
}
}
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this, statusArray);
}
} break;
@@ -131,14 +131,14 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
if (iIndex >= 0) {
csValue = GetOptionLabel(iIndex);
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
if (iRet < 0) {
return FALSE;
}
}
SetItemSelection(iIndex, TRUE);
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterValueChange(this);
}
} break;
@@ -149,14 +149,14 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
if (iIndex >= 0) {
csValue = GetOptionLabel(iIndex);
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
int iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
if (iRet < 0) {
return FALSE;
}
}
SetItemSelection(iIndex, TRUE);
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterSelectionChange(this);
}
} break;
@@ -166,19 +166,19 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
default: {
CPDF_Object* pDV = FPDF_GetFieldAttr(m_pDict, "DV");
CFX_WideString csDValue;
- if (pDV != NULL) {
+ if (pDV) {
csDValue = pDV->GetUnicodeText();
}
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict, "V");
CFX_WideString csValue;
- if (pV != NULL) {
+ if (pV) {
csValue = pV->GetUnicodeText();
}
CPDF_Object* pRV = FPDF_GetFieldAttr(m_pDict, "RV");
if (!pRV && (csDValue == csValue)) {
return FALSE;
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csDValue);
if (iRet < 0) {
return FALSE;
@@ -198,7 +198,7 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
m_pDict->SetAt("RV", pCloneR);
}
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterValueChange(this);
}
m_pForm->m_bUpdated = TRUE;
@@ -331,7 +331,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
case Text:
case ComboBox: {
CFX_WideString csValue = value;
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
int iRet = m_pForm->m_pFormNotify->BeforeValueChange(this, csValue);
if (iRet < 0) {
return FALSE;
@@ -353,7 +353,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
SetItemSelection(iIndex, TRUE);
}
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterValueChange(this);
}
m_pForm->m_bUpdated = TRUE;
@@ -366,7 +366,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
if (bDefault && iIndex == GetDefaultSelectedItem()) {
return FALSE;
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
CFX_WideString csValue = value;
int iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, csValue);
if (iRet < 0) {
@@ -378,7 +378,7 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value,
ClearSelection();
SetItemSelection(iIndex, TRUE);
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterSelectionChange(this);
}
m_pForm->m_bUpdated = TRUE;
@@ -464,7 +464,7 @@ int CPDF_FormField::GetSelectedIndex(int index) {
return -1;
}
FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify) {
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
int iRet = 0;
CFX_WideString csValue;
int iIndex = GetSelectedIndex(0);
@@ -483,7 +483,7 @@ FX_BOOL CPDF_FormField::ClearSelection(FX_BOOL bNotify) {
}
m_pDict->RemoveAt("V");
m_pDict->RemoveAt("I");
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
if (GetType() == ListBox) {
m_pForm->m_pFormNotify->AfterSelectionChange(this);
}
@@ -549,7 +549,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
return FALSE;
}
CFX_WideString opt_value = GetOptionValue(index);
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
int iRet = 0;
if (GetType() == ListBox) {
iRet = m_pForm->m_pFormNotify->BeforeSelectionChange(this, opt_value);
@@ -563,7 +563,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
}
if (!bSelected) {
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
- if (pValue != NULL) {
+ if (pValue) {
if (m_Type == ListBox) {
SelectOption(index, FALSE);
if (pValue->IsString()) {
@@ -627,7 +627,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
m_pDict->SetAt("I", pI);
}
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
if (GetType() == ListBox) {
m_pForm->m_pFormNotify->AfterSelectionChange(this);
}
@@ -745,7 +745,7 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
return FALSE;
}
CFX_ByteArray statusArray;
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
SaveCheckedFieldStatus(this, statusArray);
}
CFX_WideString csWExport = pControl->GetExportValue();
@@ -780,7 +780,7 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
} else {
CFX_ByteString csV;
CPDF_Object* pV = FPDF_GetFieldAttr(m_pDict, "V");
- if (pV != NULL) {
+ if (pV) {
csV = pV->GetString();
}
if (csV == csBExport) {
@@ -792,7 +792,7 @@ FX_BOOL CPDF_FormField::CheckControl(int iControlIndex,
csIndex.Format("%d", iControlIndex);
m_pDict->SetAtName("V", csIndex);
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this, statusArray);
}
m_pForm->m_bUpdated = TRUE;
@@ -822,7 +822,7 @@ FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value,
FX_BOOL bNotify) {
ASSERT(GetType() == CheckBox || GetType() == RadioButton);
CFX_ByteArray statusArray;
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
SaveCheckedFieldStatus(this, statusArray);
}
int iCount = CountControls();
@@ -842,7 +842,7 @@ FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value,
}
}
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
m_pForm->m_pFormNotify->AfterCheckedStatusChange(this, statusArray);
}
m_pForm->m_bUpdated = TRUE;
@@ -919,7 +919,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
if (bSelected) {
return TRUE;
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
int iRet = 0;
CFX_WideString csValue = GetOptionLabel(iOptIndex);
if (GetType() == ListBox) {
@@ -939,7 +939,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
if (!bSelected) {
continue;
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
int iRet = 0;
CFX_WideString csValue = GetOptionLabel(iOptIndex);
if (GetType() == ListBox) {
@@ -969,7 +969,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
m_pDict->RemoveAt("I");
}
}
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
if (GetType() == ListBox) {
m_pForm->m_pFormNotify->AfterSelectionChange(this);
}
@@ -981,7 +981,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
return TRUE;
}
FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify) {
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
int iRet = 0;
CFX_WideString csValue;
int iIndex = GetSelectedIndex(0);
@@ -999,7 +999,7 @@ FX_BOOL CPDF_FormField::ClearSelectedOptions(FX_BOOL bNotify) {
}
}
m_pDict->RemoveAt("I");
- if (bNotify && m_pForm->m_pFormNotify != NULL) {
+ if (bNotify && m_pForm->m_pFormNotify) {
if (GetType() == ListBox) {
m_pForm->m_pFormNotify->AfterSelectionChange(this);
}
diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp
index 4e0e1c5a31..cfca121d36 100644
--- a/core/src/fpdfdoc/doc_ocg.cpp
+++ b/core/src/fpdfdoc/doc_ocg.cpp
@@ -24,7 +24,6 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject,
static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary* pDict,
const CFX_ByteStringC& csElement,
const CFX_ByteStringC& csDef = "") {
- FXSYS_assert(pDict != NULL);
CPDF_Object* pIntent = pDict->GetElementValue("Intent");
if (pIntent == NULL) {
return csElement == csDef;
@@ -89,7 +88,7 @@ static CFX_ByteString FPDFDOC_OCG_GetUsageTypeString(
return csState;
}
CPDF_OCContext::CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType) {
- FXSYS_assert(pDoc != NULL);
+ FXSYS_assert(pDoc);
m_pDocument = pDoc;
m_eUsageType = eUsageType;
}
@@ -235,9 +234,8 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
}
FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict,
FX_BOOL bFromConfig) {
- FXSYS_assert(pOCMDDict != NULL);
CPDF_Array* pVE = pOCMDDict->GetArray("VE");
- if (pVE != NULL) {
+ if (pVE) {
return GetOCGVE(pVE, bFromConfig);
}
CFX_ByteString csP = pOCMDDict->GetString("P", "AnyOn");
diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp
index adf523f74e..f26355fae5 100644
--- a/core/src/fpdfdoc/doc_utils.cpp
+++ b/core/src/fpdfdoc/doc_utils.cpp
@@ -242,7 +242,7 @@ void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
CFX_ByteString csBaseName, csDefault;
uint8_t charSet = CPDF_InterForm::GetNativeCharSet();
pFont = CPDF_InterForm::AddStandardFont(pDocument, "Helvetica");
- if (pFont != NULL) {
+ if (pFont) {
AddInterFormFont(pFormDict, pDocument, pFont, csBaseName);
csDefault = csBaseName;
}
@@ -250,14 +250,14 @@ void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) {
CFX_ByteString csFontName = CPDF_InterForm::GetNativeFont(charSet, NULL);
if (pFont == NULL || csFontName != "Helvetica") {
pFont = CPDF_InterForm::AddNativeFont(pDocument);
- if (pFont != NULL) {
+ if (pFont) {
csBaseName = "";
AddInterFormFont(pFormDict, pDocument, pFont, csBaseName);
csDefault = csBaseName;
}
}
}
- if (pFont != NULL) {
+ if (pFont) {
csDA = "/" + PDF_NameEncode(csDefault) + " 0 Tf";
}
}
@@ -452,9 +452,9 @@ CPDF_Font* GetNativeInterFormFont(CPDF_Dictionary* pFormDict,
uint8_t charSet = CPDF_InterForm::GetNativeCharSet();
CFX_SubstFont* pSubst;
CPDF_Font* pFont = GetDefaultInterFormFont(pFormDict, pDocument);
- if (pFont != NULL) {
+ if (pFont) {
pSubst = (CFX_SubstFont*)pFont->GetSubstFont();
- if (pSubst != NULL && pSubst->m_Charset == (int)charSet) {
+ if (pSubst && pSubst->m_Charset == (int)charSet) {
FindInterFormFont(pFormDict, pFont, csNameTag);
return pFont;
}
@@ -592,7 +592,7 @@ CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
CFX_ByteString csTemp;
CPDF_Font* pFont =
GetNativeInterFormFont(pFormDict, pDocument, charSet, csTemp);
- if (pFont != NULL) {
+ if (pFont) {
csNameTag = csTemp;
return pFont;
}
@@ -603,7 +603,7 @@ CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
}
}
pFont = CPDF_InterForm::AddNativeFont(charSet, pDocument);
- if (pFont != NULL) {
+ if (pFont) {
AddInterFormFont(pFormDict, pDocument, pFont, csNameTag);
}
return pFont;
@@ -679,7 +679,7 @@ void CPDF_IconFit::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) {
return;
}
CPDF_Array* pA = m_pDict->GetArray("A");
- if (pA != NULL) {
+ if (pA) {
FX_DWORD dwCount = pA->GetCount();
if (dwCount > 0) {
fLeft = pA->GetNumber(0);
diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp
index 07824e8f04..8df687ed59 100644
--- a/core/src/fpdfdoc/doc_vt.cpp
+++ b/core/src/fpdfdoc/doc_vt.cpp
@@ -84,7 +84,6 @@ CPVT_WordPlace CSection::AddLine(const CPVT_LineInfo& lineinfo) {
return CPVT_WordPlace(SecPlace.nSecIndex, m_LineArray.Add(lineinfo), -1);
}
CPVT_FloatRect CSection::Rearrange() {
- ASSERT(m_pVT != NULL);
if (m_pVT->m_nCharArray > 0) {
return CTypeset(this).CharArray();
}
@@ -166,7 +165,7 @@ void CSection::UpdateWordPlace(CPVT_WordPlace& place) const {
}
}
CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point& point) const {
- ASSERT(m_pVT != NULL);
+ ASSERT(m_pVT);
CPVT_WordPlace place = GetBeginWordPlace();
FX_BOOL bUp = TRUE;
FX_BOOL bDown = TRUE;
@@ -306,8 +305,7 @@ CTypeset::CTypeset(CSection* pSection)
m_pSection(pSection) {}
CTypeset::~CTypeset() {}
CPVT_FloatRect CTypeset::CharArray() {
- ASSERT(m_pSection != NULL);
- ASSERT(m_pVT != NULL);
+ ASSERT(m_pSection);
FX_FLOAT fLineAscent =
m_pVT->GetFontAscent(m_pVT->GetDefaultFontIndex(), m_pVT->GetFontSize());
FX_FLOAT fLineDescent =
@@ -382,14 +380,13 @@ CPVT_FloatRect CTypeset::CharArray() {
return m_rcRet = CPVT_FloatRect(0, 0, x, y);
}
CPVT_Size CTypeset::GetEditSize(FX_FLOAT fFontSize) {
- ASSERT(m_pSection != NULL);
- ASSERT(m_pVT != NULL);
+ ASSERT(m_pSection);
+ ASSERT(m_pVT);
SplitLines(FALSE, fFontSize);
return CPVT_Size(m_rcRet.Width(), m_rcRet.Height());
}
CPVT_FloatRect CTypeset::Typeset() {
- ASSERT(m_pSection != NULL);
- ASSERT(m_pVT != NULL);
+ ASSERT(m_pVT);
m_pSection->m_LineArray.Empty();
SplitLines(TRUE, 0.0f);
m_pSection->m_LineArray.Clear();
@@ -571,8 +568,8 @@ static FX_BOOL NeedDivision(FX_WORD prevWord, FX_WORD curWord) {
return FALSE;
}
void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) {
- ASSERT(m_pVT != NULL);
- ASSERT(m_pSection != NULL);
+ ASSERT(m_pVT);
+ ASSERT(m_pSection);
int32_t nLineHead = 0;
int32_t nLineTail = 0;
FX_FLOAT fMaxX = 0.0f, fMaxY = 0.0f;
@@ -619,7 +616,7 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) {
if (IsOpenStylePunctuation(pWord->Word)) {
bOpened = TRUE;
bFullWord = TRUE;
- } else if (pOldWord != NULL) {
+ } else if (pOldWord) {
if (NeedDivision(pOldWord->Word, pWord->Word)) {
bFullWord = TRUE;
}
@@ -718,8 +715,8 @@ void CTypeset::SplitLines(FX_BOOL bTypeset, FX_FLOAT fFontSize) {
m_rcRet = CPVT_FloatRect(0, 0, fMaxX, fMaxY);
}
void CTypeset::OutputLines() {
- ASSERT(m_pVT != NULL);
- ASSERT(m_pSection != NULL);
+ ASSERT(m_pVT);
+ ASSERT(m_pSection);
FX_FLOAT fMinX = 0.0f, fMinY = 0.0f, fMaxX = 0.0f, fMaxY = 0.0f;
FX_FLOAT fPosX = 0.0f, fPosY = 0.0f;
FX_FLOAT fLineIndent = m_pVT->GetLineIndent(m_pSection->m_SecInfo);
@@ -1677,11 +1674,10 @@ CPDF_VariableText_Iterator::CPDF_VariableText_Iterator(CPDF_VariableText* pVT)
: m_CurPos(-1, -1, -1), m_pVT(pVT) {}
CPDF_VariableText_Iterator::~CPDF_VariableText_Iterator() {}
void CPDF_VariableText_Iterator::SetAt(int32_t nWordIndex) {
- ASSERT(m_pVT != NULL);
m_CurPos = m_pVT->WordIndexToWordPlace(nWordIndex);
}
void CPDF_VariableText_Iterator::SetAt(const CPVT_WordPlace& place) {
- ASSERT(m_pVT != NULL);
+ ASSERT(m_pVT);
m_CurPos = place;
}
FX_BOOL CPDF_VariableText_Iterator::NextWord() {
@@ -1738,7 +1734,7 @@ FX_BOOL CPDF_VariableText_Iterator::NextSection() {
return FALSE;
}
FX_BOOL CPDF_VariableText_Iterator::PrevSection() {
- ASSERT(m_pVT != NULL);
+ ASSERT(m_pVT);
if (m_CurPos.nSecIndex > 0) {
m_CurPos = CPVT_WordPlace(m_CurPos.nSecIndex - 1, 0, -1);
return TRUE;
@@ -1746,7 +1742,6 @@ FX_BOOL CPDF_VariableText_Iterator::PrevSection() {
return FALSE;
}
FX_BOOL CPDF_VariableText_Iterator::GetWord(CPVT_Word& word) const {
- ASSERT(m_pVT != NULL);
word.WordPlace = m_CurPos;
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) {
@@ -1772,7 +1767,6 @@ FX_BOOL CPDF_VariableText_Iterator::GetWord(CPVT_Word& word) const {
return FALSE;
}
FX_BOOL CPDF_VariableText_Iterator::SetWord(const CPVT_Word& word) {
- ASSERT(m_pVT != NULL);
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (CPVT_WordInfo* pWord =
pSection->m_WordArray.GetAt(m_CurPos.nWordIndex)) {
@@ -1785,7 +1779,7 @@ FX_BOOL CPDF_VariableText_Iterator::SetWord(const CPVT_Word& word) {
return FALSE;
}
FX_BOOL CPDF_VariableText_Iterator::GetLine(CPVT_Line& line) const {
- ASSERT(m_pVT != NULL);
+ ASSERT(m_pVT);
line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1);
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (CLine* pLine = pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) {
@@ -1802,7 +1796,6 @@ FX_BOOL CPDF_VariableText_Iterator::GetLine(CPVT_Line& line) const {
return FALSE;
}
FX_BOOL CPDF_VariableText_Iterator::GetSection(CPVT_Section& section) const {
- ASSERT(m_pVT != NULL);
section.secplace = CPVT_WordPlace(m_CurPos.nSecIndex, 0, -1);
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
section.rcSection = m_pVT->InToOut(pSection->m_SecInfo.rcSection);
@@ -1817,7 +1810,6 @@ FX_BOOL CPDF_VariableText_Iterator::GetSection(CPVT_Section& section) const {
return FALSE;
}
FX_BOOL CPDF_VariableText_Iterator::SetSection(const CPVT_Section& section) {
- ASSERT(m_pVT != NULL);
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (pSection->m_SecInfo.pSecProps) {
*pSection->m_SecInfo.pSecProps = section.SecProps;