diff options
author | thestig <thestig@chromium.org> | 2016-06-07 17:53:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-06-07 17:53:06 -0700 |
commit | 1cd352e0a4bc19f96df199b0acfa32a344240d5e (patch) | |
tree | be24d7a4bd135c2ab5568148ab318b7bf648edda | |
parent | a4fdfc5ed0e8d2e6acc52cc34eac42c6072f0ccc (diff) | |
download | pdfium-1cd352e0a4bc19f96df199b0acfa32a344240d5e.tar.xz |
Get rid of NULLs in fpdfsdk/
Review-Url: https://codereview.chromium.org/2031653003
64 files changed, 359 insertions, 371 deletions
diff --git a/core/fxcodec/codec/fx_codec_jpx_unittest.cpp b/core/fxcodec/codec/fx_codec_jpx_unittest.cpp index 13b5425927..820a618f5b 100644 --- a/core/fxcodec/codec/fx_codec_jpx_unittest.cpp +++ b/core/fxcodec/codec/fx_codec_jpx_unittest.cpp @@ -23,7 +23,7 @@ TEST(fxcodec, DecodeDataNullDecodeData) { unsigned char buffer[16]; DecodeData* ptr = nullptr; - // Error codes, not segvs, should callers pass us a NULL pointer. + // Error codes, not segvs, should callers pass us a nullptr pointer. EXPECT_EQ(kReadError, opj_read_from_memory(buffer, sizeof(buffer), ptr)); EXPECT_EQ(kWriteError, opj_write_from_memory(buffer, sizeof(buffer), ptr)); EXPECT_EQ(kSkipError, opj_skip_from_memory(1, ptr)); diff --git a/core/fxcrt/fx_basic_bstring_unittest.cpp b/core/fxcrt/fx_basic_bstring_unittest.cpp index 220105aa95..cfdf2794b4 100644 --- a/core/fxcrt/fx_basic_bstring_unittest.cpp +++ b/core/fxcrt/fx_basic_bstring_unittest.cpp @@ -758,7 +758,7 @@ TEST(fxcrt, ByteStringCFromChar) { CFX_ByteStringC nul_string_from_char(nul); CFX_ByteStringC lower_a_string_from_char(lower_a); - // Pointer to nul, not NULL ptr, hence length 1 ... + // Pointer to nul, not nullptr ptr, hence length 1 ... EXPECT_EQ(1, nul_string_from_char.GetLength()); EXPECT_NE(null_string, nul_string_from_char); diff --git a/core/fxcrt/include/fx_memory.h b/core/fxcrt/include/fx_memory.h index 3048897d76..fa8da6067c 100644 --- a/core/fxcrt/include/fx_memory.h +++ b/core/fxcrt/include/fx_memory.h @@ -13,7 +13,7 @@ extern "C" { #endif -// For external C libraries to malloc through PDFium. These may return NULL. +// For external C libraries to malloc through PDFium. These may return nullptr. void* FXMEM_DefaultAlloc(size_t byte_size, int flags); void* FXMEM_DefaultRealloc(void* pointer, size_t new_size, int flags); void FXMEM_DefaultFree(void* pointer, int flags); @@ -61,13 +61,13 @@ inline void* FX_ReallocOrDie(void* ptr, return nullptr; // Suppress compiler warning. } -// Never returns NULL. +// Never returns nullptr. #define FX_Alloc(type, size) (type*) FX_AllocOrDie(size, sizeof(type)) #define FX_Alloc2D(type, w, h) (type*) FX_AllocOrDie2D(w, h, sizeof(type)) #define FX_Realloc(type, ptr, size) \ (type*) FX_ReallocOrDie(ptr, size, sizeof(type)) -// May return NULL. +// May return nullptr. #define FX_TryAlloc(type, size) (type*) calloc(size, sizeof(type)) #define FX_TryRealloc(type, ptr, size) \ (type*) FX_SafeRealloc(ptr, size, sizeof(type)) diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp index 4c74d5a242..9102b7bf9a 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 @@ CBA_FontMap::~CBA_FontMap() {} void CBA_FontMap::Reset() { Empty(); - m_pDefaultFont = NULL; + m_pDefaultFont = nullptr; m_sDefaultFontName = ""; } @@ -83,20 +83,20 @@ CPDF_Font* CBA_FontMap::FindFontSameCharset(CFX_ByteString& sFontAlias, 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 @@ CPDF_Font* CBA_FontMap::FindResFontSameCharset(CPDF_Dictionary* pResDict, 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 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, 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 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, if (!pStreamDict) { pStreamDict = new CPDF_Dictionary; - pStream->InitStream(NULL, 0, pStreamDict); + pStream->InitStream(nullptr, 0, pStreamDict); } if (pStreamDict) { @@ -199,7 +199,7 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont, } 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_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) { } } - 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 8b2da626b2..d489a243d9 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 @@ CPWL_Wnd* CFFL_ComboBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, 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 8ee6da387d..d7bc9586a4 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -88,7 +88,8 @@ void CFFL_FormFiller::OnDraw(CPDFSDK_PageView* pPageView, } 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 @@ void CFFL_FormFiller::OnDrawDeactive(CPDFSDK_PageView* pPageView, 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 @@ PWL_CREATEPARAM CFFL_FormFiller::GetCreateParam() { ASSERT(m_pApp); PWL_CREATEPARAM cp; - cp.pParentWnd = NULL; + cp.pParentWnd = nullptr; cp.pProvider = this; cp.rcRectWnd = GetPDFWindowRect(); @@ -690,23 +691,25 @@ void CFFL_Button::OnDraw(CPDFSDK_PageView* pPageView, 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 9dcc734a24..107197fa72 100644 --- a/fpdfsdk/formfiller/cffl_iformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_iformfiller.cpp @@ -97,7 +97,7 @@ void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, 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 dc4f07d0d2..cbac83cb55 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 @@ CPWL_Wnd* CFFL_ListBox::ResetPDFWindow(CPDFSDK_PageView* pPageView, 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 7399651234..be1f36b697 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 @@ PWL_CREATEPARAM CFFL_TextField::GetCreateParam() { cp.dwFlags |= PES_PASSWORD; } - if (!(nFlags & FIELDFLAG_DONOTSPELLCHECK)) { - } - if (nFlags & FIELDFLAG_MULTILINE) { cp.dwFlags |= PES_MULTILINE | PES_AUTORETURN | PES_TOP; @@ -244,7 +241,7 @@ CPWL_Wnd* CFFL_TextField::ResetPDFWindow(CPDFSDK_PageView* pPageView, 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 dc6efbc436..878271efc9 100644 --- a/fpdfsdk/fpdf_dataavail.cpp +++ b/fpdfsdk/fpdf_dataavail.cpp @@ -37,7 +37,7 @@ static_assert(IPDF_DataAvail::FormNotExist == PDF_FORM_NOTEXIST, 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_FileAvailWrap : public IPDF_DataAvail::FileAvail { 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_DownloadHintsWrap : public IPDF_DataAvail::DownloadHints { 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 0a76a0d4be..d262e3c0a5 100644 --- a/fpdfsdk/fpdf_ext.cpp +++ b/fpdfsdk/fpdf_ext.cpp @@ -156,7 +156,7 @@ void CheckUnSupportError(CPDF_Document* pDoc, uint32_t err_code) { } 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 27646255c8..bc1a1ccc60 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -195,7 +195,8 @@ void SetPageContents(CFX_ByteString key, 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 @@ void SetPageContents(CFX_ByteString key, return; } - CPDF_Array* pContentsArray = NULL; + CPDF_Array* pContentsArray = nullptr; switch (pContentsObj->GetType()) { case CPDF_Object::STREAM: { @@ -240,7 +241,8 @@ void SetPageContents(CFX_ByteString key, 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 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { 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 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { 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 9d05903a61..2a309d9785 100644 --- a/fpdfsdk/fpdf_sysfontinfo.cpp +++ b/fpdfsdk/fpdf_sysfontinfo.cpp @@ -36,13 +36,13 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { 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 @@ class CFX_ExternalFontInfo final : public IFX_SystemFontInfo { 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 0f69340821..0cf222d796 100644 --- a/fpdfsdk/fpdfdoc.cpp +++ b/fpdfsdk/fpdfdoc.cpp @@ -130,7 +130,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDFBookmark_GetDest(FPDF_DOCUMENT document, 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 c189f2314c..4429dcd201 100644 --- a/fpdfsdk/fpdfeditimg.cpp +++ b/fpdfsdk/fpdfeditimg.cpp @@ -38,7 +38,7 @@ FPDFImageObj_LoadJpegFile(FPDF_PAGE* pages, 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 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, 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 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFImageObj_SetBitmap(FPDF_PAGE* pages, 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 576d9fb778..6f71a86548 100644 --- a/fpdfsdk/fpdfeditpage.cpp +++ b/fpdfsdk/fpdfeditpage.cpp @@ -53,7 +53,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() { } } - CPDF_Dictionary* pInfoDict = NULL; + CPDF_Dictionary* pInfoDict = nullptr; pInfoDict = pDoc->GetInfo(); if (pInfoDict) { if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS)) @@ -84,7 +84,7 @@ DLLEXPORT FPDF_PAGE STDCALL FPDFPage_New(FPDF_DOCUMENT document, 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 @@ FPDFPageObj_HasTransparency(FPDF_PAGEOBJECT pageObject) { 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 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page, 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 2631eb3e4f..c9c2c39476 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -139,7 +139,7 @@ void FFLCommon(FPDF_FORMHANDLE hHandle, 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 @@ FPDFDOC_ExitFormFillEnvironment(FPDF_FORMHANDLE hHandle) { 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 9a006530c2..36f553e556 100644 --- a/fpdfsdk/fpdfsave.cpp +++ b/fpdfsdk/fpdfsave.cpp @@ -49,7 +49,7 @@ class CFX_IFileWrite final : public IFX_StreamWrite { }; CFX_IFileWrite::CFX_IFileWrite() { - m_pFileWriteStruct = NULL; + m_pFileWriteStruct = nullptr; } FX_BOOL CFX_IFileWrite::Init(FPDF_FILEWRITE* pFileWriteStruct) { @@ -140,8 +140,8 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, 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 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, 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 @@ bool SaveXFADocumentData(CPDFXFA_Document* pDocument, 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 @@ bool FPDF_Doc_Save(FPDF_DOCUMENT document, 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 24cd8ef5c4..9847f15c60 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -335,12 +335,12 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadDocument(FPDF_STRING file_path, 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 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_LoadMemDocument(const void* data_buf, 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 @@ FPDF_LoadCustomDocument(FPDF_FILEACCESS* pFileAccess, 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 @@ DLLEXPORT void STDCALL FPDF_RenderPage(HDC dc, 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 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_Create(int width, 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 @@ DLLEXPORT FPDF_BITMAP STDCALL FPDFBitmap_CreateEx(int width, 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 @@ void FPDF_RenderPage_Retail(CRenderContext* pContext, 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 @@ DLLEXPORT FPDF_PAGERANGE STDCALL 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 @@ DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, 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 @@ DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Set(FPDF_BSTR* str, 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 @@ DLLEXPORT FPDF_RESULT STDCALL FPDF_BStr_Clear(FPDF_BSTR* str) { 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 80b39b5b9c..820d496bdc 100644 --- a/fpdfsdk/fpdfview_embeddertest.cpp +++ b/fpdfsdk/fpdfview_embeddertest.cpp @@ -180,11 +180,11 @@ TEST_F(FPDFViewEmbeddertest, NamedDests) { 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 fc15c3b1b3..ffc4e5363a 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 @@ CPDFXFA_App* CPDFXFA_App::GetInstance() { 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() 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 @@ CFX_WideString CPDFXFA_App::Response(const CFX_WideString& wsQuestion, 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 @@ void CPDFXFA_App::LoadString(int32_t iStringID, CFX_WideString& wsString) { } 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 f207760398..9d8fb42059 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -127,7 +127,7 @@ FX_BOOL CPDFXFA_Document::LoadXFADoc() { 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::DeletePage(int page_index) { } 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 @@ void CPDFXFA_Document::InvalidateRect(CXFA_FFPageView* pPageView, 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::InvalidateRect(CXFA_FFWidget* hWidget, 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 @@ void CPDFXFA_Document::DisplayCaret(CXFA_FFWidget* hWidget, return; CPDFXFA_Page* pPage = GetPage(pPageView); - - if (pPage == NULL) + if (!pPage) return; CFX_FloatRect rcCaret; @@ -485,7 +480,8 @@ FX_BOOL CPDFXFA_Document::PopupMenu(CXFA_FFWidget* hWidget, 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::SetCalculationsEnabled(CXFA_FFDoc* hDoc, } void CPDFXFA_Document::GetTitle(CXFA_FFDoc* hDoc, CFX_WideString& wsTitle) { - if (hDoc != m_pXFADoc) - return; - if (m_pPDFDoc == NULL) + if (hDoc != m_pXFADoc || !m_pPDFDoc) 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 @@ void CPDFXFA_Document::GotoURL(CXFA_FFDoc* hDoc, return; CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); - if (pEnv == NULL) + if (!pEnv) return; CFX_WideStringC str(bsURL.c_str()); @@ -759,15 +753,15 @@ void CPDFXFA_Document::SetFocusWidget(CXFA_FFDoc* hDoc, 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 @@ void CPDFXFA_Document::Print(CXFA_FFDoc* hDoc, 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 @@ void CPDFXFA_Document::GetURL(CXFA_FFDoc* hDoc, CFX_WideString& wsDocURL) { return; CPDFDoc_Environment* pEnv = m_pSDKDoc->GetEnv(); - if (pEnv == NULL) + if (!pEnv) return; pEnv->FFI_GetURL(this, wsDocURL); @@ -907,9 +899,7 @@ void CPDFXFA_Document::_OnAfterNotifySumbit() { } 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 @@ FX_BOOL CPDFXFA_Document::SubmitData(CXFA_FFDoc* hDoc, CXFA_Submit submit) { 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 @@ IFX_FileRead* CPDFXFA_Document::OpenLinkedFile(CXFA_FFDoc* hDoc, 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 9cab4d941b..90ef6f36b3 100644 --- a/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h +++ b/fpdfsdk/fpdfxfa/include/fpdfxfa_doc.h @@ -66,7 +66,7 @@ class CPDFXFA_Document : public IXFA_DocProvider { 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 @@ class CPDFXFA_Document : public IXFA_DocProvider { 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 912bc40c7f..bc6bd2826c 100644 --- a/fpdfsdk/fsdk_actionhandler.cpp +++ b/fpdfsdk/fsdk_actionhandler.cpp @@ -223,7 +223,7 @@ FX_BOOL CPDFSDK_ActionHandler::IsValidField(CPDFSDK_Document* pDocument, 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 cbcb53e169..eda3b49058 100644 --- a/fpdfsdk/fsdk_annothandler.cpp +++ b/fpdfsdk/fsdk_annothandler.cpp @@ -88,7 +88,7 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::NewAnnot(CXFA_FFWidget* pAnnot, return pAnnotHandler->NewAnnot(pAnnot, pPageView); } - return NULL; + return nullptr; } #endif // PDF_ENABLE_XFA @@ -367,8 +367,8 @@ CPDFSDK_Annot* CPDFSDK_AnnotHandlerMgr::GetNextAnnot(CPDFSDK_Annot* pSDKAnnot, #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 @@ CPDFSDK_Annot* CPDFSDK_BFAnnotHandler::NewAnnot(CPDF_Annot* pAnnot, #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 @@ void CPDFSDK_BFAnnotHandler::OnLoad(CPDFSDK_Annot* pAnnot) { 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 @@ CPDFSDK_Annot* CPDFSDK_XFAAnnotHandler::NewAnnot(CXFA_FFWidget* pAnnot, } 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 @@ void CPDFSDK_XFAAnnotHandler::OnDraw(CPDFSDK_PageView* pPageView, 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::OnKillFocus(CPDFSDK_Annot* pAnnot, 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 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, 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 @@ FX_BOOL CPDFSDK_XFAAnnotHandler::OnXFAChangedFocus(CPDFSDK_Annot* pOldAnnot, 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 7dcb663505..b628ae684f 100644 --- a/fpdfsdk/fsdk_baseannot.cpp +++ b/fpdfsdk/fsdk_baseannot.cpp @@ -554,7 +554,7 @@ void CPDFSDK_BAAnnot::DrawAppearance(CFX_RenderDevice* pDevice, } 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 @@ void CPDFSDK_BAAnnot::Annot_OnDraw(CFX_RenderDevice* pDevice, 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 0f1a0ad0d1..65be7c8c5d 100644 --- a/fpdfsdk/fsdk_baseform.cpp +++ b/fpdfsdk/fsdk_baseform.cpp @@ -41,8 +41,8 @@ CPDFSDK_Widget::CPDFSDK_Widget(CPDF_Annot* pAnnot, 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 @@ CXFA_FFWidget* CPDFSDK_Widget::GetMixXFAWidget() const { return m_hMixXFAWidget; } - return NULL; + return nullptr; } CXFA_FFWidget* CPDFSDK_Widget::GetGroupMixXFAWidget() { @@ -101,7 +101,7 @@ CXFA_FFWidgetHandler* CPDFSDK_Widget::GetXFAWidgetHandler() const { return m_pWidgetHandler; } - return NULL; + return nullptr; } static XFA_EVENTTYPE GetXFAEventType(PDFSDK_XFAAActionType eXFAAAT) { @@ -774,7 +774,7 @@ CFX_WideString CPDFSDK_Widget::OnFormat(FX_BOOL& bFormated) { 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 @@ void CPDFSDK_Widget::ResetAppearance_PushButton() { 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 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) { 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 @@ FX_BOOL CPDFSDK_InterForm::SubmitForm(const CFX_WideString& sDestination, pEnv->JS_docSubmitForm(pBuffer, nBufSize, sDestination.c_str()); - if (bUrlEncoded) { + if (bUrlEncoded) FX_Free(pBuffer); - pBuffer = NULL; - } return TRUE; } @@ -2586,7 +2584,7 @@ int CPDFSDK_InterForm::BeforeSelectionChange(CPDF_FormField* pField, 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 83fee907d2..835439394d 100644 --- a/fpdfsdk/fsdk_mgr.cpp +++ b/fpdfsdk/fsdk_mgr.cpp @@ -41,7 +41,7 @@ FPDF_WIDESTRING AsFPDFWideString(CFX_ByteString* bsUTF16LE) { 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 @@ void CPDFDoc_Environment::JS_docgotoPage(int nPageNum) { 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 @@ FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag) { 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(CPDF_Dictionary* pDict) { 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 @@ CPDF_Document* CPDFSDK_PageView::GetPDFDocument() { return m_page->m_pDocument; #endif // PDF_ENABLE_XFA } - return NULL; + return nullptr; } #ifdef PDF_ENABLE_XFA @@ -714,7 +714,7 @@ CPDF_Page* CPDFSDK_PageView::GetPDFPage() { if (m_page) { return m_page->GetPDFPage(); } - return NULL; + return nullptr; } #endif // PDF_ENABLE_XFA @@ -775,7 +775,7 @@ FX_BOOL CPDFSDK_PageView::OnRButtonDown(const CFX_FloatPoint& point, CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y); - if (pFXAnnot == NULL) + if (!pFXAnnot) return FALSE; FX_BOOL bRet = @@ -794,7 +794,7 @@ FX_BOOL CPDFSDK_PageView::OnRButtonUp(const CFX_FloatPoint& point, CPDFSDK_Annot* pFXAnnot = GetFXWidgetAtPoint(point.x, point.y); - if (pFXAnnot == NULL) + if (!pFXAnnot) return FALSE; FX_BOOL bRet = @@ -848,7 +848,7 @@ FX_BOOL CPDFSDK_PageView::OnMouseMove(const CFX_FloatPoint& point, int nFlag) { 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 3ba60778a7..0888d6ba4a 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 563acb65b5..5420b46218 100644 --- a/fpdfsdk/fxedit/fxet_ap.cpp +++ b/fpdfsdk/fxedit/fxet_ap.cpp @@ -56,12 +56,11 @@ static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, 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 0124913c5f..589ac1bd41 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -339,7 +339,7 @@ IFX_Edit_UndoItem* CFX_Edit_Undo::GetItem(int32_t nIndex) { 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 @@ void CFXEU_Clear::Undo() { 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 @@ void CFX_Edit::SetRichText(FX_BOOL bRichText, FX_BOOL bPaint) { 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 @@ void CFX_Edit::EndGroupUndo() { 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 383b84f27f..1385d57680 100644 --- a/fpdfsdk/fxedit/fxet_list.cpp +++ b/fpdfsdk/fxedit/fxet_list.cpp @@ -74,7 +74,7 @@ CFX_WideString CFX_ListItem::GetText() const { } 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 @@ IFX_Edit* CFX_List::GetItemEdit(int32_t nIndex) const { return pListItem->GetEdit(); } - return NULL; + return nullptr; } int32_t CFX_List::GetCount() const { @@ -378,7 +378,7 @@ void CPLST_Select::Done() { } 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 f12fffb373..29ad135bca 100644 --- a/fpdfsdk/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp @@ -190,7 +190,7 @@ void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, 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 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, 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 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, 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 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, 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 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, 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 5f0283f06f..710c06f809 100644 --- a/fpdfsdk/fxedit/include/fx_edit.h +++ b/fpdfsdk/fxedit/include/fx_edit.h @@ -366,23 +366,23 @@ class IFX_Edit { // 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 @@ class IFX_Edit { 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 c7500a05fb..71431de90a 100644 --- a/fpdfsdk/fxedit/include/fxet_edit.h +++ b/fpdfsdk/fxedit/include/fxet_edit.h @@ -102,7 +102,7 @@ class CFX_Edit_LineRectArray { 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 @@ class CFX_Edit_RectArray { 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 @@ class CFX_Edit : public IFX_Edit { 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 @@ class CFX_Edit : public IFX_Edit { 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 58aa94c5b6..ab4605169b 100644 --- a/fpdfsdk/fxedit/include/fxet_list.h +++ b/fpdfsdk/fxedit/include/fxet_list.h @@ -193,7 +193,7 @@ class CLST_ArrayTemplate : public CFX_ArrayTemplate<TYPE> { 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 a9c76e2523..b36fe372b2 100644 --- a/fpdfsdk/include/fsdk_annothandler.h +++ b/fpdfsdk/include/fsdk_annothandler.h @@ -142,7 +142,7 @@ class IPDFSDK_AnnotHandler { 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 @@ class CPDFSDK_XFAAnnotHandler : public IPDFSDK_AnnotHandler { 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 5e00e16402..c7a7e742d3 100644 --- a/fpdfsdk/include/fsdk_baseform.h +++ b/fpdfsdk/include/fsdk_baseform.h @@ -281,7 +281,7 @@ class CPDFSDK_InterForm : public IPDF_FormNotify { 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 a47f230c92..bf11a23765 100644 --- a/fpdfsdk/include/fsdk_mgr.h +++ b/fpdfsdk/include/fsdk_mgr.h @@ -111,13 +111,13 @@ class CPDFDoc_Environment final { 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 @@ class CPDFDoc_Environment final { 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 @@ class CPDFDoc_Environment final { 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 @@ class CPDFDoc_Environment final { return new CFPDF_FileStream(fileHandler); } - return NULL; + return nullptr; } CFX_WideString FFI_PostRequestURL(const FX_WCHAR* wsURL, @@ -361,7 +361,7 @@ class CPDFDoc_Environment final { 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 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: { diff --git a/fpdfsdk/jsapi/fxjs_v8.cpp b/fpdfsdk/jsapi/fxjs_v8.cpp index 73f6bbf4fb..790d10b602 100644 --- a/fpdfsdk/jsapi/fxjs_v8.cpp +++ b/fpdfsdk/jsapi/fxjs_v8.cpp @@ -314,7 +314,7 @@ void FXJS_InitializeRuntime( 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 @@ void FXJS_Error(v8::Isolate* pIsolate, const CFX_WideString& message) { 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 @@ const wchar_t* FXJS_GetTypeof(v8::Local<v8::Value> pObj) { return kFXJSValueNameNull; if (pObj->IsUndefined()) return kFXJSValueNameUndefined; - return NULL; + return nullptr; } void FXJS_SetPrivate(v8::Isolate* pIsolate, @@ -572,7 +572,7 @@ void FXJS_FreePrivate(v8::Local<v8::Object> pObj) { 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 a7cf1d4c05..0f002a2b4a 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.h +++ b/fpdfsdk/pdfwindow/PWL_Caret.h @@ -28,7 +28,7 @@ class CPWL_Caret : public CPWL_Wnd { 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 f49016123a..c5560228f1 100644 --- a/fpdfsdk/pdfwindow/PWL_ComboBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ComboBox.cpp @@ -169,7 +169,7 @@ void CPWL_CBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, 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 @@ FX_BOOL CPWL_CBButton::OnLButtonUp(const CFX_FloatPoint& point, } 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 eec1fd98c7..21d4b033ab 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -388,7 +388,7 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, 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 @@ void CPWL_Edit::GeneratePageObjects( 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 @@ void CPWL_Edit::GeneratePageObjects(CPDF_PageObjectHolder* pObjectHolder, 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 aa653929bd..e74a6d8b32 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 @@ CPDF_Font* CPWL_EditCtrl::GetCaretFont() const { if (IPVT_FontMap* pFontMap = GetFontMap()) return pFontMap->GetPDFFont(nFontIndex); - return NULL; + return nullptr; } FX_FLOAT CPWL_EditCtrl::GetCaretFontSize() const { @@ -563,7 +563,7 @@ void CPWL_EditCtrl::IOnSetCaret(FX_BOOL bVisible, 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 f73468bf2b..d4eab01cfd 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp @@ -35,13 +35,13 @@ const char* const g_sDEStandardFontName[] = {"Courier", } // 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 @@ CPDF_Font* CPWL_FontMap::GetPDFFont(int32_t nFontIndex) { } } - return NULL; + return nullptr; } CFX_ByteString CPWL_FontMap::GetPDFFontAlias(int32_t nFontIndex) { @@ -208,7 +208,7 @@ int32_t CPWL_FontMap::GetFontIndex(const CFX_ByteString& sFontName, return nFontIndex; CFX_ByteString sAlias; - CPDF_Font* pFont = NULL; + CPDF_Font* pFont = nullptr; if (bFind) pFont = FindFontSameCharset(sAlias, nCharset); @@ -246,7 +246,7 @@ int32_t CPWL_FontMap::GetPWLFontIndex(uint16_t word, int32_t nCharset) { 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::AddFontToDocument(CPDF_Document* pDoc, 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 @@ CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc, CFX_ByteString& sFontName, uint8_t nCharset) { if (!pDoc) - return NULL; + return nullptr; if (sFontName.IsEmpty()) sFontName = GetNativeFont(nCharset); @@ -330,7 +330,7 @@ CPDF_Font* CPWL_FontMap::AddSystemFont(CPDF_Document* pDoc, return m_pSystemHandler->AddNativeTrueTypeFontToPDF(pDoc, sFontName, nCharset); - return NULL; + return nullptr; } CFX_ByteString CPWL_FontMap::EncodeFontAlias(const CFX_ByteString& sFontName, @@ -355,7 +355,7 @@ const CPWL_FontMap_Data* CPWL_FontMap::GetFontMapData(int32_t nIndex) const { return m_aData.GetAt(nIndex); } - return NULL; + return nullptr; } int32_t CPWL_FontMap::GetNativeCharset() { @@ -424,7 +424,7 @@ const CPWL_FontMap::CharsetFontMap CPWL_FontMap::defaultTTFMap[] = { #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 18111ac358..9c2e5cbf69 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 @@ void CPWL_Image::GetImageOffset(FX_FLOAT& x, FX_FLOAT& y) { 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 @@ void CPWL_Icon::GetIconPosition(FX_FLOAT& fLeft, FX_FLOAT& fBottom) { 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 4928560f1c..26d6c92ea4 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 @@ CPWL_IconList_Item* CPWL_IconList_Content::GetListItem( } } - return NULL; + return nullptr; } void CPWL_IconList_Content::SetListData(int32_t nItemIndex, void* pData) { @@ -328,7 +331,7 @@ void CPWL_IconList_Content::SetIconFillColor(const CPWL_Color& color) { } 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 @@ void CPWL_IconList::OnNotify(CPWL_Wnd* pWnd, 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 @@ FX_BOOL CPWL_IconList::OnMouseWheel(short zDelta, 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 203ec49e0f..83d299cd34 100644 --- a/fpdfsdk/pdfwindow/PWL_Label.cpp +++ b/fpdfsdk/pdfwindow/PWL_Label.cpp @@ -87,7 +87,7 @@ void CPWL_Label::DrawThisAppearance(CFX_RenderDevice* pDevice, 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 @@ void CPWL_Label::DrawThisAppearance(CFX_RenderDevice* pDevice, 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 86f3b8f24a..84d2614804 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp @@ -65,18 +65,18 @@ void CPWL_List_Notify::IOnInvalidateRect(CFX_FloatRect* pRect) { } 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::OnCreated() { void CPWL_ListBox::OnDestroy() { delete m_pListNotify; - m_pListNotify = NULL; + m_pListNotify = nullptr; } void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { @@ -187,21 +187,21 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, 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 9532244bc9..7cec290a6b 100644 --- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp +++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp @@ -273,7 +273,7 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, 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 @@ void CPWL_SBButton::DrawThisAppearance(CFX_RenderDevice* pDevice, 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 @@ FX_BOOL CPWL_SBButton::OnMouseMove(const CFX_FloatPoint& point, 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 c737998f26..7513950cb7 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 @@ void CPWL_Signature_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) { } 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 e4232db5e8..f5d30b2d14 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -1222,7 +1222,7 @@ void CPWL_Utils::DrawFillRect(CFX_RenderDevice* pDevice, 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 @@ void CPWL_Utils::DrawFillArea(CFX_RenderDevice* pDevice, 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 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, 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 8ab08a857e..db79cf77e2 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.h +++ b/fpdfsdk/pdfwindow/PWL_Utils.h @@ -168,13 +168,13 @@ class CPWL_Utils { 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 310f2f3f90..2a0a0aabbb 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -55,7 +55,7 @@ void CPWL_Timer::TimerProc(int32_t idEvent) { 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 @@ class CPWL_MsgControl { 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 @@ class CPWL_MsgControl { if (CPWL_Wnd* pWnd = m_aKeyboardPath.GetAt(0)) pWnd->OnKillFocus(); - m_pMainKeyboardWnd = NULL; + m_pMainKeyboardWnd = nullptr; m_aKeyboardPath.RemoveAll(); } @@ -168,7 +168,7 @@ class CPWL_MsgControl { } void ReleaseCapture() { - m_pMainMouseWnd = NULL; + m_pMainMouseWnd = nullptr; m_aMousePath.RemoveAll(); } @@ -181,7 +181,7 @@ class CPWL_MsgControl { }; CPWL_Wnd::CPWL_Wnd() - : m_pVScrollBar(NULL), + : m_pVScrollBar(nullptr), m_rcWindow(), m_rcClip(), m_bCreated(FALSE), @@ -255,7 +255,7 @@ void CPWL_Wnd::Destroy() { if (CPWL_Wnd* pChild = m_aChildren[i]) { pChild->Destroy(); delete pChild; - pChild = NULL; + pChild = nullptr; } } @@ -268,7 +268,7 @@ void CPWL_Wnd::Destroy() { 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 @@ CPWL_ScrollBar* CPWL_Wnd::GetVScrollBar() const { if (HasFlag(PWS_VSCROLL)) return m_pVScrollBar; - return NULL; + return nullptr; } void CPWL_Wnd::CreateScrollBar(const PWL_CREATEPARAM& cp) { @@ -958,7 +958,7 @@ const CPWL_Wnd* CPWL_Wnd::GetFocused() const { 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 c8552fb985..c393d2730e 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -188,13 +188,13 @@ struct PWL_CREATEPARAM { 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 @@ struct PWL_CREATEPARAM { 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 @@ class CPWL_Wnd : public CPWL_TimerHandler { 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); |