Get rid of NULLs in fpdfsdk/
Review-Url: https://codereview.chromium.org/2031653003
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index 4c74d5a..9102b7b 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -16,9 +16,9 @@
CBA_FontMap::CBA_FontMap(CPDFSDK_Annot* pAnnot,
CFX_SystemHandler* pSystemHandler)
: CPWL_FontMap(pSystemHandler),
- m_pDocument(NULL),
- m_pAnnotDict(NULL),
- m_pDefaultFont(NULL),
+ m_pDocument(nullptr),
+ m_pAnnotDict(nullptr),
+ m_pDefaultFont(nullptr),
m_sAPType("N") {
CPDF_Page* pPage = pAnnot->GetPDFPage();
@@ -31,7 +31,7 @@
void CBA_FontMap::Reset() {
Empty();
- m_pDefaultFont = NULL;
+ m_pDefaultFont = nullptr;
m_sDefaultFontName = "";
}
@@ -83,20 +83,20 @@
CPDF_Document* pDocument = GetDocument();
CPDF_Dictionary* pRootDict = pDocument->GetRoot();
if (!pRootDict)
- return NULL;
+ return nullptr;
CPDF_Dictionary* pAcroFormDict = pRootDict->GetDictBy("AcroForm");
if (!pAcroFormDict)
- return NULL;
+ return nullptr;
CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictBy("DR");
if (!pDRDict)
- return NULL;
+ return nullptr;
return FindResFontSameCharset(pDRDict, sFontAlias, nCharset);
}
- return NULL;
+ return nullptr;
}
CPDF_Document* CBA_FontMap::GetDocument() {
@@ -107,14 +107,14 @@
CFX_ByteString& sFontAlias,
int32_t nCharset) {
if (!pResDict)
- return NULL;
+ return nullptr;
CPDF_Dictionary* pFonts = pResDict->GetDictBy("Font");
if (!pFonts)
- return NULL;
+ return nullptr;
CPDF_Document* pDocument = GetDocument();
- CPDF_Font* pFind = NULL;
+ CPDF_Font* pFind = nullptr;
for (const auto& it : *pFonts) {
const CFX_ByteString& csKey = it.first;
CPDF_Object* pObj = it.second;
@@ -165,7 +165,7 @@
CPDF_Stream* pStream = pAPDict->GetStreamBy(m_sAPType);
if (!pStream) {
- pStream = new CPDF_Stream(NULL, 0, NULL);
+ pStream = new CPDF_Stream(nullptr, 0, nullptr);
int32_t objnum = m_pDocument->AddIndirectObject(pStream);
pAPDict->SetAtReference(m_sAPType, m_pDocument, objnum);
}
@@ -174,7 +174,7 @@
if (!pStreamDict) {
pStreamDict = new CPDF_Dictionary;
- pStream->InitStream(NULL, 0, pStreamDict);
+ pStream->InitStream(nullptr, 0, pStreamDict);
}
if (pStreamDict) {
@@ -199,7 +199,7 @@
}
CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
- CPDF_Dictionary* pAcroFormDict = NULL;
+ CPDF_Dictionary* pAcroFormDict = nullptr;
const bool bWidget = (m_pAnnotDict->GetStringBy("Subtype") == "Widget");
if (bWidget) {
if (CPDF_Dictionary* pRootDict = m_pDocument->GetRoot())
@@ -218,7 +218,7 @@
}
}
- CPDF_Dictionary* pFontDict = NULL;
+ CPDF_Dictionary* pFontDict = nullptr;
if (!sDA.IsEmpty()) {
CPDF_SimpleParser syntax(sDA.AsStringC());
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index 8b2da62..d489a24 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -14,7 +14,7 @@
#include "fpdfsdk/pdfwindow/PWL_ComboBox.h"
CFFL_ComboBox::CFFL_ComboBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
- : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) {
+ : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(nullptr) {
m_State.nIndex = 0;
m_State.nStart = 0;
m_State.nEnd = 0;
@@ -227,7 +227,7 @@
DestroyPDFWindow(pPageView);
- CPWL_Wnd* pRet = NULL;
+ CPWL_Wnd* pRet = nullptr;
if (bRestoreValue) {
RestoreState(pPageView);
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 8ee6da3..d7bc958 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -88,7 +88,8 @@
} else {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
if (CFFL_IFormFiller::IsVisible(pWidget))
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal,
+ nullptr);
}
}
@@ -98,7 +99,7 @@
CFX_Matrix* pUser2Device,
uint32_t dwFlags) {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
}
void CFFL_FormFiller::OnCreate(CPDFSDK_Annot* pAnnot) {}
@@ -293,7 +294,7 @@
ASSERT(m_pApp);
PWL_CREATEPARAM cp;
- cp.pParentWnd = NULL;
+ cp.pParentWnd = nullptr;
cp.pProvider = this;
cp.rcRectWnd = GetPDFWindowRect();
@@ -690,23 +691,25 @@
CPDF_FormControl::HighlightingMode eHM = pCtrl->GetHighlightingMode();
if (eHM != CPDF_FormControl::Push) {
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
return;
}
if (m_bMouseDown) {
if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Down))
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, NULL);
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Down, nullptr);
else
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal,
+ nullptr);
} else if (m_bMouseIn) {
if (pWidget->IsWidgetAppearanceValid(CPDF_Annot::Rollover))
pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Rollover,
- NULL);
+ nullptr);
else
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal,
+ nullptr);
} else {
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
}
}
diff --git a/fpdfsdk/formfiller/cffl_iformfiller.cpp b/fpdfsdk/formfiller/cffl_iformfiller.cpp
index 9dcc734..107197f 100644
--- a/fpdfsdk/formfiller/cffl_iformfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_iformfiller.cpp
@@ -97,7 +97,7 @@
pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device,
dwFlags);
} else {
- pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL);
+ pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, nullptr);
}
if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget))
diff --git a/fpdfsdk/formfiller/cffl_listbox.cpp b/fpdfsdk/formfiller/cffl_listbox.cpp
index dc4f07d..cbac83c 100644
--- a/fpdfsdk/formfiller/cffl_listbox.cpp
+++ b/fpdfsdk/formfiller/cffl_listbox.cpp
@@ -16,7 +16,7 @@
#define FFL_DEFAULTLISTBOXFONTSIZE 12.0f
CFFL_ListBox::CFFL_ListBox(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pWidget)
- : CFFL_FormFiller(pApp, pWidget), m_pFontMap(NULL) {}
+ : CFFL_FormFiller(pApp, pWidget), m_pFontMap(nullptr) {}
CFFL_ListBox::~CFFL_ListBox() {
delete m_pFontMap;
@@ -193,7 +193,7 @@
DestroyPDFWindow(pPageView);
- CPWL_Wnd* pRet = NULL;
+ CPWL_Wnd* pRet = nullptr;
if (bRestoreValue) {
RestoreState(pPageView);
diff --git a/fpdfsdk/formfiller/cffl_textfield.cpp b/fpdfsdk/formfiller/cffl_textfield.cpp
index 7399651..be1f36b 100644
--- a/fpdfsdk/formfiller/cffl_textfield.cpp
+++ b/fpdfsdk/formfiller/cffl_textfield.cpp
@@ -11,7 +11,7 @@
#include "fpdfsdk/include/fsdk_mgr.h"
CFFL_TextField::CFFL_TextField(CPDFDoc_Environment* pApp, CPDFSDK_Annot* pAnnot)
- : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(NULL) {
+ : CFFL_FormFiller(pApp, pAnnot), m_pFontMap(nullptr) {
m_State.nStart = m_State.nEnd = 0;
}
@@ -30,9 +30,6 @@
cp.dwFlags |= PES_PASSWORD;
}
- if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK)) {
- }
-
if (nFlags & FIELDFLAG_MULTILINE) {
cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP;
@@ -244,7 +241,7 @@
DestroyPDFWindow(pPageView);
- CPWL_Wnd* pRet = NULL;
+ CPWL_Wnd* pRet = nullptr;
if (bRestoreValue) {
RestoreState(pPageView);
diff --git a/fpdfsdk/fpdf_dataavail.cpp b/fpdfsdk/fpdf_dataavail.cpp
index dc6efbc..878271e 100644
--- a/fpdfsdk/fpdf_dataavail.cpp
+++ b/fpdfsdk/fpdf_dataavail.cpp
@@ -37,7 +37,7 @@
class CFPDF_FileAvailWrap : public IPDF_DataAvail::FileAvail {
public:
- CFPDF_FileAvailWrap() { m_pfileAvail = NULL; }
+ CFPDF_FileAvailWrap() { m_pfileAvail = nullptr; }
~CFPDF_FileAvailWrap() override {}
void Set(FX_FILEAVAIL* pfileAvail) { m_pfileAvail = pfileAvail; }
@@ -53,7 +53,7 @@
class CFPDF_FileAccessWrap : public IFX_FileRead {
public:
- CFPDF_FileAccessWrap() { m_pFileAccess = NULL; }
+ CFPDF_FileAccessWrap() { m_pFileAccess = nullptr; }
~CFPDF_FileAccessWrap() override {}
void Set(FPDF_FILEACCESS* pFile) { m_pFileAccess = pFile; }
@@ -91,7 +91,7 @@
class CFPDF_DataAvail {
public:
- CFPDF_DataAvail() { m_pDataAvail = NULL; }
+ CFPDF_DataAvail() { m_pDataAvail = nullptr; }
~CFPDF_DataAvail() { delete m_pDataAvail; }
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index 0a76a0d..d262e3c 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -156,7 +156,7 @@
}
if (pNameDict && pNameDict->KeyExist("JavaScript")) {
CPDF_Dictionary* pJSDict = pNameDict->GetDictBy("JavaScript");
- CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayBy("Names") : NULL;
+ CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayBy("Names") : nullptr;
if (pArray) {
for (size_t i = 0; i < pArray->GetCount(); i++) {
CFX_ByteString cbStr = pArray->GetStringAt(i);
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index 2764625..bc1a1cc 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -195,7 +195,8 @@
if (!pContentsObj) {
// Create a new contents dictionary
if (!key.IsEmpty()) {
- CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, new CPDF_Dictionary);
+ CPDF_Stream* pNewContents =
+ new CPDF_Stream(nullptr, 0, new CPDF_Dictionary);
pPage->SetAtReference("Contents", pDocument,
pDocument->AddIndirectObject(pNewContents));
@@ -207,7 +208,7 @@
return;
}
- CPDF_Array* pContentsArray = NULL;
+ CPDF_Array* pContentsArray = nullptr;
switch (pContentsObj->GetType()) {
case CPDF_Object::STREAM: {
@@ -240,7 +241,8 @@
pPage->SetAtReference("Contents", pDocument, dwObjNum);
if (!key.IsEmpty()) {
- CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, new CPDF_Dictionary);
+ CPDF_Stream* pNewContents =
+ new CPDF_Stream(nullptr, 0, new CPDF_Dictionary);
dwObjNum = pDocument->AddIndirectObject(pNewContents);
pContentsArray->AddReference(pDocument, dwObjNum);
@@ -377,7 +379,7 @@
pPageDict->SetAt("Resources", pRes);
}
- CPDF_Stream* pNewXObject = new CPDF_Stream(NULL, 0, new CPDF_Dictionary);
+ CPDF_Stream* pNewXObject = new CPDF_Stream(nullptr, 0, new CPDF_Dictionary);
uint32_t dwObjNum = pDocument->AddIndirectObject(pNewXObject);
CPDF_Dictionary* pPageXObject = pRes->GetDictBy("XObject");
if (!pPageXObject) {
@@ -400,7 +402,7 @@
SetPageContents(key, pPageDict, pDocument);
- CPDF_Dictionary* pNewXORes = NULL;
+ CPDF_Dictionary* pNewXORes = nullptr;
if (!key.IsEmpty()) {
pPageXObject->SetAtReference(key, pDocument, dwObjNum);
diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp
index 9d05903..2a309d9 100644
--- a/fpdfsdk/fpdf_sysfontinfo.cpp
+++ b/fpdfsdk/fpdf_sysfontinfo.cpp
@@ -36,13 +36,13 @@
if (m_pInfo->MapFont)
return m_pInfo->MapFont(m_pInfo, weight, bItalic, charset, pitch_family,
family, &iExact);
- return NULL;
+ return nullptr;
}
void* GetFont(const FX_CHAR* family) override {
if (m_pInfo->GetFont)
return m_pInfo->GetFont(m_pInfo, family);
- return NULL;
+ return nullptr;
}
uint32_t GetFontData(void* hFont,
@@ -57,7 +57,7 @@
FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) override {
if (!m_pInfo->GetFaceName)
return FALSE;
- uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, NULL, 0);
+ uint32_t size = m_pInfo->GetFaceName(m_pInfo, hFont, nullptr, 0);
if (size == 0)
return FALSE;
char* buffer = FX_Alloc(char, size);
diff --git a/fpdfsdk/fpdfdoc.cpp b/fpdfsdk/fpdfdoc.cpp
index 0f69340..0cf222d 100644
--- a/fpdfsdk/fpdfdoc.cpp
+++ b/fpdfsdk/fpdfdoc.cpp
@@ -130,7 +130,7 @@
DLLEXPORT FPDF_ACTION STDCALL FPDFBookmark_GetAction(FPDF_BOOKMARK pDict) {
if (!pDict)
- return NULL;
+ return nullptr;
CPDF_Bookmark bookmark(ToDictionary(static_cast<CPDF_Object*>(pDict)));
return bookmark.GetAction().GetDict();
}
diff --git a/fpdfsdk/fpdfeditimg.cpp b/fpdfsdk/fpdfeditimg.cpp
index c189f23..4429dcd 100644
--- a/fpdfsdk/fpdfeditimg.cpp
+++ b/fpdfsdk/fpdfeditimg.cpp
@@ -38,7 +38,7 @@
CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]);
if (!pPage)
continue;
- pImgObj->m_pImage->ResetCache(pPage, NULL);
+ pImgObj->m_pImage->ResetCache(pPage, nullptr);
}
pImgObj->m_pImage->SetJpegImage(pFile);
@@ -71,7 +71,7 @@
FPDF_BITMAP bitmap) {
if (!image_object || !bitmap || !pages)
return FALSE;
- CFX_DIBitmap* pBmp = NULL;
+ CFX_DIBitmap* pBmp = nullptr;
pBmp = (CFX_DIBitmap*)bitmap;
CPDF_ImageObject* pImgObj = (CPDF_ImageObject*)image_object;
pImgObj->m_GeneralState.GetModify();
@@ -79,7 +79,7 @@
CPDF_Page* pPage = CPDFPageFromFPDFPage(pages[index]);
if (!pPage)
continue;
- pImgObj->m_pImage->ResetCache(pPage, NULL);
+ pImgObj->m_pImage->ResetCache(pPage, nullptr);
}
pImgObj->m_pImage->SetImage(pBmp, FALSE);
pImgObj->CalcBoundingBox();
diff --git a/fpdfsdk/fpdfeditpage.cpp b/fpdfsdk/fpdfeditpage.cpp
index 576d9fb..6f71a86 100644
--- a/fpdfsdk/fpdfeditpage.cpp
+++ b/fpdfsdk/fpdfeditpage.cpp
@@ -53,7 +53,7 @@
}
}
- CPDF_Dictionary* pInfoDict = NULL;
+ CPDF_Dictionary* pInfoDict = nullptr;
pInfoDict = pDoc->GetInfo();
if (pInfoDict) {
if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS))
@@ -84,7 +84,7 @@
CPDF_Dictionary* pPageDict = pDoc->CreateNewPage(page_index);
if (!pPageDict)
- return NULL;
+ return nullptr;
CPDF_Array* pMediaBoxArray = new CPDF_Array;
pMediaBoxArray->Add(new CPDF_Number(0));
pMediaBoxArray->Add(new CPDF_Number(0));
@@ -218,7 +218,7 @@
return TRUE;
CPDF_Dictionary* pSMaskDict =
- pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : NULL;
+ pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : nullptr;
if (pSMaskDict)
return TRUE;
@@ -291,8 +291,7 @@
CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d,
(FX_FLOAT)e, (FX_FLOAT)f);
rect.Transform(&matrix);
- CPDF_Array* pRectArray = NULL;
- pRectArray = pAnnot->GetAnnotDict()->GetArrayBy("Rect");
+ CPDF_Array* pRectArray = pAnnot->GetAnnotDict()->GetArrayBy("Rect");
if (!pRectArray)
pRectArray = new CPDF_Array;
pRectArray->SetAt(0, new CPDF_Number(rect.left));
diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp
index 2631eb3..c9c2c39 100644
--- a/fpdfsdk/fpdfformfill.cpp
+++ b/fpdfsdk/fpdfformfill.cpp
@@ -139,7 +139,7 @@
pDevice->RestoreState(false);
delete options.m_pOCContext;
#ifdef PDF_ENABLE_XFA
- options.m_pOCContext = NULL;
+ options.m_pOCContext = nullptr;
#endif // PDF_ENABLE_XFA
}
@@ -266,7 +266,7 @@
pApp->RemoveFormFillEnv(pEnv);
#else // PDF_ENABLE_XFA
if (CPDFSDK_Document* pSDKDoc = pEnv->GetSDKDocument()) {
- pEnv->SetSDKDocument(NULL);
+ pEnv->SetSDKDocument(nullptr);
delete pSDKDoc;
}
#endif // PDF_ENABLE_XFA
diff --git a/fpdfsdk/fpdfsave.cpp b/fpdfsdk/fpdfsave.cpp
index 9a00653..36f553e 100644
--- a/fpdfsdk/fpdfsave.cpp
+++ b/fpdfsdk/fpdfsave.cpp
@@ -49,7 +49,7 @@
};
CFX_IFileWrite::CFX_IFileWrite() {
- m_pFileWriteStruct = NULL;
+ m_pFileWriteStruct = nullptr;
}
FX_BOOL CFX_IFileWrite::Init(FPDF_FILEWRITE* pFileWriteStruct) {
@@ -140,8 +140,8 @@
ScopedFileStream pTemplate(FX_CreateMemoryStream(pData, dwSize2));
pContext->UpdateChecksum(pTemplate.get());
}
- CPDF_Stream* pFormStream = NULL;
- CPDF_Stream* pDataSetsStream = NULL;
+ CPDF_Stream* pFormStream = nullptr;
+ CPDF_Stream* pDataSetsStream = nullptr;
if (iFormIndex != -1) {
// Get form CPDF_Stream
CPDF_Object* pFormPDFObj = pArray->GetObjectAt(iFormIndex);
@@ -182,7 +182,7 @@
if (pDataSetsStream)
pDataSetsStream->InitStreamFromFile(pDsfileWrite.get(), pDataDict);
} else {
- CPDF_Stream* pData = new CPDF_Stream(NULL, 0, NULL);
+ CPDF_Stream* pData = new CPDF_Stream(nullptr, 0, nullptr);
pData->InitStreamFromFile(pDsfileWrite.get(), pDataDict);
pPDFDocument->AddIndirectObject(pData);
iLast = pArray->GetCount() - 2;
@@ -203,7 +203,7 @@
if (pFormStream)
pFormStream->InitStreamFromFile(pfileWrite.get(), pDataDict);
} else {
- CPDF_Stream* pData = new CPDF_Stream(NULL, 0, NULL);
+ CPDF_Stream* pData = new CPDF_Stream(nullptr, 0, nullptr);
pData->InitStreamFromFile(pfileWrite.get(), pDataDict);
pPDFDocument->AddIndirectObject(pData);
iLast = pArray->GetCount() - 2;
@@ -290,8 +290,7 @@
FileMaker.RemoveSecurity();
}
- CFX_IFileWrite* pStreamWrite = NULL;
- pStreamWrite = new CFX_IFileWrite;
+ CFX_IFileWrite* pStreamWrite = new CFX_IFileWrite;
pStreamWrite->Init(pFileWrite);
bool bRet = FileMaker.Create(pStreamWrite, flags);
#ifdef PDF_ENABLE_XFA
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index 24cd8ef..9847f15 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -335,12 +335,12 @@
if (error != CPDF_Parser::SUCCESS) {
delete pParser;
ProcessParseError(error);
- return NULL;
+ return nullptr;
}
#ifdef PDF_ENABLE_XFA
CPDF_Document* pPDFDoc = pParser->GetDocument();
if (!pPDFDoc)
- return NULL;
+ return nullptr;
CPDFXFA_App* pProvider = CPDFXFA_App::GetInstance();
return new CPDFXFA_Document(pPDFDoc, pProvider);
@@ -419,10 +419,9 @@
if (error != CPDF_Parser::SUCCESS) {
delete pParser;
ProcessParseError(error);
- return NULL;
+ return nullptr;
}
- CPDF_Document* pDoc = NULL;
- pDoc = pParser ? pParser->GetDocument() : NULL;
+ CPDF_Document* pDoc = pParser ? pParser->GetDocument() : nullptr;
CheckUnSupportError(pDoc, error);
return FPDFDocumentFromCPDFDocument(pParser->GetDocument());
}
@@ -437,10 +436,9 @@
if (error != CPDF_Parser::SUCCESS) {
delete pParser;
ProcessParseError(error);
- return NULL;
+ return nullptr;
}
- CPDF_Document* pDoc = NULL;
- pDoc = pParser ? pParser->GetDocument() : NULL;
+ CPDF_Document* pDoc = pParser ? pParser->GetDocument() : nullptr;
CheckUnSupportError(pDoc, error);
return FPDFDocumentFromCPDFDocument(pParser->GetDocument());
}
@@ -568,7 +566,7 @@
pDst->Create(size_x, size_y, FXDIB_Rgb32);
FXSYS_memset(pDst->GetBuffer(), -1, pitch * size_y);
pDst->CompositeBitmap(0, 0, size_x, size_y, pBitmap, 0, 0,
- FXDIB_BLEND_NORMAL, NULL, FALSE, NULL);
+ FXDIB_BLEND_NORMAL, nullptr, FALSE, nullptr);
WinDC.StretchDIBits(pDst, 0, 0, size_x, size_y);
delete pDst;
} else {
@@ -733,7 +731,7 @@
int alpha) {
std::unique_ptr<CFX_DIBitmap> pBitmap(new CFX_DIBitmap);
if (!pBitmap->Create(width, height, alpha ? FXDIB_Argb : FXDIB_Rgb32)) {
- return NULL;
+ return nullptr;
}
return pBitmap.release();
}
@@ -758,7 +756,7 @@
fx_format = FXDIB_Argb;
break;
default:
- return NULL;
+ return nullptr;
}
CFX_DIBitmap* pBitmap = new CFX_DIBitmap;
pBitmap->Create(width, height, fx_format, (uint8_t*)first_scan, stride);
@@ -864,7 +862,7 @@
pContext->m_pAnnots = new CPDF_AnnotList(pPage);
FX_BOOL bPrinting = pContext->m_pDevice->GetDeviceClass() != FXDC_DISPLAY;
pContext->m_pAnnots->DisplayAnnots(pPage, pContext->m_pContext, bPrinting,
- &matrix, TRUE, NULL);
+ &matrix, TRUE, nullptr);
}
pContext->m_pRenderer = new CPDF_ProgressiveRenderer(
@@ -925,7 +923,7 @@
FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document) {
CPDF_Document* pDoc = CPDFDocumentFromFPDFDocument(document);
if (!pDoc)
- return NULL;
+ return nullptr;
CPDF_ViewerPreferences viewRef(pDoc);
return viewRef.PrintPageRange();
}
@@ -1002,7 +1000,7 @@
if (length == 0) {
if (str->str) {
FX_Free(str->str);
- str->str = NULL;
+ str->str = nullptr;
}
str->len = 0;
return 0;
@@ -1014,9 +1012,6 @@
str->str = FX_Alloc(char, length + 1);
str->str[length] = 0;
- if (str->str == NULL)
- return -1;
-
FXSYS_memcpy(str->str, bstr, length);
str->len = length;
@@ -1029,7 +1024,7 @@
if (str->str) {
FX_Free(str->str);
- str->str = NULL;
+ str->str = nullptr;
}
str->len = 0;
return 0;
diff --git a/fpdfsdk/fpdfview_embeddertest.cpp b/fpdfsdk/fpdfview_embeddertest.cpp
index 80b39b5..820d496 100644
--- a/fpdfsdk/fpdfview_embeddertest.cpp
+++ b/fpdfsdk/fpdfview_embeddertest.cpp
@@ -180,11 +180,11 @@
TEST_F(FPDFViewEmbeddertest, NamedDestsByName) {
EXPECT_TRUE(OpenDocument("named_dests.pdf"));
- // Null pointer returns NULL.
+ // Null pointer returns nullptr.
FPDF_DEST dest = FPDF_GetNamedDestByName(document(), nullptr);
EXPECT_EQ(nullptr, dest);
- // Empty string returns NULL.
+ // Empty string returns nullptr.
dest = FPDF_GetNamedDestByName(document(), "");
EXPECT_EQ(nullptr, dest);
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
index fc15c3b..ffc4e53 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_app.cpp
@@ -14,7 +14,7 @@
#include "xfa/fxfa/include/xfa_ffapp.h"
#include "xfa/fxfa/include/xfa_fontmgr.h"
-CPDFXFA_App* CPDFXFA_App::g_pApp = NULL;
+CPDFXFA_App* CPDFXFA_App::g_pApp = nullptr;
CPDFXFA_App* CPDFXFA_App::GetInstance() {
if (!g_pApp) {
@@ -25,12 +25,12 @@
void CPDFXFA_App::ReleaseInstance() {
delete g_pApp;
- g_pApp = NULL;
+ g_pApp = nullptr;
}
CPDFXFA_App::CPDFXFA_App()
: m_bJavaScriptInitialized(FALSE),
- m_pXFAApp(NULL),
+ m_pXFAApp(nullptr),
m_pIsolate(nullptr),
m_csAppType(JS_STR_VIEWERTYPE_STANDARD) {
m_pEnvList.RemoveAll();
@@ -38,7 +38,7 @@
CPDFXFA_App::~CPDFXFA_App() {
delete m_pXFAApp;
- m_pXFAApp = NULL;
+ m_pXFAApp = nullptr;
FXJSE_Runtime_Release(m_pIsolate);
m_pIsolate = nullptr;
@@ -190,8 +190,8 @@
int nLength = 2048;
char* pBuff = new char[nLength];
nLength = pEnv->JS_appResponse(wsQuestion.c_str(), wsTitle.c_str(),
- wsDefaultAnswer.c_str(), NULL, bMark, pBuff,
- nLength);
+ wsDefaultAnswer.c_str(), nullptr, bMark,
+ pBuff, nLength);
if (nLength > 0) {
nLength = nLength > 2046 ? 2046 : nLength;
pBuff[nLength] = 0;
@@ -350,7 +350,7 @@
}
IFWL_AdapterTimerMgr* CPDFXFA_App::GetTimerMgr() {
- CXFA_FWLAdapterTimerMgr* pAdapter = NULL;
+ CXFA_FWLAdapterTimerMgr* pAdapter = nullptr;
CPDFDoc_Environment* pEnv = m_pEnvList.GetAt(0);
if (pEnv)
pAdapter = new CXFA_FWLAdapterTimerMgr(pEnv);
diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
index f207760..9d8fb42 100644
--- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
+++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp
@@ -127,7 +127,7 @@
return FALSE;
}
- m_pXFADocView->DoLayout(NULL);
+ m_pXFADocView->DoLayout(nullptr);
m_pXFADocView->StopLayout();
m_nLoadStatus = FXFA_LOADSTATUS_LOADED;
@@ -214,7 +214,7 @@
}
void CPDFXFA_Document::RemovePage(CPDFXFA_Page* page) {
- m_XFAPageList.SetAt(page->GetPageIndex(), NULL);
+ m_XFAPageList.SetAt(page->GetPageIndex(), nullptr);
}
CPDFSDK_Document* CPDFXFA_Document::GetSDKDocument(
@@ -257,8 +257,7 @@
FXRect2PDFRect(rt, rcPage);
CPDFXFA_Page* pPage = GetPage(pPageView);
-
- if (pPage == NULL)
+ if (!pPage)
return;
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
@@ -296,10 +295,7 @@
void CPDFXFA_Document::DisplayCaret(CXFA_FFWidget* hWidget,
FX_BOOL bVisible,
const CFX_RectF* pRtAnchor) {
- if (!hWidget || pRtAnchor == NULL)
- return;
-
- if (!m_pXFADoc || !m_pSDKDoc || !m_pXFADocView)
+ if (!hWidget || !pRtAnchor || !m_pXFADoc || !m_pSDKDoc || !m_pXFADocView)
return;
if (m_iDocType != DOCTYPE_DYNAMIC_XFA)
@@ -314,8 +310,7 @@
return;
CPDFXFA_Page* pPage = GetPage(pPageView);
-
- if (pPage == NULL)
+ if (!pPage)
return;
CFX_FloatRect rcCaret;
@@ -485,7 +480,8 @@
menuFlag |= FXFA_MEMU_SELECTALL;
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
- return pEnv && pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, NULL);
+ return pEnv &&
+ pEnv->FFI_PopupMenu(pPage, hWidget, menuFlag, ptPopup, nullptr);
}
void CPDFXFA_Document::PageViewEvent(CXFA_FFPageView* pPageView,
@@ -602,13 +598,11 @@
}
void CPDFXFA_Document::GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) {
- if (hDoc != m_pXFADoc)
+ if (hDoc != m_pXFADoc || !m_pPDFDoc)
return;
- if (m_pPDFDoc == NULL)
- return;
- CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo();
- if (pInfoDict == NULL)
+ CPDF_Dictionary* pInfoDict = m_pPDFDoc->GetInfo();
+ if (!pInfoDict)
return;
CFX_ByteString csTitle = pInfoDict->GetStringBy("Title");
@@ -731,7 +725,7 @@
return;
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
- if (pEnv == NULL)
+ if (!pEnv)
return;
CFX_WideStringC str(bsURL.c_str());
@@ -759,15 +753,15 @@
if (hDoc != m_pXFADoc)
return;
- if (NULL == hWidget) {
- m_pSDKDoc->SetFocusAnnot(NULL);
+ if (!hWidget) {
+ m_pSDKDoc->SetFocusAnnot(nullptr);
return;
}
int pageViewCount = m_pSDKDoc->GetPageViewCount();
for (int i = 0; i < pageViewCount; i++) {
CPDFSDK_PageView* pPageView = m_pSDKDoc->GetPageView(i);
- if (pPageView == NULL)
+ if (!pPageView)
continue;
CPDFSDK_Annot* pAnnot = pPageView->GetAnnotByXFAWidget(hWidget);
if (pAnnot) {
@@ -784,14 +778,12 @@
return;
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
- if (pEnv == NULL)
+ if (!pEnv || !pEnv->GetFormFillInfo() ||
+ !pEnv->GetFormFillInfo()->m_pJsPlatform ||
+ !pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print) {
return;
+ }
- if (!pEnv->GetFormFillInfo() ||
- pEnv->GetFormFillInfo()->m_pJsPlatform == NULL)
- return;
- if (pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print == NULL)
- return;
pEnv->GetFormFillInfo()->m_pJsPlatform->Doc_print(
pEnv->GetFormFillInfo()->m_pJsPlatform,
dwOptions & XFA_PRINTOPT_ShowDialog, nStartPage, nEndPage,
@@ -805,7 +797,7 @@
return;
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
- if (pEnv == NULL)
+ if (!pEnv)
return;
pEnv->FFI_GetURL(this, wsDocURL);
@@ -907,9 +899,7 @@
}
FX_BOOL CPDFXFA_Document::SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) {
- if (!_NotifySubmit(TRUE))
- return FALSE;
- if (NULL == m_pXFADocView)
+ if (!_NotifySubmit(TRUE) || !m_pXFADocView)
return FALSE;
m_pXFADocView->UpdateDocView();
@@ -921,7 +911,7 @@
IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(CXFA_FFDoc* hDoc,
const CFX_WideString& wsLink) {
CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv();
- if (pEnv == NULL)
+ if (!pEnv)
return FALSE;
CFX_ByteString bs = wsLink.UTF16LE_Encode();
int len = bs.GetLength() / sizeof(unsigned short);
@@ -929,8 +919,8 @@
0, (FPDF_WIDESTRING)bs.GetBuffer(len * sizeof(unsigned short)), "rb");
bs.ReleaseBuffer(len * sizeof(unsigned short));
- if (pFileHandler == NULL)
- return NULL;
+ if (!pFileHandler)
+ return nullptr;
return new CFPDF_FileStream(pFileHandler);
}
FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler,
diff --git a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h
index 9cab4d9..90ef6f3 100644
--- a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h
+++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h
@@ -66,7 +66,7 @@
CFX_RectF& rtPopup);
virtual FX_BOOL PopupMenu(CXFA_FFWidget* hWidget,
CFX_PointF ptPopup,
- const CFX_RectF* pRectExclude = NULL);
+ const CFX_RectF* pRectExclude = nullptr);
// dwFlags XFA_PAGEVIEWEVENT_Added, XFA_PAGEVIEWEVENT_Removing
virtual void PageViewEvent(CXFA_FFPageView* pPageView, uint32_t dwFlags);
@@ -177,7 +177,7 @@
virtual CPDF_Document* OpenPDF(CXFA_FFDoc* hDoc,
IFX_FileRead* pFile,
FX_BOOL bTakeOverFile) {
- return NULL;
+ return nullptr;
}
virtual IFX_FileRead* OpenLinkedFile(CXFA_FFDoc* hDoc,
diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp
index 912bc40..bc6bd28 100644
--- a/fpdfsdk/fsdk_actionhandler.cpp
+++ b/fpdfsdk/fsdk_actionhandler.cpp
@@ -223,7 +223,7 @@
CPDFSDK_InterForm* pInterForm = pDocument->GetInterForm();
CPDF_InterForm* pPDFInterForm = pInterForm->GetInterForm();
- return pPDFInterForm->GetFieldByDict(pFieldDict) != NULL;
+ return !!pPDFInterForm->GetFieldByDict(pFieldDict);
}
FX_BOOL CPDFSDK_ActionHandler::ExecuteFieldAction(
diff --git a/fpdfsdk/fsdk_annothandler.cpp b/fpdfsdk/fsdk_annothandler.cpp
index cbcb53e..eda3b49 100644
--- a/fpdfsdk/fsdk_annothandler.cpp
+++ b/fpdfsdk/fsdk_annothandler.cpp
@@ -88,7 +88,7 @@
return pAnnotHandler->NewAnnot(pAnnot, pPageView);
}
- return NULL;
+ return nullptr;
}
#endif // PDF_ENABLE_XFA
@@ -367,8 +367,8 @@
#ifdef PDF_ENABLE_XFA
CPDFSDK_PageView* pPageView = pSDKAnnot->GetPageView();
CPDFXFA_Page* pPage = pPageView->GetPDFXFAPage();
- if (pPage == NULL)
- return NULL;
+ if (!pPage)
+ return nullptr;
if (pPage->GetPDFPage()) { // for pdf annots.
CBA_AnnotIterator ai(pSDKAnnot->GetPageView(), pSDKAnnot->GetType(), "");
CPDFSDK_Annot* pNext =
@@ -441,7 +441,7 @@
#ifdef PDF_ENABLE_XFA
CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CXFA_FFWidget* hWidget,
CPDFSDK_PageView* pPage) {
- return NULL;
+ return nullptr;
}
#endif // PDF_ENABLE_XFA
@@ -653,7 +653,7 @@
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot;
if (!pWidget->IsAppearanceValid())
- pWidget->ResetAppearance(NULL, FALSE);
+ pWidget->ResetAppearance(nullptr, FALSE);
int nFieldType = pWidget->GetFieldType();
if (nFieldType == FIELDTYPE_TEXTFIELD || nFieldType == FIELDTYPE_COMBOBOX) {
@@ -736,7 +736,7 @@
}
FX_BOOL CPDFSDK_XFAAnnotHandler::CanAnswer(CPDFSDK_Annot* pAnnot) {
- return pAnnot->GetXFAWidget() != NULL;
+ return !!pAnnot->GetXFAWidget();
}
void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView,
@@ -744,8 +744,8 @@
CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
uint32_t dwFlags) {
- ASSERT(pPageView != NULL);
- ASSERT(pAnnot != NULL);
+ ASSERT(pPageView);
+ ASSERT(pAnnot);
CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument();
CXFA_FFWidgetHandler* pWidgetHandler = GetXFAWidgetHandler(pAnnot);
@@ -982,7 +982,7 @@
FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot,
CPDFSDK_Annot* pNewAnnot) {
- CXFA_FFWidgetHandler* pWidgetHandler = NULL;
+ CXFA_FFWidgetHandler* pWidgetHandler = nullptr;
if (pOldAnnot)
pWidgetHandler = GetXFAWidgetHandler(pOldAnnot);
@@ -991,7 +991,7 @@
if (pWidgetHandler) {
FX_BOOL bRet = TRUE;
- CXFA_FFWidget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : NULL;
+ CXFA_FFWidget* hWidget = pNewAnnot ? pNewAnnot->GetXFAWidget() : nullptr;
if (hWidget) {
CXFA_FFPageView* pXFAPageView = hWidget->GetPageView();
if (pXFAPageView) {
@@ -1009,23 +1009,23 @@
CXFA_FFWidgetHandler* CPDFSDK_XFAAnnotHandler::GetXFAWidgetHandler(
CPDFSDK_Annot* pAnnot) {
if (!pAnnot)
- return NULL;
+ return nullptr;
CPDFSDK_PageView* pPageView = pAnnot->GetPageView();
if (!pPageView)
- return NULL;
+ return nullptr;
CPDFSDK_Document* pSDKDoc = pPageView->GetSDKDocument();
if (!pSDKDoc)
- return NULL;
+ return nullptr;
CPDFXFA_Document* pDoc = pSDKDoc->GetXFADocument();
if (!pDoc)
- return NULL;
+ return nullptr;
CXFA_FFDocView* pDocView = pDoc->GetXFADocView();
if (!pDocView)
- return NULL;
+ return nullptr;
return pDocView->GetWidgetHandler();
}
diff --git a/fpdfsdk/fsdk_baseannot.cpp b/fpdfsdk/fsdk_baseannot.cpp
index 7dcb663..b628ae6 100644
--- a/fpdfsdk/fsdk_baseannot.cpp
+++ b/fpdfsdk/fsdk_baseannot.cpp
@@ -554,7 +554,7 @@
}
FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid() {
- return m_pAnnot->GetAnnotDict()->GetDictBy("AP") != NULL;
+ return !!m_pAnnot->GetAnnotDict()->GetDictBy("AP");
}
FX_BOOL CPDFSDK_BAAnnot::IsAppearanceValid(CPDF_Annot::AppearanceMode mode) {
@@ -914,7 +914,7 @@
CPDF_RenderOptions* pOptions) {
m_pAnnot->GetAPForm(m_pPageView->GetPDFPage(), CPDF_Annot::Normal);
m_pAnnot->DrawAppearance(m_pPageView->GetPDFPage(), pDevice, pUser2Device,
- CPDF_Annot::Normal, NULL);
+ CPDF_Annot::Normal, nullptr);
}
UnderlyingPageType* CPDFSDK_Annot::GetUnderlyingPage() {
diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp
index 0f1a0ad..65be7c8 100644
--- a/fpdfsdk/fsdk_baseform.cpp
+++ b/fpdfsdk/fsdk_baseform.cpp
@@ -41,8 +41,8 @@
m_nValueAge(0)
#ifdef PDF_ENABLE_XFA
,
- m_hMixXFAWidget(NULL),
- m_pWidgetHandler(NULL)
+ m_hMixXFAWidget(nullptr),
+ m_pWidgetHandler(nullptr)
#endif // PDF_ENABLE_XFA
{
}
@@ -72,7 +72,7 @@
return m_hMixXFAWidget;
}
- return NULL;
+ return nullptr;
}
CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() {
@@ -101,7 +101,7 @@
return m_pWidgetHandler;
}
- return NULL;
+ return nullptr;
}
static XFA_EVENTTYPE GetXFAEventType(PDFSDK_XFAAActionType eXFAAAT) {
@@ -774,7 +774,7 @@
void CPDFSDK_Widget::ResetFieldAppearance(FX_BOOL bValueChanged) {
CPDF_FormField* pFormField = GetFormField();
ASSERT(pFormField);
- m_pInterForm->ResetFieldAppearance(pFormField, NULL, bValueChanged);
+ m_pInterForm->ResetFieldAppearance(pFormField, nullptr, bValueChanged);
}
void CPDFSDK_Widget::DrawAppearance(CFX_RenderDevice* pDevice,
@@ -932,9 +932,9 @@
csDownCaption = pControl->GetDownCaption();
}
- CPDF_Stream* pNormalIcon = NULL;
- CPDF_Stream* pRolloverIcon = NULL;
- CPDF_Stream* pDownIcon = NULL;
+ CPDF_Stream* pNormalIcon = nullptr;
+ CPDF_Stream* pRolloverIcon = nullptr;
+ CPDF_Stream* pDownIcon = nullptr;
if (pControl->HasMKEntry("I")) {
pNormalIcon = pControl->GetNormalIcon();
@@ -1571,7 +1571,7 @@
CFX_FloatRect rcContent = pEdit->GetContentRect();
CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(
- pEdit, CFX_FloatPoint(0.0f, 0.0f), NULL, !bCharArray, subWord);
+ pEdit, CFX_FloatPoint(0.0f, 0.0f), nullptr, !bCharArray, subWord);
if (sEdit.GetLength() > 0) {
sBody << "/Tx BMC\n"
@@ -2487,10 +2487,8 @@
pEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str());
- if (bUrlEncoded) {
+ if (bUrlEncoded)
FX_Free(pBuffer);
- pBuffer = NULL;
- }
return TRUE;
}
@@ -2586,7 +2584,7 @@
void CPDFSDK_InterForm::AfterSelectionChange(CPDF_FormField* pField) {
if (pField->GetFieldType() == FIELDTYPE_LISTBOX) {
OnCalculate(pField);
- ResetFieldAppearance(pField, NULL, TRUE);
+ ResetFieldAppearance(pField, nullptr, TRUE);
UpdateField(pField);
}
}
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index 83fee90..8354393 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -41,7 +41,7 @@
CPDFDoc_Environment::CPDFDoc_Environment(UnderlyingDocumentType* pDoc,
FPDF_FORMFILLINFO* pFFinfo)
- : m_pInfo(pFFinfo), m_pSDKDoc(NULL), m_pUnderlyingDoc(pDoc) {
+ : m_pInfo(pFFinfo), m_pSDKDoc(nullptr), m_pUnderlyingDoc(pDoc) {
m_pSysHandler.reset(new CFX_SystemHandler(this));
}
@@ -202,7 +202,7 @@
IJS_Runtime* CPDFDoc_Environment::GetJSRuntime() {
if (!IsJSInitiated())
- return NULL;
+ return nullptr;
if (!m_pJSRuntime)
m_pJSRuntime.reset(IJS_Runtime::Create(this));
return m_pJSRuntime.get();
@@ -427,7 +427,7 @@
int nFieldType = pWidget->GetFieldType();
if (FIELDTYPE_TEXTFIELD == nFieldType ||
FIELDTYPE_COMBOBOX == nFieldType) {
- m_pEnv->FFI_OnSetFieldInputFocus(NULL, NULL, 0, FALSE);
+ m_pEnv->FFI_OnSetFieldInputFocus(nullptr, nullptr, 0, FALSE);
}
}
@@ -667,7 +667,7 @@
CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(const FX_CHAR* lpSubType,
CPDF_Dictionary* pDict) {
- return NULL;
+ return nullptr;
}
FX_BOOL CPDFSDK_PageView::DeleteAnnot(CPDFSDK_Annot* pAnnot) {
@@ -706,7 +706,7 @@
return m_page->m_pDocument;
#endif // PDF_ENABLE_XFA
}
- return NULL;
+ return nullptr;
}
#ifdef PDF_ENABLE_XFA
@@ -714,7 +714,7 @@
if (m_page) {
return m_page->GetPDFPage();
}
- return NULL;
+ return nullptr;
}
#endif // PDF_ENABLE_XFA
@@ -775,7 +775,7 @@
CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y);
- if (pFXAnnot == NULL)
+ if (!pFXAnnot)
return FALSE;
FX_BOOL bRet =
@@ -794,7 +794,7 @@
CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y);
- if (pFXAnnot == NULL)
+ if (!pFXAnnot)
return FALSE;
FX_BOOL bRet =
@@ -848,7 +848,7 @@
m_bEnterWidget = FALSE;
if (m_CaptureWidget) {
pAnnotHandlerMgr->Annot_OnMouseExit(this, m_CaptureWidget, nFlag);
- m_CaptureWidget = NULL;
+ m_CaptureWidget = nullptr;
}
}
return FALSE;
diff --git a/fpdfsdk/fsdk_rendercontext.cpp b/fpdfsdk/fsdk_rendercontext.cpp
index 3ba6077..0888d6b 100644
--- a/fpdfsdk/fsdk_rendercontext.cpp
+++ b/fpdfsdk/fsdk_rendercontext.cpp
@@ -10,11 +10,11 @@
#include "core/fxge/include/fx_ge.h"
void CRenderContext::Clear() {
- m_pDevice = NULL;
- m_pContext = NULL;
- m_pRenderer = NULL;
- m_pAnnots = NULL;
- m_pOptions = NULL;
+ m_pDevice = nullptr;
+ m_pContext = nullptr;
+ m_pRenderer = nullptr;
+ m_pAnnots = nullptr;
+ m_pOptions = nullptr;
}
CRenderContext::~CRenderContext() {
diff --git a/fpdfsdk/fxedit/fxet_ap.cpp b/fpdfsdk/fxedit/fxet_ap.cpp
index 563acb6..5420b46 100644
--- a/fpdfsdk/fxedit/fxet_ap.cpp
+++ b/fpdfsdk/fxedit/fxet_ap.cpp
@@ -56,12 +56,11 @@
return sRet.MakeString();
}
-CFX_ByteString IFX_Edit::GetEditAppearanceStream(
- IFX_Edit* pEdit,
- const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange /* = NULL*/,
- FX_BOOL bContinuous /* = TRUE*/,
- uint16_t SubWord /* = 0*/) {
+CFX_ByteString IFX_Edit::GetEditAppearanceStream(IFX_Edit* pEdit,
+ const CFX_FloatPoint& ptOffset,
+ const CPVT_WordRange* pRange,
+ FX_BOOL bContinuous,
+ uint16_t SubWord) {
CFX_ByteTextBuf sEditStream, sWords;
CFX_FloatPoint ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f);
diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp
index 0124913..589ac1b 100644
--- a/fpdfsdk/fxedit/fxet_edit.cpp
+++ b/fpdfsdk/fxedit/fxet_edit.cpp
@@ -339,7 +339,7 @@
if (nIndex >= 0 && nIndex < m_UndoItemStack.GetSize())
return m_UndoItemStack.GetAt(nIndex);
- return NULL;
+ return nullptr;
}
void CFX_Edit_Undo::RemoveHeads() {
@@ -576,8 +576,8 @@
if (m_pEdit) {
m_pEdit->SelectNone();
m_pEdit->SetCaret(m_wrSel.BeginPos);
- m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, NULL, NULL, FALSE,
- TRUE);
+ m_pEdit->InsertText(m_swText.c_str(), DEFAULT_CHARSET, nullptr, nullptr,
+ FALSE, TRUE);
m_pEdit->SetSel(m_wrSel.BeginPos, m_wrSel.EndPos);
}
}
@@ -1079,83 +1079,83 @@
FX_BOOL CFX_Edit::SetRichFontIndex(int32_t nFontIndex) {
CPVT_WordProps WordProps;
WordProps.nFontIndex = nFontIndex;
- return SetRichTextProps(EP_FONTINDEX, NULL, &WordProps);
+ return SetRichTextProps(EP_FONTINDEX, nullptr, &WordProps);
}
FX_BOOL CFX_Edit::SetRichFontSize(FX_FLOAT fFontSize) {
CPVT_WordProps WordProps;
WordProps.fFontSize = fFontSize;
- return SetRichTextProps(EP_FONTSIZE, NULL, &WordProps);
+ return SetRichTextProps(EP_FONTSIZE, nullptr, &WordProps);
}
FX_BOOL CFX_Edit::SetRichTextColor(FX_COLORREF dwColor) {
CPVT_WordProps WordProps;
WordProps.dwWordColor = dwColor;
- return SetRichTextProps(EP_WORDCOLOR, NULL, &WordProps);
+ return SetRichTextProps(EP_WORDCOLOR, nullptr, &WordProps);
}
FX_BOOL CFX_Edit::SetRichTextScript(CPDF_VariableText::ScriptType nScriptType) {
CPVT_WordProps WordProps;
WordProps.nScriptType = nScriptType;
- return SetRichTextProps(EP_SCRIPTTYPE, NULL, &WordProps);
+ return SetRichTextProps(EP_SCRIPTTYPE, nullptr, &WordProps);
}
FX_BOOL CFX_Edit::SetRichTextBold(FX_BOOL bBold) {
CPVT_WordProps WordProps;
if (bBold)
WordProps.nWordStyle |= PVTWORD_STYLE_BOLD;
- return SetRichTextProps(EP_BOLD, NULL, &WordProps);
+ return SetRichTextProps(EP_BOLD, nullptr, &WordProps);
}
FX_BOOL CFX_Edit::SetRichTextItalic(FX_BOOL bItalic) {
CPVT_WordProps WordProps;
if (bItalic)
WordProps.nWordStyle |= PVTWORD_STYLE_ITALIC;
- return SetRichTextProps(EP_ITALIC, NULL, &WordProps);
+ return SetRichTextProps(EP_ITALIC, nullptr, &WordProps);
}
FX_BOOL CFX_Edit::SetRichTextUnderline(FX_BOOL bUnderline) {
CPVT_WordProps WordProps;
if (bUnderline)
WordProps.nWordStyle |= PVTWORD_STYLE_UNDERLINE;
- return SetRichTextProps(EP_UNDERLINE, NULL, &WordProps);
+ return SetRichTextProps(EP_UNDERLINE, nullptr, &WordProps);
}
FX_BOOL CFX_Edit::SetRichTextCrossout(FX_BOOL bCrossout) {
CPVT_WordProps WordProps;
if (bCrossout)
WordProps.nWordStyle |= PVTWORD_STYLE_CROSSOUT;
- return SetRichTextProps(EP_CROSSOUT, NULL, &WordProps);
+ return SetRichTextProps(EP_CROSSOUT, nullptr, &WordProps);
}
FX_BOOL CFX_Edit::SetRichTextCharSpace(FX_FLOAT fCharSpace) {
CPVT_WordProps WordProps;
WordProps.fCharSpace = fCharSpace;
- return SetRichTextProps(EP_CHARSPACE, NULL, &WordProps);
+ return SetRichTextProps(EP_CHARSPACE, nullptr, &WordProps);
}
FX_BOOL CFX_Edit::SetRichTextHorzScale(int32_t nHorzScale) {
CPVT_WordProps WordProps;
WordProps.nHorzScale = nHorzScale;
- return SetRichTextProps(EP_HORZSCALE, NULL, &WordProps);
+ return SetRichTextProps(EP_HORZSCALE, nullptr, &WordProps);
}
FX_BOOL CFX_Edit::SetRichTextLineLeading(FX_FLOAT fLineLeading) {
CPVT_SecProps SecProps;
SecProps.fLineLeading = fLineLeading;
- return SetRichTextProps(EP_LINELEADING, &SecProps, NULL);
+ return SetRichTextProps(EP_LINELEADING, &SecProps, nullptr);
}
FX_BOOL CFX_Edit::SetRichTextLineIndent(FX_FLOAT fLineIndent) {
CPVT_SecProps SecProps;
SecProps.fLineIndent = fLineIndent;
- return SetRichTextProps(EP_LINEINDENT, &SecProps, NULL);
+ return SetRichTextProps(EP_LINEINDENT, &SecProps, nullptr);
}
FX_BOOL CFX_Edit::SetRichTextAlignment(int32_t nAlignment) {
CPVT_SecProps SecProps;
SecProps.nAlignment = nAlignment;
- return SetRichTextProps(EP_ALIGNMENT, &SecProps, NULL);
+ return SetRichTextProps(EP_ALIGNMENT, &SecProps, nullptr);
}
FX_BOOL CFX_Edit::SetRichTextProps(EDIT_PROPS_E eProps,
@@ -2961,7 +2961,7 @@
m_Undo.AddItem(m_pGroupUndoItem);
if (m_bOprNotify && m_pOprNotify)
m_pOprNotify->OnAddUndo(m_pGroupUndoItem);
- m_pGroupUndoItem = NULL;
+ m_pGroupUndoItem = nullptr;
}
void CFX_Edit::AddEditUndoItem(CFX_Edit_UndoItem* pEditUndoItem) {
diff --git a/fpdfsdk/fxedit/fxet_list.cpp b/fpdfsdk/fxedit/fxet_list.cpp
index 383b84f..1385d57 100644
--- a/fpdfsdk/fxedit/fxet_list.cpp
+++ b/fpdfsdk/fxedit/fxet_list.cpp
@@ -74,7 +74,7 @@
}
CFX_List::CFX_List()
- : m_fFontSize(0.0f), m_pFontMap(NULL), m_bMultiple(FALSE) {}
+ : m_fFontSize(0.0f), m_pFontMap(nullptr), m_bMultiple(FALSE) {}
CFX_List::~CFX_List() {
Empty();
@@ -125,7 +125,7 @@
return pListItem->GetEdit();
}
- return NULL;
+ return nullptr;
}
int32_t CFX_List::GetCount() const {
@@ -378,7 +378,7 @@
}
CFX_ListCtrl::CFX_ListCtrl()
- : m_pNotify(NULL),
+ : m_pNotify(nullptr),
m_bNotifyFlag(FALSE),
m_ptScrollPos(0.0f, 0.0f),
m_nSelItem(-1),
diff --git a/fpdfsdk/fxedit/fxet_pageobjs.cpp b/fpdfsdk/fxedit/fxet_pageobjs.cpp
index f12fffb..29ad135 100644
--- a/fpdfsdk/fxedit/fxet_pageobjs.cpp
+++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp
@@ -190,7 +190,7 @@
pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom,
rcUnderline.right, rcUnderline.top);
- pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, color, 0,
+ pDevice->DrawPath(&pathUnderline, pUser2Device, nullptr, color, 0,
FXFILL_WINDING);
}
}
@@ -275,7 +275,7 @@
word.ptWord.x, line.ptLine.y + line.fLineDescent,
word.ptWord.x + word.fWidth, line.ptLine.y + line.fLineAscent);
- pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0,
+ pDevice->DrawPath(&pathSelBK, pUser2Device, nullptr, crSelBK, 0,
FXFILL_WINDING);
}
}
@@ -387,7 +387,7 @@
word.ptWord.x + word.fWidth + ptOffset.x,
line.ptLine.y + line.fLineAscent + ptOffset.y);
- pDevice->DrawPath(&pathSelBK, pUser2Device, NULL, crSelBK, 0,
+ pDevice->DrawPath(&pathSelBK, pUser2Device, nullptr, crSelBK, 0,
FXFILL_WINDING);
}
@@ -419,7 +419,7 @@
pathUnderline.AppendRect(rcUnderline.left, rcUnderline.bottom,
rcUnderline.right, rcUnderline.top);
- pDevice->DrawPath(&pathUnderline, pUser2Device, NULL, crCurText, 0,
+ pDevice->DrawPath(&pathUnderline, pUser2Device, nullptr, crCurText, 0,
FXFILL_WINDING);
}
@@ -429,7 +429,7 @@
pathCrossout.AppendRect(rcCrossout.left, rcCrossout.bottom,
rcCrossout.right, rcCrossout.top);
- pDevice->DrawPath(&pathCrossout, pUser2Device, NULL, crCurText, 0,
+ pDevice->DrawPath(&pathCrossout, pUser2Device, nullptr, crCurText, 0,
FXFILL_WINDING);
}
diff --git a/fpdfsdk/fxedit/include/fx_edit.h b/fpdfsdk/fxedit/include/fx_edit.h
index 5f0283f..710c06f 100644
--- a/fpdfsdk/fxedit/include/fx_edit.h
+++ b/fpdfsdk/fxedit/include/fx_edit.h
@@ -366,23 +366,23 @@
// put text into edit.
virtual void SetText(const FX_WCHAR* text,
int32_t charset = DEFAULT_CHARSET,
- const CPVT_SecProps* pSecProps = NULL,
- const CPVT_WordProps* pWordProps = NULL) = 0;
+ const CPVT_SecProps* pSecProps = nullptr,
+ const CPVT_WordProps* pWordProps = nullptr) = 0;
// insert a word into the edit.
virtual FX_BOOL InsertWord(uint16_t word,
int32_t charset = DEFAULT_CHARSET,
- const CPVT_WordProps* pWordProps = NULL) = 0;
+ const CPVT_WordProps* pWordProps = nullptr) = 0;
// insert a return into the edit.
- virtual FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = NULL,
- const CPVT_WordProps* pWordProps = NULL) = 0;
+ virtual FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = nullptr,
+ const CPVT_WordProps* pWordProps = nullptr) = 0;
// insert text into the edit.
virtual FX_BOOL InsertText(const FX_WCHAR* text,
int32_t charset = DEFAULT_CHARSET,
- const CPVT_SecProps* pSecProps = NULL,
- const CPVT_WordProps* pWordProps = NULL) = 0;
+ const CPVT_SecProps* pSecProps = nullptr,
+ const CPVT_WordProps* pWordProps = nullptr) = 0;
// do backspace operation.
virtual FX_BOOL Backspace() = 0;
@@ -476,13 +476,13 @@
static CFX_ByteString GetEditAppearanceStream(
IFX_Edit* pEdit,
const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange = NULL,
+ const CPVT_WordRange* pRange = nullptr,
FX_BOOL bContinuous = TRUE,
uint16_t SubWord = 0);
static CFX_ByteString GetSelectAppearanceStream(
IFX_Edit* pEdit,
const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange = NULL);
+ const CPVT_WordRange* pRange = nullptr);
static void DrawEdit(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device,
IFX_Edit* pEdit,
diff --git a/fpdfsdk/fxedit/include/fxet_edit.h b/fpdfsdk/fxedit/include/fxet_edit.h
index c7500a0..71431de 100644
--- a/fpdfsdk/fxedit/include/fxet_edit.h
+++ b/fpdfsdk/fxedit/include/fxet_edit.h
@@ -102,7 +102,7 @@
CFX_Edit_LineRect* GetAt(int32_t nIndex) const {
if (nIndex < 0 || nIndex >= m_LineRects.GetSize())
- return NULL;
+ return nullptr;
return m_LineRects.GetAt(nIndex);
}
@@ -138,7 +138,7 @@
CFX_FloatRect* GetAt(int32_t nIndex) const {
if (nIndex < 0 || nIndex >= m_Rects.GetSize())
- return NULL;
+ return nullptr;
return m_Rects.GetAt(nIndex);
}
@@ -570,20 +570,20 @@
void OnVK_END(FX_BOOL bShift, FX_BOOL bCtrl) override;
void SetText(const FX_WCHAR* text,
int32_t charset = DEFAULT_CHARSET,
- const CPVT_SecProps* pSecProps = NULL,
- const CPVT_WordProps* pWordProps = NULL) override;
+ const CPVT_SecProps* pSecProps = nullptr,
+ const CPVT_WordProps* pWordProps = nullptr) override;
FX_BOOL InsertWord(uint16_t word,
int32_t charset = DEFAULT_CHARSET,
- const CPVT_WordProps* pWordProps = NULL) override;
- FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = NULL,
- const CPVT_WordProps* pWordProps = NULL) override;
+ const CPVT_WordProps* pWordProps = nullptr) override;
+ FX_BOOL InsertReturn(const CPVT_SecProps* pSecProps = nullptr,
+ const CPVT_WordProps* pWordProps = nullptr) override;
FX_BOOL Backspace() override;
FX_BOOL Delete() override;
FX_BOOL Clear() override;
FX_BOOL InsertText(const FX_WCHAR* text,
int32_t charset = DEFAULT_CHARSET,
- const CPVT_SecProps* pSecProps = NULL,
- const CPVT_WordProps* pWordProps = NULL) override;
+ const CPVT_SecProps* pSecProps = nullptr,
+ const CPVT_WordProps* pWordProps = nullptr) override;
FX_BOOL Redo() override;
FX_BOOL Undo() override;
int32_t WordPlaceToWordIndex(const CPVT_WordPlace& place) const override;
@@ -701,8 +701,8 @@
inline CFX_FloatRect EditToVT(const CFX_FloatRect& rect) const;
void Refresh(REFRESH_PLAN_E ePlan,
- const CPVT_WordRange* pRange1 = NULL,
- const CPVT_WordRange* pRange2 = NULL);
+ const CPVT_WordRange* pRange1 = nullptr,
+ const CPVT_WordRange* pRange2 = nullptr);
void RefreshPushLineRects(const CPVT_WordRange& wr);
void RefreshPushRandomRects(const CPVT_WordRange& wr);
diff --git a/fpdfsdk/fxedit/include/fxet_list.h b/fpdfsdk/fxedit/include/fxet_list.h
index 58aa94c..ab46051 100644
--- a/fpdfsdk/fxedit/include/fxet_list.h
+++ b/fpdfsdk/fxedit/include/fxet_list.h
@@ -193,7 +193,7 @@
TYPE GetAt(int32_t nIndex) const {
if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize())
return CFX_ArrayTemplate<TYPE>::GetAt(nIndex);
- return NULL;
+ return nullptr;
}
void RemoveAt(int32_t nIndex) {
if (nIndex >= 0 && nIndex < CFX_ArrayTemplate<TYPE>::GetSize())
diff --git a/fpdfsdk/include/fsdk_annothandler.h b/fpdfsdk/include/fsdk_annothandler.h
index a9c76e2..b36fe37 100644
--- a/fpdfsdk/include/fsdk_annothandler.h
+++ b/fpdfsdk/include/fsdk_annothandler.h
@@ -142,7 +142,7 @@
class CPDFSDK_BFAnnotHandler : public IPDFSDK_AnnotHandler {
public:
explicit CPDFSDK_BFAnnotHandler(CPDFDoc_Environment* pApp)
- : m_pApp(pApp), m_pFormFiller(NULL) {}
+ : m_pApp(pApp), m_pFormFiller(nullptr) {}
~CPDFSDK_BFAnnotHandler() override {}
// IPDFSDK_AnnotHandler
@@ -255,7 +255,7 @@
virtual FX_BOOL CanAnswer(CPDFSDK_Annot* pAnnot);
virtual CPDFSDK_Annot* NewAnnot(CPDF_Annot* pAnnot, CPDFSDK_PageView* pPage) {
- return NULL;
+ return nullptr;
}
virtual CPDFSDK_Annot* NewAnnot(CXFA_FFWidget* pAnnot,
diff --git a/fpdfsdk/include/fsdk_baseform.h b/fpdfsdk/include/fsdk_baseform.h
index 5e00e16..c7a7e74 100644
--- a/fpdfsdk/include/fsdk_baseform.h
+++ b/fpdfsdk/include/fsdk_baseform.h
@@ -281,7 +281,7 @@
FX_BOOL OnKeyStrokeCommit(CPDF_FormField* pFormField,
const CFX_WideString& csValue);
FX_BOOL OnValidate(CPDF_FormField* pFormField, const CFX_WideString& csValue);
- void OnCalculate(CPDF_FormField* pFormField = NULL);
+ void OnCalculate(CPDF_FormField* pFormField = nullptr);
CFX_WideString OnFormat(CPDF_FormField* pFormField, FX_BOOL& bFormated);
void ResetFieldAppearance(CPDF_FormField* pFormField,
diff --git a/fpdfsdk/include/fsdk_mgr.h b/fpdfsdk/include/fsdk_mgr.h
index a47f230..bf11a23 100644
--- a/fpdfsdk/include/fsdk_mgr.h
+++ b/fpdfsdk/include/fsdk_mgr.h
@@ -111,13 +111,13 @@
FPDF_PAGE FFI_GetPage(FPDF_DOCUMENT document, int nPageIndex) {
if (m_pInfo && m_pInfo->FFI_GetPage)
return m_pInfo->FFI_GetPage(m_pInfo, document, nPageIndex);
- return NULL;
+ return nullptr;
}
FPDF_PAGE FFI_GetCurrentPage(FPDF_DOCUMENT document) {
if (m_pInfo && m_pInfo->FFI_GetCurrentPage)
return m_pInfo->FFI_GetCurrentPage(m_pInfo, document);
- return NULL;
+ return nullptr;
}
int FFI_GetRotation(FPDF_PAGE page) {
@@ -181,7 +181,7 @@
CFX_WideString FFI_GetPlatform() {
if (m_pInfo && m_pInfo->FFI_GetPlatform) {
- int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, NULL, 0);
+ int nRequiredLen = m_pInfo->FFI_GetPlatform(m_pInfo, nullptr, 0);
if (nRequiredLen <= 0)
return L"";
@@ -275,7 +275,7 @@
const char* mode) {
if (m_pInfo && m_pInfo->FFI_OpenFile)
return m_pInfo->FFI_OpenFile(m_pInfo, fileType, wsURL, mode);
- return NULL;
+ return nullptr;
}
CFX_WideString FFI_GetFilePath(FPDF_FILEHANDLER* pFileHandler) const {
@@ -296,7 +296,7 @@
return new CFPDF_FileStream(fileHandler);
}
- return NULL;
+ return nullptr;
}
CFX_WideString FFI_PostRequestURL(const FX_WCHAR* wsURL,
@@ -361,7 +361,7 @@
CFX_WideString FFI_GetLanguage() {
if (m_pInfo && m_pInfo->FFI_GetLanguage) {
- int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, NULL, 0);
+ int nRequiredLen = m_pInfo->FFI_GetLanguage(m_pInfo, nullptr, 0);
if (nRequiredLen <= 0)
return L"";
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 12d8c2d..076e998 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -147,8 +147,8 @@
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 @@
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 5808982..43bc89e 100644
--- a/fpdfsdk/javascript/Field.cpp
+++ b/fpdfsdk/javascript/Field.cpp
@@ -122,12 +122,12 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 7dde8bf..031ec4f 100644
--- a/fpdfsdk/javascript/Icon.cpp
+++ b/fpdfsdk/javascript/Icon.cpp
@@ -23,7 +23,7 @@
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 5984946..8dc1b82 100644
--- a/fpdfsdk/javascript/JS_EventHandler.cpp
+++ b/fpdfsdk/javascript/JS_EventHandler.cpp
@@ -18,24 +18,24 @@
: 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 @@
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 b34bf09..aaa25ff 100644
--- a/fpdfsdk/javascript/JS_GlobalData.cpp
+++ b/fpdfsdk/javascript/JS_GlobalData.cpp
@@ -280,7 +280,7 @@
}
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 7dc91a7..6339bb7 100644
--- a/fpdfsdk/javascript/JS_Object.cpp
+++ b/fpdfsdk/javascript/JS_Object.cpp
@@ -31,7 +31,7 @@
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 @@
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 b01ee58..1b8964b 100644
--- a/fpdfsdk/javascript/JS_Value.cpp
+++ b/fpdfsdk/javascript/JS_Value.cpp
@@ -753,7 +753,7 @@
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 2c0ed32..69d61dc 100644
--- a/fpdfsdk/javascript/cjs_runtime.cpp
+++ b/fpdfsdk/javascript/cjs_runtime.cpp
@@ -52,9 +52,9 @@
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 043bd29..32498e4 100644
--- a/fpdfsdk/javascript/global.cpp
+++ b/fpdfsdk/javascript/global.cpp
@@ -94,7 +94,7 @@
}
JSGlobalAlternate::JSGlobalAlternate(CJS_Object* pJSObject)
- : CJS_EmbedObj(pJSObject), m_pApp(NULL) {}
+ : CJS_EmbedObj(pJSObject), m_pApp(nullptr) {}
JSGlobalAlternate::~JSGlobalAlternate() {
DestroyGlobalPersisitentVariables();
@@ -232,14 +232,14 @@
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 @@
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 @@
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 @@
return TRUE;
}
- JSGlobalData* pNewData = NULL;
+ JSGlobalData* pNewData = nullptr;
switch (nType) {
case JS_GLOBALDATA_TYPE_NUMBER: {
diff --git a/fpdfsdk/jsapi/fxjs_v8.cpp b/fpdfsdk/jsapi/fxjs_v8.cpp
index 73f6bbf..790d10b 100644
--- a/fpdfsdk/jsapi/fxjs_v8.cpp
+++ b/fpdfsdk/jsapi/fxjs_v8.cpp
@@ -314,7 +314,7 @@
v8::Isolate::Scope isolate_scope(pIsolate);
v8::HandleScope handle_scope(pIsolate);
v8::Local<v8::Context> v8Context =
- v8::Context::New(pIsolate, NULL, GetGlobalObjectTemplate(pIsolate));
+ v8::Context::New(pIsolate, nullptr, GetGlobalObjectTemplate(pIsolate));
v8::Context::Scope context_scope(v8Context);
FXJS_PerIsolateData::SetUp(pIsolate);
@@ -513,7 +513,7 @@
const wchar_t* FXJS_GetTypeof(v8::Local<v8::Value> pObj) {
if (pObj.IsEmpty())
- return NULL;
+ return nullptr;
if (pObj->IsString())
return kFXJSValueNameString;
if (pObj->IsNumber())
@@ -528,7 +528,7 @@
return kFXJSValueNameNull;
if (pObj->IsUndefined())
return kFXJSValueNameUndefined;
- return NULL;
+ return nullptr;
}
void FXJS_SetPrivate(v8::Isolate* pIsolate,
@@ -572,7 +572,7 @@
if (pObj.IsEmpty() || !pObj->InternalFieldCount())
return;
FXJS_FreePrivate(pObj->GetAlignedPointerFromInternalField(0));
- pObj->SetAlignedPointerInInternalField(0, NULL);
+ pObj->SetAlignedPointerInInternalField(0, nullptr);
}
v8::Local<v8::String> FXJS_WSToJSString(v8::Isolate* pIsolate,
diff --git a/fpdfsdk/pdfwindow/PWL_Caret.h b/fpdfsdk/pdfwindow/PWL_Caret.h
index a7cf1d4..0f002a2 100644
--- a/fpdfsdk/pdfwindow/PWL_Caret.h
+++ b/fpdfsdk/pdfwindow/PWL_Caret.h
@@ -28,7 +28,7 @@
void GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) override;
void DrawThisAppearance(CFX_RenderDevice* pDevice,
CFX_Matrix* pUser2Device) override;
- void InvalidateRect(CFX_FloatRect* pRect = NULL) override;
+ void InvalidateRect(CFX_FloatRect* pRect = nullptr) override;
void SetVisible(FX_BOOL bVisible) override {}
void TimerProc() override;
diff --git a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
index f490161..c556022 100644
--- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp
@@ -169,7 +169,7 @@
path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO);
path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO);
- pDevice->DrawPath(&path, pUser2Device, NULL,
+ pDevice->DrawPath(&path, pUser2Device, nullptr,
CPWL_Utils::PWLColorToFXColor(PWL_DEFAULT_BLACKCOLOR,
GetTransparency()),
0, FXFILL_ALTERNATE);
@@ -201,13 +201,13 @@
}
CPWL_ComboBox::CPWL_ComboBox()
- : m_pEdit(NULL),
- m_pButton(NULL),
- m_pList(NULL),
+ : m_pEdit(nullptr),
+ m_pButton(nullptr),
+ m_pList(nullptr),
m_bPopup(FALSE),
m_nPopupWhere(0),
m_nSelectItem(-1),
- m_pFillerNotify(NULL) {}
+ m_pFillerNotify(nullptr) {}
CFX_ByteString CPWL_ComboBox::GetClassName() const {
return "CPWL_ComboBox";
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index eec1fd9..21d4b03 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -388,7 +388,7 @@
CFX_FloatRect rcClip;
CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange();
- CPVT_WordRange* pRange = NULL;
+ CPVT_WordRange* pRange = nullptr;
if (!HasFlag(PES_TEXTOVERFLOW)) {
rcClip = GetClientRect();
@@ -938,7 +938,7 @@
const CFX_FloatPoint& ptOffset,
CFX_ArrayTemplate<CPDF_TextObject*>& ObjArray) {
IFX_Edit::GeneratePageObjects(
- pObjectHolder, m_pEdit, ptOffset, NULL,
+ pObjectHolder, m_pEdit, ptOffset, nullptr,
CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
ObjArray);
}
@@ -947,7 +947,7 @@
const CFX_FloatPoint& ptOffset) {
CFX_ArrayTemplate<CPDF_TextObject*> ObjArray;
IFX_Edit::GeneratePageObjects(
- pObjectHolder, m_pEdit, ptOffset, NULL,
+ pObjectHolder, m_pEdit, ptOffset, nullptr,
CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
ObjArray);
}
diff --git a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
index aa65392..e74a6d8 100644
--- a/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
+++ b/fpdfsdk/pdfwindow/PWL_EditCtrl.cpp
@@ -22,9 +22,9 @@
CPWL_EditCtrl::CPWL_EditCtrl()
: m_pEdit(IFX_Edit::NewEdit()),
- m_pEditCaret(NULL),
+ m_pEditCaret(nullptr),
m_bMouseDown(FALSE),
- m_pEditNotify(NULL),
+ m_pEditNotify(nullptr),
m_nCharSet(DEFAULT_CHARSET),
m_nCodePage(0) {}
@@ -450,7 +450,7 @@
if (IPVT_FontMap* pFontMap = GetFontMap())
return pFontMap->GetPDFFont(nFontIndex);
- return NULL;
+ return nullptr;
}
FX_FLOAT CPWL_EditCtrl::GetCaretFontSize() const {
@@ -563,7 +563,7 @@
cInfo.ptHead = ptHead;
cInfo.ptFoot = ptFoot;
- OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t)NULL);
+ OnNotify(this, PNM_SETCARETINFO, (intptr_t)&cInfo, (intptr_t) nullptr);
}
void CPWL_EditCtrl::IOnCaretChange(const CPVT_SecProps& secProps,
diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
index f73468b..d4eab01 100644
--- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp
+++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp
@@ -35,13 +35,13 @@
} // namespace
CPWL_FontMap::CPWL_FontMap(CFX_SystemHandler* pSystemHandler)
- : m_pPDFDoc(NULL), m_pSystemHandler(pSystemHandler) {
+ : m_pPDFDoc(nullptr), m_pSystemHandler(pSystemHandler) {
ASSERT(m_pSystemHandler);
}
CPWL_FontMap::~CPWL_FontMap() {
delete m_pPDFDoc;
- m_pPDFDoc = NULL;
+ m_pPDFDoc = nullptr;
Empty();
}
@@ -68,7 +68,7 @@
}
}
- return NULL;
+ return nullptr;
}
CFX_ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) {
@@ -208,7 +208,7 @@
return nFontIndex;
CFX_ByteString sAlias;
- CPDF_Font* pFont = NULL;
+ CPDF_Font* pFont = nullptr;
if (bFind)
pFont = FindFontSameCharset(sAlias, nCharset);
@@ -246,7 +246,7 @@
CPDF_Font* CPWL_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias,
int32_t nCharset) {
- return NULL;
+ return nullptr;
}
int32_t CPWL_FontMap::AddFontData(CPDF_Font* pFont,
@@ -301,12 +301,12 @@
CPDF_Font* CPWL_FontMap::AddStandardFont(CPDF_Document* pDoc,
CFX_ByteString& sFontName) {
if (!pDoc)
- return NULL;
+ return nullptr;
- CPDF_Font* pFont = NULL;
+ CPDF_Font* pFont = nullptr;
if (sFontName == "ZapfDingbats") {
- pFont = pDoc->AddStandardFont(sFontName.c_str(), NULL);
+ pFont = pDoc->AddStandardFont(sFontName.c_str(), nullptr);
} else {
CPDF_FontEncoding fe(PDFFONT_ENCODING_WINANSI);
pFont = pDoc->AddStandardFont(sFontName.c_str(), &fe);
@@ -319,7 +319,7 @@
CFX_ByteString& sFontName,
uint8_t nCharset) {
if (!pDoc)
- return NULL;
+ return nullptr;
if (sFontName.IsEmpty())
sFontName = GetNativeFont(nCharset);
@@ -330,7 +330,7 @@
return m_pSystemHandler->AddNativeTrueTypeFontToPDF(pDoc, sFontName,
nCharset);
- return NULL;
+ return nullptr;
}
CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName,
@@ -355,7 +355,7 @@
return m_aData.GetAt(nIndex);
}
- return NULL;
+ return nullptr;
}
int32_t CPWL_FontMap::GetNativeCharset() {
@@ -424,7 +424,7 @@
#else
{EASTEUROPE_CHARSET, "Tahoma"},
#endif
- {ARABIC_CHARSET, "Arial"}, {-1, NULL}};
+ {ARABIC_CHARSET, "Arial"}, {-1, nullptr}};
CFX_ByteString CPWL_FontMap::GetDefaultFontByCharset(int32_t nCharset) {
int i = 0;
diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp
index 18111ac..9c2e5cb 100644
--- a/fpdfsdk/pdfwindow/PWL_Icon.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp
@@ -11,7 +11,7 @@
#include "fpdfsdk/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
-CPWL_Image::CPWL_Image() : m_pPDFStream(NULL) {}
+CPWL_Image::CPWL_Image() : m_pPDFStream(nullptr) {}
CPWL_Image::~CPWL_Image() {}
@@ -108,7 +108,7 @@
y = 0.0f;
}
-CPWL_Icon::CPWL_Icon() : m_pIconFit(NULL) {}
+CPWL_Icon::CPWL_Icon() : m_pIconFit(nullptr) {}
CPWL_Icon::~CPWL_Icon() {}
@@ -130,8 +130,9 @@
if (m_pIconFit) {
fLeft = 0.0f;
fBottom = 0.0f;
- CPDF_Array* pA =
- m_pIconFit->GetDict() ? m_pIconFit->GetDict()->GetArrayBy("A") : NULL;
+ CPDF_Array* pA = m_pIconFit->GetDict()
+ ? m_pIconFit->GetDict()->GetArrayBy("A")
+ : nullptr;
if (pA) {
size_t dwCount = pA->GetCount();
if (dwCount > 0)
diff --git a/fpdfsdk/pdfwindow/PWL_IconList.cpp b/fpdfsdk/pdfwindow/PWL_IconList.cpp
index 4928560..26d6c92 100644
--- a/fpdfsdk/pdfwindow/PWL_IconList.cpp
+++ b/fpdfsdk/pdfwindow/PWL_IconList.cpp
@@ -19,7 +19,10 @@
#define PWL_IconList_ITEM_SPACE 4.0f
CPWL_IconList_Item::CPWL_IconList_Item()
- : m_nIconIndex(-1), m_pData(NULL), m_bSelected(FALSE), m_pText(NULL) {}
+ : m_nIconIndex(-1),
+ m_pData(nullptr),
+ m_bSelected(FALSE),
+ m_pText(nullptr) {}
CPWL_IconList_Item::~CPWL_IconList_Item() {}
@@ -288,7 +291,7 @@
}
}
- return NULL;
+ return nullptr;
}
void CPWL_IconList_Content::SetListData(int32_t nItemIndex, void* pData) {
@@ -328,7 +331,7 @@
}
CPWL_IconList::CPWL_IconList(int32_t nListCount)
- : m_pListContent(NULL), m_nListCount(nListCount) {}
+ : m_pListContent(nullptr), m_nListCount(nListCount) {}
CPWL_IconList::~CPWL_IconList() {}
@@ -392,7 +395,7 @@
m_pListContent->SetScrollPos(
CFX_FloatPoint(0.0f, *(FX_FLOAT*)lParam));
m_pListContent->ResetFace();
- m_pListContent->InvalidateRect(NULL);
+ m_pListContent->InvalidateRect(nullptr);
}
return;
case PNM_SETSCROLLPOS:
@@ -461,7 +464,7 @@
if (ptNew.y != ptScroll.y) {
m_pListContent->SetScrollPos(ptNew);
m_pListContent->ResetFace();
- m_pListContent->InvalidateRect(NULL);
+ m_pListContent->InvalidateRect(nullptr);
if (CPWL_ScrollBar* pScrollBar = GetVScrollBar())
pScrollBar->OnNotify(this, PNM_SETSCROLLPOS, SBT_VSCROLL,
diff --git a/fpdfsdk/pdfwindow/PWL_Label.cpp b/fpdfsdk/pdfwindow/PWL_Label.cpp
index 203ec49..83d299c 100644
--- a/fpdfsdk/pdfwindow/PWL_Label.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Label.cpp
@@ -87,7 +87,7 @@
CFX_FloatRect rcClip;
CPVT_WordRange wrRange = m_pEdit->GetVisibleWordRange();
- CPVT_WordRange* pRange = NULL;
+ CPVT_WordRange* pRange = nullptr;
if (!HasFlag(PES_TEXTOVERFLOW)) {
rcClip = GetClientRect();
@@ -98,7 +98,7 @@
pDevice, pUser2Device, m_pEdit,
CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()),
CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()),
- rcClip, CFX_FloatPoint(0.0f, 0.0f), pRange, pSysHandler, NULL);
+ rcClip, CFX_FloatPoint(0.0f, 0.0f), pRange, pSysHandler, nullptr);
}
void CPWL_Label::SetHorzScale(int32_t nHorzScale) {
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index 86f3b8f..84d2614 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -65,18 +65,18 @@
}
CPWL_ListBox::CPWL_ListBox()
- : m_pList(NULL),
- m_pListNotify(NULL),
+ : m_pList(nullptr),
+ m_pListNotify(nullptr),
m_bMouseDown(FALSE),
m_bHoverSel(FALSE),
- m_pFillerNotify(NULL) {
+ m_pFillerNotify(nullptr) {
m_pList = IFX_List::NewList();
}
CPWL_ListBox::~CPWL_ListBox() {
IFX_List::DelList(m_pList);
delete m_pListNotify;
- m_pListNotify = NULL;
+ m_pListNotify = nullptr;
}
CFX_ByteString CPWL_ListBox::GetClassName() const {
@@ -100,7 +100,7 @@
void CPWL_ListBox::OnDestroy() {
delete m_pListNotify;
- m_pListNotify = NULL;
+ m_pListNotify = nullptr;
}
void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
@@ -187,21 +187,21 @@
pDevice, pUser2Device, m_pList->GetItemEdit(i),
CPWL_Utils::PWLColorToFXColor(GetTextColor()),
CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), rcList,
- ptOffset, NULL, pSysHandler, m_pFormFiller);
+ ptOffset, nullptr, pSysHandler, m_pFormFiller);
pSysHandler->OutputSelectedRect(m_pFormFiller, rcItem);
} else {
CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem,
ArgbEncode(255, 0, 51, 113));
IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
ArgbEncode(255, 255, 255, 255), 0, rcList,
- ptOffset, NULL, pSysHandler, m_pFormFiller);
+ ptOffset, nullptr, pSysHandler, m_pFormFiller);
}
} else {
CFX_SystemHandler* pSysHandler = GetSystemHandler();
IFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i),
CPWL_Utils::PWLColorToFXColor(GetTextColor()),
CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()),
- rcList, ptOffset, NULL, pSysHandler, NULL);
+ rcList, ptOffset, nullptr, pSysHandler, nullptr);
}
}
}
diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
index 9532244..7cec290 100644
--- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
@@ -273,7 +273,7 @@
path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO);
path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO);
- pDevice->DrawPath(&path, pUser2Device, NULL,
+ pDevice->DrawPath(&path, pUser2Device, nullptr,
CPWL_Utils::PWLColorToFXColor(
PWL_DEFAULT_BLACKCOLOR, nTransparancy),
0, FXFILL_ALTERNATE);
@@ -297,7 +297,7 @@
path.SetPoint(2, pt3.x, pt3.y, FXPT_LINETO);
path.SetPoint(3, pt1.x, pt1.y, FXPT_LINETO);
- pDevice->DrawPath(&path, pUser2Device, NULL,
+ pDevice->DrawPath(&path, pUser2Device, nullptr,
CPWL_Utils::PWLColorToFXColor(
PWL_DEFAULT_BLACKCOLOR, nTransparancy),
0, FXFILL_ALTERNATE);
@@ -579,9 +579,9 @@
CPWL_ScrollBar::CPWL_ScrollBar(PWL_SCROLLBAR_TYPE sbType)
: m_sbType(sbType),
- m_pMinButton(NULL),
- m_pMaxButton(NULL),
- m_pPosButton(NULL),
+ m_pMinButton(nullptr),
+ m_pMaxButton(nullptr),
+ m_pPosButton(nullptr),
m_bMouseDown(FALSE),
m_bMinOrMax(FALSE),
m_bNotifyForever(TRUE) {}
diff --git a/fpdfsdk/pdfwindow/PWL_Signature.cpp b/fpdfsdk/pdfwindow/PWL_Signature.cpp
index c737998..7513950 100644
--- a/fpdfsdk/pdfwindow/PWL_Signature.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Signature.cpp
@@ -12,7 +12,7 @@
#include "fpdfsdk/pdfwindow/PWL_Utils.h"
#include "fpdfsdk/pdfwindow/PWL_Wnd.h"
-CPWL_Signature_Image::CPWL_Signature_Image() : m_pImage(NULL) {}
+CPWL_Signature_Image::CPWL_Signature_Image() : m_pImage(nullptr) {}
CPWL_Signature_Image::~CPWL_Signature_Image() {}
@@ -57,9 +57,9 @@
}
CPWL_Signature::CPWL_Signature()
- : m_pText(NULL),
- m_pDescription(NULL),
- m_pImage(NULL),
+ : m_pText(nullptr),
+ m_pDescription(nullptr),
+ m_pImage(nullptr),
m_bTextExist(TRUE),
m_bImageExist(FALSE),
m_bFlagExist(TRUE) {}
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp
index e4232db..f5d30b2 100644
--- a/fpdfsdk/pdfwindow/PWL_Utils.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp
@@ -1222,7 +1222,7 @@
CFX_PathData path;
CFX_FloatRect rcTemp(rect);
path.AppendRect(rcTemp.left, rcTemp.bottom, rcTemp.right, rcTemp.top);
- pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_WINDING);
+ pDevice->DrawPath(&path, pUser2Device, nullptr, color, 0, FXFILL_WINDING);
}
void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice,
@@ -1237,7 +1237,7 @@
for (int32_t i = 1; i < nCount; i++)
path.SetPoint(i, pPts[i].x, pPts[i].y, FXPT_LINETO);
- pDevice->DrawPath(&path, pUser2Device, NULL, color, 0, FXFILL_ALTERNATE);
+ pDevice->DrawPath(&path, pUser2Device, nullptr, color, 0, FXFILL_ALTERNATE);
}
void CPWL_Utils::DrawStrokeRect(CFX_RenderDevice* pDevice,
@@ -1340,7 +1340,7 @@
path.AppendRect(fLeft, fBottom, fRight, fTop);
path.AppendRect(fLeft + fWidth, fBottom + fWidth, fRight - fWidth,
fTop - fWidth);
- pDevice->DrawPath(&path, pUser2Device, NULL,
+ pDevice->DrawPath(&path, pUser2Device, nullptr,
PWLColorToFXColor(color, nTransparancy), 0,
FXFILL_ALTERNATE);
break;
diff --git a/fpdfsdk/pdfwindow/PWL_Utils.h b/fpdfsdk/pdfwindow/PWL_Utils.h
index 8ab08a8..db79cf7 100644
--- a/fpdfsdk/pdfwindow/PWL_Utils.h
+++ b/fpdfsdk/pdfwindow/PWL_Utils.h
@@ -168,13 +168,13 @@
static CFX_ByteString GetEditAppStream(IFX_Edit* pEdit,
const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange = NULL,
+ const CPVT_WordRange* pRange = nullptr,
FX_BOOL bContinuous = TRUE,
uint16_t SubWord = 0);
static CFX_ByteString GetEditSelAppStream(
IFX_Edit* pEdit,
const CFX_FloatPoint& ptOffset,
- const CPVT_WordRange* pRange = NULL);
+ const CPVT_WordRange* pRange = nullptr);
static CFX_ByteString GetTextAppStream(const CFX_FloatRect& rcBBox,
IPVT_FontMap* pFontMap,
const CFX_WideString& sText,
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
index 310f2f3..2a0a0aa 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp
@@ -55,7 +55,7 @@
pTimer->m_pAttached->TimerProc();
}
-CPWL_TimerHandler::CPWL_TimerHandler() : m_pTimer(NULL) {}
+CPWL_TimerHandler::CPWL_TimerHandler() : m_pTimer(nullptr) {}
CPWL_TimerHandler::~CPWL_TimerHandler() {
delete m_pTimer;
@@ -90,8 +90,8 @@
void Default() {
m_aMousePath.RemoveAll();
m_aKeyboardPath.RemoveAll();
- m_pMainMouseWnd = NULL;
- m_pMainKeyboardWnd = NULL;
+ m_pMainMouseWnd = nullptr;
+ m_pMainKeyboardWnd = nullptr;
}
FX_BOOL IsWndCreated(const CPWL_Wnd* pWnd) const {
@@ -149,7 +149,7 @@
if (CPWL_Wnd* pWnd = m_aKeyboardPath.GetAt(0))
pWnd->OnKillFocus();
- m_pMainKeyboardWnd = NULL;
+ m_pMainKeyboardWnd = nullptr;
m_aKeyboardPath.RemoveAll();
}
@@ -168,7 +168,7 @@
}
void ReleaseCapture() {
- m_pMainMouseWnd = NULL;
+ m_pMainMouseWnd = nullptr;
m_aMousePath.RemoveAll();
}
@@ -181,7 +181,7 @@
};
CPWL_Wnd::CPWL_Wnd()
- : m_pVScrollBar(NULL),
+ : m_pVScrollBar(nullptr),
m_rcWindow(),
m_rcClip(),
m_bCreated(FALSE),
@@ -255,7 +255,7 @@
if (CPWL_Wnd* pChild = m_aChildren[i]) {
pChild->Destroy();
delete pChild;
- pChild = NULL;
+ pChild = nullptr;
}
}
@@ -268,7 +268,7 @@
FXSYS_memset(&m_sPrivateParam, 0, sizeof(PWL_CREATEPARAM));
m_aChildren.RemoveAll();
- m_pVScrollBar = NULL;
+ m_pVScrollBar = nullptr;
}
void CPWL_Wnd::Move(const CFX_FloatRect& rcNew,
@@ -624,7 +624,7 @@
if (HasFlag(PWS_VSCROLL))
return m_pVScrollBar;
- return NULL;
+ return nullptr;
}
void CPWL_Wnd::CreateScrollBar(const PWL_CREATEPARAM& cp) {
@@ -958,7 +958,7 @@
return pMsgCtrl->m_pMainKeyboardWnd;
}
- return NULL;
+ return nullptr;
}
void CPWL_Wnd::EnableWindow(FX_BOOL bEnable) {
diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h
index c8552fb..c393d27 100644
--- a/fpdfsdk/pdfwindow/PWL_Wnd.h
+++ b/fpdfsdk/pdfwindow/PWL_Wnd.h
@@ -188,13 +188,13 @@
public:
PWL_CREATEPARAM()
: rcRectWnd(0, 0, 0, 0),
- pSystemHandler(NULL),
- pFontMap(NULL),
- pProvider(NULL),
- pFocusHandler(NULL),
+ pSystemHandler(nullptr),
+ pFontMap(nullptr),
+ pProvider(nullptr),
+ pFocusHandler(nullptr),
dwFlags(0),
sBackgroundColor(),
- hAttachedWnd(NULL),
+ hAttachedWnd(nullptr),
nBorderStyle(BorderStyle::SOLID),
dwBorderWidth(1),
sBorderColor(),
@@ -203,9 +203,9 @@
nTransparency(255),
fFontSize(PWL_DEFAULT_FONTSIZE),
sDash(3, 0, 0),
- pAttachedData(NULL),
- pParentWnd(NULL),
- pMsgControl(NULL),
+ pAttachedData(nullptr),
+ pParentWnd(nullptr),
+ pMsgControl(nullptr),
eCursorType(FXCT_ARROW),
mtChild(1, 0, 0, 1, 0, 0) {}
@@ -274,7 +274,7 @@
void InvalidateProvider(IPWL_Provider* provider);
void Destroy();
void Move(const CFX_FloatRect& rcNew, FX_BOOL bReset, FX_BOOL bRefresh);
- virtual void InvalidateRect(CFX_FloatRect* pRect = NULL);
+ virtual void InvalidateRect(CFX_FloatRect* pRect = nullptr);
void DrawAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device);