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

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

Issue 1512763013: Get rid of most instance of 'foo != NULL' (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: nits Created 5 years 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/javascript/JS_EventHandler.cpp ('k') | fpdfsdk/src/javascript/JS_Object.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/javascript/JS_GlobalData.cpp
diff --git a/fpdfsdk/src/javascript/JS_GlobalData.cpp b/fpdfsdk/src/javascript/JS_GlobalData.cpp
index d9a07a85074ee0de52f855300c8a11e86a534fac..474886c4846c85b1f287abca441d230d16d3fba1 100644
--- a/fpdfsdk/src/javascript/JS_GlobalData.cpp
+++ b/fpdfsdk/src/javascript/JS_GlobalData.cpp
@@ -23,8 +23,6 @@ void CJS_GlobalVariableArray::Copy(const CJS_GlobalVariableArray& array) {
Empty();
for (int i = 0, sz = array.Count(); i < sz; i++) {
CJS_KeyValue* pOldObjData = array.GetAt(i);
- ASSERT(pOldObjData != NULL);
-
switch (pOldObjData->nType) {
case JS_GLOBALDATA_TYPE_NUMBER: {
CJS_KeyValue* pNewObjData = new CJS_KeyValue;
@@ -141,19 +139,15 @@ int CJS_GlobalData::FindGlobalVariable(const FX_CHAR* propname) {
CJS_GlobalData_Element* CJS_GlobalData::GetGlobalVariable(
const FX_CHAR* propname) {
- ASSERT(propname != NULL);
+ ASSERT(propname);
int nFind = FindGlobalVariable(propname);
- if (nFind >= 0)
- return m_arrayGlobalData.GetAt(nFind);
-
- return NULL;
+ return nFind >= 0 ? m_arrayGlobalData.GetAt(nFind) : nullptr;
}
void CJS_GlobalData::SetGlobalVariableNumber(const FX_CHAR* propname,
double dData) {
- ASSERT(propname != NULL);
-
+ ASSERT(propname);
CFX_ByteString sPropName = propname;
sPropName.TrimLeft();
sPropName.TrimRight();
@@ -174,7 +168,7 @@ void CJS_GlobalData::SetGlobalVariableNumber(const FX_CHAR* propname,
void CJS_GlobalData::SetGlobalVariableBoolean(const FX_CHAR* propname,
bool bData) {
- ASSERT(propname != NULL);
+ ASSERT(propname);
CFX_ByteString sPropName = propname;
sPropName.TrimLeft();
@@ -198,7 +192,7 @@ void CJS_GlobalData::SetGlobalVariableBoolean(const FX_CHAR* propname,
void CJS_GlobalData::SetGlobalVariableString(const FX_CHAR* propname,
const CFX_ByteString& sData) {
- ASSERT(propname != NULL);
+ ASSERT(propname);
CFX_ByteString sPropName = propname;
sPropName.TrimLeft();
@@ -223,7 +217,7 @@ void CJS_GlobalData::SetGlobalVariableString(const FX_CHAR* propname,
void CJS_GlobalData::SetGlobalVariableObject(
const FX_CHAR* propname,
const CJS_GlobalVariableArray& array) {
- ASSERT(propname != NULL);
+ ASSERT(propname);
CFX_ByteString sPropName = propname;
sPropName.TrimLeft();
@@ -246,7 +240,7 @@ void CJS_GlobalData::SetGlobalVariableObject(
}
void CJS_GlobalData::SetGlobalVariableNull(const FX_CHAR* propname) {
- ASSERT(propname != NULL);
+ ASSERT(propname);
CFX_ByteString sPropName = propname;
sPropName.TrimLeft();
@@ -268,7 +262,7 @@ void CJS_GlobalData::SetGlobalVariableNull(const FX_CHAR* propname) {
FX_BOOL CJS_GlobalData::SetGlobalVariablePersistent(const FX_CHAR* propname,
FX_BOOL bPersistent) {
- ASSERT(propname != NULL);
+ ASSERT(propname);
CFX_ByteString sPropName = propname;
sPropName.TrimLeft();
@@ -286,7 +280,7 @@ FX_BOOL CJS_GlobalData::SetGlobalVariablePersistent(const FX_CHAR* propname,
}
FX_BOOL CJS_GlobalData::DeleteGlobalVariable(const FX_CHAR* propname) {
- ASSERT(propname != NULL);
+ ASSERT(propname);
CFX_ByteString sPropName = propname;
sPropName.TrimLeft();
@@ -409,8 +403,6 @@ void CJS_GlobalData::SaveGlobalPersisitentVariables() {
for (int i = 0, sz = m_arrayGlobalData.GetSize(); i < sz; i++) {
CJS_GlobalData_Element* pElement = m_arrayGlobalData.GetAt(i);
- ASSERT(pElement != NULL);
-
if (pElement->bPersistent) {
CFX_BinaryBuf sElement;
MakeByteString(pElement->data.sKey, &pElement->data, sElement);
« no previous file with comments | « fpdfsdk/src/javascript/JS_EventHandler.cpp ('k') | fpdfsdk/src/javascript/JS_Object.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698