diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-05-15 14:01:28 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-05-15 14:01:28 -0700 |
commit | b6e5df2eded21ca142adf43b4f78a9027589bfeb (patch) | |
tree | e665051b0d327fff3aa55b3ca4169116d79f39bc /core/src | |
parent | 861a552af4aa7edb24c600e25a7bf388a1cdb364 (diff) | |
download | pdfium-b6e5df2eded21ca142adf43b4f78a9027589bfeb.tar.xz |
Merge to XFA: Remove FX_NEW_VECTOR() macros.
Original Review URL: https://codereview.chromium.org/1135273004
R=thestig@chromium.org
TBR=thestig@chromium.org
Review URL: https://codereview.chromium.org/1134003007
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/fpdfapi/fpdf_font/fpdf_font.cpp | 12 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | 15 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 5 |
3 files changed, 11 insertions, 21 deletions
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp index 66d7d4f026..80dd1df803 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp @@ -786,7 +786,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding, int& iBaseEncoding, CFX_ if (pDiffs == NULL) { return; } - FX_NEW_VECTOR(pCharNames, CFX_ByteString, 256); + pCharNames = new CFX_ByteString[256]; FX_DWORD cur_code = 0; for (FX_DWORD i = 0; i < pDiffs->GetCount(); i ++) { CPDF_Object* pElement = pDiffs->GetElementValue(i); @@ -828,9 +828,7 @@ CPDF_SimpleFont::CPDF_SimpleFont(int fonttype) : CPDF_Font(fonttype) } CPDF_SimpleFont::~CPDF_SimpleFont() { - if (m_pCharNames) { - FX_DELETE_VECTOR(m_pCharNames, CFX_ByteString, 256); - } + delete[] m_pCharNames; } int CPDF_SimpleFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph) { @@ -971,10 +969,8 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() CPDF_Object* pEncoding = m_pFontDict->GetElementValue(FX_BSTRC("Encoding")); LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, m_pFontFile != NULL, m_Font.IsTTFont()); LoadGlyphMap(); - if (m_pCharNames) { - FX_DELETE_VECTOR(m_pCharNames, CFX_ByteString, 256); - m_pCharNames = NULL; - } + delete[] m_pCharNames; + m_pCharNames = NULL; if (m_Font.m_Face == NULL) { return TRUE; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp index e098f66dec..2bf3b1d4c3 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -33,9 +33,7 @@ CPDF_ClipPathData::CPDF_ClipPathData() CPDF_ClipPathData::~CPDF_ClipPathData() { int i; - if (m_pPathList) { - FX_DELETE_VECTOR(m_pPathList, CPDF_Path, m_PathCount); - } + delete[] m_pPathList; if (m_pTypeList) { FX_Free(m_pTypeList); } @@ -58,7 +56,7 @@ CPDF_ClipPathData::CPDF_ClipPathData(const CPDF_ClipPathData& src) if (alloc_size % 8) { alloc_size += 8 - (alloc_size % 8); } - FX_NEW_VECTOR(m_pPathList, CPDF_Path, alloc_size); + m_pPathList = new CPDF_Path[alloc_size]; for (int i = 0; i < m_PathCount; i ++) { m_pPathList[i] = src.m_pPathList[i]; } @@ -89,7 +87,7 @@ void CPDF_ClipPathData::SetCount(int path_count, int text_count) if (path_count) { m_PathCount = path_count; int alloc_size = (path_count + 7) / 8 * 8; - FX_NEW_VECTOR(m_pPathList, CPDF_Path, alloc_size); + m_pPathList = new CPDF_Path[alloc_size]; m_pTypeList = FX_Alloc(FX_BYTE, alloc_size); } if (text_count) { @@ -152,14 +150,11 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge) } } if (pData->m_PathCount % 8 == 0) { - CPDF_Path* pNewPath; - FX_NEW_VECTOR(pNewPath, CPDF_Path, pData->m_PathCount + 8); + CPDF_Path* pNewPath = new CPDF_Path[pData->m_PathCount + 8]; for (int i = 0; i < pData->m_PathCount; i ++) { pNewPath[i] = pData->m_pPathList[i]; } - if (pData->m_pPathList) { - FX_DELETE_VECTOR(pData->m_pPathList, CPDF_Path, pData->m_PathCount); - } + delete[] pData->m_pPathList; FX_BYTE* pNewType = FX_Alloc(FX_BYTE, pData->m_PathCount + 8); FXSYS_memcpy32(pNewType, pData->m_pTypeList, pData->m_PathCount); if (pData->m_pTypeList) { diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index b306c66dcb..b3e3cd6a2c 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -1348,8 +1348,7 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() }; return; } - CFX_ByteString* pStrs; - FX_NEW_VECTOR(pStrs, CFX_ByteString, nsegs); + CFX_ByteString* pStrs = new CFX_ByteString[nsegs]; FX_FLOAT* pKerning = FX_Alloc(FX_FLOAT, nsegs); int iSegment = 0; FX_FLOAT fInitKerning = 0; @@ -1372,7 +1371,7 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() } } AddTextObject(pStrs, fInitKerning, pKerning, iSegment); - FX_DELETE_VECTOR(pStrs, CFX_ByteString, nsegs); + delete[] pStrs; FX_Free(pKerning); } void CPDF_StreamContentParser::Handle_SetTextLeading() |