summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_action.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-14 18:27:25 -0800
committerLei Zhang <thestig@chromium.org>2015-12-14 18:27:25 -0800
commit96660d6f382204339d6b1aadc3913303d436e252 (patch)
treeb5f84756e1a89251831cebc05b9d4e1f6cb2027b /core/src/fpdfdoc/doc_action.cpp
parentd983b09c3ae29a97cba8e9ec9c6351545f6087ee (diff)
downloadpdfium-96660d6f382204339d6b1aadc3913303d436e252.tar.xz
Merge to XFA: Get rid of most instance of 'foo != NULL'
TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1512763013 . (cherry picked from commit e3c7c2b54348da4a6939f6672f6c6bff126815a7) Review URL: https://codereview.chromium.org/1529553003 .
Diffstat (limited to 'core/src/fpdfdoc/doc_action.cpp')
-rw-r--r--core/src/fpdfdoc/doc_action.cpp17
1 files changed, 7 insertions, 10 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);
}