diff options
Diffstat (limited to 'core/fpdfapi')
43 files changed, 494 insertions, 479 deletions
diff --git a/core/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp b/core/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp index 119c42b5c1..2da1197787 100644 --- a/core/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp +++ b/core/fpdfapi/fpdf_cmaps/CNS1/cmaps_cns1.cpp @@ -14,33 +14,33 @@ static const FXCMAP_CMap g_FXCMAP_CNS1_cmaps[] = { {"B5pc-H", FXCMAP_CMap::Range, g_FXCMAP_B5pc_H_0, 247, FXCMAP_CMap::None, - NULL, 0, 0}, + nullptr, 0, 0}, {"B5pc-V", FXCMAP_CMap::Range, g_FXCMAP_B5pc_V_0, 12, FXCMAP_CMap::None, - NULL, 0, -1}, + nullptr, 0, -1}, {"HKscs-B5-H", FXCMAP_CMap::Range, g_FXCMAP_HKscs_B5_H_5, 1210, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"HKscs-B5-V", FXCMAP_CMap::Range, g_FXCMAP_HKscs_B5_V_5, 13, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"ETen-B5-H", FXCMAP_CMap::Range, g_FXCMAP_ETen_B5_H_0, 254, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"ETen-B5-V", FXCMAP_CMap::Range, g_FXCMAP_ETen_B5_V_0, 13, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"ETenms-B5-H", FXCMAP_CMap::Range, g_FXCMAP_ETenms_B5_H_0, 1, - FXCMAP_CMap::None, NULL, 0, -2}, + FXCMAP_CMap::None, nullptr, 0, -2}, {"ETenms-B5-V", FXCMAP_CMap::Range, g_FXCMAP_ETenms_B5_V_0, 18, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"CNS-EUC-H", FXCMAP_CMap::Range, g_FXCMAP_CNS_EUC_H_0, 157, FXCMAP_CMap::Range, g_FXCMAP_CNS_EUC_H_0_DWord, 238, 0}, {"CNS-EUC-V", FXCMAP_CMap::Range, g_FXCMAP_CNS_EUC_V_0, 180, FXCMAP_CMap::Range, g_FXCMAP_CNS_EUC_V_0_DWord, 261, 0}, {"UniCNS-UCS2-H", FXCMAP_CMap::Range, g_FXCMAP_UniCNS_UCS2_H_3, 16418, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"UniCNS-UCS2-V", FXCMAP_CMap::Range, g_FXCMAP_UniCNS_UCS2_V_3, 13, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"UniCNS-UTF16-H", FXCMAP_CMap::Single, g_FXCMAP_UniCNS_UTF16_H_0, 14557, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"UniCNS-UTF16-V", FXCMAP_CMap::Range, g_FXCMAP_UniCNS_UCS2_V_3, 13, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, }; void CPDF_ModuleMgr::LoadEmbeddedCNS1CMaps() { diff --git a/core/fpdfapi/fpdf_cmaps/GB1/cmaps_gb1.cpp b/core/fpdfapi/fpdf_cmaps/GB1/cmaps_gb1.cpp index 34a43858b4..35e4894382 100644 --- a/core/fpdfapi/fpdf_cmaps/GB1/cmaps_gb1.cpp +++ b/core/fpdfapi/fpdf_cmaps/GB1/cmaps_gb1.cpp @@ -14,33 +14,33 @@ static const FXCMAP_CMap g_FXCMAP_GB1_cmaps[] = { {"GB-EUC-H", FXCMAP_CMap::Range, g_FXCMAP_GB_EUC_H_0, 90, FXCMAP_CMap::None, - NULL, 0, 0}, + nullptr, 0, 0}, {"GB-EUC-V", FXCMAP_CMap::Range, g_FXCMAP_GB_EUC_V_0, 20, FXCMAP_CMap::None, - NULL, 0, -1}, + nullptr, 0, -1}, {"GBpc-EUC-H", FXCMAP_CMap::Range, g_FXCMAP_GBpc_EUC_H_0, 91, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"GBpc-EUC-V", FXCMAP_CMap::Range, g_FXCMAP_GBpc_EUC_V_0, 20, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"GBK-EUC-H", FXCMAP_CMap::Range, g_FXCMAP_GBK_EUC_H_2, 4071, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"GBK-EUC-V", FXCMAP_CMap::Range, g_FXCMAP_GBK_EUC_V_2, 20, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"GBKp-EUC-H", FXCMAP_CMap::Range, g_FXCMAP_GBKp_EUC_H_2, 4070, - FXCMAP_CMap::None, NULL, 0, -2}, + FXCMAP_CMap::None, nullptr, 0, -2}, {"GBKp-EUC-V", FXCMAP_CMap::Range, g_FXCMAP_GBKp_EUC_V_2, 20, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"GBK2K-H", FXCMAP_CMap::Range, g_FXCMAP_GBK2K_H_5, 4071, FXCMAP_CMap::Single, g_FXCMAP_GBK2K_H_5_DWord, 1017, -4}, {"GBK2K-V", FXCMAP_CMap::Range, g_FXCMAP_GBK2K_V_5, 41, FXCMAP_CMap::None, - NULL, 0, -1}, + nullptr, 0, -1}, {"UniGB-UCS2-H", FXCMAP_CMap::Range, g_FXCMAP_UniGB_UCS2_H_4, 13825, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"UniGB-UCS2-V", FXCMAP_CMap::Range, g_FXCMAP_UniGB_UCS2_V_4, 24, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"UniGB-UTF16-H", FXCMAP_CMap::Range, g_FXCMAP_UniGB_UCS2_H_4, 13825, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"UniGB-UTF16-V", FXCMAP_CMap::Range, g_FXCMAP_UniGB_UCS2_V_4, 24, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, }; void CPDF_ModuleMgr::LoadEmbeddedGB1CMaps() { diff --git a/core/fpdfapi/fpdf_cmaps/Japan1/cmaps_japan1.cpp b/core/fpdfapi/fpdf_cmaps/Japan1/cmaps_japan1.cpp index 6299579081..595989be3c 100644 --- a/core/fpdfapi/fpdf_cmaps/Japan1/cmaps_japan1.cpp +++ b/core/fpdfapi/fpdf_cmaps/Japan1/cmaps_japan1.cpp @@ -14,43 +14,45 @@ static const FXCMAP_CMap g_FXCMAP_Japan1_cmaps[] = { {"83pv-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_83pv_RKSJ_H_1, 222, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"90ms-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_90ms_RKSJ_H_2, 171, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"90ms-RKSJ-V", FXCMAP_CMap::Range, g_FXCMAP_90ms_RKSJ_V_2, 78, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"90msp-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_90msp_RKSJ_H_2, 170, - FXCMAP_CMap::None, NULL, 0, -2}, + FXCMAP_CMap::None, nullptr, 0, -2}, {"90msp-RKSJ-V", FXCMAP_CMap::Range, g_FXCMAP_90msp_RKSJ_V_2, 78, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"90pv-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_90pv_RKSJ_H_1, 263, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"Add-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_Add_RKSJ_H_1, 635, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"Add-RKSJ-V", FXCMAP_CMap::Range, g_FXCMAP_Add_RKSJ_V_1, 57, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"EUC-H", FXCMAP_CMap::Range, g_FXCMAP_EUC_H_1, 120, FXCMAP_CMap::None, - NULL, 0, 0}, - {"EUC-V", FXCMAP_CMap::Range, g_FXCMAP_EUC_V_1, 27, FXCMAP_CMap::None, NULL, - 0, -1}, + nullptr, 0, 0}, + {"EUC-V", FXCMAP_CMap::Range, g_FXCMAP_EUC_V_1, 27, FXCMAP_CMap::None, + nullptr, 0, -1}, {"Ext-RKSJ-H", FXCMAP_CMap::Range, g_FXCMAP_Ext_RKSJ_H_2, 665, - FXCMAP_CMap::None, NULL, 0, -4}, + FXCMAP_CMap::None, nullptr, 0, -4}, {"Ext-RKSJ-V", FXCMAP_CMap::Range, g_FXCMAP_Ext_RKSJ_V_2, 39, - FXCMAP_CMap::None, NULL, 0, -1}, - {"H", FXCMAP_CMap::Range, g_FXCMAP_H_1, 118, FXCMAP_CMap::None, NULL, 0, 0}, - {"V", FXCMAP_CMap::Range, g_FXCMAP_V_1, 27, FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, + {"H", FXCMAP_CMap::Range, g_FXCMAP_H_1, 118, FXCMAP_CMap::None, nullptr, 0, + 0}, + {"V", FXCMAP_CMap::Range, g_FXCMAP_V_1, 27, FXCMAP_CMap::None, nullptr, 0, + -1}, {"UniJIS-UCS2-H", FXCMAP_CMap::Single, g_FXCMAP_UniJIS_UCS2_H_4, 9772, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"UniJIS-UCS2-V", FXCMAP_CMap::Single, g_FXCMAP_UniJIS_UCS2_V_4, 251, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"UniJIS-UCS2-HW-H", FXCMAP_CMap::Range, g_FXCMAP_UniJIS_UCS2_HW_H_4, 4, - FXCMAP_CMap::None, NULL, 0, -2}, + FXCMAP_CMap::None, nullptr, 0, -2}, {"UniJIS-UCS2-HW-V", FXCMAP_CMap::Range, g_FXCMAP_UniJIS_UCS2_HW_V_4, 199, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"UniJIS-UTF16-H", FXCMAP_CMap::Single, g_FXCMAP_UniJIS_UCS2_H_4, 9772, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"UniJIS-UTF16-V", FXCMAP_CMap::Single, g_FXCMAP_UniJIS_UCS2_V_4, 251, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, }; void CPDF_ModuleMgr::LoadEmbeddedJapan1CMaps() { diff --git a/core/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp b/core/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp index ac6346cf7f..1649bf429f 100644 --- a/core/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp +++ b/core/fpdfapi/fpdf_cmaps/Korea1/cmaps_korea1.cpp @@ -14,27 +14,27 @@ static const FXCMAP_CMap g_FXCMAP_Korea1_cmaps[] = { {"KSC-EUC-H", FXCMAP_CMap::Range, g_FXCMAP_KSC_EUC_H_0, 467, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"KSC-EUC-V", FXCMAP_CMap::Range, g_FXCMAP_KSC_EUC_V_0, 16, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"KSCms-UHC-H", FXCMAP_CMap::Range, g_FXCMAP_KSCms_UHC_H_1, 675, - FXCMAP_CMap::None, NULL, 0, -2}, + FXCMAP_CMap::None, nullptr, 0, -2}, {"KSCms-UHC-V", FXCMAP_CMap::Range, g_FXCMAP_KSCms_UHC_V_1, 16, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"KSCms-UHC-HW-H", FXCMAP_CMap::Range, g_FXCMAP_KSCms_UHC_HW_H_1, 675, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"KSCms-UHC-HW-V", FXCMAP_CMap::Range, g_FXCMAP_KSCms_UHC_HW_V_1, 16, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"KSCpc-EUC-H", FXCMAP_CMap::Range, g_FXCMAP_KSCpc_EUC_H_0, 509, - FXCMAP_CMap::None, NULL, 0, -6}, + FXCMAP_CMap::None, nullptr, 0, -6}, {"UniKS-UCS2-H", FXCMAP_CMap::Range, g_FXCMAP_UniKS_UCS2_H_1, 8394, - FXCMAP_CMap::None, NULL, 0, 0}, + FXCMAP_CMap::None, nullptr, 0, 0}, {"UniKS-UCS2-V", FXCMAP_CMap::Range, g_FXCMAP_UniKS_UCS2_V_1, 18, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, {"UniKS-UTF16-H", FXCMAP_CMap::Single, g_FXCMAP_UniKS_UTF16_H_0, 158, - FXCMAP_CMap::None, NULL, 0, -2}, + FXCMAP_CMap::None, nullptr, 0, -2}, {"UniKS-UTF16-V", FXCMAP_CMap::Range, g_FXCMAP_UniKS_UCS2_V_1, 18, - FXCMAP_CMap::None, NULL, 0, -1}, + FXCMAP_CMap::None, nullptr, 0, -1}, }; void CPDF_ModuleMgr::LoadEmbeddedKorea1CMaps() { diff --git a/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp b/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp index e0c5b9b7d6..2a9900df91 100644 --- a/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp +++ b/core/fpdfapi/fpdf_cmaps/fpdf_cmaps.cpp @@ -14,7 +14,7 @@ void FPDFAPI_FindEmbeddedCMap(const char* name, int charset, int coding, const FXCMAP_CMap*& pMap) { - pMap = NULL; + pMap = nullptr; CPDF_FontGlobals* pFontGlobals = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals(); const FXCMAP_CMap* pCMaps = diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp index 2907ebe71c..20ae34349b 100644 --- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp @@ -47,11 +47,11 @@ void CPDF_PageContentGenerator::GenerateContent() { ProcessImage(buf, pPageObj->AsImage()); } CPDF_Object* pContent = - pPageDict ? pPageDict->GetDirectObjectBy("Contents") : NULL; + pPageDict ? pPageDict->GetDirectObjectBy("Contents") : nullptr; if (pContent) { pPageDict->RemoveAt("Contents"); } - CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); + CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, nullptr); pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); m_pDocument->AddIndirectObject(pStream); pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum()); @@ -108,7 +108,7 @@ void CPDF_PageContentGenerator::ProcessForm(CFX_ByteTextBuf& buf, if (!data || !size) { return; } - CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); + CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, nullptr); CPDF_Dictionary* pFormDict = new CPDF_Dictionary; pFormDict->SetAtName("Type", "XObject"); pFormDict->SetAtName("Subtype", "Form"); @@ -122,7 +122,8 @@ void CPDF_PageContentGenerator::ProcessForm(CFX_ByteTextBuf& buf, } void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) { CPDF_Dictionary* pDict = m_pPage->m_pFormDict; - CPDF_Object* pContent = pDict ? pDict->GetDirectObjectBy("Contents") : NULL; + CPDF_Object* pContent = + pDict ? pDict->GetDirectObjectBy("Contents") : nullptr; if (!pContent) return; @@ -159,7 +160,7 @@ void CPDF_PageContentGenerator::TransformContent(CFX_Matrix& matrix) { contentStream.LoadAllData(pStream); ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); } - CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); + CPDF_Stream* pStream = new CPDF_Stream(nullptr, 0, nullptr); pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); m_pDocument->AddIndirectObject(pStream); m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, diff --git a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h index 8782c54f86..285efff4b0 100644 --- a/core/fpdfapi/fpdf_edit/include/cpdf_creator.h +++ b/core/fpdfapi/fpdf_edit/include/cpdf_creator.h @@ -33,7 +33,7 @@ class CPDF_Creator { void RemoveSecurity(); bool Create(IFX_StreamWrite* pFile, uint32_t flags = 0); - int32_t Continue(IFX_Pause* pPause = NULL); + int32_t Continue(IFX_Pause* pPause = nullptr); FX_BOOL SetFileVersion(int32_t fileVersion = 17); private: diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp index 194db8b25c..af4121da16 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.cpp @@ -320,7 +320,7 @@ uint32_t CPDF_CIDFont::CharCodeFromUnicode(FX_WCHAR unicode) const { uint8_t buffer[32]; int ret = FXSYS_WideCharToMultiByte(g_CharsetCPs[m_pCMap->m_Coding], 0, &unicode, 1, - (char*)buffer, 4, NULL, NULL); + (char*)buffer, 4, nullptr, nullptr); if (ret == 1) { return buffer[0]; } @@ -603,13 +603,13 @@ int CPDF_CIDFont::GetGlyphIndex(uint32_t unicode, FX_BOOL* pVertGlyph) { if (!m_Font.GetSubData()) { unsigned long length = 0; int error = FXFT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, - NULL, &length); + nullptr, &length); if (!error) { m_Font.SetSubData(FX_Alloc(uint8_t, length)); } } int error = FXFT_Load_Sfnt_Table(face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, - m_Font.GetSubData(), NULL); + m_Font.GetSubData(), nullptr); if (!error && m_Font.GetSubData()) { m_pTTGSUBTable.reset(new CFX_CTTGSUBTable); m_pTTGSUBTable->LoadGSUBTable((FT_Bytes)m_Font.GetSubData()); @@ -678,7 +678,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph) { } else if (bMacRoman) { iBaseEncoding = PDFFONT_ENCODING_MACROMAN; } - const FX_CHAR* name = GetAdobeCharName(iBaseEncoding, NULL, charcode); + const FX_CHAR* name = GetAdobeCharName(iBaseEncoding, nullptr, charcode); if (!name) { return charcode == 0 ? -1 : (int)charcode; } diff --git a/core/fpdfapi/fpdf_font/cpdf_cidfont.h b/core/fpdfapi/fpdf_font/cpdf_cidfont.h index 62840f847a..f1c72c65cf 100644 --- a/core/fpdfapi/fpdf_font/cpdf_cidfont.h +++ b/core/fpdfapi/fpdf_font/cpdf_cidfont.h @@ -40,7 +40,8 @@ class CPDF_CIDFont : public CPDF_Font { bool IsCIDFont() const override; const CPDF_CIDFont* AsCIDFont() const override; CPDF_CIDFont* AsCIDFont() override; - int GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph = NULL) override; + int GlyphFromCharCode(uint32_t charcode, + FX_BOOL* pVertGlyph = nullptr) override; int GetCharWidthF(uint32_t charcode, int level = 0) override; FX_RECT GetCharBBox(uint32_t charcode, int level = 0) override; uint32_t GetNextChar(const FX_CHAR* pString, diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp index 9fb54a828b..78bdeeffaa 100644 --- a/core/fpdfapi/fpdf_font/cpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp @@ -60,7 +60,7 @@ CPDF_Font::CPDF_Font() CPDF_Font::~CPDF_Font() { delete m_pToUnicodeMap; - m_pToUnicodeMap = NULL; + m_pToUnicodeMap = nullptr; if (m_pFontFile) { m_pDocument->GetPageData()->ReleaseFontFileStreamAcc( @@ -332,7 +332,7 @@ CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc, pDict->SetAtName("Subtype", "Type1"); pDict->SetAtName("BaseFont", fontname); pDict->SetAtName("Encoding", "WinAnsiEncoding"); - pFont = CPDF_Font::CreateFontF(NULL, pDict); + pFont = CPDF_Font::CreateFontF(nullptr, pDict); pFontGlobals->Set(pDoc, font_id, pFont); return pFont; } diff --git a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp index 8a280e6ba0..6b726f0a32 100644 --- a/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp @@ -330,40 +330,40 @@ const FX_CHAR* const StandardEncodingNames[224] = { "bar", "braceright", "asciitilde", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, "exclamdown", "cent", "sterling", @@ -379,12 +379,12 @@ const FX_CHAR* const StandardEncodingNames[224] = { "guilsinglright", "fi", "fl", - NULL, + nullptr, "endash", "dagger", "daggerdbl", "periodcentered", - NULL, + nullptr, "paragraph", "bullet", "quotesinglbase", @@ -393,9 +393,9 @@ const FX_CHAR* const StandardEncodingNames[224] = { "guillemotright", "ellipsis", "perthousand", - NULL, + nullptr, "questiondown", - NULL, + nullptr, "grave", "acute", "circumflex", @@ -404,61 +404,61 @@ const FX_CHAR* const StandardEncodingNames[224] = { "breve", "dotaccent", "dieresis", - NULL, + nullptr, "ring", "cedilla", - NULL, + nullptr, "hungarumlaut", "ogonek", "caron", "emdash", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, "AE", - NULL, + nullptr, "ordfeminine", - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, "Lslash", "Oslash", "OE", "ordmasculine", - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, "ae", - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, "dotlessi", - NULL, - NULL, + nullptr, + nullptr, "lslash", "oslash", "oe", "germandbls", - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, }; const FX_CHAR* const AdobeWinAnsiEncodingNames[224] = { @@ -784,7 +784,7 @@ const FX_CHAR* const MacRomanEncodingNames[224] = { "bar", "braceright", "asciitilde", - NULL, + nullptr, "Adieresis", "Aring", "Ccedilla", @@ -944,17 +944,17 @@ const FX_CHAR* const MacExpertEncodingNames[224] = { "nineoldstyle", "colon", "semicolon", - NULL, + nullptr, "threequartersemdash", - NULL, + nullptr, "questionsmall", - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, "Ethsmall", - NULL, - NULL, + nullptr, + nullptr, "onequarter", "onehalf", "threequarters", @@ -964,19 +964,19 @@ const FX_CHAR* const MacExpertEncodingNames[224] = { "seveneighths", "onethird", "twothirds", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", - NULL, + nullptr, "parenrightinferior", "Circumflexsmall", "hypheninferior", @@ -1011,14 +1011,14 @@ const FX_CHAR* const MacExpertEncodingNames[224] = { "onefitted", "rupiah", "Tildesmall", - NULL, - NULL, + nullptr, + nullptr, "asuperior", "centsuperior", - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, "Aacutesmall", "Agravesmall", "Acircumflexsmall", @@ -1044,7 +1044,7 @@ const FX_CHAR* const MacExpertEncodingNames[224] = { "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", - NULL, + nullptr, "eightsuperior", "fourinferior", "threeinferior", @@ -1052,25 +1052,25 @@ const FX_CHAR* const MacExpertEncodingNames[224] = { "eightinferior", "seveninferior", "Scaronsmall", - NULL, + nullptr, "centinferior", "twoinferior", - NULL, + nullptr, "Dieresissmall", - NULL, + nullptr, "Caronsmall", "Scaronsmall", "fiveinferior", - NULL, + nullptr, "commainferior", "periodinferior", "Yacutesmall", - NULL, + nullptr, "dollarinferior", - NULL, - NULL, + nullptr, + nullptr, "Thornsmall", - NULL, + nullptr, "nineinferior", "zeroinferior", "Zcaronsmall", @@ -1079,29 +1079,29 @@ const FX_CHAR* const MacExpertEncodingNames[224] = { "questiondownsmall", "oneinferior", "asuperior", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, "Cedillasmall", - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, "OEsmall", "figuredash", "hyphensuperior", - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, "exclamdownsmall", - NULL, + nullptr, "Ydieresissmall", - NULL, + nullptr, "onesuperior", "twosuperior", "threesuperior", @@ -1111,20 +1111,20 @@ const FX_CHAR* const MacExpertEncodingNames[224] = { "sevensuperior", "ninesuperior", "zerosuperior", - NULL, + nullptr, "esuperior", "rsuperior", - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, "isuperior", "ssuperior", "dsuperior", - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, "lsuperior", "Ogoneksmall", "Brevesmall", @@ -1136,10 +1136,10 @@ const FX_CHAR* const MacExpertEncodingNames[224] = { "periodsuperior", "Dotaccentsmall", "Ringsmall", - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, }; const FX_CHAR* const PDFDocEncodingNames[232] = { @@ -1246,7 +1246,7 @@ const FX_CHAR* const PDFDocEncodingNames[232] = { "bar", "braceright", "asciitilde", - NULL, + nullptr, "bullet3", "dagger", "daggerdbl", @@ -1278,7 +1278,7 @@ const FX_CHAR* const PDFDocEncodingNames[232] = { "oe", "scaron", "zcaron2", - NULL, + nullptr, "Euro", "exclamdown", "cent", @@ -1292,7 +1292,7 @@ const FX_CHAR* const PDFDocEncodingNames[232] = { "ordfeminine", "guillemotleft4", "logicalnot", - NULL, + nullptr, "registered", "macron", "degree", @@ -1473,39 +1473,39 @@ const FX_CHAR* const AdobeSymbolEncodingNames[224] = { "bar", "braceright", "similar", - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, + nullptr, "Euro", "Upsilon1", "minute", @@ -1586,7 +1586,7 @@ const FX_CHAR* const AdobeSymbolEncodingNames[224] = { "braceleftmid", "braceleftbt", "braceex", - NULL, + nullptr, "angleright", "integral", "integraltp", @@ -1601,35 +1601,38 @@ const FX_CHAR* const AdobeSymbolEncodingNames[224] = { "bracerighttp", "bracerightmid", "bracerightbt", - NULL, + nullptr, }; const FX_CHAR* const ZapfEncodingNames[224] = { - "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", - "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", - "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", - "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", - "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", - "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", - "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", - "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", - "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", - "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", - "a84", "a97", "a98", "a99", "a100", NULL, "a89", "a90", "a93", - "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", - "a95", "a96", NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, "a101", "a102", "a103", "a104", "a106", "a107", - "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", - "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", - "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", - "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", - "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", - "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", - "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", - "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", - "a182", NULL, "a201", "a183", "a184", "a197", "a185", "a194", "a198", - "a186", "a195", "a187", "a188", "a189", "a190", "a191", NULL}; + "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", + "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", + "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", + "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", + "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", + "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", + "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", + "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", + "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", + "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", + "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", + "a82", "a83", "a84", "a97", "a98", "a99", "a100", nullptr, + "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", + "a206", "a86", "a87", "a88", "a95", "a96", nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, "a101", "a102", "a103", "a104", "a106", "a107", "a108", + "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", + "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", + "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", + "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", + "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", + "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", + "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", + "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", + "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", + nullptr, "a201", "a183", "a184", "a197", "a185", "a194", "a198", + "a186", "a195", "a187", "a188", "a189", "a190", "a191", nullptr}; uint32_t PDF_FindCode(const uint16_t* pCodes, uint16_t unicode) { for (uint32_t i = 0; i < 256; i++) @@ -1694,7 +1697,7 @@ CPDF_Object* CPDF_FontEncoding::Realize() { if (predefined == PDFFONT_ENCODING_MACEXPERT) { return new CPDF_Name("MacExpertEncoding"); } - return NULL; + return nullptr; } const uint16_t* pStandard = PDF_UnicodesForPredefinedCharSet(PDFFONT_ENCODING_WINANSI); @@ -1751,7 +1754,7 @@ const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding) { case PDFFONT_ENCODING_MS_SYMBOL: return MSSymbolEncoding; } - return NULL; + return nullptr; } FX_WCHAR PDF_UnicodeFromAdobeName(const FX_CHAR* name) { @@ -1768,12 +1771,12 @@ const FX_CHAR* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode) { if (encoding == PDFFONT_ENCODING_PDFDOC) { if (charcode < 24) - return NULL; + return nullptr; charcode -= 24; } else { if (charcode < 32) - return NULL; + return nullptr; charcode -= 32; } diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp index b367184e2e..129441625a 100644 --- a/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.cpp @@ -142,11 +142,11 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() { m_BaseEncoding = PDFFONT_ENCODING_STANDARD; } CPDF_Object* pEncoding = m_pFontDict->GetDirectObjectBy("Encoding"); - LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, m_pFontFile != NULL, + LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, !!m_pFontFile, m_Font.IsTTFont()); LoadGlyphMap(); delete[] m_pCharNames; - m_pCharNames = NULL; + m_pCharNames = nullptr; if (!m_Font.GetFace()) return TRUE; @@ -189,8 +189,6 @@ void CPDF_SimpleFont::LoadSubstFont() { int weight = m_StemV < 140 ? m_StemV * 5 : (m_StemV * 4 + 140); m_Font.LoadSubst(m_BaseFont, IsTrueTypeFont(), m_Flags, weight, m_ItalicAngle, 0); - if (m_Font.GetSubstFont()->m_SubstFlags & FXFONT_SUBST_NONSYMBOL) { - } } FX_BOOL CPDF_SimpleFont::IsUnicodeCompatible() const { diff --git a/core/fpdfapi/fpdf_font/cpdf_simplefont.h b/core/fpdfapi/fpdf_font/cpdf_simplefont.h index 7b07c9971e..881744a405 100644 --- a/core/fpdfapi/fpdf_font/cpdf_simplefont.h +++ b/core/fpdfapi/fpdf_font/cpdf_simplefont.h @@ -20,7 +20,8 @@ class CPDF_SimpleFont : public CPDF_Font { // CPDF_Font: int GetCharWidthF(uint32_t charcode, int level = 0) override; FX_RECT GetCharBBox(uint32_t charcode, int level = 0) override; - int GlyphFromCharCode(uint32_t charcode, FX_BOOL* pVertGlyph = NULL) override; + int GlyphFromCharCode(uint32_t charcode, + FX_BOOL* pVertGlyph = nullptr) override; FX_BOOL IsUnicodeCompatible() const override; CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override; uint32_t CharCodeFromUnicode(FX_WCHAR Unicode) const override; diff --git a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp index fc12ae78ee..908b6e3a2f 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type1font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_type1font.cpp @@ -40,7 +40,7 @@ const FX_CHAR* GlyphNameRemap(const FX_CHAR* pStrAdobe) { compareString); if (found) return found->m_pStrUnicode; - return NULL; + return nullptr; } #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp index 9f7b127d60..e5442215c4 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp @@ -297,6 +297,6 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) { ->GetFontGlobals() ->m_CMapManager.GetCID2UnicodeMap(cid_set, FALSE); } else { - m_pBaseMap = NULL; + m_pBaseMap = nullptr; } } diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 01a0f6cbdd..2a55955cc0 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -336,13 +336,13 @@ CPDF_CID2UnicodeMap* CPDF_CMapManager::LoadCID2UnicodeMap(CIDSet charset, CPDF_CID2UnicodeMap* pMap = new CPDF_CID2UnicodeMap(); if (!pMap->Initialize()) { delete pMap; - return NULL; + return nullptr; } pMap->Load(this, charset, bPromptCJK); return pMap; } CPDF_CMapParser::CPDF_CMapParser() { - m_pCMap = NULL; + m_pCMap = nullptr; m_Status = 0; m_CodeSeq = 0; } @@ -506,11 +506,11 @@ CPDF_CMap::CPDF_CMap() { m_CodingScheme = TwoBytes; m_bVertical = 0; m_bLoaded = FALSE; - m_pMapping = NULL; - m_pLeadingBytes = NULL; - m_pAddMapping = NULL; - m_pEmbedMap = NULL; - m_pUseMap = NULL; + m_pMapping = nullptr; + m_pLeadingBytes = nullptr; + m_pAddMapping = nullptr; + m_pEmbedMap = nullptr; + m_pUseMap = nullptr; m_nCodeRanges = 0; } CPDF_CMap::~CPDF_CMap() { diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/fpdfapi/fpdf_font/ttgsubtable.cpp index f6d6400f47..5734816a87 100644 --- a/core/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -290,7 +290,7 @@ void CFX_CTTGSUBTable::ParseLookup(FT_Bytes raw, TLookup* rec) { } rec->SubTable = new struct TSubTableBase*[rec->SubTableCount]; for (i = 0; i < rec->SubTableCount; i++) { - rec->SubTable[i] = NULL; + rec->SubTable[i] = nullptr; } if (rec->LookupType != 1) { return; diff --git a/core/fpdfapi/fpdf_font/ttgsubtable.h b/core/fpdfapi/fpdf_font/ttgsubtable.h index 0ef2351336..830e67af88 100644 --- a/core/fpdfapi/fpdf_font/ttgsubtable.h +++ b/core/fpdfapi/fpdf_font/ttgsubtable.h @@ -53,7 +53,7 @@ class CFX_CTTGSUBTable { : LookupOrder(0), ReqFeatureIndex(0), FeatureCount(0), - FeatureIndex(NULL) {} + FeatureIndex(nullptr) {} ~TLangSys() { delete[] FeatureIndex; } private: @@ -73,7 +73,7 @@ class CFX_CTTGSUBTable { uint16_t DefaultLangSys; uint16_t LangSysCount; struct TLangSysRecord* LangSysRecord; - TScript() : DefaultLangSys(0), LangSysCount(0), LangSysRecord(NULL) {} + TScript() : DefaultLangSys(0), LangSysCount(0), LangSysRecord(nullptr) {} ~TScript() { delete[] LangSysRecord; } private: @@ -92,7 +92,7 @@ class CFX_CTTGSUBTable { struct TScriptList { uint16_t ScriptCount; struct TScriptRecord* ScriptRecord; - TScriptList() : ScriptCount(0), ScriptRecord(NULL) {} + TScriptList() : ScriptCount(0), ScriptRecord(nullptr) {} ~TScriptList() { delete[] ScriptRecord; } private: @@ -103,7 +103,7 @@ class CFX_CTTGSUBTable { uint16_t FeatureParams; int LookupCount; uint16_t* LookupListIndex; - TFeature() : FeatureParams(0), LookupCount(0), LookupListIndex(NULL) {} + TFeature() : FeatureParams(0), LookupCount(0), LookupListIndex(nullptr) {} ~TFeature() { delete[] LookupListIndex; } private: @@ -122,7 +122,7 @@ class CFX_CTTGSUBTable { struct TFeatureList { int FeatureCount; struct TFeatureRecord* FeatureRecord; - TFeatureList() : FeatureCount(0), FeatureRecord(NULL) {} + TFeatureList() : FeatureCount(0), FeatureRecord(nullptr) {} ~TFeatureList() { delete[] FeatureRecord; } private: @@ -150,7 +150,9 @@ class CFX_CTTGSUBTable { struct TCoverageFormat1 : public TCoverageFormatBase { uint16_t GlyphCount; uint16_t* GlyphArray; - TCoverageFormat1() : GlyphCount(0), GlyphArray(NULL) { CoverageFormat = 1; } + TCoverageFormat1() : GlyphCount(0), GlyphArray(nullptr) { + CoverageFormat = 1; + } ~TCoverageFormat1() override { delete[] GlyphArray; } private: @@ -172,7 +174,7 @@ class CFX_CTTGSUBTable { struct TCoverageFormat2 : public TCoverageFormatBase { uint16_t RangeCount; struct TRangeRecord* RangeRecord; - TCoverageFormat2() : RangeCount(0), RangeRecord(NULL) { + TCoverageFormat2() : RangeCount(0), RangeRecord(nullptr) { CoverageFormat = 2; } ~TCoverageFormat2() override { delete[] RangeRecord; } @@ -194,7 +196,8 @@ class CFX_CTTGSUBTable { uint16_t StartGlyph; uint16_t GlyphCount; uint16_t* ClassValueArray; - TClassDefFormat1() : StartGlyph(0), GlyphCount(0), ClassValueArray(NULL) { + TClassDefFormat1() + : StartGlyph(0), GlyphCount(0), ClassValueArray(nullptr) { ClassFormat = 1; } ~TClassDefFormat1() override { delete[] ClassValueArray; } @@ -216,7 +219,7 @@ class CFX_CTTGSUBTable { struct TClassDefFormat2 : public TClassDefFormatBase { uint16_t ClassRangeCount; struct TClassRangeRecord* ClassRangeRecord; - TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(NULL) { + TClassDefFormat2() : ClassRangeCount(0), ClassRangeRecord(nullptr) { ClassFormat = 2; } ~TClassDefFormat2() override { delete[] ClassRangeRecord; } @@ -247,7 +250,9 @@ class CFX_CTTGSUBTable { struct TSingleSubstFormat1 : public TSubTableBase { TCoverageFormatBase* Coverage; int16_t DeltaGlyphID; - TSingleSubstFormat1() : Coverage(NULL), DeltaGlyphID(0) { SubstFormat = 1; } + TSingleSubstFormat1() : Coverage(nullptr), DeltaGlyphID(0) { + SubstFormat = 1; + } ~TSingleSubstFormat1() override { delete Coverage; } private: @@ -258,7 +263,8 @@ class CFX_CTTGSUBTable { TCoverageFormatBase* Coverage; uint16_t GlyphCount; uint16_t* Substitute; - TSingleSubstFormat2() : Coverage(NULL), GlyphCount(0), Substitute(NULL) { + TSingleSubstFormat2() + : Coverage(nullptr), GlyphCount(0), Substitute(nullptr) { SubstFormat = 2; } ~TSingleSubstFormat2() override { @@ -276,7 +282,7 @@ class CFX_CTTGSUBTable { uint16_t SubTableCount; struct TSubTableBase** SubTable; TLookup() - : LookupType(0), LookupFlag(0), SubTableCount(0), SubTable(NULL) {} + : LookupType(0), LookupFlag(0), SubTableCount(0), SubTable(nullptr) {} ~TLookup() { if (SubTable) { for (int i = 0; i < SubTableCount; ++i) @@ -292,7 +298,7 @@ class CFX_CTTGSUBTable { struct TLookupList { int LookupCount; struct TLookup* Lookup; - TLookupList() : LookupCount(0), Lookup(NULL) {} + TLookupList() : LookupCount(0), Lookup(nullptr) {} ~TLookupList() { delete[] Lookup; } private: diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp index 4fe5283251..5230b3b206 100644 --- a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp @@ -126,7 +126,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS, FXSYS_memcpy(pGeneralState->m_SMaskMatrix, &pParser->GetCurStates()->m_CTM, sizeof(CFX_Matrix)); } else { - pGeneralState->m_pSoftMask = NULL; + pGeneralState->m_pSoftMask = nullptr; } break; case FXBSTR_ID('C', 'A', 0, 0): diff --git a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp index d66b920f07..9300f1081b 100644 --- a/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_colorspace.cpp @@ -325,7 +325,7 @@ CPDF_ColorSpace* CPDF_ColorSpace::ColorspaceFromName( if (name == "Pattern") { return CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN); } - return NULL; + return nullptr; } CPDF_ColorSpace* CPDF_ColorSpace::GetStockCS(int family) { @@ -366,7 +366,7 @@ CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) { if (pArray->GetCount() == 1) return ColorspaceFromName(familyname); - CPDF_ColorSpace* pCS = NULL; + CPDF_ColorSpace* pCS = nullptr; uint32_t id = familyname.GetID(); if (id == FXBSTR_ID('C', 'a', 'l', 'G')) { pCS = new CPDF_CalGray(pDoc); @@ -386,12 +386,12 @@ CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) { } else if (id == FXBSTR_ID('P', 'a', 't', 't')) { pCS = new CPDF_PatternCS(pDoc); } else { - return NULL; + return nullptr; } pCS->m_pArray = pArray; if (!pCS->v_Load(pDoc, pArray)) { pCS->ReleaseCS(); - return NULL; + return nullptr; } return pCS; } @@ -965,7 +965,7 @@ CPDF_IndexedCS::CPDF_IndexedCS(CPDF_Document* pDoc) CPDF_IndexedCS::~CPDF_IndexedCS() { FX_Free(m_pCompMinMax); - CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : NULL; + CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : nullptr; if (pCS && m_pDocument) { m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); } @@ -980,7 +980,7 @@ FX_BOOL CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { return FALSE; } CPDF_DocPageData* pDocPageData = pDoc->GetPageData(); - m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, NULL); + m_pBaseCS = pDocPageData->GetColorSpace(pBaseObj, nullptr); if (!m_pBaseCS) { return FALSE; } @@ -1052,7 +1052,7 @@ CPDF_PatternCS::CPDF_PatternCS(CPDF_Document* pDoc) m_pCountedBaseCS(nullptr) {} CPDF_PatternCS::~CPDF_PatternCS() { - CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : NULL; + CPDF_ColorSpace* pCS = m_pCountedBaseCS ? m_pCountedBaseCS->get() : nullptr; if (pCS && m_pDocument) { m_pDocument->GetPageData()->ReleaseColorSpace(pCS->GetArray()); } @@ -1064,7 +1064,7 @@ FX_BOOL CPDF_PatternCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) { return FALSE; } CPDF_DocPageData* pDocPageData = pDoc->GetPageData(); - m_pBaseCS = pDocPageData->GetColorSpace(pBaseCS, NULL); + m_pBaseCS = pDocPageData->GetColorSpace(pBaseCS, nullptr); if (m_pBaseCS) { if (m_pBaseCS->GetFamily() == PDFCS_PATTERN) { return FALSE; diff --git a/core/fpdfapi/fpdf_page/cpdf_image.cpp b/core/fpdfapi/fpdf_page/cpdf_image.cpp index d7e50d8291..63e006fc06 100644 --- a/core/fpdfapi/fpdf_page/cpdf_image.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_image.cpp @@ -58,7 +58,7 @@ FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) { m_pStream = pStream; if (m_bInline && m_pInlineDict) { m_pInlineDict->Release(); - m_pInlineDict = NULL; + m_pInlineDict = nullptr; } m_bInline = bInline; CPDF_Dictionary* pDict = pStream->GetDict(); @@ -168,7 +168,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) { pDict->SetAtName("Subtype", "Image"); pDict->SetAtInteger("Width", BitmapWidth); pDict->SetAtInteger("Height", BitmapHeight); - uint8_t* dest_buf = NULL; + uint8_t* dest_buf = nullptr; FX_STRSIZE dest_pitch = 0, dest_size = 0, opType = -1; if (bpp == 1) { int32_t reset_a = 0, reset_r = 0, reset_g = 0, reset_b = 0; @@ -252,7 +252,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) { opType = 0; } } - const CFX_DIBitmap* pMaskBitmap = NULL; + const CFX_DIBitmap* pMaskBitmap = nullptr; FX_BOOL bDeleteMask = FALSE; if (pBitmap->HasAlpha()) { pMaskBitmap = pBitmap->GetAlphaMask(); @@ -261,7 +261,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) { if (pMaskBitmap) { int32_t maskWidth = pMaskBitmap->GetWidth(); int32_t maskHeight = pMaskBitmap->GetHeight(); - uint8_t* mask_buf = NULL; + uint8_t* mask_buf = nullptr; FX_STRSIZE mask_size = 0; CPDF_Dictionary* pMaskDict = new CPDF_Dictionary; pMaskDict->SetAtName("Type", "XObject"); @@ -301,10 +301,10 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) { SetImage(pNewBitmap, iCompress); if (pDict) { pDict->Release(); - pDict = NULL; + pDict = nullptr; } FX_Free(dest_buf); - dest_buf = NULL; + dest_buf = nullptr; dest_size = 0; delete pNewBitmap; return; @@ -343,7 +343,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) { } } if (!m_pStream) { - m_pStream = new CPDF_Stream(NULL, 0, NULL); + m_pStream = new CPDF_Stream(nullptr, 0, nullptr); } m_pStream->InitStream(dest_buf, dest_size, pDict); m_bIsMask = pBitmap->IsAlphaMask(); diff --git a/core/fpdfapi/fpdf_page/cpdf_textstate.cpp b/core/fpdfapi/fpdf_page/cpdf_textstate.cpp index 5269cae44b..50fc7789fe 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textstate.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textstate.cpp @@ -13,11 +13,11 @@ void CPDF_TextState::SetFont(CPDF_Font* pFont) { CPDF_TextStateData* pStateData = GetModify(); if (pStateData) { CPDF_Document* pDoc = pStateData->m_pDocument; - CPDF_DocPageData* pPageData = pDoc ? pDoc->GetPageData() : NULL; + CPDF_DocPageData* pPageData = pDoc ? pDoc->GetPageData() : nullptr; if (pPageData && pStateData->m_pFont && !pPageData->IsForceClear()) { pPageData->ReleaseFont(pStateData->m_pFont->GetFontDict()); } - pStateData->m_pDocument = pFont ? pFont->m_pDocument : NULL; + pStateData->m_pDocument = pFont ? pFont->m_pDocument : nullptr; pStateData->m_pFont = pFont; } } diff --git a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 2256fda585..6fd7621a51 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -217,7 +217,7 @@ void CPDF_DeviceCS::TranslateImageLine(uint8_t* pDestBuf, } CPDF_IccProfile::CPDF_IccProfile(const uint8_t* pData, uint32_t dwSize) - : m_bsRGB(FALSE), m_pTransform(NULL), m_nSrcComponents(0) { + : m_bsRGB(FALSE), m_pTransform(nullptr), m_nSrcComponents(0) { if (dwSize == 3144 && FXSYS_memcmp(pData + 0x190, "sRGB IEC61966-2.1", 17) == 0) { m_bsRGB = TRUE; diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp index ae02cfb4a7..e7f68224a4 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -128,7 +128,7 @@ void CPDF_DocPageData::Clear(FX_BOOL bForceRelease) { CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, FX_BOOL findOnly) { if (!pFontDict) { - return NULL; + return nullptr; } if (findOnly) { auto it = m_FontMap.find(pFontDict); @@ -434,7 +434,7 @@ void CPDF_DocPageData::ReleaseImage(CPDF_Object* pImageStream) { CPDF_IccProfile* CPDF_DocPageData::GetIccProfile( CPDF_Stream* pIccProfileStream) { if (!pIccProfileStream) - return NULL; + return nullptr; auto it = m_IccProfileMap.find(pIccProfileStream); if (it != m_IccProfileMap.end()) { diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 4bd4a4d529..802f424274 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -82,7 +82,7 @@ class CPDF_StreamParserAutoClearer { : scoped_variable_(scoped_variable) { *scoped_variable_ = new_parser; } - ~CPDF_StreamParserAutoClearer() { *scoped_variable_ = NULL; } + ~CPDF_StreamParserAutoClearer() { *scoped_variable_ = nullptr; } private: CPDF_StreamParser** scoped_variable_; @@ -321,7 +321,7 @@ void CPDF_StreamContentParser::ClearAllParams() { CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) { if (index >= m_ParamCount) { - return NULL; + return nullptr; } int real_index = m_ParamStartPos + m_ParamCount - index - 1; if (real_index >= PARAM_BUF_SIZE) { @@ -348,7 +348,7 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) { return param.m_pObject; } ASSERT(FALSE); - return NULL; + return nullptr; } CFX_ByteString CPDF_StreamContentParser::GetString(uint32_t index) { @@ -612,7 +612,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() { } } PDF_ReplaceAbbr(pDict); - CPDF_Object* pCSObj = NULL; + CPDF_Object* pCSObj = nullptr; if (pDict->KeyExist("ColorSpace")) { pCSObj = pDict->GetDirectObjectBy("ColorSpace"); if (pCSObj->IsName()) { @@ -642,7 +642,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() { } } pDict->SetAtName("Subtype", "Image"); - CPDF_ImageObject* pImgObj = AddImage(pStream, NULL, TRUE); + CPDF_ImageObject* pImgObj = AddImage(pStream, nullptr, TRUE); if (!pImgObj) { if (pStream) { pStream->Release(); @@ -654,7 +654,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() { void CPDF_StreamContentParser::Handle_BeginMarkedContent() { CFX_ByteString tag = GetString(0); - m_CurContentMark.GetModify()->AddMark(tag, NULL, FALSE); + m_CurContentMark.GetModify()->AddMark(tag, nullptr, FALSE); } void CPDF_StreamContentParser::Handle_BeginText() { @@ -738,7 +738,7 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() { type = pXObject->GetDict()->GetStringBy("Subtype"); if (type == "Image") { - CPDF_ImageObject* pObj = AddImage(pXObject, NULL, FALSE); + CPDF_ImageObject* pObj = AddImage(pXObject, nullptr, FALSE); m_LastImageName = name; m_pLastImage = pObj->m_pImage; if (!m_pObjectHolder->HasImageMask()) @@ -773,7 +773,7 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, FX_BOOL bInline) { if (!pStream && !pImage) { - return NULL; + return nullptr; } CFX_Matrix ImageMatrix; ImageMatrix.Copy(m_pCurStates->m_CTM); @@ -1010,7 +1010,7 @@ void CPDF_StreamContentParser::Handle_SetColor_Fill() { for (int i = 0; i < nargs; i++) { values[i] = GetNumber(nargs - i - 1); } - m_pCurStates->m_ColorState.SetFillColor(NULL, values, nargs); + m_pCurStates->m_ColorState.SetFillColor(nullptr, values, nargs); } void CPDF_StreamContentParser::Handle_SetColor_Stroke() { @@ -1022,7 +1022,7 @@ void CPDF_StreamContentParser::Handle_SetColor_Stroke() { for (int i = 0; i < nargs; i++) { values[i] = GetNumber(nargs - i - 1); } - m_pCurStates->m_ColorState.SetStrokeColor(NULL, values, nargs); + m_pCurStates->m_ColorState.SetStrokeColor(nullptr, values, nargs); } void CPDF_StreamContentParser::Handle_SetColorPS_Fill() { @@ -1034,7 +1034,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Fill() { uint32_t nvalues = nargs; if (pLastParam->IsName()) nvalues--; - FX_FLOAT* values = NULL; + FX_FLOAT* values = nullptr; if (nvalues) { values = FX_Alloc(FX_FLOAT, nvalues); for (uint32_t i = 0; i < nvalues; i++) { @@ -1047,7 +1047,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Fill() { m_pCurStates->m_ColorState.SetFillPattern(pPattern, values, nvalues); } } else { - m_pCurStates->m_ColorState.SetFillColor(NULL, values, nvalues); + m_pCurStates->m_ColorState.SetFillColor(nullptr, values, nvalues); } FX_Free(values); } @@ -1062,7 +1062,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() { if (pLastParam->IsName()) nvalues--; - FX_FLOAT* values = NULL; + FX_FLOAT* values = nullptr; if (nvalues) { values = FX_Alloc(FX_FLOAT, nvalues); for (int i = 0; i < nvalues; i++) { @@ -1075,7 +1075,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() { m_pCurStates->m_ColorState.SetStrokePattern(pPattern, values, nvalues); } } else { - m_pCurStates->m_ColorState.SetStrokeColor(NULL, values, nvalues); + m_pCurStates->m_ColorState.SetStrokeColor(nullptr, values, nvalues); } FX_Free(values); } @@ -1189,7 +1189,7 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace( CPDF_Object* pCSObj = FindResourceObj("ColorSpace", name); if (!pCSObj) { m_bResourceMissing = TRUE; - return NULL; + return nullptr; } return m_pDocument->LoadColorSpace(pCSObj); } @@ -1284,7 +1284,7 @@ void CPDF_StreamContentParser::Handle_ShowText() { if (str.IsEmpty()) { return; } - AddTextObject(&str, 0, NULL, 1); + AddTextObject(&str, 0, nullptr, 1); } void CPDF_StreamContentParser::Handle_ShowText_Positioning() { diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index 5bac23e137..42adb84638 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -43,7 +43,7 @@ CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize) { m_pBuf = pData; m_Size = dwSize; m_Pos = 0; - m_pLastObj = NULL; + m_pLastObj = nullptr; } CPDF_StreamParser::~CPDF_StreamParser() { @@ -168,30 +168,30 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, } uint32_t pitch = width; if (bpc && pitch > INT_MAX / bpc) { - return NULL; + return nullptr; } pitch *= bpc; if (nComponents && pitch > INT_MAX / nComponents) { - return NULL; + return nullptr; } pitch *= nComponents; if (pitch > INT_MAX - 7) { - return NULL; + return nullptr; } pitch += 7; pitch /= 8; OrigSize = pitch; } else { if (width > INT_MAX - 7) { - return NULL; + return nullptr; } OrigSize = ((width + 7) / 8); } if (height && OrigSize > INT_MAX / height) { - return NULL; + return nullptr; } OrigSize *= height; - uint8_t* pData = NULL; + uint8_t* pData = nullptr; uint32_t dwStreamSize; if (Decoder.IsEmpty()) { if (OrigSize > m_Size - m_Pos) { @@ -208,7 +208,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc, Decoder, pParam, pData, dwDestSize); FX_Free(pData); if ((int)dwStreamSize < 0) - return NULL; + return nullptr; uint32_t dwSavePos = m_Pos; m_Pos += dwStreamSize; @@ -714,7 +714,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, pData->m_BlendType = FXDIB_BLEND_NORMAL; pData->m_StrokeAlpha = 1.0f; pData->m_FillAlpha = 1.0f; - pData->m_pSoftMask = NULL; + pData->m_pSoftMask = nullptr; } m_nStreams = 0; m_pSingleStream.reset(new CPDF_StreamAcc); diff --git a/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h b/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h index 48ace36835..8bb6c57260 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_colorspace.h @@ -79,7 +79,7 @@ class CPDF_ColorSpace { FX_BOOL bTransMask = FALSE) const; CPDF_Array*& GetArray() { return m_pArray; } - virtual CPDF_ColorSpace* GetBaseCS() const { return NULL; } + virtual CPDF_ColorSpace* GetBaseCS() const { return nullptr; } virtual void EnableStdConversion(FX_BOOL bEnabled); diff --git a/core/fpdfapi/fpdf_page/include/cpdf_form.h b/core/fpdfapi/fpdf_page/include/cpdf_form.h index d36a976176..92acbca25a 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_form.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_form.h @@ -21,7 +21,7 @@ class CPDF_Form : public CPDF_PageObjectHolder { CPDF_Form(CPDF_Document* pDocument, CPDF_Dictionary* pPageResources, CPDF_Stream* pFormStream, - CPDF_Dictionary* pParentResources = NULL); + CPDF_Dictionary* pParentResources = nullptr); ~CPDF_Form(); diff --git a/core/fpdfapi/fpdf_page/include/cpdf_image.h b/core/fpdfapi/fpdf_page/include/cpdf_image.h index 48349deb3b..f475e53478 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_image.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_image.h @@ -39,7 +39,7 @@ class CPDF_Image { CPDF_Dictionary* GetInlineDict() const { return m_pInlineDict; } CPDF_Stream* GetStream() const { return m_pStream; } CPDF_Dictionary* GetDict() const { - return m_pStream ? m_pStream->GetDict() : NULL; + return m_pStream ? m_pStream->GetDict() : nullptr; } CPDF_Dictionary* GetOC() const { return m_pOC; } CPDF_Document* GetDocument() const { return m_pDocument; } @@ -51,8 +51,8 @@ class CPDF_Image { FX_BOOL IsMask() const { return m_bIsMask; } FX_BOOL IsInterpol() const { return m_bInterpolate; } - CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = NULL, - uint32_t* pMatteColor = NULL, + CFX_DIBSource* LoadDIBSource(CFX_DIBSource** ppMask = nullptr, + uint32_t* pMatteColor = nullptr, FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE) const; diff --git a/core/fpdfapi/fpdf_page/pageint.h b/core/fpdfapi/fpdf_page/pageint.h index b2204d8dbf..29fd6fb86e 100644 --- a/core/fpdfapi/fpdf_page/pageint.h +++ b/core/fpdfapi/fpdf_page/pageint.h @@ -52,7 +52,7 @@ class CPDF_StreamParser { uint32_t GetWordSize() const { return m_WordSize; } CPDF_Object* GetObject() { CPDF_Object* pObj = m_pLastObj; - m_pLastObj = NULL; + m_pLastObj = nullptr; return pObj; } uint32_t GetPos() const { return m_Pos; } diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp index d4f49f659b..c039871401 100644 --- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp @@ -10,9 +10,9 @@ #include "core/fpdfapi/fpdf_parser/cpdf_syntax_parser.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -CFDF_Document::CFDF_Document() : CPDF_IndirectObjectHolder(NULL) { - m_pRootDict = NULL; - m_pFile = NULL; +CFDF_Document::CFDF_Document() : CPDF_IndirectObjectHolder(nullptr) { + m_pRootDict = nullptr; + m_pFile = nullptr; m_bOwnFile = FALSE; } CFDF_Document::~CFDF_Document() { diff --git a/core/fpdfapi/fpdf_parser/cpdf_array.cpp b/core/fpdfapi/fpdf_parser/cpdf_array.cpp index 20073772b7..a047b3af7b 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_array.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_array.cpp @@ -101,12 +101,12 @@ FX_FLOAT CPDF_Array::GetNumberAt(size_t i) const { CPDF_Dictionary* CPDF_Array::GetDictAt(size_t i) const { CPDF_Object* p = GetDirectObjectAt(i); if (!p) - return NULL; + return nullptr; if (CPDF_Dictionary* pDict = p->AsDictionary()) return pDict; if (CPDF_Stream* pStream = p->AsStream()) return pStream->GetDict(); - return NULL; + return nullptr; } CPDF_Stream* CPDF_Array::GetStreamAt(size_t i) const { diff --git a/core/fpdfapi/fpdf_parser/cpdf_crypto_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_crypto_handler.cpp index 2d845d856a..3cd973c277 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_crypto_handler.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_crypto_handler.cpp @@ -328,7 +328,7 @@ FX_BOOL CPDF_CryptoHandler::EncryptContent(uint32_t objnum, return TRUE; } CPDF_CryptoHandler::CPDF_CryptoHandler() { - m_pAESContext = NULL; + m_pAESContext = nullptr; m_Cipher = FXCIPHER_NONE; m_KeyLen = 0; } diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp index c705a657aa..d3f9a54f4c 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp @@ -74,13 +74,13 @@ CPDF_DataAvail::CPDF_DataAvail(IPDF_DataAvail::FileAvail* pFileAvail, m_bPageLoadedOK = FALSE; m_bNeedDownLoadResource = FALSE; m_bLinearizedFormParamLoad = FALSE; - m_pLinearized = NULL; - m_pRoot = NULL; - m_pTrailer = NULL; - m_pCurrentParser = NULL; - m_pAcroForm = NULL; - m_pPageDict = NULL; - m_pPageResource = NULL; + m_pLinearized = nullptr; + m_pRoot = nullptr; + m_pTrailer = nullptr; + m_pCurrentParser = nullptr; + m_pAcroForm = nullptr; + m_pPageDict = nullptr; + m_pPageResource = nullptr; m_docStatus = PDF_DATAAVAIL_HEADER; m_parser.m_bOwnFileRead = false; m_bTotalLoadPageTree = FALSE; @@ -569,7 +569,7 @@ FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) { } CPDF_Dictionary* pDict = pPages->GetDict(); - CPDF_Object* pKids = pDict ? pDict->GetObjectBy("Kids") : NULL; + CPDF_Object* pKids = pDict ? pDict->GetObjectBy("Kids") : nullptr; if (!pKids) return TRUE; @@ -642,19 +642,19 @@ FX_BOOL CPDF_DataAvail::CheckHeader(IPDF_DataAvail::DownloadHints* pHints) { FX_BOOL CPDF_DataAvail::CheckFirstPage(IPDF_DataAvail::DownloadHints* pHints) { CPDF_Dictionary* pDict = m_pLinearized->GetDict(); - CPDF_Object* pEndOffSet = pDict ? pDict->GetObjectBy("E") : NULL; + CPDF_Object* pEndOffSet = pDict ? pDict->GetObjectBy("E") : nullptr; if (!pEndOffSet) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; } - CPDF_Object* pXRefOffset = pDict ? pDict->GetObjectBy("T") : NULL; + CPDF_Object* pXRefOffset = pDict ? pDict->GetObjectBy("T") : nullptr; if (!pXRefOffset) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; } - CPDF_Object* pFileLen = pDict ? pDict->GetObjectBy("L") : NULL; + CPDF_Object* pFileLen = pDict ? pDict->GetObjectBy("L") : nullptr; if (!pFileLen) { m_docStatus = PDF_DATAAVAIL_ERROR; return FALSE; diff --git a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp index a4629dcf6b..65d3173613 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_security_handler.cpp @@ -531,7 +531,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, owner_size = user_size; } if (m_Revision >= 5) { - int t = (int)time(NULL); + int t = (int)time(nullptr); uint8_t sha[128]; CRYPT_SHA256Start(sha); CRYPT_SHA256Update(sha, (uint8_t*)&t, sizeof t); @@ -620,7 +620,8 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, const uint8_t* user_pass, uint32_t user_size, uint32_t type) { - OnCreate(pEncryptDict, pIdArray, user_pass, user_size, NULL, 0, FALSE, type); + OnCreate(pEncryptDict, pIdArray, user_pass, user_size, nullptr, 0, FALSE, + type); } void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict, const uint8_t* password, diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h index e1d1c77a12..24d400fcd7 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h @@ -70,7 +70,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder { // |pFontDict| must not be null. CPDF_Font* LoadFont(CPDF_Dictionary* pFontDict); CPDF_ColorSpace* LoadColorSpace(CPDF_Object* pCSObj, - CPDF_Dictionary* pResources = NULL); + CPDF_Dictionary* pResources = nullptr); CPDF_Pattern* LoadPattern(CPDF_Object* pObj, FX_BOOL bShading, diff --git a/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h index 4f9ea1fe46..df0d73ac64 100644 --- a/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h +++ b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h @@ -41,7 +41,7 @@ class CPDF_PageRenderCache { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); @@ -56,7 +56,7 @@ class CPDF_PageRenderCache { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp index 6ac78ecd43..7e8c8348a5 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp @@ -61,7 +61,7 @@ void CPDF_DocRenderData::Clear(FX_BOOL bRelease) { if (m_pFontCache) { if (bRelease) { delete m_pFontCache; - m_pFontCache = NULL; + m_pFontCache = nullptr; } else { m_pFontCache->FreeCache(FALSE); } @@ -92,7 +92,7 @@ CPDF_RenderOptions::CPDF_RenderOptions() m_Flags(RENDER_CLEARTYPE), m_Interpolation(0), m_AddFlags(0), - m_pOCContext(NULL), + m_pOCContext(nullptr), m_dwLimitCacheSize(1024 * 1024 * 100), m_HalftoneLimit(-1) {} FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const { @@ -324,7 +324,7 @@ void CPDF_RenderStatus::ProcessObjectNoClip(const CPDF_PageObject* pObj, FX_BOOL bRet = FALSE; switch (pObj->GetType()) { case CPDF_PageObject::TEXT: - bRet = ProcessText(pObj->AsText(), pObj2Device, NULL); + bRet = ProcessText(pObj->AsText(), pObj2Device, nullptr); break; case CPDF_PageObject::PATH: bRet = ProcessPath(pObj->AsPath(), pObj2Device); @@ -384,7 +384,7 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, CFX_Matrix matrix = *pObj2Device; matrix.Concat(*buffer.GetMatrix()); GetScaledMatrix(matrix); - CPDF_Dictionary* pFormResource = NULL; + CPDF_Dictionary* pFormResource = nullptr; if (pObj->IsForm()) { const CPDF_FormObject* pFormObj = pObj->AsForm(); if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { @@ -392,9 +392,9 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, } } CPDF_RenderStatus status; - status.Initialize(m_pContext, buffer.GetDevice(), buffer.GetMatrix(), NULL, - NULL, NULL, &m_Options, m_Transparency, m_bDropObjects, - pFormResource); + status.Initialize(m_pContext, buffer.GetDevice(), buffer.GetMatrix(), nullptr, + nullptr, nullptr, &m_Options, m_Transparency, + m_bDropObjects, pFormResource); status.RenderSingleObject(pObj, &matrix); buffer.OutputToDevice(); } @@ -407,12 +407,12 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj, } CFX_Matrix matrix = pFormObj->m_FormMatrix; matrix.Concat(*pObj2Device); - CPDF_Dictionary* pResources = NULL; + CPDF_Dictionary* pResources = nullptr; if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) { pResources = pFormObj->m_pForm->m_pFormDict->GetDictBy("Resources"); } CPDF_RenderStatus status; - status.Initialize(m_pContext, m_pDevice, NULL, m_pStopObj, this, pFormObj, + status.Initialize(m_pContext, m_pDevice, nullptr, m_pStopObj, this, pFormObj, &m_Options, m_Transparency, m_bDropObjects, pResources, FALSE); status.m_curBlend = m_curBlend; @@ -669,14 +669,14 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, return TRUE; } CPDF_Dictionary* pSMaskDict = - pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : NULL; + pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : nullptr; if (pSMaskDict) { if (pPageObj->IsImage() && pPageObj->AsImage()->m_pImage->GetDict()->KeyExist("SMask")) { - pSMaskDict = NULL; + pSMaskDict = nullptr; } } - CPDF_Dictionary* pFormResource = NULL; + CPDF_Dictionary* pFormResource = nullptr; FX_FLOAT group_alpha = 1.0f; int Transparency = m_Transparency; FX_BOOL bGroupTransparent = FALSE; @@ -701,15 +701,15 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, } if ((m_Options.m_Flags & RENDER_OVERPRINT) && pPageObj->IsImage() && pGeneralState && pGeneralState->m_FillOP && pGeneralState->m_StrokeOP) { - CPDF_Document* pDocument = NULL; - CPDF_Page* pPage = NULL; + CPDF_Document* pDocument = nullptr; + CPDF_Page* pPage = nullptr; if (m_pContext->GetPageCache()) { pPage = m_pContext->GetPageCache()->GetPage(); pDocument = pPage->m_pDocument; } else { pDocument = pPageObj->AsImage()->m_pImage->GetDocument(); } - CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL; + CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : nullptr; CPDF_Object* pCSObj = pPageObj->AsImage() ->m_pImage->GetStream() ->GetDict() @@ -796,9 +796,9 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, } } CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pContext, &bitmap_device, NULL, m_pStopObj, NULL, - NULL, &m_Options, 0, m_bDropObjects, pFormResource, - TRUE); + bitmap_render.Initialize(m_pContext, &bitmap_device, nullptr, m_pStopObj, + nullptr, nullptr, &m_Options, 0, m_bDropObjects, + pFormResource, TRUE); bitmap_render.ProcessObjectNoClip(pPageObj, &new_matrix); m_bStopped = bitmap_render.m_bStopped; if (pSMaskDict) { @@ -891,7 +891,7 @@ CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates( const CPDF_GraphicStates* pSrcStates, FX_BOOL bStroke) { if (!pSrcStates) { - return NULL; + return nullptr; } CPDF_GraphicStates* pStates = new CPDF_GraphicStates; pStates->CopyStates(*pSrcStates); @@ -935,7 +935,7 @@ void CPDF_RenderContext::AppendLayer(CPDF_PageObjectHolder* pObjectHolder, void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, const CPDF_RenderOptions* pOptions, const CFX_Matrix* pLastMatrix) { - Render(pDevice, NULL, pOptions, pLastMatrix); + Render(pDevice, nullptr, pOptions, pLastMatrix); } void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, const CPDF_PageObject* pStopObj, @@ -949,9 +949,9 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, CFX_Matrix FinalMatrix = pLayer->m_Matrix; FinalMatrix.Concat(*pLastMatrix); CPDF_RenderStatus status; - status.Initialize(this, pDevice, pLastMatrix, pStopObj, NULL, NULL, + status.Initialize(this, pDevice, pLastMatrix, pStopObj, nullptr, nullptr, pOptions, pLayer->m_pObjectHolder->m_Transparency, - FALSE, NULL); + FALSE, nullptr); status.RenderObjectList(pLayer->m_pObjectHolder, &FinalMatrix); if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); @@ -962,8 +962,9 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, } } else { CPDF_RenderStatus status; - status.Initialize(this, pDevice, NULL, pStopObj, NULL, NULL, pOptions, - pLayer->m_pObjectHolder->m_Transparency, FALSE, NULL); + status.Initialize(this, pDevice, nullptr, pStopObj, nullptr, nullptr, + pOptions, pLayer->m_pObjectHolder->m_Transparency, + FALSE, nullptr); status.RenderObjectList(pLayer->m_pObjectHolder, &pLayer->m_Matrix); if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); @@ -1014,8 +1015,8 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { m_pCurrentLayer->m_pObjectHolder->GetPageObjectList()->end(); m_pRenderStatus.reset(new CPDF_RenderStatus()); m_pRenderStatus->Initialize( - m_pContext, m_pDevice, NULL, NULL, NULL, NULL, m_pOptions, - m_pCurrentLayer->m_pObjectHolder->m_Transparency, FALSE, NULL); + m_pContext, m_pDevice, nullptr, nullptr, nullptr, nullptr, m_pOptions, + m_pCurrentLayer->m_pObjectHolder->m_Transparency, FALSE, nullptr); m_pDevice->SaveState(); m_ClipRect = CFX_FloatRect(m_pDevice->GetClipBox()); CFX_Matrix device2object; @@ -1204,7 +1205,7 @@ void CPDF_DeviceBuffer::OutputToDevice() { CFX_DIBitmap buffer; m_pDevice->CreateCompatibleBitmap(&buffer, m_pBitmap->GetWidth(), m_pBitmap->GetHeight()); - m_pContext->GetBackground(&buffer, m_pObject, NULL, &m_Matrix); + m_pContext->GetBackground(&buffer, m_pObject, nullptr, &m_Matrix); buffer.CompositeBitmap(0, 0, buffer.GetWidth(), buffer.GetHeight(), m_pBitmap.get(), 0, 0); m_pDevice->StretchDIBits(&buffer, m_Rect.left, m_Rect.top, m_Rect.Width(), diff --git a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp index b0539a2014..07fa2e7b82 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -166,14 +166,14 @@ void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream, CPDF_ImageCacheEntry::CPDF_ImageCacheEntry(CPDF_Document* pDoc, CPDF_Stream* pStream) : m_dwTimeCount(0), - m_pCurBitmap(NULL), - m_pCurMask(NULL), + m_pCurBitmap(nullptr), + m_pCurMask(nullptr), m_MatteColor(0), - m_pRenderStatus(NULL), + m_pRenderStatus(nullptr), m_pDocument(pDoc), m_pStream(pStream), - m_pCachedBitmap(NULL), - m_pCachedMask(NULL), + m_pCachedBitmap(nullptr), + m_pCachedMask(nullptr), m_dwCacheSize(0) {} CPDF_ImageCacheEntry::~CPDF_ImageCacheEntry() { delete m_pCachedBitmap; @@ -181,7 +181,7 @@ CPDF_ImageCacheEntry::~CPDF_ImageCacheEntry() { } void CPDF_ImageCacheEntry::Reset(const CFX_DIBitmap* pBitmap) { delete m_pCachedBitmap; - m_pCachedBitmap = NULL; + m_pCachedBitmap = nullptr; if (pBitmap) { m_pCachedBitmap = pBitmap->Clone(); } @@ -217,12 +217,12 @@ FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap, CPDF_PageRenderCache* pPageRenderCache = pContext->GetPageCache(); m_dwTimeCount = pPageRenderCache->GetTimeCount(); CPDF_DIBSource* pSrc = new CPDF_DIBSource; - CPDF_DIBSource* pMaskSrc = NULL; + CPDF_DIBSource* pMaskSrc = nullptr; if (!pSrc->Load(m_pDocument, m_pStream, &pMaskSrc, &MatteColor, pRenderStatus->m_pFormResource, pPageResources, bStdCS, GroupFamily, bLoadMask)) { delete pSrc; - pBitmap = NULL; + pBitmap = nullptr; return FALSE; } m_MatteColor = MatteColor; @@ -244,12 +244,12 @@ FX_BOOL CPDF_ImageCacheEntry::GetCachedBitmap(CFX_DIBSource*& pBitmap, } CFX_DIBSource* CPDF_ImageCacheEntry::DetachBitmap() { CFX_DIBSource* pDIBSource = m_pCurBitmap; - m_pCurBitmap = NULL; + m_pCurBitmap = nullptr; return pDIBSource; } CFX_DIBSource* CPDF_ImageCacheEntry::DetachMask() { CFX_DIBSource* pDIBSource = m_pCurMask; - m_pCurMask = NULL; + m_pCurMask = nullptr; return pDIBSource; } int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, @@ -279,7 +279,7 @@ int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, } if (!ret) { delete m_pCurBitmap; - m_pCurBitmap = NULL; + m_pCurBitmap = nullptr; return 0; } ContinueGetCachedBitmap(); @@ -295,14 +295,14 @@ void CPDF_ImageCacheEntry::ContinueGetCachedBitmap() { FPDF_HUGE_IMAGE_SIZE) { m_pCachedBitmap = m_pCurBitmap->Clone(); delete m_pCurBitmap; - m_pCurBitmap = NULL; + m_pCurBitmap = nullptr; } else { m_pCachedBitmap = m_pCurBitmap; } if (m_pCurMask) { m_pCachedMask = m_pCurMask->Clone(); delete m_pCurMask; - m_pCurMask = NULL; + m_pCurMask = nullptr; } m_pCurBitmap = m_pCachedBitmap; m_pCurMask = m_pCachedMask; @@ -315,7 +315,7 @@ int CPDF_ImageCacheEntry::Continue(IFX_Pause* pPause) { } if (!ret) { delete m_pCurBitmap; - m_pCurBitmap = NULL; + m_pCurBitmap = nullptr; return 0; } ContinueGetCachedBitmap(); diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp index acfb20314a..76a6d4e764 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -31,7 +31,7 @@ FX_BOOL CPDF_RenderStatus::ProcessImage(const CPDF_ImageObject* pImageObj, const CFX_Matrix* pObj2Device) { CPDF_ImageRenderer render; if (render.Start(this, pImageObj, pObj2Device, m_bStdCS, m_curBlend)) { - render.Continue(NULL); + render.Continue(nullptr); } return render.m_Result; } @@ -89,7 +89,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, FX_RECT rect(left, top, left + pDIBitmap->GetWidth(), top + pDIBitmap->GetHeight()); rect.Intersect(m_pDevice->GetClipBox()); - CFX_DIBitmap* pClone = NULL; + CFX_DIBitmap* pClone = nullptr; FX_BOOL bClone = FALSE; if (m_pDevice->GetBackDrop() && m_pDevice->GetBitmap()) { bClone = TRUE; @@ -315,19 +315,19 @@ void CPDF_DIBTransferFunc::TranslateDownSamples(uint8_t* dest_buf, } } CPDF_ImageRenderer::CPDF_ImageRenderer() { - m_pRenderStatus = NULL; - m_pImageObject = NULL; + m_pRenderStatus = nullptr; + m_pImageObject = nullptr; m_Result = TRUE; m_Status = 0; - m_pTransformer = NULL; - m_DeviceHandle = NULL; - m_LoadHandle = NULL; - m_pClone = NULL; + m_pTransformer = nullptr; + m_DeviceHandle = nullptr; + m_LoadHandle = nullptr; + m_pClone = nullptr; m_bStdCS = FALSE; m_bPatternColor = FALSE; m_BlendType = FXDIB_BLEND_NORMAL; - m_pPattern = NULL; - m_pObj2Device = NULL; + m_pPattern = nullptr; + m_pObj2Device = nullptr; } CPDF_ImageRenderer::~CPDF_ImageRenderer() { delete m_pTransformer; @@ -392,7 +392,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { } m_FillArgb = 0; m_bPatternColor = FALSE; - m_pPattern = NULL; + m_pPattern = nullptr; if (m_pDIBSource->IsAlphaMask()) { CPDF_Color* pColor = m_pImageObject->m_ColorState.GetFillColor(); if (pColor && pColor->IsPattern()) { @@ -450,15 +450,15 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() { pGeneralState->m_OPMode == 0 && pGeneralState->m_BlendType == FXDIB_BLEND_NORMAL && pGeneralState->m_StrokeAlpha == 1 && pGeneralState->m_FillAlpha == 1) { - CPDF_Document* pDocument = NULL; - CPDF_Page* pPage = NULL; + CPDF_Document* pDocument = nullptr; + CPDF_Page* pPage = nullptr; if (m_pRenderStatus->m_pContext->GetPageCache()) { pPage = m_pRenderStatus->m_pContext->GetPageCache()->GetPage(); pDocument = pPage->m_pDocument; } else { pDocument = m_pImageObject->m_pImage->GetDocument(); } - CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL; + CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : nullptr; CPDF_Object* pCSObj = m_pImageObject->m_pImage->GetStream()->GetDict()->GetDirectObjectBy( "ColorSpace"); @@ -537,9 +537,10 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { bitmap_device1.GetBitmap()->Clear(0xffffff); { CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, NULL, - NULL, NULL, NULL, &m_pRenderStatus->m_Options, 0, - m_pRenderStatus->m_bDropObjects, NULL, TRUE); + bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, + nullptr, nullptr, nullptr, nullptr, + &m_pRenderStatus->m_Options, 0, + m_pRenderStatus->m_bDropObjects, nullptr, TRUE); CFX_Matrix patternDevice = *pObj2Device; patternDevice.Translate((FX_FLOAT)-rect.left, (FX_FLOAT)-rect.top); if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) { @@ -559,13 +560,13 @@ FX_BOOL CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { } bitmap_device2.GetBitmap()->Clear(0); CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, NULL, - NULL, NULL, NULL, NULL, 0, - m_pRenderStatus->m_bDropObjects, NULL, TRUE); + bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, + nullptr, nullptr, nullptr, nullptr, nullptr, 0, + m_pRenderStatus->m_bDropObjects, nullptr, TRUE); CPDF_ImageRenderer image_render; if (image_render.Start(&bitmap_render, m_pDIBSource, 0xffffffff, 255, &new_matrix, m_Flags, TRUE)) { - image_render.Continue(NULL); + image_render.Continue(nullptr); } if (m_Loader.m_MatteColor != 0xffffffff) { int matte_r = FXARGB_R(m_Loader.m_MatteColor); @@ -636,13 +637,13 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() { bitmap_device1.GetBitmap()->Clear(0xffffff); { CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, NULL, - NULL, NULL, NULL, NULL, 0, - m_pRenderStatus->m_bDropObjects, NULL, TRUE); + bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device1, + nullptr, nullptr, nullptr, nullptr, nullptr, 0, + m_pRenderStatus->m_bDropObjects, nullptr, TRUE); CPDF_ImageRenderer image_render; if (image_render.Start(&bitmap_render, m_pDIBSource, 0, 255, &new_matrix, m_Flags, TRUE)) { - image_render.Continue(NULL); + image_render.Continue(nullptr); } } { @@ -652,13 +653,13 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() { bitmap_device2.GetBitmap()->Clear(0); CPDF_RenderStatus bitmap_render; - bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, NULL, - NULL, NULL, NULL, NULL, 0, - m_pRenderStatus->m_bDropObjects, NULL, TRUE); + bitmap_render.Initialize(m_pRenderStatus->m_pContext, &bitmap_device2, + nullptr, nullptr, nullptr, nullptr, nullptr, 0, + m_pRenderStatus->m_bDropObjects, nullptr, TRUE); CPDF_ImageRenderer image_render; if (image_render.Start(&bitmap_render, m_Loader.m_pMask, 0xffffffff, 255, &new_matrix, m_Flags, TRUE)) { - image_render.Continue(NULL); + image_render.Continue(nullptr); } if (m_Loader.m_MatteColor != 0xffffffff) { int matte_r = FXARGB_R(m_Loader.m_MatteColor); @@ -803,7 +804,7 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() { path.Transform(&m_ImageMatrix); uint32_t fill_color = ArgbEncode(0xff, m_BitmapAlpha, m_BitmapAlpha, m_BitmapAlpha); - m_pRenderStatus->m_pDevice->DrawPath(&path, NULL, NULL, fill_color, 0, + m_pRenderStatus->m_pDevice->DrawPath(&path, nullptr, nullptr, fill_color, 0, FXFILL_WINDING); } else { const CFX_DIBSource* pAlphaMask = m_pDIBSource->IsAlphaMask() @@ -922,8 +923,8 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, return nullptr; CFX_DIBitmap& bitmap = *bitmap_device.GetBitmap(); - CPDF_Object* pCSObj = NULL; - CPDF_ColorSpace* pCS = NULL; + CPDF_Object* pCSObj = nullptr; + CPDF_ColorSpace* pCS = nullptr; if (bLuminosity) { CPDF_Array* pBC = pSMaskDict->GetArrayBy("BC"); FX_ARGB back_color = 0xff000000; @@ -932,7 +933,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, if (pDict && pDict->GetDictBy("Group")) pCSObj = pDict->GetDictBy("Group")->GetDirectObjectBy("CS"); else - pCSObj = NULL; + pCSObj = nullptr; pCS = m_pContext->GetDocument()->LoadColorSpace(pCSObj); if (pCS) { FX_FLOAT R, G, B; @@ -945,7 +946,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, FX_SAFE_UINT32 num_floats = comps; num_floats *= sizeof(FX_FLOAT); if (!num_floats.IsValid()) { - return NULL; + return nullptr; } FXSYS_memset(pFloats, 0, num_floats.ValueOrDie()); size_t count = pBC->GetCount() > 8 ? 8 : pBC->GetCount(); @@ -962,16 +963,16 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, } else { bitmap.Clear(0); } - CPDF_Dictionary* pFormResource = NULL; + CPDF_Dictionary* pFormResource = nullptr; if (form.m_pFormDict) { pFormResource = form.m_pFormDict->GetDictBy("Resources"); } CPDF_RenderOptions options; options.m_ColorMode = bLuminosity ? RENDER_COLOR_NORMAL : RENDER_COLOR_ALPHA; CPDF_RenderStatus status; - status.Initialize(m_pContext, &bitmap_device, NULL, NULL, NULL, NULL, - &options, 0, m_bDropObjects, pFormResource, TRUE, NULL, 0, - pCS ? pCS->GetFamily() : 0, bLuminosity); + status.Initialize(m_pContext, &bitmap_device, nullptr, nullptr, nullptr, + nullptr, &options, 0, m_bDropObjects, pFormResource, TRUE, + nullptr, 0, pCS ? pCS->GetFamily() : 0, bLuminosity); status.RenderObjectList(&form, &matrix); std::unique_ptr<CFX_DIBitmap> pMask(new CFX_DIBitmap); if (!pMask->Create(width, height, FXDIB_8bppMask)) diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index 7896f83459..20278f71d9 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -677,7 +677,7 @@ struct CPDF_PatchDrawer { fillFlags |= FXFILL_NOPATHSMOOTH; } pDevice->DrawPath( - &path, NULL, NULL, + &path, nullptr, nullptr, FXARGB_MAKE(alpha, div_colors[0].comp[0], div_colors[0].comp[1], div_colors[0].comp[2]), 0, fillFlags); @@ -1044,7 +1044,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern, if (width > clip_box.Width() || height > clip_box.Height() || width * height > clip_box.Width() * clip_box.Height()) { - CPDF_GraphicStates* pStates = NULL; + CPDF_GraphicStates* pStates = nullptr; if (!pPattern->colored()) pStates = CloneObjStates(pPageObj, bStroke); diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp index a3df1c2214..43816c4d99 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -328,7 +328,7 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, CPDF_Type3Cache* CPDF_RenderStatus::GetCachedType3(CPDF_Type3Font* pFont) { if (!pFont->m_pDocument) { - return NULL; + return nullptr; } pFont->m_pDocument->GetPageData()->GetFont(pFont->GetFontDict(), FALSE); return pFont->m_pDocument->GetRenderData()->GetCachedType3(pFont); @@ -415,17 +415,17 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, CPDF_RenderOptions Options = m_Options; Options.m_Flags |= RENDER_FORCE_HALFTONE | RENDER_RECT_AA; Options.m_Flags &= ~RENDER_FORCE_DOWNSAMPLE; - CPDF_Dictionary* pFormResource = NULL; + CPDF_Dictionary* pFormResource = nullptr; if (pType3Char->m_pForm && pType3Char->m_pForm->m_pFormDict) { pFormResource = pType3Char->m_pForm->m_pFormDict->GetDictBy("Resources"); } if (fill_alpha == 255) { CPDF_RenderStatus status; - status.Initialize(m_pContext, m_pDevice, NULL, NULL, this, pStates, - &Options, pType3Char->m_pForm->m_Transparency, - m_bDropObjects, pFormResource, FALSE, pType3Char, - fill_argb); + status.Initialize(m_pContext, m_pDevice, nullptr, nullptr, this, + pStates, &Options, + pType3Char->m_pForm->m_Transparency, m_bDropObjects, + pFormResource, FALSE, pType3Char, fill_argb); status.m_Type3FontCache.Append(m_Type3FontCache); status.m_Type3FontCache.Add(pType3Font); m_pDevice->SaveState(); @@ -443,10 +443,10 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, } bitmap_device.GetBitmap()->Clear(0); CPDF_RenderStatus status; - status.Initialize(m_pContext, &bitmap_device, NULL, NULL, this, pStates, - &Options, pType3Char->m_pForm->m_Transparency, - m_bDropObjects, pFormResource, FALSE, pType3Char, - fill_argb); + status.Initialize(m_pContext, &bitmap_device, nullptr, nullptr, this, + pStates, &Options, + pType3Char->m_pForm->m_Transparency, m_bDropObjects, + pFormResource, FALSE, pType3Char, fill_argb); status.m_Type3FontCache.Append(m_Type3FontCache); status.m_Type3FontCache.Add(pType3Font); matrix.TranslateI(-rect.left, -rect.top); @@ -527,7 +527,7 @@ class CPDF_CharPosList { }; CPDF_CharPosList::CPDF_CharPosList() { - m_pCharPos = NULL; + m_pCharPos = nullptr; } CPDF_CharPosList::~CPDF_CharPosList() { @@ -641,7 +641,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, if (nChars == 1) { charcode = pFont->GetNextChar(str.c_str(), str.GetLength(), offset); pCharCodes = (uint32_t*)(uintptr_t)charcode; - pCharPos = NULL; + pCharPos = nullptr; } else { pCharCodes = FX_Alloc(uint32_t, nChars); pCharPos = FX_Alloc(FX_FLOAT, nChars - 1); @@ -690,7 +690,7 @@ FX_BOOL CPDF_TextRenderer::DrawNormalText(CFX_RenderDevice* pDevice, const CPDF_RenderOptions* pOptions) { CFX_FontCache* pCache = pFont->m_pDocument ? pFont->m_pDocument->GetRenderData()->GetFontCache() - : NULL; + : nullptr; CPDF_CharPosList CharPosList; CharPosList.Load(nChars, pCharCodes, pCharPos, pFont, font_size); int FXGE_flags = 0; diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h index 98822797b0..f373b9371a 100644 --- a/core/fpdfapi/fpdf_render/render_int.h +++ b/core/fpdfapi/fpdf_render/render_int.h @@ -98,7 +98,7 @@ class CPDF_TransferFunc { class CPDF_DocRenderData { public: - CPDF_DocRenderData(CPDF_Document* pPDFDoc = NULL); + CPDF_DocRenderData(CPDF_Document* pPDFDoc = nullptr); ~CPDF_DocRenderData(); CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObj); @@ -133,9 +133,9 @@ class CPDF_RenderStatus { const CPDF_RenderOptions* pOptions, int transparency, FX_BOOL bDropObjects, - CPDF_Dictionary* pFormResource = NULL, + CPDF_Dictionary* pFormResource = nullptr, FX_BOOL bStdCS = FALSE, - CPDF_Type3Char* pType3Char = NULL, + CPDF_Type3Char* pType3Char = nullptr, FX_ARGB fill_color = 0, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE); @@ -291,7 +291,7 @@ class CPDF_ImageLoader { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); FX_BOOL Continue(CPDF_ImageLoaderHandle* LoadHandle, IFX_Pause* pPause); @@ -316,7 +316,7 @@ class CPDF_ImageLoaderHandle { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); FX_BOOL Continue(IFX_Pause* pPause); @@ -389,7 +389,7 @@ class CPDF_ScaledRenderBuffer { CFX_RenderDevice* pDevice, const FX_RECT& pRect, const CPDF_PageObject* pObj, - const CPDF_RenderOptions* pOptions = NULL, + const CPDF_RenderOptions* pOptions = nullptr, int max_dpi = 0); CFX_RenderDevice* GetDevice() { return m_pBitmapDevice ? m_pBitmapDevice.get() : m_pDevice; @@ -441,7 +441,7 @@ class CPDF_ImageCacheEntry { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); uint32_t EstimateSize() const { return m_dwCacheSize; } @@ -456,7 +456,7 @@ class CPDF_ImageCacheEntry { FX_BOOL bStdCS = FALSE, uint32_t GroupFamily = 0, FX_BOOL bLoadMask = FALSE, - CPDF_RenderStatus* pRenderStatus = NULL, + CPDF_RenderStatus* pRenderStatus = nullptr, int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); int Continue(IFX_Pause* pPause); @@ -610,7 +610,7 @@ class CPDF_DIBTransferFunc : public CFX_FilteredDIB { // CFX_FilteredDIB FXDIB_Format GetDestFormat() override; - FX_ARGB* GetDestPalette() override { return NULL; } + FX_ARGB* GetDestPalette() override { return nullptr; } void TranslateScanline(uint8_t* dest_buf, const uint8_t* src_buf) const override; void TranslateDownSamples(uint8_t* dest_buf, |