summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/javascript
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
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')
-rw-r--r--fpdfsdk/src/javascript/Document.cpp39
-rw-r--r--fpdfsdk/src/javascript/Field.cpp188
-rw-r--r--fpdfsdk/src/javascript/JS_Context.cpp2
-rw-r--r--fpdfsdk/src/javascript/JS_EventHandler.cpp10
-rw-r--r--fpdfsdk/src/javascript/JS_GlobalData.cpp26
-rw-r--r--fpdfsdk/src/javascript/JS_Object.cpp2
-rw-r--r--fpdfsdk/src/javascript/PublicMethods.cpp24
-rw-r--r--fpdfsdk/src/javascript/app.cpp9
-rw-r--r--fpdfsdk/src/javascript/event.cpp35
-rw-r--r--fpdfsdk/src/javascript/global.cpp8
10 files changed, 48 insertions, 295 deletions
diff --git a/fpdfsdk/src/javascript/Document.cpp b/fpdfsdk/src/javascript/Document.cpp
index 1fa88f9b12..b0ca69b5ba 100644
--- a/fpdfsdk/src/javascript/Document.cpp
+++ b/fpdfsdk/src/javascript/Document.cpp
@@ -22,11 +22,7 @@
static v8::Isolate* GetIsolate(IJS_Context* cc) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
-
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
- ASSERT(pRuntime != NULL);
-
return pRuntime->GetIsolate();
}
@@ -194,8 +190,6 @@ FX_BOOL Document::numFields(IJS_Context* cc,
FX_BOOL Document::dirty(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (vp.IsGetting()) {
if (m_pDocument->GetChangeMark())
vp << true;
@@ -218,8 +212,6 @@ FX_BOOL Document::dirty(IJS_Context* cc,
FX_BOOL Document::ADBE(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (vp.IsGetting()) {
vp.SetNull();
} else {
@@ -231,8 +223,6 @@ FX_BOOL Document::ADBE(IJS_Context* cc,
FX_BOOL Document::pageNum(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (vp.IsGetting()) {
if (CPDFSDK_PageView* pPageView = m_pDocument->GetCurrentView()) {
vp << pPageView->GetPageIndex();
@@ -394,8 +384,6 @@ FX_BOOL Document::mailForm(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS))
return FALSE;
@@ -410,18 +398,13 @@ FX_BOOL Document::mailForm(IJS_Context* cc,
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)m_pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
CFX_ByteTextBuf textBuf;
if (!pInterForm->ExportFormToFDFTextBuf(textBuf))
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CPDFDoc_Environment* pEnv = pContext->GetReaderApp();
- ASSERT(pEnv != NULL);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
- ASSERT(pRuntime != NULL);
pRuntime->BeginBlock();
pEnv->JS_docmailForm(textBuf.GetBuffer(), textBuf.GetLength(), bUI,
@@ -485,8 +468,6 @@ FX_BOOL Document::print(IJS_Context* cc,
bAnnotations = params[7].ToBool();
}
- ASSERT(m_pDocument != NULL);
-
if (CPDFDoc_Environment* pEnv = m_pDocument->GetEnv()) {
pEnv->JS_docprint(bUI, nStart, nEnd, bSilent, bShrinkToFit, bPrintAsImage,
bReverse, bAnnotations);
@@ -503,8 +484,6 @@ FX_BOOL Document::removeField(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) ||
m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM)))
return FALSE;
@@ -518,7 +497,6 @@ FX_BOOL Document::removeField(IJS_Context* cc,
CFX_WideString sFieldName = params[0].ToCFXWideString();
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)m_pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
std::vector<CPDFSDK_Widget*> widgets;
pInterForm->GetWidgets(sFieldName, &widgets);
@@ -1100,11 +1078,8 @@ FX_BOOL Document::baseURL(IJS_Context* cc,
FX_BOOL Document::calculate(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)m_pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
if (vp.IsGetting()) {
if (pInterForm->IsCalculateEnabled())
@@ -1220,7 +1195,6 @@ FX_BOOL Document::closeDoc(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
return TRUE;
}
@@ -1479,8 +1453,6 @@ FX_BOOL Document::calculateNow(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!(m_pDocument->GetPermissions(FPDFPERM_MODIFY) ||
m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) ||
m_pDocument->GetPermissions(FPDFPERM_FILL_FORM)))
@@ -1488,7 +1460,6 @@ FX_BOOL Document::calculateNow(IJS_Context* cc,
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)m_pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
pInterForm->OnCalculate();
return TRUE;
}
@@ -1503,8 +1474,6 @@ FX_BOOL Document::getPageNthWord(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS))
return FALSE;
@@ -1565,8 +1534,6 @@ FX_BOOL Document::getPageNthWordQuads(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS))
return FALSE;
@@ -1577,16 +1544,12 @@ FX_BOOL Document::getPageNumWords(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!m_pDocument->GetPermissions(FPDFPERM_EXTRACT_ACCESS))
return FALSE;
int nPageNo = params.size() > 0 ? params[0].ToInt() : 0;
CPDF_Document* pDocument = m_pDocument->GetPDFDocument();
- ASSERT(pDocument != NULL);
-
CJS_Context* pContext = static_cast<CJS_Context*>(cc);
if (nPageNo < 0 || nPageNo >= pDocument->GetPageCount()) {
sError = JSGetStringFromID(pContext, IDS_STRING_JSVALUEERROR);
@@ -1673,8 +1636,6 @@ int Document::CountWords(CPDF_TextObject* pTextObj) {
CFX_WideString Document::GetObjWordStr(CPDF_TextObject* pTextObj,
int nWordIndex) {
- ASSERT(pTextObj != NULL);
-
CFX_WideString swRet;
CPDF_Font* pFont = pTextObj->GetFont();
diff --git a/fpdfsdk/src/javascript/Field.cpp b/fpdfsdk/src/javascript/Field.cpp
index 39e15e9868..288ab5e747 100644
--- a/fpdfsdk/src/javascript/Field.cpp
+++ b/fpdfsdk/src/javascript/Field.cpp
@@ -19,8 +19,6 @@
#include "fpdfsdk/include/fsdk_mgr.h" // For CPDFDoc_Environment.
#include "fpdfsdk/include/javascript/IJavaScript.h"
-/* ---------------------- Field ---------------------- */
-
BEGIN_JS_STATIC_CONST(CJS_Field)
END_JS_STATIC_CONST()
@@ -156,22 +154,14 @@ void Field::ParseFieldName(const std::wstring& strFieldNameParsed,
FX_BOOL Field::AttachField(Document* pDocument,
const CFX_WideString& csFieldName) {
- ASSERT(pDocument != NULL);
m_pJSDoc = pDocument;
-
m_pDocument = pDocument->GetReaderDoc();
- ASSERT(m_pDocument != NULL);
-
m_bCanSet = m_pDocument->GetPermissions(FPDFPERM_FILL_FORM) ||
m_pDocument->GetPermissions(FPDFPERM_ANNOT_FORM) ||
m_pDocument->GetPermissions(FPDFPERM_MODIFY);
CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm();
- ASSERT(pRDInterForm != NULL);
-
CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
- ASSERT(pInterForm != NULL);
-
CFX_WideString swFieldNameTemp = csFieldName;
swFieldNameTemp.Replace(L"..", L".");
@@ -251,12 +241,9 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument,
FX_BOOL bChangeMark,
FX_BOOL bResetAP,
FX_BOOL bRefresh) {
- ASSERT(pDocument != NULL);
- ASSERT(pFormControl != NULL);
+ ASSERT(pFormControl);
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl);
if (pWidget) {
@@ -278,7 +265,6 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument,
if (bRefresh) {
CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
CPDFSDK_Document* pDoc = pInterForm->GetDocument();
- ASSERT(pDoc != NULL);
pDoc->UpdateAllViews(NULL, pWidget);
}
}
@@ -289,19 +275,14 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument,
CPDFSDK_Widget* Field::GetWidget(CPDFSDK_Document* pDocument,
CPDF_FormControl* pFormControl) {
- ASSERT(pDocument != NULL);
- ASSERT(pFormControl != NULL);
+ ASSERT(pFormControl);
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
return pInterForm->GetWidget(pFormControl);
}
FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField,
CFX_WideString csOptLabel) {
- ASSERT(pFormField != NULL);
-
for (int i = 0, sz = pFormField->CountOptions(); i < sz; i++) {
if (csOptLabel.Compare(pFormField->GetOptionLabel(i)) == 0)
return TRUE;
@@ -321,13 +302,10 @@ CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) {
return pFormField->GetControl(m_nFormControlIndex);
}
-/* ---------------------------------------- property
- * ---------------------------------------- */
-
FX_BOOL Field::alignment(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -383,7 +361,7 @@ void Field::SetAlignment(CPDFSDK_Document* pDocument,
FX_BOOL Field::borderStyle(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -443,7 +421,7 @@ void Field::SetBorderStyle(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
const CFX_ByteString& string) {
- ASSERT(pDocument != NULL);
+ ASSERT(pDocument);
int nBorderStyle = 0;
@@ -495,7 +473,7 @@ void Field::SetBorderStyle(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonAlignX(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -544,7 +522,7 @@ void Field::SetButtonAlignX(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonAlignY(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -593,7 +571,7 @@ void Field::SetButtonAlignY(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonFitBounds(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -638,7 +616,7 @@ void Field::SetButtonFitBounds(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonPosition(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -681,7 +659,7 @@ void Field::SetButtonPosition(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonScaleHow(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -729,7 +707,7 @@ void Field::SetButtonScaleHow(CPDFSDK_Document* pDocument,
FX_BOOL Field::buttonScaleWhen(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -788,7 +766,7 @@ void Field::SetButtonScaleWhen(CPDFSDK_Document* pDocument,
FX_BOOL Field::calcOrderIndex(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -815,11 +793,7 @@ FX_BOOL Field::calcOrderIndex(IJS_Context* cc,
}
CPDFSDK_InterForm* pRDInterForm = m_pDocument->GetInterForm();
- ASSERT(pRDInterForm != NULL);
-
CPDF_InterForm* pInterForm = pRDInterForm->GetInterForm();
- ASSERT(pInterForm != NULL);
-
vp << (int32_t)pInterForm->FindFieldInCalculationOrder(pFormField);
}
@@ -836,7 +810,7 @@ void Field::SetCalcOrderIndex(CPDFSDK_Document* pDocument,
FX_BOOL Field::charLimit(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -874,7 +848,7 @@ void Field::SetCharLimit(CPDFSDK_Document* pDocument,
FX_BOOL Field::comb(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -916,7 +890,7 @@ void Field::SetComb(CPDFSDK_Document* pDocument,
FX_BOOL Field::commitOnSelChange(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1023,7 +997,7 @@ void Field::SetCurrentValueIndices(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
const CFX_DWordArray& array) {
- ASSERT(pDocument != NULL);
+ ASSERT(pDocument);
std::vector<CPDF_FormField*> FieldArray =
GetFormFields(pDocument, swFieldName);
@@ -1063,7 +1037,7 @@ void Field::SetDefaultStyle(CPDFSDK_Document* pDocument,
FX_BOOL Field::defaultValue(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1104,7 +1078,7 @@ void Field::SetDefaultValue(CPDFSDK_Document* pDocument,
FX_BOOL Field::doNotScroll(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1146,7 +1120,7 @@ void Field::SetDoNotScroll(CPDFSDK_Document* pDocument,
FX_BOOL Field::doNotSpellCheck(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1203,8 +1177,6 @@ FX_BOOL Field::delay(IJS_Context* cc,
FX_BOOL Field::display(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (vp.IsSetting()) {
if (!m_bCanSet)
return FALSE;
@@ -1255,11 +1227,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
int number) {
- ASSERT(pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
std::vector<CPDF_FormField*> FieldArray =
GetFormFields(pDocument, swFieldName);
for (CPDF_FormField* pFormField : FieldArray) {
@@ -1267,7 +1235,7 @@ void Field::SetDisplay(CPDFSDK_Document* pDocument,
FX_BOOL bSet = FALSE;
for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
CPDF_FormControl* pFormControl = pFormField->GetControl(i);
- ASSERT(pFormControl != NULL);
+ ASSERT(pFormControl);
if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
FX_DWORD dwFlag = pWidget->GetFlags();
@@ -1357,7 +1325,6 @@ FX_BOOL Field::doc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
FX_BOOL Field::editable(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
if (vp.IsSetting()) {
if (!m_bCanSet)
return FALSE;
@@ -1430,8 +1397,6 @@ FX_BOOL Field::exportValues(IJS_Context* cc,
FX_BOOL Field::fileSelect(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -1528,8 +1493,6 @@ void Field::SetFillColor(CPDFSDK_Document* pDocument,
FX_BOOL Field::hidden(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (vp.IsSetting()) {
if (!m_bCanSet)
return FALSE;
@@ -1571,11 +1534,7 @@ void Field::SetHidden(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
bool b) {
- ASSERT(pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
std::vector<CPDF_FormField*> FieldArray =
GetFormFields(pDocument, swFieldName);
for (CPDF_FormField* pFormField : FieldArray) {
@@ -1638,7 +1597,7 @@ void Field::SetHidden(CPDFSDK_Document* pDocument,
FX_BOOL Field::highlight(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1699,8 +1658,6 @@ void Field::SetHighlight(CPDFSDK_Document* pDocument,
FX_BOOL Field::lineWidth(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (vp.IsSetting()) {
if (!m_bCanSet)
return FALSE;
@@ -1727,8 +1684,6 @@ FX_BOOL Field::lineWidth(IJS_Context* cc,
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)m_pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
if (!pFormField->CountControls())
return FALSE;
@@ -1746,10 +1701,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
int number) {
- ASSERT(pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
std::vector<CPDF_FormField*> FieldArray =
GetFormFields(pDocument, swFieldName);
@@ -1758,7 +1710,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument,
FX_BOOL bSet = FALSE;
for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
CPDF_FormControl* pFormControl = pFormField->GetControl(i);
- ASSERT(pFormControl != NULL);
+ ASSERT(pFormControl);
if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
if (number != pWidget->GetBorderWidth()) {
@@ -1788,7 +1740,7 @@ void Field::SetLineWidth(CPDFSDK_Document* pDocument,
FX_BOOL Field::multiline(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1830,7 +1782,7 @@ void Field::SetMultiline(CPDFSDK_Document* pDocument,
FX_BOOL Field::multipleSelection(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1945,7 +1897,7 @@ FX_BOOL Field::page(IJS_Context* cc,
FX_BOOL Field::password(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -1987,12 +1939,8 @@ void Field::SetPassword(CPDFSDK_Document* pDocument,
FX_BOOL Field::print(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)m_pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -2066,8 +2014,6 @@ FX_BOOL Field::print(IJS_Context* cc,
FX_BOOL Field::radiosInUnison(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -2096,8 +2042,6 @@ FX_BOOL Field::radiosInUnison(IJS_Context* cc,
FX_BOOL Field::readonly(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -2187,10 +2131,7 @@ void Field::SetRect(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
const CPDF_Rect& rect) {
- ASSERT(pDocument != NULL);
-
CPDFSDK_InterForm* pInterForm = (CPDFSDK_InterForm*)pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
std::vector<CPDF_FormField*> FieldArray =
GetFormFields(pDocument, swFieldName);
@@ -2199,7 +2140,7 @@ void Field::SetRect(CPDFSDK_Document* pDocument,
FX_BOOL bSet = FALSE;
for (int i = 0, sz = pFormField->CountControls(); i < sz; ++i) {
CPDF_FormControl* pFormControl = pFormField->GetControl(i);
- ASSERT(pFormControl != NULL);
+ ASSERT(pFormControl);
if (CPDFSDK_Widget* pWidget = pInterForm->GetWidget(pFormControl)) {
CPDF_Rect crRect = rect;
@@ -2229,11 +2170,6 @@ void Field::SetRect(CPDFSDK_Document* pDocument,
CPDF_Rect crRect = rect;
CPDF_Page* pPDFPage = pWidget->GetPDFPage();
- ASSERT(pPDFPage != NULL);
-
- // CPDF_Page* pPDFPage = pPage->GetPage();
- // ASSERT(pPDFPage != NULL);
-
crRect.Intersect(pPDFPage->GetPageBBox());
if (!crRect.IsEmpty()) {
@@ -2253,8 +2189,6 @@ void Field::SetRect(CPDFSDK_Document* pDocument,
FX_BOOL Field::required(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -2283,7 +2217,7 @@ FX_BOOL Field::required(IJS_Context* cc,
FX_BOOL Field::richText(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2337,7 +2271,7 @@ void Field::SetRichValue(CPDFSDK_Document* pDocument,
FX_BOOL Field::rotation(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2447,7 +2381,7 @@ void Field::SetStrokeColor(CPDFSDK_Document* pDocument,
FX_BOOL Field::style(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2582,7 +2516,7 @@ void Field::SetTextColor(CPDFSDK_Document* pDocument,
FX_BOOL Field::textFont(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2638,7 +2572,7 @@ void Field::SetTextFont(CPDFSDK_Document* pDocument,
FX_BOOL Field::textSize(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2686,8 +2620,6 @@ void Field::SetTextSize(CPDFSDK_Document* pDocument,
FX_BOOL Field::type(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!vp.IsGetting())
return FALSE;
@@ -2732,7 +2664,7 @@ FX_BOOL Field::type(IJS_Context* cc,
FX_BOOL Field::userName(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (vp.IsSetting()) {
if (!m_bCanSet)
@@ -2885,7 +2817,7 @@ void Field::SetValue(CPDFSDK_Document* pDocument,
const CFX_WideString& swFieldName,
int nControlIndex,
const CJS_WideStringArray& strArray) {
- ASSERT(pDocument != NULL);
+ ASSERT(pDocument);
if (strArray.GetSize() < 1)
return;
@@ -2944,8 +2876,6 @@ void Field::SetValue(CPDFSDK_Document* pDocument,
FX_BOOL Field::valueAsString(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!vp.IsGetting())
return FALSE;
@@ -2985,15 +2915,10 @@ FX_BOOL Field::valueAsString(IJS_Context* cc,
return TRUE;
}
-/* --------------------------------- methods ---------------------------------
- */
-
FX_BOOL Field::browseForFileToSubmit(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -3016,8 +2941,6 @@ FX_BOOL Field::buttonGetCaption(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
int nface = 0;
int iSize = params.size();
if (iSize >= 1)
@@ -3051,8 +2974,6 @@ FX_BOOL Field::buttonGetIcon(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
int nface = 0;
int iSize = params.size();
if (iSize >= 1)
@@ -3120,7 +3041,7 @@ FX_BOOL Field::checkThisBox(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
+ ASSERT(m_pDocument);
if (!m_bCanSet)
return FALSE;
@@ -3165,8 +3086,6 @@ FX_BOOL Field::defaultIsChecked(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
if (!m_bCanSet)
return FALSE;
@@ -3199,9 +3118,6 @@ FX_BOOL Field::deleteItemAt(IJS_Context* cc,
}
int JS_COMPARESTRING(CFX_WideString* ps1, CFX_WideString* ps2) {
- ASSERT(ps1 != NULL);
- ASSERT(ps2 != NULL);
-
return ps1->Compare(*ps2);
}
@@ -3209,8 +3125,6 @@ FX_BOOL Field::getArray(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -3251,7 +3165,6 @@ FX_BOOL Field::getItemAt(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
int iSize = params.size();
int nIdx = -1;
@@ -3305,8 +3218,6 @@ FX_BOOL Field::isBoxChecked(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
int nIndex = -1;
if (params.size() >= 1)
nIndex = params[0].ToInt();
@@ -3338,8 +3249,6 @@ FX_BOOL Field::isDefaultChecked(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
int nIndex = -1;
if (params.size() >= 1)
nIndex = params[0].ToInt();
@@ -3377,8 +3286,6 @@ FX_BOOL Field::setFocus(IJS_Context* cc,
const std::vector<CJS_Value>& params,
CJS_Value& vRet,
CFX_WideString& sError) {
- ASSERT(m_pDocument != NULL);
-
std::vector<CPDF_FormField*> FieldArray = GetFormFields(m_FieldName);
if (FieldArray.empty())
return FALSE;
@@ -3390,8 +3297,6 @@ FX_BOOL Field::setFocus(IJS_Context* cc,
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)m_pDocument->GetInterForm();
- ASSERT(pInterForm != NULL);
-
CPDFSDK_Widget* pWidget = NULL;
if (nCount == 1) {
pWidget = pInterForm->GetWidget(pFormField->GetControl(0));
@@ -3487,12 +3392,7 @@ FX_BOOL Field::source(IJS_Context* cc,
return TRUE;
}
-/////////////////////////////////////////// delay
-////////////////////////////////////////////////
-
void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3503,8 +3403,6 @@ void Field::AddDelay_Int(enum FIELD_PROP prop, int32_t n) {
}
void Field::AddDelay_Bool(enum FIELD_PROP prop, bool b) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3516,8 +3414,6 @@ void Field::AddDelay_Bool(enum FIELD_PROP prop, bool b) {
void Field::AddDelay_String(enum FIELD_PROP prop,
const CFX_ByteString& string) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3529,8 +3425,6 @@ void Field::AddDelay_String(enum FIELD_PROP prop,
void Field::AddDelay_WideString(enum FIELD_PROP prop,
const CFX_WideString& string) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3541,8 +3435,6 @@ void Field::AddDelay_WideString(enum FIELD_PROP prop,
}
void Field::AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3553,8 +3445,6 @@ void Field::AddDelay_Rect(enum FIELD_PROP prop, const CPDF_Rect& rect) {
}
void Field::AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3566,8 +3456,6 @@ void Field::AddDelay_Color(enum FIELD_PROP prop, const CPWL_Color& color) {
void Field::AddDelay_WordArray(enum FIELD_PROP prop,
const CFX_DWordArray& array) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3581,8 +3469,6 @@ void Field::AddDelay_WordArray(enum FIELD_PROP prop,
void Field::AddDelay_WideStringArray(enum FIELD_PROP prop,
const CJS_WideStringArray& array) {
- ASSERT(m_pJSDoc != NULL);
-
CJS_DelayData* pNewData = new CJS_DelayData;
pNewData->sFieldName = m_FieldName;
pNewData->nControlIndex = m_nFormControlIndex;
@@ -3594,8 +3480,7 @@ void Field::AddDelay_WideStringArray(enum FIELD_PROP prop,
}
void Field::DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData) {
- ASSERT(pDocument != NULL);
- ASSERT(pData != NULL);
+ ASSERT(pDocument);
switch (pData->eProp) {
case FP_ALIGNMENT:
@@ -3735,9 +3620,6 @@ void Field::DoDelay(CPDFSDK_Document* pDocument, CJS_DelayData* pData) {
}
}
-#define JS_FIELD_MINWIDTH 1
-#define JS_FIELD_MINHEIGHT 1
-
void Field::AddField(CPDFSDK_Document* pDocument,
int nPageIndex,
int nFieldType,
diff --git a/fpdfsdk/src/javascript/JS_Context.cpp b/fpdfsdk/src/javascript/JS_Context.cpp
index 8d54cddc41..b9a10e1bc2 100644
--- a/fpdfsdk/src/javascript/JS_Context.cpp
+++ b/fpdfsdk/src/javascript/JS_Context.cpp
@@ -27,8 +27,6 @@ CPDFSDK_Document* CJS_Context::GetReaderDocument() {
}
CPDFDoc_Environment* CJS_Context::GetReaderApp() {
- ASSERT(m_pRuntime != NULL);
-
return m_pRuntime->GetReaderApp();
}
diff --git a/fpdfsdk/src/javascript/JS_EventHandler.cpp b/fpdfsdk/src/javascript/JS_EventHandler.cpp
index df7f9791c2..e413166328 100644
--- a/fpdfsdk/src/javascript/JS_EventHandler.cpp
+++ b/fpdfsdk/src/javascript/JS_EventHandler.cpp
@@ -115,7 +115,6 @@ void CJS_EventHandler::OnField_MouseEnter(FX_BOOL bModifier,
m_bModifier = bModifier;
m_bShift = bShift;
- ASSERT(pTarget != NULL);
m_strTargetName = pTarget->GetFullName();
}
@@ -126,7 +125,6 @@ void CJS_EventHandler::OnField_MouseExit(FX_BOOL bModifier,
m_bModifier = bModifier;
m_bShift = bShift;
- ASSERT(pTarget != NULL);
m_strTargetName = pTarget->GetFullName();
}
@@ -138,7 +136,6 @@ void CJS_EventHandler::OnField_MouseDown(FX_BOOL bModifier,
m_bModifier = bModifier;
m_bShift = bShift;
- ASSERT(pTarget != NULL);
m_strTargetName = pTarget->GetFullName();
}
@@ -149,7 +146,6 @@ void CJS_EventHandler::OnField_MouseUp(FX_BOOL bModifier,
m_bModifier = bModifier;
m_bShift = bShift;
- ASSERT(pTarget != NULL);
m_strTargetName = pTarget->GetFullName();
}
@@ -161,7 +157,6 @@ void CJS_EventHandler::OnField_Focus(FX_BOOL bModifier,
m_bModifier = bModifier;
m_bShift = bShift;
- ASSERT(pTarget != NULL);
m_strTargetName = pTarget->GetFullName();
m_pValue = (CFX_WideString*)&Value;
}
@@ -174,7 +169,6 @@ void CJS_EventHandler::OnField_Blur(FX_BOOL bModifier,
m_bModifier = bModifier;
m_bShift = bShift;
- ASSERT(pTarget != NULL);
m_strTargetName = pTarget->GetFullName();
m_pValue = (CFX_WideString*)&Value;
}
@@ -201,7 +195,6 @@ void CJS_EventHandler::OnField_Keystroke(CFX_WideString& strChange,
m_pISelEnd = &nSelEnd;
m_pISelStart = &nSelStart;
m_bShift = bShift;
- ASSERT(pTarget != NULL);
m_strTargetName = pTarget->GetFullName();
m_pValue = &Value;
m_bWillCommit = bWillCommit;
@@ -224,7 +217,6 @@ void CJS_EventHandler::OnField_Validate(CFX_WideString& strChange,
m_bKeyDown = bKeyDown;
m_bModifier = bModifier;
m_bShift = bShift;
- ASSERT(pTarget != NULL);
m_strTargetName = pTarget->GetFullName();
m_pValue = &Value;
m_pbRc = &bRc;
@@ -238,7 +230,6 @@ void CJS_EventHandler::OnField_Calculate(CPDF_FormField* pSource,
if (pSource)
m_strSourceName = pSource->GetFullName();
- ASSERT(pTarget != NULL);
m_strTargetName = pTarget->GetFullName();
m_pValue = &Value;
m_pbRc = &bRc;
@@ -250,7 +241,6 @@ void CJS_EventHandler::OnField_Format(CPDF_FormField* pTarget,
Initial(JET_FIELD_FORMAT);
m_nCommitKey = 0;
- ASSERT(pTarget != NULL);
m_strTargetName = pTarget->GetFullName();
m_pValue = &Value;
m_bWillCommit = bWillCommit;
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);
diff --git a/fpdfsdk/src/javascript/JS_Object.cpp b/fpdfsdk/src/javascript/JS_Object.cpp
index 529b540237..058ec02925 100644
--- a/fpdfsdk/src/javascript/JS_Object.cpp
+++ b/fpdfsdk/src/javascript/JS_Object.cpp
@@ -86,8 +86,6 @@ int CJS_Object::MsgBox(CPDFDoc_Environment* pApp,
}
void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) {
- ASSERT(pContext != NULL);
-
if (pContext->IsMsgBoxEnabled()) {
CPDFDoc_Environment* pApp = pContext->GetReaderApp();
if (pApp)
diff --git a/fpdfsdk/src/javascript/PublicMethods.cpp b/fpdfsdk/src/javascript/PublicMethods.cpp
index 094f3e7dd7..c2e15fb116 100644
--- a/fpdfsdk/src/javascript/PublicMethods.cpp
+++ b/fpdfsdk/src/javascript/PublicMethods.cpp
@@ -1096,9 +1096,7 @@ FX_BOOL CJS_PublicMethods::AFNumber_Keystroke(
CJS_Value& vRet,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (params.size() < 2)
return FALSE;
@@ -1217,9 +1215,7 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format(
CFX_WideString& sError) {
#if _FX_OS_ != _FX_ANDROID_
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (params.size() != 2) {
sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
@@ -1319,9 +1315,7 @@ FX_BOOL CJS_PublicMethods::AFDate_FormatEx(IJS_Context* cc,
CJS_Value& vRet,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (params.size() != 1) {
sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
@@ -1436,9 +1430,7 @@ FX_BOOL CJS_PublicMethods::AFDate_KeystrokeEx(
CJS_Value& vRet,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (params.size() != 1) {
sError = L"AFDate_KeystrokeEx's parameters' size r not correct";
@@ -1609,7 +1601,6 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Format(
CJS_Value& vRet,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
if (params.size() != 1) {
sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
@@ -1620,8 +1611,6 @@ FX_BOOL CJS_PublicMethods::AFSpecial_Format(
int iIndex = params[0].ToInt();
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
-
if (!pEvent->m_pValue)
return FALSE;
CFX_WideString& Value = pEvent->Value();
@@ -1661,11 +1650,8 @@ FX_BOOL CJS_PublicMethods::AFSpecial_KeystrokeEx(
CJS_Value& vRet,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
-
if (params.size() < 1) {
sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
return FALSE;
@@ -1805,9 +1791,7 @@ FX_BOOL CJS_PublicMethods::AFMergeChange(IJS_Context* cc,
CJS_Value& vRet,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEventHandler = pContext->GetEventHandler();
- ASSERT(pEventHandler != NULL);
if (params.size() != 1) {
sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
@@ -1847,7 +1831,7 @@ FX_BOOL CJS_PublicMethods::AFParseDateEx(IJS_Context* cc,
CJS_Value& vRet,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
+ ASSERT(pContext);
if (params.size() != 2) {
sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
@@ -1878,7 +1862,7 @@ FX_BOOL CJS_PublicMethods::AFSimple(IJS_Context* cc,
CFX_WideString& sError) {
if (params.size() != 3) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
+ ASSERT(pContext);
sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
return FALSE;
@@ -1895,7 +1879,7 @@ FX_BOOL CJS_PublicMethods::AFMakeNumber(IJS_Context* cc,
CFX_WideString& sError) {
if (params.size() != 1) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
+ ASSERT(pContext);
sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
return FALSE;
@@ -2011,9 +1995,7 @@ FX_BOOL CJS_PublicMethods::AFRange_Validate(
CJS_Value& vRet,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (params.size() != 4) {
sError = JSGetStringFromID(pContext, IDS_STRING_JSPARAMERROR);
diff --git a/fpdfsdk/src/javascript/app.cpp b/fpdfsdk/src/javascript/app.cpp
index 70ce771090..0ed280740d 100644
--- a/fpdfsdk/src/javascript/app.cpp
+++ b/fpdfsdk/src/javascript/app.cpp
@@ -126,7 +126,7 @@ FX_BOOL app::activeDocs(IJS_Context* cc,
pRuntime->GetIsolate(), pRuntime, CJS_Document::g_nObjDefnID);
pJSDocument =
(CJS_Document*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj);
- ASSERT(pJSDocument != NULL);
+ ASSERT(pJSDocument);
}
aDocs.SetElement(0, CJS_Value(pRuntime, pJSDocument));
}
@@ -416,9 +416,7 @@ FX_BOOL app::setTimeOut(IJS_Context* cc,
}
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_Runtime* pRuntime = pContext->GetJSRuntime();
- ASSERT(pRuntime != NULL);
CFX_WideString script = params.size() > 0 ? params[0].ToCFXWideString() : L"";
if (script.IsEmpty()) {
@@ -527,8 +525,6 @@ FX_BOOL app::execMenuItem(IJS_Context* cc,
}
void app::TimerProc(CJS_Timer* pTimer) {
- ASSERT(pTimer != NULL);
-
CJS_Runtime* pRuntime = pTimer->GetRuntime();
switch (pTimer->GetType()) {
@@ -770,10 +766,7 @@ FX_BOOL app::response(IJS_Context* cc,
}
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
-
CPDFDoc_Environment* pApp = pContext->GetReaderApp();
- ASSERT(pApp != NULL);
const int MAX_INPUT_BYTES = 2048;
nonstd::unique_ptr<char[]> pBuff(new char[MAX_INPUT_BYTES + 2]);
diff --git a/fpdfsdk/src/javascript/event.cpp b/fpdfsdk/src/javascript/event.cpp
index 5ad1ca513f..2362c01287 100644
--- a/fpdfsdk/src/javascript/event.cpp
+++ b/fpdfsdk/src/javascript/event.cpp
@@ -56,10 +56,7 @@ FX_BOOL event::change(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
-
CFX_WideString& wChange = pEvent->Change();
if (vp.IsSetting()) {
if (vp.GetType() == CJS_Value::VT_string)
@@ -77,9 +74,7 @@ FX_BOOL event::changeEx(IJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
vp << pEvent->ChangeEx();
return TRUE;
@@ -92,9 +87,7 @@ FX_BOOL event::commitKey(IJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
vp << pEvent->CommitKey();
return TRUE;
@@ -104,9 +97,7 @@ FX_BOOL event::fieldFull(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (!vp.IsGetting() &&
wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0)
@@ -126,9 +117,7 @@ FX_BOOL event::keyDown(IJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (pEvent->KeyDown())
vp << TRUE;
@@ -144,9 +133,7 @@ FX_BOOL event::modifier(IJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (pEvent->Modifier())
vp << TRUE;
@@ -162,9 +149,7 @@ FX_BOOL event::name(IJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
vp << pEvent->Name();
return TRUE;
@@ -172,9 +157,7 @@ FX_BOOL event::name(IJS_Context* cc,
FX_BOOL event::rc(IJS_Context* cc, CJS_PropValue& vp, CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
FX_BOOL& bRc = pEvent->Rc();
if (vp.IsSetting()) {
@@ -222,9 +205,7 @@ FX_BOOL event::selEnd(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) {
return TRUE;
@@ -243,9 +224,7 @@ FX_BOOL event::selStart(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (wcscmp((const wchar_t*)pEvent->Name(), L"Keystroke") != 0) {
return TRUE;
@@ -266,9 +245,7 @@ FX_BOOL event::shift(IJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (pEvent->Shift())
vp << TRUE;
@@ -284,9 +261,7 @@ FX_BOOL event::source(IJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
vp << pEvent->Source()->GetJSObject();
return TRUE;
@@ -299,9 +274,7 @@ FX_BOOL event::target(IJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
vp << pEvent->Target_Field()->GetJSObject();
return TRUE;
@@ -314,9 +287,7 @@ FX_BOOL event::targetName(IJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
vp << pEvent->TargetName();
return TRUE;
@@ -329,9 +300,7 @@ FX_BOOL event::type(IJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
vp << pEvent->Type();
return TRUE;
@@ -341,9 +310,7 @@ FX_BOOL event::value(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (wcscmp((const wchar_t*)pEvent->Type(), L"Field") != 0)
return FALSE;
@@ -365,9 +332,7 @@ FX_BOOL event::willCommit(IJS_Context* cc,
return FALSE;
CJS_Context* pContext = (CJS_Context*)cc;
- ASSERT(pContext != NULL);
CJS_EventHandler* pEvent = pContext->GetEventHandler();
- ASSERT(pEvent != NULL);
if (pEvent->WillCommit())
vp << TRUE;
diff --git a/fpdfsdk/src/javascript/global.cpp b/fpdfsdk/src/javascript/global.cpp
index 2d9799dd4e..7a43b677e9 100644
--- a/fpdfsdk/src/javascript/global.cpp
+++ b/fpdfsdk/src/javascript/global.cpp
@@ -227,12 +227,8 @@ FX_BOOL JSGlobalAlternate::setPersistent(IJS_Context* cc,
}
void JSGlobalAlternate::UpdateGlobalPersistentVariables() {
- ASSERT(m_pGlobalData != NULL);
-
for (int i = 0, sz = m_pGlobalData->GetSize(); i < sz; i++) {
CJS_GlobalData_Element* pData = m_pGlobalData->GetAt(i);
- ASSERT(pData != NULL);
-
switch (pData->data.nType) {
case JS_GLOBALDATA_TYPE_NUMBER:
SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER,
@@ -380,12 +376,8 @@ void JSGlobalAlternate::ObjectToArray(IJS_Context* cc,
void JSGlobalAlternate::PutObjectProperty(v8::Local<v8::Object> pObj,
CJS_KeyValue* pData) {
- ASSERT(pData != NULL);
-
for (int i = 0, sz = pData->objData.Count(); i < sz; i++) {
CJS_KeyValue* pObjData = pData->objData.GetAt(i);
- ASSERT(pObjData != NULL);
-
switch (pObjData->nType) {
case JS_GLOBALDATA_TYPE_NUMBER:
FXJS_PutObjectNumber(NULL, pObj, pObjData->sKey.UTF8Decode().c_str(),