diff options
author | Lei Zhang <thestig@chromium.org> | 2015-05-06 14:48:28 -0700 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-05-06 14:48:28 -0700 |
commit | 5734d862cb22eca6e9644ea7d1c096d70123434f (patch) | |
tree | 896e80b1809d3961375e0cdca6b78fbe4ec7d8f5 /core/src/fpdfapi/fpdf_font | |
parent | 903e03a03ad4526252874d8ba15258e7c2955739 (diff) | |
download | pdfium-5734d862cb22eca6e9644ea7d1c096d70123434f.tar.xz |
Merge to XFA: 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.
Review URL: https://codereview.chromium.org/1075953004
(cherry picked from commit 5c357a5d3d873be6b0ab01d7bec82f79d0a09f0e)
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1125183006
Diffstat (limited to 'core/src/fpdfapi/fpdf_font')
-rw-r--r-- | core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 22 | ||||
-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, 16 insertions, 21 deletions
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index eace07ceb2..282d02263f 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) @@ -363,7 +361,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) @@ -435,7 +433,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->m_pFontDict = pFontDict; pFont->m_pDocument = pDoc; if (!pFont->Load()) { @@ -447,13 +445,13 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc, CPDF_Dictionary* pFontDic } #endif } - pFont = FX_NEW CPDF_TrueTypeFont; + pFont = new CPDF_TrueTypeFont; } else if (type == FX_BSTRC("Type3")) { - pFont = FX_NEW CPDF_Type3Font; + pFont = new CPDF_Type3Font; } else if (type == FX_BSTRC("Type0")) { - pFont = FX_NEW CPDF_CIDFont; + pFont = new CPDF_CIDFont; } else { - pFont = FX_NEW CPDF_Type1Font; + pFont = new CPDF_Type1Font; } pFont->m_pFontDict = pFontDict; pFont->m_pDocument = pDoc; @@ -1688,8 +1686,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 63afbe5983..6911942c0e 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; } |