summaryrefslogtreecommitdiff
path: root/fpdfsdk/javascript
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/javascript')
-rw-r--r--fpdfsdk/javascript/Document.cpp8
-rw-r--r--fpdfsdk/javascript/Field.cpp20
-rw-r--r--fpdfsdk/javascript/Icon.cpp2
-rw-r--r--fpdfsdk/javascript/JS_EventHandler.cpp36
-rw-r--r--fpdfsdk/javascript/JS_GlobalData.cpp2
-rw-r--r--fpdfsdk/javascript/JS_Object.cpp4
-rw-r--r--fpdfsdk/javascript/JS_Value.cpp2
-rw-r--r--fpdfsdk/javascript/cjs_runtime.cpp4
-rw-r--r--fpdfsdk/javascript/global.cpp30
9 files changed, 55 insertions, 53 deletions
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 12d8c2df31..076e99849e 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -147,8 +147,8 @@ void CJS_Document::InitInstance(IJS_Runtime* pIRuntime) {
Document::Document(CJS_Object* pJSObject)
: CJS_EmbedObj(pJSObject),
- m_isolate(NULL),
- m_pDocument(NULL),
+ m_isolate(nullptr),
+ m_pDocument(nullptr),
m_cwBaseURL(L""),
m_bDelay(FALSE) {}
@@ -715,8 +715,8 @@ FX_BOOL Document::mailDoc(IJS_Context* cc,
pRuntime->BeginBlock();
CPDFDoc_Environment* pEnv = pRuntime->GetReaderApp();
- pEnv->JS_docmailForm(NULL, 0, bUI, cTo.c_str(), cSubject.c_str(), cCc.c_str(),
- cBcc.c_str(), cMsg.c_str());
+ pEnv->JS_docmailForm(nullptr, 0, bUI, cTo.c_str(), cSubject.c_str(),
+ cCc.c_str(), cBcc.c_str(), cMsg.c_str());
pRuntime->EndBlock();
return TRUE;
diff --git a/fpdfsdk/javascript/Field.cpp b/fpdfsdk/javascript/Field.cpp
index 5808982b43..43bc89e26e 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -122,12 +122,12 @@ void CJS_Field::InitInstance(IJS_Runtime* pIRuntime) {
Field::Field(CJS_Object* pJSObject)
: CJS_EmbedObj(pJSObject),
- m_pJSDoc(NULL),
- m_pDocument(NULL),
+ m_pJSDoc(nullptr),
+ m_pDocument(nullptr),
m_nFormControlIndex(-1),
m_bCanSet(FALSE),
m_bDelay(FALSE),
- m_isolate(NULL) {}
+ m_isolate(nullptr) {}
Field::~Field() {}
@@ -262,16 +262,16 @@ void Field::UpdateFormControl(CPDFSDK_Document* pDocument,
if (bFormated)
pWidget->ResetAppearance(sValue.c_str(), FALSE);
else
- pWidget->ResetAppearance(NULL, FALSE);
+ pWidget->ResetAppearance(nullptr, FALSE);
} else {
- pWidget->ResetAppearance(NULL, FALSE);
+ pWidget->ResetAppearance(nullptr, FALSE);
}
}
if (bRefresh) {
CPDFSDK_InterForm* pInterForm = pWidget->GetInterForm();
CPDFSDK_Document* pDoc = pInterForm->GetDocument();
- pDoc->UpdateAllViews(NULL, pWidget);
+ pDoc->UpdateAllViews(nullptr, pWidget);
}
}
@@ -299,7 +299,7 @@ FX_BOOL Field::ValueIsOccur(CPDF_FormField* pFormField,
CPDF_FormControl* Field::GetSmartFieldControl(CPDF_FormField* pFormField) {
if (!pFormField->CountControls() ||
m_nFormControlIndex >= pFormField->CountControls())
- return NULL;
+ return nullptr;
if (m_nFormControlIndex < 0)
return pFormField->GetControl(0);
@@ -2956,7 +2956,7 @@ FX_BOOL Field::buttonGetIcon(IJS_Context* cc,
CJS_Icon* pJS_Icon = (CJS_Icon*)FXJS_GetPrivate(pRuntime->GetIsolate(), pObj);
Icon* pIcon = (Icon*)pJS_Icon->GetEmbedObject();
- CPDF_Stream* pIconStream = NULL;
+ CPDF_Stream* pIconStream = nullptr;
if (nface == 0)
pIconStream = pFormControl->GetNormalIcon();
else if (nface == 1)
@@ -3254,7 +3254,7 @@ FX_BOOL Field::setFocus(IJS_Context* cc,
CPDFSDK_InterForm* pInterForm =
(CPDFSDK_InterForm*)m_pDocument->GetInterForm();
- CPDFSDK_Widget* pWidget = NULL;
+ CPDFSDK_Widget* pWidget = nullptr;
if (nCount == 1) {
pWidget = pInterForm->GetWidget(pFormField->GetControl(0));
} else {
@@ -3343,7 +3343,7 @@ FX_BOOL Field::source(IJS_Context* cc,
CJS_PropValue& vp,
CFX_WideString& sError) {
if (vp.IsGetting()) {
- vp << (CJS_Object*)NULL;
+ vp << (CJS_Object*)nullptr;
}
return TRUE;
diff --git a/fpdfsdk/javascript/Icon.cpp b/fpdfsdk/javascript/Icon.cpp
index 7dde8bf0b5..031ec4f63a 100644
--- a/fpdfsdk/javascript/Icon.cpp
+++ b/fpdfsdk/javascript/Icon.cpp
@@ -23,7 +23,7 @@ END_JS_STATIC_METHOD()
IMPLEMENT_JS_CLASS(CJS_Icon, Icon)
Icon::Icon(CJS_Object* pJSObject)
- : CJS_EmbedObj(pJSObject), m_pIconStream(NULL), m_swIconName(L"") {}
+ : CJS_EmbedObj(pJSObject), m_pIconStream(nullptr), m_swIconName(L"") {}
Icon::~Icon() {}
diff --git a/fpdfsdk/javascript/JS_EventHandler.cpp b/fpdfsdk/javascript/JS_EventHandler.cpp
index 5984946f6d..8dc1b8270c 100644
--- a/fpdfsdk/javascript/JS_EventHandler.cpp
+++ b/fpdfsdk/javascript/JS_EventHandler.cpp
@@ -18,24 +18,24 @@ CJS_EventHandler::CJS_EventHandler(CJS_Context* pContext)
: m_pJSContext(pContext),
m_eEventType(JET_UNKNOWN),
m_bValid(FALSE),
- m_pWideStrChange(NULL),
+ m_pWideStrChange(nullptr),
m_nCommitKey(-1),
m_bKeyDown(FALSE),
m_bModifier(FALSE),
m_bShift(FALSE),
- m_pISelEnd(NULL),
+ m_pISelEnd(nullptr),
m_nSelEndDu(0),
- m_pISelStart(NULL),
+ m_pISelStart(nullptr),
m_nSelStartDu(0),
m_bWillCommit(FALSE),
- m_pValue(NULL),
+ m_pValue(nullptr),
m_bFieldFull(FALSE),
- m_pbRc(NULL),
+ m_pbRc(nullptr),
m_bRcDu(FALSE),
- m_pSourceDoc(NULL),
- m_pTargetBookMark(NULL),
- m_pTargetDoc(NULL),
- m_pTargetAnnot(NULL) {}
+ m_pSourceDoc(nullptr),
+ m_pTargetBookMark(nullptr),
+ m_pTargetDoc(nullptr),
+ m_pTargetAnnot(nullptr) {}
CJS_EventHandler::~CJS_EventHandler() {}
@@ -382,27 +382,27 @@ void CJS_EventHandler::Initial(JS_EVENT_T type) {
m_strTargetName = L"";
m_strSourceName = L"";
- m_pWideStrChange = NULL;
+ m_pWideStrChange = nullptr;
m_WideStrChangeDu = L"";
m_WideStrChangeEx = L"";
m_nCommitKey = -1;
m_bKeyDown = FALSE;
m_bModifier = FALSE;
m_bShift = FALSE;
- m_pISelEnd = NULL;
+ m_pISelEnd = nullptr;
m_nSelEndDu = 0;
- m_pISelStart = NULL;
+ m_pISelStart = nullptr;
m_nSelStartDu = 0;
m_bWillCommit = FALSE;
- m_pValue = NULL;
+ m_pValue = nullptr;
m_bFieldFull = FALSE;
- m_pbRc = NULL;
+ m_pbRc = nullptr;
m_bRcDu = FALSE;
- m_pSourceDoc = NULL;
- m_pTargetBookMark = NULL;
- m_pTargetDoc = NULL;
- m_pTargetAnnot = NULL;
+ m_pSourceDoc = nullptr;
+ m_pTargetBookMark = nullptr;
+ m_pTargetDoc = nullptr;
+ m_pTargetAnnot = nullptr;
m_bValid = TRUE;
}
diff --git a/fpdfsdk/javascript/JS_GlobalData.cpp b/fpdfsdk/javascript/JS_GlobalData.cpp
index b34bf0907e..aaa25ff474 100644
--- a/fpdfsdk/javascript/JS_GlobalData.cpp
+++ b/fpdfsdk/javascript/JS_GlobalData.cpp
@@ -280,7 +280,7 @@ CJS_GlobalData_Element* CJS_GlobalData::GetAt(int index) const {
}
void CJS_GlobalData::LoadGlobalPersistentVariables() {
- uint8_t* pBuffer = NULL;
+ uint8_t* pBuffer = nullptr;
int32_t nLength = 0;
LoadFileBuffer(m_sFilePath.c_str(), pBuffer, nLength);
diff --git a/fpdfsdk/javascript/JS_Object.cpp b/fpdfsdk/javascript/JS_Object.cpp
index 7dc91a7291..6339bb7359 100644
--- a/fpdfsdk/javascript/JS_Object.cpp
+++ b/fpdfsdk/javascript/JS_Object.cpp
@@ -31,7 +31,7 @@ int FXJS_MsgBox(CPDFDoc_Environment* pApp,
CJS_EmbedObj::CJS_EmbedObj(CJS_Object* pJSObject) : m_pJSObject(pJSObject) {}
CJS_EmbedObj::~CJS_EmbedObj() {
- m_pJSObject = NULL;
+ m_pJSObject = nullptr;
}
int CJS_EmbedObj::MsgBox(CPDFDoc_Environment* pApp,
@@ -87,7 +87,7 @@ void CJS_Object::Alert(CJS_Context* pContext, const FX_WCHAR* swMsg) {
if (pContext->IsMsgBoxEnabled()) {
CPDFDoc_Environment* pApp = pContext->GetReaderApp();
if (pApp)
- pApp->JS_appAlert(swMsg, NULL, 0, 3);
+ pApp->JS_appAlert(swMsg, nullptr, 0, 3);
}
}
diff --git a/fpdfsdk/javascript/JS_Value.cpp b/fpdfsdk/javascript/JS_Value.cpp
index b01ee586e1..1b8964bd00 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -753,7 +753,7 @@ int _DateFromTime(double t) {
double JS_GetDateTime() {
if (!FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS))
return 0;
- time_t t = time(NULL);
+ time_t t = time(nullptr);
struct tm* pTm = localtime(&t);
int year = pTm->tm_year + 1900;
diff --git a/fpdfsdk/javascript/cjs_runtime.cpp b/fpdfsdk/javascript/cjs_runtime.cpp
index 2c0ed32bd6..69d61dc940 100644
--- a/fpdfsdk/javascript/cjs_runtime.cpp
+++ b/fpdfsdk/javascript/cjs_runtime.cpp
@@ -52,9 +52,9 @@ CJS_Runtime* CJS_Runtime::FromContext(const IJS_Context* cc) {
CJS_Runtime::CJS_Runtime(CPDFDoc_Environment* pApp)
: m_pApp(pApp),
- m_pDocument(NULL),
+ m_pDocument(nullptr),
m_bBlocking(FALSE),
- m_isolate(NULL),
+ m_isolate(nullptr),
m_isolateManaged(false) {
#ifndef PDF_ENABLE_XFA
IPDF_JSPLATFORM* pPlatform = m_pApp->GetFormFillInfo()->m_pJsPlatform;
diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp
index 043bd290ac..32498e474c 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -94,7 +94,7 @@ void CJS_Global::InitInstance(IJS_Runtime* pIRuntime) {
}
JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject)
- : CJS_EmbedObj(pJSObject), m_pApp(NULL) {}
+ : CJS_EmbedObj(pJSObject), m_pApp(nullptr) {}
JSGlobalAlternate::~JSGlobalAlternate() {
DestroyGlobalPersisitentVariables();
@@ -232,14 +232,14 @@ void JSGlobalAlternate::UpdateGlobalPersistentVariables() {
SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NUMBER,
pData->data.dData, false, "",
v8::Local<v8::Object>(), pData->bPersistent == 1);
- FXJS_PutObjectNumber(NULL, m_pJSObject->ToV8Object(),
+ FXJS_PutObjectNumber(nullptr, m_pJSObject->ToV8Object(),
pData->data.sKey.UTF8Decode(), pData->data.dData);
break;
case JS_GLOBALDATA_TYPE_BOOLEAN:
SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_BOOLEAN, 0,
(bool)(pData->data.bData == 1), "",
v8::Local<v8::Object>(), pData->bPersistent == 1);
- FXJS_PutObjectBoolean(NULL, m_pJSObject->ToV8Object(),
+ FXJS_PutObjectBoolean(nullptr, m_pJSObject->ToV8Object(),
pData->data.sKey.UTF8Decode(),
(bool)(pData->data.bData == 1));
break;
@@ -247,26 +247,27 @@ void JSGlobalAlternate::UpdateGlobalPersistentVariables() {
SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_STRING, 0,
false, pData->data.sData, v8::Local<v8::Object>(),
pData->bPersistent == 1);
- FXJS_PutObjectString(NULL, m_pJSObject->ToV8Object(),
+ FXJS_PutObjectString(nullptr, m_pJSObject->ToV8Object(),
pData->data.sKey.UTF8Decode(),
pData->data.sData.UTF8Decode());
break;
case JS_GLOBALDATA_TYPE_OBJECT: {
v8::Isolate* pRuntime = m_pJSObject->ToV8Object()->GetIsolate();
- v8::Local<v8::Object> pObj = FXJS_NewFxDynamicObj(pRuntime, NULL, -1);
+ v8::Local<v8::Object> pObj =
+ FXJS_NewFxDynamicObj(pRuntime, nullptr, -1);
PutObjectProperty(pObj, &pData->data);
SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_OBJECT, 0,
false, "", pObj, pData->bPersistent == 1);
- FXJS_PutObjectObject(NULL, m_pJSObject->ToV8Object(),
+ FXJS_PutObjectObject(nullptr, m_pJSObject->ToV8Object(),
pData->data.sKey.UTF8Decode(), pObj);
} break;
case JS_GLOBALDATA_TYPE_NULL:
SetGlobalVariables(pData->data.sKey, JS_GLOBALDATA_TYPE_NULL, 0, false,
"", v8::Local<v8::Object>(),
pData->bPersistent == 1);
- FXJS_PutObjectNull(NULL, m_pJSObject->ToV8Object(),
+ FXJS_PutObjectNull(nullptr, m_pJSObject->ToV8Object(),
pData->data.sKey.UTF8Decode());
break;
}
@@ -373,26 +374,27 @@ void JSGlobalAlternate::PutObjectProperty(v8::Local<v8::Object> pObj,
CJS_KeyValue* pObjData = pData->objData.GetAt(i);
switch (pObjData->nType) {
case JS_GLOBALDATA_TYPE_NUMBER:
- FXJS_PutObjectNumber(NULL, pObj, pObjData->sKey.UTF8Decode(),
+ FXJS_PutObjectNumber(nullptr, pObj, pObjData->sKey.UTF8Decode(),
pObjData->dData);
break;
case JS_GLOBALDATA_TYPE_BOOLEAN:
- FXJS_PutObjectBoolean(NULL, pObj, pObjData->sKey.UTF8Decode(),
+ FXJS_PutObjectBoolean(nullptr, pObj, pObjData->sKey.UTF8Decode(),
pObjData->bData == 1);
break;
case JS_GLOBALDATA_TYPE_STRING:
- FXJS_PutObjectString(NULL, pObj, pObjData->sKey.UTF8Decode(),
+ FXJS_PutObjectString(nullptr, pObj, pObjData->sKey.UTF8Decode(),
pObjData->sData.UTF8Decode());
break;
case JS_GLOBALDATA_TYPE_OBJECT: {
v8::Isolate* pRuntime = m_pJSObject->ToV8Object()->GetIsolate();
v8::Local<v8::Object> pNewObj =
- FXJS_NewFxDynamicObj(pRuntime, NULL, -1);
+ FXJS_NewFxDynamicObj(pRuntime, nullptr, -1);
PutObjectProperty(pNewObj, pObjData);
- FXJS_PutObjectObject(NULL, pObj, pObjData->sKey.UTF8Decode(), pNewObj);
+ FXJS_PutObjectObject(nullptr, pObj, pObjData->sKey.UTF8Decode(),
+ pNewObj);
} break;
case JS_GLOBALDATA_TYPE_NULL:
- FXJS_PutObjectNull(NULL, pObj, pObjData->sKey.UTF8Decode());
+ FXJS_PutObjectNull(nullptr, pObj, pObjData->sKey.UTF8Decode());
break;
}
}
@@ -447,7 +449,7 @@ FX_BOOL JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname,
return TRUE;
}
- JSGlobalData* pNewData = NULL;
+ JSGlobalData* pNewData = nullptr;
switch (nType) {
case JS_GLOBALDATA_TYPE_NUMBER: {