Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: fpdfsdk/src/javascript/PublicMethods.cpp

Issue 1414793016: Merge to XFA: Cleanup: Remove some NULL checks in fpdfsdk. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/fsdk_baseform.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/PublicMethods.cpp
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp
index 71726a2db0b1dd7952d3bbc8163ce2f4b2c91c0a..c11197d93e1421a9748f34a3a657a5cef04347dc 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()) {
« no previous file with comments | « fpdfsdk/src/fsdk_baseform.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698