From 3522876d5291922ddc62bf1b70d02743b0850673 Mon Sep 17 00:00:00 2001 From: Bo Xu Date: Tue, 8 Jul 2014 15:30:46 -0700 Subject: Remove custom memory manager BUG= R=palmer@chromium.org Review URL: https://codereview.chromium.org/372473003 --- core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp | 3 +-- core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 4 ---- core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp | 1 - core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp | 1 - core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp | 2 -- core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 1 - core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp | 2 -- 7 files changed, 1 insertion(+), 13 deletions(-) (limited to 'core/src/fpdfapi') diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index 2672116e4f..9985f06dc6 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -543,8 +543,7 @@ static void _CFString2CFXByteString(CFStringRef src, CFX_ByteString &dest) SInt32 len = CFStringGetLength(src); CFRange range = CFRangeMake(0, len); CFIndex used = 0; - UInt8* pBuffer = (UInt8*)malloc(sizeof(UInt8) * (len + 1)); - FXSYS_memset32(pBuffer, 0, sizeof(UInt8) * (len + 1)); + UInt8* pBuffer = (UInt8*)calloc(len+1, sizeof(UInt8)); CFStringGetBytes(src, range, kCFStringEncodingASCII, 0, false, pBuffer, len, &used); dest = (FX_LPSTR)pBuffer; free(pBuffer); diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index 23bbc4aab9..bd1187645c 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -411,7 +411,6 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, FX_LPCSTR pName, FX_BO m_CodingScheme = map.m_CodingScheme; if (m_CodingScheme == MixedTwoBytes) { m_pLeadingBytes = FX_Alloc(FX_BYTE, 256); - FXSYS_memset32(m_pLeadingBytes, 0, 256); for (FX_DWORD i = 0; i < map.m_LeadingSegCount; i ++) { for (int b = map.m_LeadingSegs[i * 2]; b <= map.m_LeadingSegs[i * 2 + 1]; b ++) { m_pLeadingBytes[b] = 1; @@ -431,7 +430,6 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, FX_LPCSTR pName, FX_BO return FALSE; } m_pMapping = FX_Alloc(FX_WORD, 65536); - FXSYS_memset32(m_pMapping, 0, 65536 * sizeof(FX_WORD)); FX_DWORD dwRecodeEndPos = 0; if (pBuffer[5] == 0) { FX_DWORD dwStartIndex = *(FX_DWORD*)(pBuffer + 8); @@ -480,7 +478,6 @@ extern "C" { FX_BOOL CPDF_CMap::LoadEmbedded(FX_LPCBYTE pData, FX_DWORD size) { m_pMapping = FX_Alloc(FX_WORD, 65536); - FXSYS_memset32(m_pMapping, 0, 65536 * sizeof(FX_WORD)); CPDF_CMapParser parser; parser.Initialize(this); CPDF_SimpleParser syntax(pData, size); @@ -1528,7 +1525,6 @@ FX_BOOL CPDF_CIDFont::LoadGB2312() CheckFontMetrics(); m_DefaultWidth = 1000; m_pAnsiWidths = FX_Alloc(FX_WORD, 128); - FXSYS_memset32(m_pAnsiWidths, 0, 128 * sizeof(FX_WORD)); for (int i = 32; i < 127; i ++) { m_pAnsiWidths[i] = 500; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 867b245a50..b661bbefba 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -1163,7 +1163,6 @@ FX_FLOAT* CPDF_ColorSpace::CreateBuf() { int size = GetBufSize(); FX_BYTE* pBuf = FX_Alloc(FX_BYTE, size); - FXSYS_memset32(pBuf, 0, size); return (FX_FLOAT*)pBuf; } FX_BOOL CPDF_ColorSpace::sRGB() const diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index af22c5649e..649bd54a33 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -721,7 +721,6 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) return FALSE; } m_pSubFunctions = FX_Alloc(CPDF_Function*, m_nSubs); - FXSYS_memset32(m_pSubFunctions, 0, sizeof(CPDF_Function*)*m_nSubs); m_nOutputs = 0; int i; for (i = 0; i < m_nSubs; i ++) { 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 628fb3da99..8053718c19 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -71,7 +71,6 @@ CPDF_ClipPathData::CPDF_ClipPathData(const CPDF_ClipPathData& src) m_TextCount = src.m_TextCount; if (m_TextCount) { m_pTextList = FX_Alloc(CPDF_TextObject*, m_TextCount); - FXSYS_memset32(m_pTextList, 0, sizeof(CPDF_TextObject*) * m_TextCount); for (int i = 0; i < m_TextCount; i ++) { if (src.m_pTextList[i]) { m_pTextList[i] = FX_NEW CPDF_TextObject; @@ -96,7 +95,6 @@ void CPDF_ClipPathData::SetCount(int path_count, int text_count) if (text_count) { m_TextCount = text_count; m_pTextList = FX_Alloc(CPDF_TextObject*, text_count); - FXSYS_memset32(m_pTextList, 0, sizeof(void*) * text_count); } } CPDF_Rect CPDF_ClipPath::GetClipBox() const diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index fe5e59c698..85cf034c1f 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -962,7 +962,6 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) return; } m_pStreamArray = FX_Alloc(CPDF_StreamAcc*, m_nStreams); - FXSYS_memset32(m_pStreamArray, 0, sizeof(CPDF_StreamAcc*) * m_nStreams); } else { m_Status = Done; return; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index a26d619565..fcb422b6c4 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -390,7 +390,6 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj, cons FXTEXT_GLYPHPOS* pGlyphAndPos = NULL; if (device_class == FXDC_DISPLAY) { pGlyphAndPos = FX_Alloc(FXTEXT_GLYPHPOS, textobj->m_nChars); - FXSYS_memset32(pGlyphAndPos, 0, sizeof(FXTEXT_GLYPHPOS) * textobj->m_nChars); } else if (fill_alpha < 255) { return FALSE; } @@ -540,7 +539,6 @@ void CPDF_CharPosList::Load(int nChars, FX_DWORD* pCharCodes, FX_FLOAT* pCharPos FX_FLOAT FontSize) { m_pCharPos = FX_Alloc(FXTEXT_CHARPOS, nChars); - FXSYS_memset32(m_pCharPos, 0, sizeof(FXTEXT_CHARPOS) * nChars); m_nChars = 0; CPDF_CIDFont* pCIDFont = pFont->GetCIDFont(); FX_BOOL bVertWriting = pCIDFont && pCIDFont->IsVertWriting(); -- cgit v1.2.3