From 5c357a5d3d873be6b0ab01d7bec82f79d0a09f0e Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Thu, 16 Apr 2015 14:37:47 -0700 Subject: Replace FX_NEW with new, remove tests from fpdfapi Very few places where a change is required, but remove FX_NEW to show they've been audited. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1075953004 --- core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'core/src/fpdfapi/fpdf_font/fpdf_font.cpp') diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index 9ee9621849..996c68669d 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -62,10 +62,8 @@ void CPDF_FontGlobals::Set(void* key, int index, CPDF_Font* pFont) ((CFX_StockFontArray*)value)->m_pStockFonts[index] = pFont; return; } - CFX_StockFontArray* pFonts = FX_NEW CFX_StockFontArray(); - if (pFonts) { - pFonts->m_pStockFonts[index] = pFont; - } + CFX_StockFontArray* pFonts = new CFX_StockFontArray(); + pFonts->m_pStockFonts[index] = pFont; m_pStockMap.SetAt(key, pFonts); } void CPDF_FontGlobals::Clear(void* key) @@ -123,7 +121,7 @@ CPDF_Font::CPDF_Font() } FX_BOOL CPDF_Font::Initialize() { - m_pCharMap = FX_NEW CPDF_FontCharMap(this); + m_pCharMap = new CPDF_FontCharMap(this); return TRUE; } CPDF_Font::~CPDF_Font() @@ -369,7 +367,7 @@ void CPDF_Font::LoadUnicodeMap() if (pStream == NULL) { return; } - m_pToUnicodeMap = FX_NEW CPDF_ToUnicodeMap; + m_pToUnicodeMap = new CPDF_ToUnicodeMap; m_pToUnicodeMap->Load(pStream); } int CPDF_Font::GetStringWidth(FX_LPCSTR pString, int size) @@ -441,7 +439,7 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary* pFontDic if (i < count) { CPDF_Dictionary* pFontDesc = pFontDict->GetDict(FX_BSTRC("FontDescriptor")); if (pFontDesc == NULL || !pFontDesc->KeyExist(FX_BSTRC("FontFile2"))) { - pFont = FX_NEW CPDF_CIDFont; + pFont = new CPDF_CIDFont; pFont->Initialize(); pFont->m_FontType = PDFFONT_CIDFONT; pFont->m_pFontDict = pFontDict; @@ -455,19 +453,19 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary* pFontDic } #endif } - pFont = FX_NEW CPDF_TrueTypeFont; + pFont = new CPDF_TrueTypeFont; pFont->Initialize(); pFont->m_FontType = PDFFONT_TRUETYPE; } else if (type == FX_BSTRC("Type3")) { - pFont = FX_NEW CPDF_Type3Font; + pFont = new CPDF_Type3Font; pFont->Initialize(); pFont->m_FontType = PDFFONT_TYPE3; } else if (type == FX_BSTRC("Type0")) { - pFont = FX_NEW CPDF_CIDFont; + pFont = new CPDF_CIDFont; pFont->Initialize(); pFont->m_FontType = PDFFONT_CIDFONT; } else { - pFont = FX_NEW CPDF_Type1Font; + pFont = new CPDF_Type1Font; pFont->Initialize(); pFont->m_FontType = PDFFONT_TYPE1; } @@ -1704,8 +1702,8 @@ CPDF_Type3Char* CPDF_Type3Font::LoadChar(FX_DWORD charcode, int level) if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) { return NULL; } - pChar = FX_NEW CPDF_Type3Char; - pChar->m_pForm = FX_NEW CPDF_Form(m_pDocument, m_pFontResources ? m_pFontResources : m_pPageResources, pStream, NULL); + pChar = new CPDF_Type3Char; + pChar->m_pForm = new CPDF_Form(m_pDocument, m_pFontResources ? m_pFontResources : m_pPageResources, pStream, NULL); pChar->m_pForm->ParseContent(NULL, NULL, pChar, NULL, level + 1); FX_FLOAT scale = m_FontMatrix.GetXUnit(); pChar->m_Width = (FX_INT32)(pChar->m_Width * scale + 0.5f); -- cgit v1.2.3