summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-11-04 18:04:03 -0800
committerLei Zhang <thestig@chromium.org>2015-11-04 18:04:03 -0800
commitff5adbc0dfa71270a9979f0c3e1d27923c16218a (patch)
treec68169974c3d747d30f925c1ace74d7bc9fb774c /fpdfsdk/src/javascript
parent4544797e8998a31e7bc3f5439a5982f7f66dff26 (diff)
downloadpdfium-ff5adbc0dfa71270a9979f0c3e1d27923c16218a.tar.xz
Cleanup: Remove some NULL checks in fpdfsdk.
And simplify code. R=ochang@chromium.org Review URL: https://codereview.chromium.org/1411663013 .
Diffstat (limited to 'fpdfsdk/src/javascript')
-rw-r--r--fpdfsdk/src/javascript/PublicMethods.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp
index e898214cd8..92b47666e2 100644
--- a/fpdfsdk/src/javascript/PublicMethods.cpp
+++ b/fpdfsdk/src/javascript/PublicMethods.cpp
@@ -366,20 +366,20 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime,
while (*p) {
const char* pTemp = strchr(p, ch);
- if (pTemp == NULL) {
+ if (!pTemp) {
StrArray.SetElement(nIndex, CJS_Value(pRuntime, StrTrim(p).c_str()));
break;
- } else {
- char* pSub = new char[pTemp - p + 1];
- strncpy(pSub, p, pTemp - p);
- *(pSub + (pTemp - p)) = '\0';
+ }
- StrArray.SetElement(nIndex, CJS_Value(pRuntime, StrTrim(pSub).c_str()));
- delete[] pSub;
+ char* pSub = new char[pTemp - p + 1];
+ strncpy(pSub, p, pTemp - p);
+ *(pSub + (pTemp - p)) = '\0';
- nIndex++;
- p = ++pTemp;
- }
+ StrArray.SetElement(nIndex, CJS_Value(pRuntime, StrTrim(pSub).c_str()));
+ delete[] pSub;
+
+ nIndex++;
+ p = ++pTemp;
}
return StrArray;
}
@@ -1804,7 +1804,7 @@ FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc,
}
CFX_WideString swValue;
- if (pEventHandler->m_pValue != NULL)
+ if (pEventHandler->m_pValue)
swValue = pEventHandler->Value();
if (pEventHandler->WillCommit()) {