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/javascript | |
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/javascript')
-rw-r--r-- | fpdfsdk/src/javascript/PublicMethods.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp index 71726a2db0..c11197d93e 100644 --- a/fpdfsdk/src/javascript/PublicMethods.cpp +++ b/fpdfsdk/src/javascript/PublicMethods.cpp @@ -358,20 +358,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; } @@ -1796,7 +1796,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()) { |