summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript/JS_GlobalData.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-14 18:10:25 -0800
committerLei Zhang <thestig@chromium.org>2015-12-14 18:10:25 -0800
commite3c7c2b54348da4a6939f6672f6c6bff126815a7 (patch)
tree68cc9bebdd5f4f055bfa7de116862091709b4054 /fpdfsdk/src/javascript/JS_GlobalData.cpp
parentba41a35553573ab718026e8508e1e32107db6595 (diff)
downloadpdfium-e3c7c2b54348da4a6939f6672f6c6bff126815a7.tar.xz
Get rid of most instance of 'foo != NULL'
R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1512763013 .
Diffstat (limited to 'fpdfsdk/src/javascript/JS_GlobalData.cpp')
-rw-r--r--fpdfsdk/src/javascript/JS_GlobalData.cpp26
1 files changed, 9 insertions, 17 deletions
diff --git a/fpdfsdk/src/javascript/JS_GlobalData.cpp b/fpdfsdk/src/javascript/JS_GlobalData.cpp
index d9a07a8507..474886c484 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);