diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-04-16 14:37:47 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-04-16 14:37:47 -0700 |
commit | 5c357a5d3d873be6b0ab01d7bec82f79d0a09f0e (patch) | |
tree | 05e79b45a3e8387414c10fda267d6abc381a4dcd /core/src/fpdfapi/fpdf_font | |
parent | 7f6b6677665588a27b9d14babc6358840454ce17 (diff) | |
download | pdfium-5c357a5d3d873be6b0ab01d7bec82f79d0a09f0e.tar.xz |
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
Diffstat (limited to 'core/src/fpdfapi/fpdf_font')
-rw-r--r-- | core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 24 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 10 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_font/ttgsubtable.cpp | 5 |
3 files changed, 17 insertions, 22 deletions
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); diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 0d193e2189..afdb35e197 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -38,7 +38,7 @@ CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, FX_BO } CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK) { - CPDF_CMap* pCMap = FX_NEW CPDF_CMap; + CPDF_CMap* pCMap = new CPDF_CMap; FX_LPCSTR pname = name; if (*pname == '/') { pname ++; @@ -97,7 +97,7 @@ CPDF_CID2UnicodeMap* CPDF_CMapManager::GetCID2UnicodeMap(int charset, FX_BOOL bP } CPDF_CID2UnicodeMap* CPDF_CMapManager::LoadCID2UnicodeMap(int charset, FX_BOOL bPromptCJK) { - CPDF_CID2UnicodeMap* pMap = FX_NEW CPDF_CID2UnicodeMap(); + CPDF_CID2UnicodeMap* pMap = new CPDF_CID2UnicodeMap(); if (!pMap->Initialize()) { delete pMap; return NULL; @@ -918,7 +918,7 @@ FX_BOOL CPDF_CIDFont::_Load() m_pCMap = CPDF_ModuleMgr::Get()->GetPageModule()->GetFontGlobals()->m_CMapManager.GetPredefinedCMap(cmap, m_pFontFile && m_bType1); } else if (pEncoding->GetType() == PDFOBJ_STREAM) { - m_pAllocatedCMap = m_pCMap = FX_NEW CPDF_CMap; + m_pAllocatedCMap = m_pCMap = new CPDF_CMap; CPDF_Stream* pStream = (CPDF_Stream*)pEncoding; CPDF_StreamAcc acc; acc.LoadAllData(pStream, FALSE); @@ -959,7 +959,7 @@ FX_BOOL CPDF_CIDFont::_Load() CPDF_Object* pmap = pCIDFontDict->GetElementValue(FX_BSTRC("CIDToGIDMap")); if (pmap) { if (pmap->GetType() == PDFOBJ_STREAM) { - m_pCIDToGIDMap = FX_NEW CPDF_StreamAcc; + m_pCIDToGIDMap = new CPDF_StreamAcc; m_pCIDToGIDMap->LoadAllData((CPDF_Stream*)pmap, FALSE); } else if (pmap->GetString() == FX_BSTRC("Identity")) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ @@ -1155,7 +1155,7 @@ int CPDF_CIDFont::GetGlyphIndex(FX_DWORD unicode, FX_BOOL *pVertGlyph) } int error = FXFT_Load_Sfnt_Table( m_Font.m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, m_Font.m_pGsubData, NULL); if (!error && m_Font.m_pGsubData) { - m_pTTGSUBTable = FX_NEW CFX_CTTGSUBTable; + m_pTTGSUBTable = new CFX_CTTGSUBTable; m_pTTGSUBTable->LoadGSUBTable((FT_Bytes)m_Font.m_pGsubData); TT_uint32_t vindex = 0; m_pTTGSUBTable->GetVerticalGlyph(index, &vindex); diff --git a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp index e317aa67fd..ae67d2f0ef 100644 --- a/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp +++ b/core/src/fpdfapi/fpdf_font/ttgsubtable.cpp @@ -439,10 +439,7 @@ IFX_GSUBTable* FXGE_CreateGSUBTable(CFX_Font* pFont) } int error = FXFT_Load_Sfnt_Table(pFont->m_Face, FT_MAKE_TAG('G', 'S', 'U', 'B'), 0, pFont->m_pGsubData, NULL); if (!error && pFont->m_pGsubData) { - CFX_GSUBTable* pGsubTable = FX_NEW CFX_GSUBTable; - if (!pGsubTable) { - return NULL; - } + CFX_GSUBTable* pGsubTable = new CFX_GSUBTable; if (pGsubTable->m_GsubImp.LoadGSUBTable((FT_Bytes)pFont->m_pGsubData)) { return pGsubTable; } |