From 4997b22f84307521a62838f874928bf56cd3423c Mon Sep 17 00:00:00 2001 From: thestig Date: Tue, 7 Jun 2016 10:46:22 -0700 Subject: Get rid of NULLs in core/ Review-Url: https://codereview.chromium.org/2032613003 --- core/fpdfapi/fpdf_font/cpdf_cidfont.cpp | 8 +- core/fpdfapi/fpdf_font/cpdf_cidfont.h | 3 +- core/fpdfapi/fpdf_font/cpdf_font.cpp | 4 +- core/fpdfapi/fpdf_font/cpdf_fontencoding.cpp | 409 ++++++++++++++------------- core/fpdfapi/fpdf_font/cpdf_simplefont.cpp | 6 +- core/fpdfapi/fpdf_font/cpdf_simplefont.h | 3 +- core/fpdfapi/fpdf_font/cpdf_type1font.cpp | 2 +- core/fpdfapi/fpdf_font/fpdf_font.cpp | 2 +- core/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 14 +- core/fpdfapi/fpdf_font/ttgsubtable.cpp | 2 +- core/fpdfapi/fpdf_font/ttgsubtable.h | 32 ++- 11 files changed, 247 insertions(+), 238 deletions(-) (limited to 'core/fpdfapi/fpdf_font') 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: -- cgit v1.2.3