diff options
author | Lei Zhang <thestig@chromium.org> | 2015-11-04 18:17:53 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-11-04 18:17:53 -0800 |
commit | 997de6127fe4dd0f6df3ca72676e31311c3d66bd (patch) | |
tree | c24c58d6783a529dbfea6d9fce868c6e79cecdb5 /fpdfsdk/src/fsdk_baseform.cpp | |
parent | 79e893a1d0f2083f17c40ccadf2cc1250aad5a14 (diff) | |
download | pdfium-997de6127fe4dd0f6df3ca72676e31311c3d66bd.tar.xz |
Merge to XFA: Cleanup: Remove some NULL checks in fpdfsdk.
And simplify code.
TBR=ochang@chromium.org
Review URL: https://codereview.chromium.org/1411663013 .
(cherry picked from commit ff5adbc0dfa71270a9979f0c3e1d27923c16218a)
Review URL: https://codereview.chromium.org/1414793016 .
Diffstat (limited to 'fpdfsdk/src/fsdk_baseform.cpp')
-rw-r--r-- | fpdfsdk/src/fsdk_baseform.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/fpdfsdk/src/fsdk_baseform.cpp b/fpdfsdk/src/fsdk_baseform.cpp index 202f77f571..ebc983794e 100644 --- a/fpdfsdk/src/fsdk_baseform.cpp +++ b/fpdfsdk/src/fsdk_baseform.cpp @@ -2459,7 +2459,7 @@ CFX_WideString CPDFSDK_InterForm::OnFormat(CPDF_FormField* pFormField, bFormated = FALSE; CPDF_AAction aAction = pFormField->GetAdditionalAction(); - if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Format)) { + if (aAction && aAction.ActionExist(CPDF_AAction::Format)) { CPDF_Action action = aAction.GetAction(CPDF_AAction::Format); if (action) { CFX_WideString script = action.GetJavaScript(); @@ -2529,7 +2529,7 @@ void CPDFSDK_InterForm::OnKeyStrokeCommit(CPDF_FormField* pFormField, ASSERT(pFormField != NULL); CPDF_AAction aAction = pFormField->GetAdditionalAction(); - if (aAction != NULL && aAction.ActionExist(CPDF_AAction::KeyStroke)) { + if (aAction && aAction.ActionExist(CPDF_AAction::KeyStroke)) { CPDF_Action action = aAction.GetAction(CPDF_AAction::KeyStroke); if (action) { ASSERT(m_pDocument != NULL); @@ -2557,7 +2557,7 @@ void CPDFSDK_InterForm::OnValidate(CPDF_FormField* pFormField, ASSERT(pFormField != NULL); CPDF_AAction aAction = pFormField->GetAdditionalAction(); - if (aAction != NULL && aAction.ActionExist(CPDF_AAction::Validate)) { + if (aAction && aAction.ActionExist(CPDF_AAction::Validate)) { CPDF_Action action = aAction.GetAction(CPDF_AAction::Validate); if (action) { ASSERT(m_pDocument != NULL); @@ -2691,19 +2691,19 @@ FX_BOOL CPDFSDK_InterForm::FDFToURLEncodedData(uint8_t*& pBuf, CFDF_Document* pFDF = CFDF_Document::ParseMemory(pBuf, nBufSize); if (pFDF) { CPDF_Dictionary* pMainDict = pFDF->GetRoot()->GetDict("FDF"); - if (pMainDict == NULL) + if (!pMainDict) return FALSE; // Get fields CPDF_Array* pFields = pMainDict->GetArray("Fields"); - if (pFields == NULL) + if (!pFields) return FALSE; CFX_ByteTextBuf fdfEncodedData; for (FX_DWORD i = 0; i < pFields->GetCount(); i++) { CPDF_Dictionary* pField = pFields->GetDict(i); - if (pField == NULL) + if (!pField) continue; CFX_WideString name; name = pField->GetUnicodeText("T"); @@ -2778,14 +2778,14 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, CPDFDoc_Environment* pEnv = m_pDocument->GetEnv(); ASSERT(pEnv != NULL); - if (NULL == m_pDocument) + if (!m_pDocument) return FALSE; CFX_WideString wsPDFFilePath = m_pDocument->GetPath(); - if (NULL == m_pInterForm) + if (!m_pInterForm) return FALSE; CFDF_Document* pFDFDoc = m_pInterForm->ExportToFDF(wsPDFFilePath); - if (NULL == pFDFDoc) + if (!pFDFDoc) return FALSE; CFX_ByteTextBuf FdfBuffer; |