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 | |
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
28 files changed, 240 insertions, 290 deletions
diff --git a/core/src/fpdfapi/fpdf_basic_module.cpp b/core/src/fpdfapi/fpdf_basic_module.cpp index 82658ab51e..d564bdb687 100644 --- a/core/src/fpdfapi/fpdf_basic_module.cpp +++ b/core/src/fpdfapi/fpdf_basic_module.cpp @@ -13,7 +13,7 @@ CPDF_ModuleMgr* CPDF_ModuleMgr::Get() } void CPDF_ModuleMgr::Create() { - g_FPDFAPI_pDefaultMgr = FX_NEW CPDF_ModuleMgr; + g_FPDFAPI_pDefaultMgr = new CPDF_ModuleMgr; g_FPDFAPI_pDefaultMgr->Initialize(); } void CPDF_ModuleMgr::Destroy() @@ -38,8 +38,8 @@ void CPDF_ModuleMgr::Initialize() void CPDF_ModuleMgr::InitModules() { m_pCodecModule = NULL; - m_pPageModule = FX_NEW CPDF_PageModuleDef; - m_pRenderModule = FX_NEW CPDF_RenderModuleDef; + m_pPageModule = new CPDF_PageModuleDef; + m_pRenderModule = new CPDF_RenderModuleDef; } CPDF_ModuleMgr::~CPDF_ModuleMgr() { diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp index e8c051b434..b64151ad06 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_content.cpp @@ -50,7 +50,7 @@ void CPDF_PageContentGenerate::GenerateContent() if (pContent != NULL) { pPageDict->RemoveAt("Contents"); } - CPDF_Stream* pStream = FX_NEW CPDF_Stream(NULL, 0, NULL); + CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); m_pDocument->AddIndirectObject(pStream); pPageDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum()); @@ -58,13 +58,13 @@ void CPDF_PageContentGenerate::GenerateContent() CFX_ByteString CPDF_PageContentGenerate::RealizeResource(CPDF_Object* pResourceObj, const FX_CHAR* szType) { if (m_pPage->m_pResources == NULL) { - m_pPage->m_pResources = FX_NEW CPDF_Dictionary; + m_pPage->m_pResources = new CPDF_Dictionary; int objnum = m_pDocument->AddIndirectObject(m_pPage->m_pResources); m_pPage->m_pFormDict->SetAtReference("Resources", m_pDocument, objnum); } CPDF_Dictionary* pResList = m_pPage->m_pResources->GetDict(szType); if (pResList == NULL) { - pResList = FX_NEW CPDF_Dictionary; + pResList = new CPDF_Dictionary; m_pPage->m_pResources->SetAt(szType, pResList); } m_pDocument->AddIndirectObject(pResourceObj); @@ -104,7 +104,7 @@ void CPDF_PageContentGenerate::ProcessForm(CFX_ByteTextBuf& buf, FX_LPCBYTE data if (!data || !size) { return; } - CPDF_Stream* pStream = FX_NEW CPDF_Stream(NULL, 0, NULL); + CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); CPDF_Dictionary* pFormDict = CPDF_Dictionary::Create(); pFormDict->SetAtName(FX_BSTR("Type"), FX_BSTR("XObject")); pFormDict->SetAtName(FX_BSTR("Subtype"), FX_BSTR("Form")); @@ -136,7 +136,7 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix) if (!pContent || pContent->GetType() != PDFOBJ_STREAM) { continue; } - CPDF_StreamAcc* pStream = FX_NEW CPDF_StreamAcc(); + CPDF_StreamAcc* pStream = new CPDF_StreamAcc(); pStream->LoadAllData((CPDF_Stream*)pContent); pContentArray[i] = pStream; size += pContentArray[i]->GetSize() + 1; @@ -157,7 +157,7 @@ void CPDF_PageContentGenerate::TransformContent(CFX_Matrix& matrix) contentStream.LoadAllData((CPDF_Stream*)pContent); ProcessForm(buf, contentStream.GetData(), contentStream.GetSize(), matrix); } - CPDF_Stream* pStream = FX_NEW CPDF_Stream(NULL, 0, NULL); + CPDF_Stream* pStream = new CPDF_Stream(NULL, 0, NULL); pStream->SetData(buf.GetBuffer(), buf.GetLength(), FALSE, FALSE); m_pDocument->AddIndirectObject(pStream); m_pPage->m_pFormDict->SetAtReference("Contents", m_pDocument, pStream->GetObjNum()); diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 7795f1fe91..0886d3ff53 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp @@ -1485,7 +1485,7 @@ FX_INT32 CPDF_Creator::WriteDoc_Stage1(IFX_Pause *pPause) CPDF_Dictionary* pDict = m_pDocument->GetRoot(); m_pMetadata = pDict ? pDict->GetElementValue(FX_BSTRC("Metadata")) : NULL; if (m_dwFlags & FPDFCREATE_OBJECTSTREAM) { - m_pXRefStream = FX_NEW CPDF_XRefStream; + m_pXRefStream = new CPDF_XRefStream; m_pXRefStream->Start(); if ((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser) { FX_FILESIZE prev = m_pParser->GetLastXRefOffset(); @@ -2072,7 +2072,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault ) if (m_pCryptoHandler && m_bNewCrypto) { delete m_pCryptoHandler; } - m_pCryptoHandler = FX_NEW CPDF_StandardCryptoHandler; + m_pCryptoHandler = new CPDF_StandardCryptoHandler; m_pCryptoHandler->Init(m_pEncryptDict, &handler); m_bNewCrypto = TRUE; m_bSecurityChanged = TRUE; diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp index b6c1dff84b..9d0967978c 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp @@ -21,16 +21,16 @@ CPDF_Document::CPDF_Document() : CPDF_IndirectObjects(NULL) void CPDF_Document::CreateNewDoc() { ASSERT(m_pRootDict == NULL && m_pInfoDict == NULL); - m_pRootDict = FX_NEW CPDF_Dictionary; + m_pRootDict = new CPDF_Dictionary; m_pRootDict->SetAtName("Type", "Catalog"); int objnum = AddIndirectObject(m_pRootDict); - CPDF_Dictionary* pPages = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pPages = new CPDF_Dictionary; pPages->SetAtName("Type", "Pages"); pPages->SetAtNumber("Count", 0); - pPages->SetAt("Kids", FX_NEW CPDF_Array); + pPages->SetAt("Kids", new CPDF_Array); objnum = AddIndirectObject(pPages); m_pRootDict->SetAtReference("Pages", this, objnum); - m_pInfoDict = FX_NEW CPDF_Dictionary; + m_pInfoDict = new CPDF_Dictionary; AddIndirectObject(m_pInfoDict); } static const FX_WCHAR g_FX_CP874Unicodes[128] = { @@ -207,7 +207,7 @@ static void _InsertWidthArray(HDC hDC, int start, int end, CPDF_Array* pWidthArr pWidthArray->AddInteger(first + size - 1); pWidthArray->AddInteger(*widths); } else { - CPDF_Array* pWidthArray1 = FX_NEW CPDF_Array; + CPDF_Array* pWidthArray1 = new CPDF_Array; pWidthArray->Add(pWidthArray1); for (i = 0; i < size; i ++) { pWidthArray1->AddInteger(widths[i]); @@ -288,7 +288,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_B bbox[3] = ptm->otmrcFontBox.top; FX_Free(tm_buf); basefont.Replace(" ", ""); - CPDF_Dictionary* pBaseDict = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; pBaseDict->SetAtName("Type", "Font"); CPDF_Dictionary* pFontDict = pBaseDict; if (!bCJK) { @@ -308,9 +308,9 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_B break; } if (i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes)) { - CPDF_Dictionary* pEncoding = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pEncoding = new CPDF_Dictionary; pEncoding->SetAtName(FX_BSTRC("BaseEncoding"), "WinAnsiEncoding"); - CPDF_Array* pArray = FX_NEW CPDF_Array; + CPDF_Array* pArray = new CPDF_Array; pArray->AddInteger(128); const FX_WCHAR* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; for (int j = 0; j < 128; j ++) { @@ -339,18 +339,18 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_B pBaseDict->SetAtNumber("LastChar", 255); int char_widths[224]; GetCharWidth(hDC, 32, 255, char_widths); - CPDF_Array* pWidths = FX_NEW CPDF_Array; + CPDF_Array* pWidths = new CPDF_Array; for (int i = 0; i < 224; i ++) { pWidths->AddInteger(char_widths[i]); } pBaseDict->SetAt("Widths", pWidths); } else { flags |= PDFFONT_NONSYMBOLIC; - pFontDict = FX_NEW CPDF_Dictionary; + pFontDict = new CPDF_Dictionary; CFX_ByteString cmap; CFX_ByteString ordering; int supplement; - CPDF_Array* pWidthArray = FX_NEW CPDF_Array; + CPDF_Array* pWidthArray = new CPDF_Array; switch (pLogFont->lfCharSet) { case CHINESEBIG5_CHARSET: cmap = bVert ? "ETenms-B5-V" : "ETenms-B5-H"; @@ -395,22 +395,22 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont, FX_BOOL bVert, FX_B pFontDict->SetAtName("Type", "Font"); pFontDict->SetAtName("Subtype", "CIDFontType2"); pFontDict->SetAtName("BaseFont", basefont); - CPDF_Dictionary* pCIDSysInfo = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pCIDSysInfo = new CPDF_Dictionary; pCIDSysInfo->SetAtString("Registry", "Adobe"); pCIDSysInfo->SetAtString("Ordering", ordering); pCIDSysInfo->SetAtInteger("Supplement", supplement); pFontDict->SetAt("CIDSystemInfo", pCIDSysInfo); - CPDF_Array* pArray = FX_NEW CPDF_Array; + CPDF_Array* pArray = new CPDF_Array; pBaseDict->SetAt("DescendantFonts", pArray); AddIndirectObject(pFontDict); pArray->AddReference(this, pFontDict); } AddIndirectObject(pBaseDict); - CPDF_Dictionary* pFontDesc = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pFontDesc = new CPDF_Dictionary; pFontDesc->SetAtName("Type", "FontDescriptor"); pFontDesc->SetAtName("FontName", basefont); pFontDesc->SetAtInteger("Flags", flags); - CPDF_Array* pBBox = FX_NEW CPDF_Array; + CPDF_Array* pBBox = new CPDF_Array; for (int i = 0; i < 4; i ++) { pBBox->AddInteger(bbox[i]); } @@ -590,7 +590,7 @@ static void _InsertWidthArray(CTFontRef font, int start, int end, CPDF_Array* pW pWidthArray->AddInteger(first + size - 1); pWidthArray->AddInteger(*widths); } else { - CPDF_Array* pWidthArray1 = FX_NEW CPDF_Array; + CPDF_Array* pWidthArray1 = new CPDF_Array; pWidthArray->Add(pWidthArray1); for (i = 0; i < size; i ++) { pWidthArray1->AddInteger(widths[i]); @@ -666,9 +666,8 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr CFRelease(fullName); } basefont.Replace(" ", ""); - CPDF_Dictionary* pFontDict = NULL; - CPDF_Dictionary* pBaseDict = FX_NEW CPDF_Dictionary; - pFontDict = pBaseDict; + CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; + CPDF_Dictionary* pFontDict = pBaseDict; if (!bCJK) { charSets.RemoveAll(); charSets.Add(FXFONT_ANSI_CHARSET); @@ -694,9 +693,9 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr } } if (i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes)) { - CPDF_Dictionary* pEncoding = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pEncoding = new CPDF_Dictionary; pEncoding->SetAtName(FX_BSTRC("BaseEncoding"), "WinAnsiEncoding"); - CPDF_Array* pArray = FX_NEW CPDF_Array; + CPDF_Array* pArray = new CPDF_Array; pArray->AddInteger(128); const FX_WCHAR* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; for (int j = 0; j < 128; j ++) { @@ -725,7 +724,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr pBaseDict->SetAtNumber("LastChar", 255); int char_widths[224]; FX_GetCharWidth(font, 32, 255, char_widths); - CPDF_Array* pWidths = FX_NEW CPDF_Array; + CPDF_Array* pWidths = new CPDF_Array; for (int i = 0; i < 224; i ++) { pWidths->AddInteger(char_widths[i]); } @@ -733,12 +732,12 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr } else { flags |= PDFFONT_NONSYMBOLIC; CPDF_Array* pArray = NULL; - pFontDict = FX_NEW CPDF_Dictionary; + pFontDict = new CPDF_Dictionary; CFX_ByteString cmap; CFX_ByteString ordering; int supplement; FX_BOOL bFound = FALSE; - CPDF_Array* pWidthArray = FX_NEW CPDF_Array; + CPDF_Array* pWidthArray = new CPDF_Array; charSets.RemoveAll(); charSets.Add(FXFONT_CHINESEBIG5_CHARSET); if (IsHasCharSet(languages, charSets)) { @@ -792,22 +791,22 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont, FX_BOOL bVert, FX_BOOL bTr pFontDict->SetAtName("Type", "Font"); pFontDict->SetAtName("Subtype", "CIDFontType2"); pFontDict->SetAtName("BaseFont", basefont); - CPDF_Dictionary* pCIDSysInfo = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pCIDSysInfo = new CPDF_Dictionary; pCIDSysInfo->SetAtString("Registry", "Adobe"); pCIDSysInfo->SetAtString("Ordering", ordering); pCIDSysInfo->SetAtInteger("Supplement", supplement); pFontDict->SetAt("CIDSystemInfo", pCIDSysInfo); - pArray = FX_NEW CPDF_Array; + pArray = new CPDF_Array; pBaseDict->SetAt("DescendantFonts", pArray); AddIndirectObject(pFontDict); pArray->AddReference(this, pFontDict); } AddIndirectObject(pBaseDict); - CPDF_Dictionary* pFontDesc = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pFontDesc = new CPDF_Dictionary; pFontDesc->SetAtName("Type", "FontDescriptor"); pFontDesc->SetAtName("FontName", basefont); pFontDesc->SetAtInteger("Flags", flags); - CPDF_Array* pBBox = FX_NEW CPDF_Array; + CPDF_Array* pBBox = new CPDF_Array; for (int i = 0; i < 4; i ++) { pBBox->AddInteger(bbox[i]); } @@ -859,7 +858,7 @@ static void _InsertWidthArray1(CFX_Font* pFont, IFX_FontEncoding* pEncoding, FX_ pWidthArray->AddInteger(first + size - 1); pWidthArray->AddInteger(*widths); } else { - CPDF_Array* pWidthArray1 = FX_NEW CPDF_Array; + CPDF_Array* pWidthArray1 = new CPDF_Array; pWidthArray->Add(pWidthArray1); for (i = 0; i < size; i ++) { pWidthArray1->AddInteger(widths[i]); @@ -886,12 +885,12 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) if (pFont->IsFixedWidth()) { flags |= PDFFONT_FIXEDPITCH; } - CPDF_Dictionary* pBaseDict = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pBaseDict = new CPDF_Dictionary; pBaseDict->SetAtName("Type", "Font"); IFX_FontEncoding* pEncoding = FXGE_CreateUnicodeEncoding(pFont); CPDF_Dictionary* pFontDict = pBaseDict; if (!bCJK) { - CPDF_Array* pWidths = FX_NEW CPDF_Array; + CPDF_Array* pWidths = new CPDF_Array; int charcode; for (charcode = 32; charcode < 128; charcode ++) { int glyph_index = pEncoding->GlyphFromCharCode(charcode); @@ -919,9 +918,9 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) break; } if (i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes)) { - CPDF_Dictionary* pEncodingDict = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pEncodingDict = new CPDF_Dictionary; pEncodingDict->SetAtName(FX_BSTRC("BaseEncoding"), "WinAnsiEncoding"); - CPDF_Array* pArray = FX_NEW CPDF_Array; + CPDF_Array* pArray = new CPDF_Array; pArray->AddInteger(128); const FX_WCHAR* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes; for (int j = 0; j < 128; j ++) { @@ -954,11 +953,11 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) pBaseDict->SetAt("Widths", pWidths); } else { flags |= PDFFONT_NONSYMBOLIC; - pFontDict = FX_NEW CPDF_Dictionary; + pFontDict = new CPDF_Dictionary; CFX_ByteString cmap; CFX_ByteString ordering; int supplement; - CPDF_Array* pWidthArray = FX_NEW CPDF_Array; + CPDF_Array* pWidthArray = new CPDF_Array; switch (charset) { case FXFONT_CHINESEBIG5_CHARSET: cmap = bVert ? "ETenms-B5-V" : "ETenms-B5-H"; @@ -1003,18 +1002,18 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) pFontDict->SetAtName("Type", "Font"); pFontDict->SetAtName("Subtype", "CIDFontType2"); pFontDict->SetAtName("BaseFont", basefont); - CPDF_Dictionary* pCIDSysInfo = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pCIDSysInfo = new CPDF_Dictionary; pCIDSysInfo->SetAtString("Registry", "Adobe"); pCIDSysInfo->SetAtString("Ordering", ordering); pCIDSysInfo->SetAtInteger("Supplement", supplement); pFontDict->SetAt("CIDSystemInfo", pCIDSysInfo); - CPDF_Array* pArray = FX_NEW CPDF_Array; + CPDF_Array* pArray = new CPDF_Array; pBaseDict->SetAt("DescendantFonts", pArray); AddIndirectObject(pFontDict); pArray->AddReference(this, pFontDict); } AddIndirectObject(pBaseDict); - CPDF_Dictionary* pFontDesc = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pFontDesc = new CPDF_Dictionary; pFontDesc->SetAtName("Type", "FontDescriptor"); pFontDesc->SetAtName("FontName", basefont); pFontDesc->SetAtInteger("Flags", flags); @@ -1023,7 +1022,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) pFontDesc->SetAtInteger("Descent", pFont->GetDescent()); FX_RECT bbox; pFont->GetBBox(bbox); - CPDF_Array* pBBox = FX_NEW CPDF_Array; + CPDF_Array* pBBox = new CPDF_Array; pBBox->AddInteger(bbox.left); pBBox->AddInteger(bbox.bottom); pBBox->AddInteger(bbox.right); @@ -1114,7 +1113,7 @@ static int InsertNewPage(CPDF_Document* pDoc, int iPage, CPDF_Dictionary* pPageD if (iPage == nPages) { CPDF_Array* pPagesList = pPages->GetArray(FX_BSTRC("Kids")); if (!pPagesList) { - pPagesList = FX_NEW CPDF_Array; + pPagesList = new CPDF_Array; pPages->SetAt(FX_BSTRC("Kids"), pPagesList); } pPagesList->Add(pPageDict, pDoc); @@ -1132,7 +1131,7 @@ static int InsertNewPage(CPDF_Document* pDoc, int iPage, CPDF_Dictionary* pPageD } CPDF_Dictionary* CPDF_Document::CreateNewPage(int iPage) { - CPDF_Dictionary* pDict = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pDict = new CPDF_Dictionary; pDict->SetAtName("Type", "Page"); FX_DWORD dwObjNum = AddIndirectObject(pDict); if (InsertNewPage(this, iPage, pDict, m_PageList) < 0) { diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp index d73d7614da..3a3756de5d 100644 --- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp +++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp @@ -17,7 +17,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size) LoadInfo(pData, size, width, height, num_comps, bits, color_trans)) { return NULL; } - CPDF_Dictionary* pDict = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pDict = new CPDF_Dictionary; pDict->SetAtName("Type", "XObject"); pDict->SetAtName("Subtype", "Image"); pDict->SetAtInteger("Width", width); @@ -40,7 +40,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size) pDict->SetAtInteger("BitsPerComponent", bits); pDict->SetAtName("Filter", "DCTDecode"); if (!color_trans) { - CPDF_Dictionary* pParms = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pParms = new CPDF_Dictionary; pDict->SetAt("DecodeParms", pParms); pParms->SetAtInteger("ColorTransform", 0); } @@ -48,7 +48,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(FX_LPBYTE pData, FX_DWORD size) m_Width = width; m_Height = height; if (m_pStream == NULL) { - m_pStream = FX_NEW CPDF_Stream(NULL, 0, NULL); + m_pStream = new CPDF_Stream(NULL, 0, NULL); } return pDict; } @@ -108,7 +108,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F FX_INT32 src_pitch = pBitmap->GetPitch(); FX_INT32 bpp = pBitmap->GetBPP(); FX_BOOL bUseMatte = pParam && pParam->pMatteColor && (pBitmap->GetFormat() == FXDIB_Argb); - CPDF_Dictionary* pDict = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pDict = new CPDF_Dictionary; pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject")); pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image")); pDict->SetAtInteger(FX_BSTRC("Width"), BitmapWidth); @@ -123,15 +123,15 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F ArgbDecode(pBitmap->GetPaletteArgb(1), set_a, set_r, set_g, set_b); } if (set_a == 0 || reset_a == 0) { - pDict->SetAt(FX_BSTRC("ImageMask"), FX_NEW CPDF_Boolean(TRUE)); + pDict->SetAt(FX_BSTRC("ImageMask"), new CPDF_Boolean(TRUE)); if (reset_a == 0) { - CPDF_Array* pArray = FX_NEW CPDF_Array; + CPDF_Array* pArray = new CPDF_Array; pArray->AddInteger(1); pArray->AddInteger(0); pDict->SetAt(FX_BSTRC("Decode"), pArray); } } else { - CPDF_Array* pCS = FX_NEW CPDF_Array; + CPDF_Array* pCS = new CPDF_Array; pCS->AddName(FX_BSTRC("Indexed")); pCS->AddName(FX_BSTRC("DeviceRGB")); pCS->AddInteger(1); @@ -157,7 +157,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F } else if (bpp == 8) { FX_INT32 iPalette = pBitmap->GetPaletteSize(); if (iPalette > 0) { - CPDF_Array* pCS = FX_NEW CPDF_Array; + CPDF_Array* pCS = new CPDF_Array; m_pDocument->AddIndirectObject(pCS); pCS->AddName(FX_BSTRC("Indexed")); pCS->AddName(FX_BSTRC("DeviceRGB")); @@ -211,7 +211,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F FX_LPBYTE mask_buf = NULL; FX_STRSIZE mask_size; FX_BOOL bDeleteMask = TRUE; - CPDF_Dictionary* pMaskDict = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pMaskDict = new CPDF_Dictionary; pMaskDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject")); pMaskDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image")); pMaskDict->SetAtInteger(FX_BSTRC("Width"), maskWidth); @@ -235,13 +235,13 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F if (bUseMatte) { int a, r, g, b; ArgbDecode(*(pParam->pMatteColor), a, r, g, b); - CPDF_Array* pMatte = FX_NEW CPDF_Array; + CPDF_Array* pMatte = new CPDF_Array; pMatte->AddInteger(r); pMatte->AddInteger(g); pMatte->AddInteger(b); pMaskDict->SetAt(FX_BSTRC("Matte"), pMatte); } - pMaskStream = FX_NEW CPDF_Stream(mask_buf, mask_size, pMaskDict); + pMaskStream = new CPDF_Stream(mask_buf, mask_size, pMaskDict); m_pDocument->AddIndirectObject(pMaskStream); bDeleteMask = FALSE; pDict->SetAtReference(FX_BSTRC("SMask"), m_pDocument, pMaskStream); @@ -260,7 +260,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F if (pBitmap->GetBPP() == 1) { _JBIG2EncodeBitmap(pDict, pBitmap, m_pDocument, dest_buf, dest_size, FALSE); } else if (pBitmap->GetBPP() >= 8 && pBitmap->GetPalette() != NULL) { - CFX_DIBitmap *pNewBitmap = FX_NEW CFX_DIBitmap(); + CFX_DIBitmap *pNewBitmap = new CFX_DIBitmap(); pNewBitmap->Copy(pBitmap); pNewBitmap->ConvertFormat(FXDIB_Rgb); SetImage(pNewBitmap, iCompress, pFileWrite, pFileRead); @@ -277,7 +277,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F return; } else { if (bUseMatte) { - CFX_DIBitmap *pNewBitmap = FX_NEW CFX_DIBitmap(); + CFX_DIBitmap *pNewBitmap = new CFX_DIBitmap(); pNewBitmap->Create(BitmapWidth, BitmapHeight, FXDIB_Argb); FX_LPBYTE dst_buf = pNewBitmap->GetBuffer(); FX_INT32 src_offset = 0; @@ -353,7 +353,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, FX_INT32 iCompress, IFX_F } } if (m_pStream == NULL) { - m_pStream = FX_NEW CPDF_Stream(NULL, 0, NULL); + m_pStream = new CPDF_Stream(NULL, 0, NULL); } if (!bStream) { m_pStream->InitStream(dest_buf, dest_size, pDict); 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; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp index c9b17054a8..4ec753d751 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp @@ -11,15 +11,15 @@ CPDF_PageObject* CPDF_PageObject::Create(int type) { switch (type) { case PDFPAGE_TEXT: - return FX_NEW CPDF_TextObject; + return new CPDF_TextObject; case PDFPAGE_IMAGE: - return FX_NEW CPDF_ImageObject; + return new CPDF_ImageObject; case PDFPAGE_PATH: - return FX_NEW CPDF_PathObject; + return new CPDF_PathObject; case PDFPAGE_SHADING: - return FX_NEW CPDF_ShadingObject; + return new CPDF_ShadingObject; case PDFPAGE_FORM: - return FX_NEW CPDF_FormObject; + return new CPDF_FormObject; } return NULL; } @@ -887,7 +887,7 @@ void CPDF_Page::StartParse(CPDF_ParseOptions* pOptions, FX_BOOL bReParse) if (m_ParseState == PDF_CONTENT_PARSED || m_ParseState == PDF_CONTENT_PARSING) { return; } - m_pParser = FX_NEW CPDF_ContentParser; + m_pParser = new CPDF_ContentParser; m_pParser->Start(this, pOptions); m_ParseState = PDF_CONTENT_PARSING; } @@ -951,7 +951,7 @@ void CPDF_Form::StartParse(CPDF_AllStates* pGraphicStates, CFX_AffineMatrix* pPa if (m_ParseState == PDF_CONTENT_PARSED || m_ParseState == PDF_CONTENT_PARSING) { return; } - m_pParser = FX_NEW CPDF_ContentParser; + m_pParser = new CPDF_ContentParser; m_pParser->Start(this, pGraphicStates, pParentMatrix, pType3Char, pOptions, level); m_ParseState = PDF_CONTENT_PARSING; } @@ -963,7 +963,7 @@ void CPDF_Form::ParseContent(CPDF_AllStates* pGraphicStates, CFX_AffineMatrix* p } CPDF_Form* CPDF_Form::Clone() const { - CPDF_Form* pClone = FX_NEW CPDF_Form(m_pDocument, m_pPageResources, m_pFormStream, m_pResources); + CPDF_Form* pClone = new CPDF_Form(m_pDocument, m_pPageResources, m_pFormStream, m_pResources); FX_POSITION pos = m_ObjectList.GetHeadPosition(); while (pos) { CPDF_PageObject* pObj = (CPDF_PageObject*)m_ObjectList.GetNext(pos); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp index 64be24c1ed..b6bf7950ff 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp @@ -1145,21 +1145,21 @@ CPDF_ColorSpace* CPDF_ColorSpace::Load(CPDF_Document* pDoc, CPDF_Object* pObj) CPDF_ColorSpace* pCS = NULL; FX_DWORD id = familyname.GetID(); if (id == FXBSTR_ID('C', 'a', 'l', 'G')) { - pCS = FX_NEW CPDF_CalGray(); + pCS = new CPDF_CalGray(); } else if (id == FXBSTR_ID('C', 'a', 'l', 'R')) { - pCS = FX_NEW CPDF_CalRGB(); + pCS = new CPDF_CalRGB(); } else if (id == FXBSTR_ID('L', 'a', 'b', 0)) { - pCS = FX_NEW CPDF_LabCS(); + pCS = new CPDF_LabCS(); } else if (id == FXBSTR_ID('I', 'C', 'C', 'B')) { - pCS = FX_NEW CPDF_ICCBasedCS(); + pCS = new CPDF_ICCBasedCS(); } else if (id == FXBSTR_ID('I', 'n', 'd', 'e') || id == FXBSTR_ID('I', 0, 0, 0)) { - pCS = FX_NEW CPDF_IndexedCS(); + pCS = new CPDF_IndexedCS(); } else if (id == FXBSTR_ID('S', 'e', 'p', 'a')) { - pCS = FX_NEW CPDF_SeparationCS(); + pCS = new CPDF_SeparationCS(); } else if (id == FXBSTR_ID('D', 'e', 'v', 'i')) { - pCS = FX_NEW CPDF_DeviceNCS(); + pCS = new CPDF_DeviceNCS(); } else if (id == FXBSTR_ID('P', 'a', 't', 't')) { - pCS = FX_NEW CPDF_PatternCS(); + pCS = new CPDF_PatternCS(); } else { return NULL; } diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp index 5df664312c..241b5895c5 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -21,7 +21,7 @@ public: } virtual CPDF_DocPageData* CreateDocData(CPDF_Document* pDoc) { - return FX_NEW CPDF_DocPageData(pDoc); + return new CPDF_DocPageData(pDoc); } virtual void ReleaseDoc(CPDF_Document* pDoc); virtual void ClearDoc(CPDF_Document* pDoc); @@ -59,11 +59,8 @@ CPDF_ColorSpace* CPDF_PageModule::GetStockCS(int family) } void CPDF_ModuleMgr::InitPageModule() { - if (m_pPageModule) { - delete m_pPageModule; - } - CPDF_PageModule* pPageModule = FX_NEW CPDF_PageModule; - m_pPageModule = pPageModule; + delete m_pPageModule; + m_pPageModule = new CPDF_PageModule; } void CPDF_PageModule::ReleaseDoc(CPDF_Document* pDoc) { @@ -298,11 +295,8 @@ CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, FX_BOOL findOnl } FX_BOOL bNew = FALSE; if (!fontData) { - fontData = FX_NEW CPDF_CountedObject<CPDF_Font*>; + fontData = new CPDF_CountedObject<CPDF_Font*>; bNew = TRUE; - if (!fontData) { - return NULL; - } } CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pFontDict); if (!pFont) { @@ -349,7 +343,7 @@ CPDF_Font* CPDF_DocPageData::GetStandardFont(FX_BSTR fontName, CPDF_FontEncoding fontData->m_nCount ++; return pFont; } - CPDF_Dictionary* pDict = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pDict = new CPDF_Dictionary; pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("Font")); pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Type1")); pDict->SetAtName(FX_BSTRC("BaseFont"), fontName); @@ -357,10 +351,7 @@ CPDF_Font* CPDF_DocPageData::GetStandardFont(FX_BSTR fontName, CPDF_FontEncoding pDict->SetAt(FX_BSTRC("Encoding"), pEncoding->Realize()); } m_pPDFDoc->AddIndirectObject(pDict); - CPDF_CountedObject<CPDF_Font*>* fontData = FX_NEW CPDF_CountedObject<CPDF_Font*>; - if (!fontData) { - return NULL; - } + CPDF_CountedObject<CPDF_Font*>* fontData = new CPDF_CountedObject<CPDF_Font*>; CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pDict); if (!pFont) { delete fontData; @@ -443,10 +434,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace(CPDF_Object* pCSObj, CPDF_Dicti } FX_BOOL bNew = FALSE; if (!csData) { - csData = FX_NEW CPDF_CountedObject<CPDF_ColorSpace*>; - if (!csData) { - return NULL; - } + csData = new CPDF_CountedObject<CPDF_ColorSpace*>; bNew = TRUE; } CPDF_ColorSpace* pCS = CPDF_ColorSpace::Load(m_pPDFDoc, pArray); @@ -504,23 +492,20 @@ CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, FX_BOOL bSh } FX_BOOL bNew = FALSE; if (!ptData) { - ptData = FX_NEW CPDF_CountedObject<CPDF_Pattern*>; + ptData = new CPDF_CountedObject<CPDF_Pattern*>; bNew = TRUE; - if (!ptData) { - return NULL; - } } CPDF_Pattern* pPattern = NULL; if (bShading) { - pPattern = FX_NEW CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, bShading, matrix); + pPattern = new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, bShading, matrix); } else { CPDF_Dictionary* pDict = pPatternObj ? pPatternObj->GetDict() : NULL; if (pDict) { int type = pDict->GetInteger(FX_BSTRC("PatternType")); if (type == 1) { - pPattern = FX_NEW CPDF_TilingPattern(m_pPDFDoc, pPatternObj, matrix); + pPattern = new CPDF_TilingPattern(m_pPDFDoc, pPatternObj, matrix); } else if (type == 2) { - pPattern = FX_NEW CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, FALSE, matrix); + pPattern = new CPDF_ShadingPattern(m_pPDFDoc, pPatternObj, FALSE, matrix); } } } @@ -560,15 +545,8 @@ CPDF_Image* CPDF_DocPageData::GetImage(CPDF_Object* pImageStream) imageData->m_nCount ++; return imageData->m_Obj; } - imageData = FX_NEW CPDF_CountedObject<CPDF_Image*>; - if (!imageData) { - return NULL; - } - CPDF_Image* pImage = FX_NEW CPDF_Image(m_pPDFDoc); - if (!pImage) { - delete imageData; - return NULL; - } + imageData = new CPDF_CountedObject<CPDF_Image*>; + CPDF_Image* pImage = new CPDF_Image(m_pPDFDoc); pImage->LoadImageF((CPDF_Stream*)pImageStream, FALSE); imageData->m_nCount = 2; imageData->m_Obj = pImage; @@ -602,15 +580,8 @@ CPDF_IccProfile* CPDF_DocPageData::GetIccProfile(CPDF_Stream* pIccProfileStream) ipData->m_nCount++; return ipData->m_Obj; } - CPDF_IccProfile* pProfile = FX_NEW CPDF_IccProfile(stream.GetData(), stream.GetSize()); - if (!pProfile) { - return NULL; - } - ipData = FX_NEW CPDF_CountedObject<CPDF_IccProfile*>; - if (!ipData) { - delete pProfile; - return NULL; - } + CPDF_IccProfile* pProfile = new CPDF_IccProfile(stream.GetData(), stream.GetSize()); + ipData = new CPDF_CountedObject<CPDF_IccProfile*>; ipData->m_nCount = 2; ipData->m_Obj = pProfile; m_IccProfileMap.SetAt(pIccProfileStream, ipData); @@ -647,15 +618,8 @@ CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(CPDF_Stream* pFontStream) ftData->m_nCount ++; return ftData->m_Obj; } - ftData = FX_NEW CPDF_CountedObject<CPDF_StreamAcc*>; - if (!ftData) { - return NULL; - } - CPDF_StreamAcc* pFontFile = FX_NEW CPDF_StreamAcc; - if (!pFontFile) { - delete ftData; - return NULL; - } + ftData = new CPDF_CountedObject<CPDF_StreamAcc*>; + CPDF_StreamAcc* pFontFile = new CPDF_StreamAcc; CPDF_Dictionary* pFontDict = pFontStream->GetDict(); FX_INT32 org_size = pFontDict->GetInteger(FX_BSTRC("Length1")) + pFontDict->GetInteger(FX_BSTRC("Length2")) + pFontDict->GetInteger(FX_BSTRC("Length3")); if (org_size < 0) { diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp index c786df5a5b..bd1cdb6434 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp @@ -167,7 +167,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) return TRUE; } if (word == FX_BSTRC("{")) { - CPDF_PSProc* pProc = FX_NEW CPDF_PSProc; + CPDF_PSProc* pProc = new CPDF_PSProc; m_Operators.Add((FX_LPVOID)PSOP_PROC); m_Operators.Add(pProc); if (!pProc->Parse(parser)) { @@ -484,7 +484,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode")); m_nBitsPerSample = pDict->GetInteger(FX_BSTRC("BitsPerSample")); m_SampleMax = 0xffffffff >> (32 - m_nBitsPerSample); - m_pSampleStream = FX_NEW CPDF_StreamAcc; + m_pSampleStream = new CPDF_StreamAcc; m_pSampleStream->LoadAllData(pStream, FALSE); m_pEncodeInfo = FX_Alloc(SampleEncodeInfo, m_nInputs); int i; @@ -809,13 +809,13 @@ CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) return NULL; } if (type == 0) { - pFunc = FX_NEW CPDF_SampledFunc; + pFunc = new CPDF_SampledFunc; } else if (type == 2) { - pFunc = FX_NEW CPDF_ExpIntFunc; + pFunc = new CPDF_ExpIntFunc; } else if (type == 3) { - pFunc = FX_NEW CPDF_StitchFunc; + pFunc = new CPDF_StitchFunc; } else if (type == 4) { - pFunc = FX_NEW CPDF_PSFunc; + pFunc = new CPDF_PSFunc; } else { return NULL; } 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 4ba65f2ccb..e098f66dec 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp @@ -73,7 +73,7 @@ CPDF_ClipPathData::CPDF_ClipPathData(const CPDF_ClipPathData& src) m_pTextList = FX_Alloc(CPDF_TextObject*, m_TextCount); for (int i = 0; i < m_TextCount; i ++) { if (src.m_pTextList[i]) { - m_pTextList[i] = FX_NEW CPDF_TextObject; + m_pTextList[i] = new CPDF_TextObject; m_pTextList[i]->Copy(src.m_pTextList[i]); } else { m_pTextList[i] = NULL; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp index 5d24ab742a..2b11aefd7d 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp @@ -54,7 +54,7 @@ CPDF_Image* CPDF_Image::Clone() if (m_pStream->GetObjNum()) { return m_pDocument->GetPageData()->GetImage(m_pStream); } - CPDF_Image* pImage = FX_NEW CPDF_Image(m_pDocument); + CPDF_Image* pImage = new CPDF_Image(m_pDocument); pImage->LoadImageF((CPDF_Stream*)((CPDF_Object*)m_pStream)->Clone(), m_bInline); if (m_bInline) { CPDF_Dictionary *pInlineDict = (CPDF_Dictionary*)m_pInlineDict->Clone(TRUE); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index deb7127bbe..b306c66dcb 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -83,7 +83,7 @@ void CPDF_StreamContentParser::PrepareParse(CPDF_Document* pDocument, m_BBox = *pBBox; } m_Level = level; - m_pCurStates = FX_NEW CPDF_AllStates; + m_pCurStates = new CPDF_AllStates; if (pStates) { m_pCurStates->Copy(*pStates); } else { @@ -731,8 +731,8 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) parser.Parse(stream.GetData(), stream.GetSize(), 0); return; } - CPDF_FormObject* pFormObj = FX_NEW CPDF_FormObject; - pFormObj->m_pForm = FX_NEW CPDF_Form(m_pDocument, m_pPageResources, pStream, m_pResources); + CPDF_FormObject* pFormObj = new CPDF_FormObject; + pFormObj->m_pForm = new CPDF_Form(m_pDocument, m_pPageResources, pStream, m_pResources); pFormObj->m_FormMatrix = m_pCurStates->m_CTM; pFormObj->m_FormMatrix.Concat(m_mtContentToUser); CPDF_AllStates status; @@ -756,13 +756,13 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, CPDF_ CFX_AffineMatrix ImageMatrix; ImageMatrix.Copy(m_pCurStates->m_CTM); ImageMatrix.Concat(m_mtContentToUser); - CPDF_ImageObject* pImageObj = FX_NEW CPDF_ImageObject; + CPDF_ImageObject* pImageObj = new CPDF_ImageObject; if (pImage) { pImageObj->m_pImage = m_pDocument->GetPageData()->GetImage(pImage->GetStream()); } else if (pStream->GetObjNum()) { pImageObj->m_pImage = m_pDocument->LoadImageF(pStream); } else { - pImageObj->m_pImage = FX_NEW CPDF_Image(m_pDocument); + pImageObj->m_pImage = new CPDF_Image(m_pDocument); pImageObj->m_pImage->LoadImageF(pStream, bInline); } SetGraphicStates(pImageObj, pImageObj->m_pImage->IsMask(), FALSE, FALSE); @@ -942,7 +942,7 @@ void CPDF_StreamContentParser::Handle_EndPath() } void CPDF_StreamContentParser::Handle_SaveGraphState() { - CPDF_AllStates* pStates = FX_NEW CPDF_AllStates; + CPDF_AllStates* pStates = new CPDF_AllStates; pStates->Copy(*m_pCurStates); m_StateStack.Add(pStates); } @@ -1129,7 +1129,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill() if (!pShading->Load()) { return; } - CPDF_ShadingObject* pObj = FX_NEW CPDF_ShadingObject; + CPDF_ShadingObject* pObj = new CPDF_ShadingObject; pObj->m_pShading = pShading; SetGraphicStates(pObj, FALSE, FALSE, FALSE); pObj->m_Matrix = m_pCurStates->m_CTM; @@ -1289,7 +1289,7 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, FX_FLOAT fIn } else { textmode = m_pCurStates->m_TextState.GetObject()->m_TextMode; } - CPDF_TextObject* pText = FX_NEW CPDF_TextObject; + CPDF_TextObject* pText = new CPDF_TextObject; m_pLastTextObject = pText; SetGraphicStates(pText, TRUE, TRUE, TRUE); if (textmode && textmode != 3 && textmode != 4 && textmode != 7) { @@ -1308,7 +1308,7 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs, FX_FLOAT fIn m_pCurStates->m_TextX += x_advance; m_pCurStates->m_TextY += y_advance; if (textmode > 3) { - CPDF_TextObject* pCopy = FX_NEW CPDF_TextObject; + CPDF_TextObject* pCopy = new CPDF_TextObject; pCopy->Copy(pText); m_ClipTextList.Add(pCopy); } @@ -1529,7 +1529,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke) CFX_AffineMatrix matrix = m_pCurStates->m_CTM; matrix.Concat(m_mtContentToUser); if (bStroke || FillType) { - CPDF_PathObject* pPathObj = FX_NEW CPDF_PathObject; + CPDF_PathObject* pPathObj = new CPDF_PathObject; pPathObj->m_bStroke = bStroke; pPathObj->m_FillType = FillType; pPathObj->m_Path = Path; 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 9177c3e1d4..952fe1d9a9 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -961,7 +961,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) } if (pContent->GetType() == PDFOBJ_STREAM) { m_nStreams = 0; - m_pSingleStream = FX_NEW CPDF_StreamAcc; + m_pSingleStream = new CPDF_StreamAcc; m_pSingleStream->LoadAllData((CPDF_Stream*)pContent, FALSE); } else if (pContent->GetType() == PDFOBJ_ARRAY) { CPDF_Array* pArray = (CPDF_Array*)pContent; @@ -1003,7 +1003,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates, } } CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDict(FX_BSTRC("Resources")); - m_pParser = FX_NEW CPDF_StreamContentParser; + m_pParser = new CPDF_StreamContentParser; m_pParser->Initialize(); m_pParser->PrepareParse(pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources, pParentMatrix, pForm, pResources, &form_bbox, pOptions, pGraphicStates, level); @@ -1020,7 +1020,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates, pData->m_pSoftMask = NULL; } m_nStreams = 0; - m_pSingleStream = FX_NEW CPDF_StreamAcc; + m_pSingleStream = new CPDF_StreamAcc; if (pForm->m_pDocument) { m_pSingleStream->LoadAllData(pForm->m_pFormStream, FALSE); } else { @@ -1071,7 +1071,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) m_CurrentOffset = 0; } else { CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray(FX_BSTRC("Contents")); - m_pStreamArray[m_CurrentOffset] = FX_NEW CPDF_StreamAcc; + m_pStreamArray[m_CurrentOffset] = new CPDF_StreamAcc; CPDF_Stream* pStreamObj = (CPDF_Stream*)(pContent ? pContent->GetElementValue(m_CurrentOffset) : NULL); m_pStreamArray[m_CurrentOffset]->LoadAllData(pStreamObj, FALSE); m_CurrentOffset ++; @@ -1079,7 +1079,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) } if (m_InternalStage == PAGEPARSE_STAGE_PARSE) { if (m_pParser == NULL) { - m_pParser = FX_NEW CPDF_StreamContentParser; + m_pParser = new CPDF_StreamContentParser; m_pParser->Initialize(); m_pParser->PrepareParse(m_pObjects->m_pDocument, m_pObjects->m_pPageResources, NULL, NULL, m_pObjects, m_pObjects->m_pResources, &m_pObjects->m_BBox, &m_Options, NULL, 0); diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp index 9e61ce2f0b..d23d75a25d 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp @@ -55,7 +55,7 @@ FX_BOOL CPDF_TilingPattern::Load() return FALSE; } CPDF_Stream* pStream = (CPDF_Stream*)m_pPatternObj; - m_pForm = FX_NEW CPDF_Form(m_pDocument, NULL, pStream); + m_pForm = new CPDF_Form(m_pDocument, NULL, pStream); m_pForm->ParseContent(NULL, &m_ParentMatrix, NULL, NULL); m_BBox = pDict->GetRect(FX_BSTRC("BBox")); return TRUE; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp index 4fb9b4db13..e35b0a9d10 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp @@ -52,7 +52,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt, FX_LPCBYTE password, FX_DWORD pas } CPDF_CryptoHandler* CPDF_StandardSecurityHandler::CreateCryptoHandler() { - return FX_NEW CPDF_StandardCryptoHandler; + return new CPDF_StandardCryptoHandler; } typedef struct _PDF_CRYPTOITEM { FX_INT32 m_Cipher; @@ -495,7 +495,7 @@ FX_BOOL CPDF_StandardSecurityHandler::IsMetadataEncrypted() } CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler() { - return FX_NEW CPDF_StandardSecurityHandler; + return new CPDF_StandardSecurityHandler; } void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict, CPDF_Array* pIdArray, FX_LPCBYTE user_pass, FX_DWORD user_size, diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp index b851a11926..5bacfd7393 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp @@ -19,10 +19,10 @@ CFDF_Document::~CFDF_Document() } CFDF_Document* CFDF_Document::CreateNewDoc() { - CFDF_Document* pDoc = FX_NEW CFDF_Document; - pDoc->m_pRootDict = FX_NEW CPDF_Dictionary; + CFDF_Document* pDoc = new CFDF_Document; + pDoc->m_pRootDict = new CPDF_Dictionary; pDoc->AddIndirectObject(pDoc->m_pRootDict); - CPDF_Dictionary* pFDFDict = FX_NEW CPDF_Dictionary; + CPDF_Dictionary* pFDFDict = new CPDF_Dictionary; pDoc->m_pRootDict->SetAt(FX_BSTRC("FDF"), pFDFDict); return pDoc; } @@ -31,7 +31,7 @@ CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead *pFile, FX_BOOL bOwnFile) if (!pFile) { return NULL; } - CFDF_Document* pDoc = FX_NEW CFDF_Document; + CFDF_Document* pDoc = new CFDF_Document; pDoc->ParseStream(pFile, bOwnFile); if (pDoc->m_pRootDict == NULL) { delete pDoc; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp index d17b123765..ac3f2b29d7 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_filters.cpp @@ -76,12 +76,12 @@ CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, const CPDF_Dictionary* pParam, i case FXBSTR_ID('L', 'Z', 'W', 0): { CFX_DataFilter* pFilter; if (id == FXBSTR_ID('L', 'Z', 'W', 'D') || id == FXBSTR_ID('L', 'Z', 'W', 0)) { - pFilter = FX_NEW CPDF_LzwFilter(pParam ? pParam->GetInteger("EarlyChange", 1) : 1); + pFilter = new CPDF_LzwFilter(pParam ? pParam->GetInteger("EarlyChange", 1) : 1); } else { - pFilter = FX_NEW CPDF_FlateFilter; + pFilter = new CPDF_FlateFilter; } if ((pParam ? pParam->GetInteger("Predictor", 1) : 1) > 1) { - CFX_DataFilter* pPredictor = FX_NEW CPDF_PredictorFilter(pParam->GetInteger(FX_BSTRC("Predictor"), 1), + CFX_DataFilter* pPredictor = new CPDF_PredictorFilter(pParam->GetInteger(FX_BSTRC("Predictor"), 1), pParam->GetInteger(FX_BSTRC("Colors"), 1), pParam->GetInteger(FX_BSTRC("BitsPerComponent"), 8), pParam->GetInteger(FX_BSTRC("Columns"), 1)); pFilter->SetDestFilter(pPredictor); @@ -90,15 +90,15 @@ CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, const CPDF_Dictionary* pParam, i } case FXBSTR_ID('A', 'S', 'C', 'I'): if (name == "ASCIIHexDecode") { - return FX_NEW CPDF_AsciiHexFilter; + return new CPDF_AsciiHexFilter; } - return FX_NEW CPDF_Ascii85Filter; + return new CPDF_Ascii85Filter; case FXBSTR_ID('A', 'H', 'x', 0): - return FX_NEW CPDF_AsciiHexFilter; + return new CPDF_AsciiHexFilter; case FXBSTR_ID('A', '8', '5', 0): - return FX_NEW CPDF_Ascii85Filter; + return new CPDF_Ascii85Filter; case FXBSTR_ID('R', 'u', 'n', 'L'): - return FX_NEW CPDF_RunLenFilter; + return new CPDF_RunLenFilter; case FXBSTR_ID('C', 'C', 'I', 'T'): { int Encoding = 0; int bEndOfLine = FALSE; @@ -120,12 +120,12 @@ CFX_DataFilter* FPDF_CreateFilter(FX_BSTR name, const CPDF_Dictionary* pParam, i if (nRows == 0) { nRows = height; } - CPDF_FaxFilter* pFilter = FX_NEW CPDF_FaxFilter(); + CPDF_FaxFilter* pFilter = new CPDF_FaxFilter(); pFilter->Initialize(Encoding, bEndOfLine, bByteAlign, bBlack, nRows, nColumns); return pFilter; } case FXBSTR_ID('D', 'C', 'T', 'D'): - return FX_NEW CPDF_JpegFilter; + return new CPDF_JpegFilter; default: return NULL; } @@ -170,7 +170,7 @@ CPDF_StreamFilter* CPDF_Stream::GetStreamFilter(FX_BOOL bRaw) const { CFX_DataFilter* pFirstFilter = NULL; if (m_pCryptoHandler) { - pFirstFilter = FX_NEW CPDF_DecryptFilter(m_pCryptoHandler, m_ObjNum, m_GenNum); + pFirstFilter = new CPDF_DecryptFilter(m_pCryptoHandler, m_ObjNum, m_GenNum); } if (!bRaw) { CFX_DataFilter* pFilter = _FPDF_CreateFilterFromDict(m_pDict); @@ -182,7 +182,7 @@ CPDF_StreamFilter* CPDF_Stream::GetStreamFilter(FX_BOOL bRaw) const } } } - CPDF_StreamFilter* pStreamFilter = FX_NEW CPDF_StreamFilter; + CPDF_StreamFilter* pStreamFilter = new CPDF_StreamFilter; pStreamFilter->m_pStream = this; pStreamFilter->m_pFilter = pFirstFilter; pStreamFilter->m_pBuffer = NULL; @@ -226,7 +226,7 @@ FX_DWORD CPDF_StreamFilter::ReadBlock(FX_LPBYTE buffer, FX_DWORD buf_size) if (m_pFilter->IsEOF()) { return read_size; } - m_pBuffer = FX_NEW CFX_BinaryBuf; + m_pBuffer = new CFX_BinaryBuf; m_pBuffer->EstimateSize(FPDF_FILTER_BUFFER_SIZE, FPDF_FILTER_BUFFER_SIZE); m_BufOffset = 0; while (1) { diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index e592f18227..008349c61c 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -248,15 +248,15 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite { switch (m_Type) { case PDFOBJ_BOOLEAN: - return FX_NEW CPDF_Boolean(((CPDF_Boolean*)this)->m_bValue); + return new CPDF_Boolean(((CPDF_Boolean*)this)->m_bValue); case PDFOBJ_NUMBER: - return FX_NEW CPDF_Number(((CPDF_Number*)this)->m_bInteger, &((CPDF_Number*)this)->m_Integer); + return new CPDF_Number(((CPDF_Number*)this)->m_bInteger, &((CPDF_Number*)this)->m_Integer); case PDFOBJ_STRING: - return FX_NEW CPDF_String(((CPDF_String*)this)->m_String, ((CPDF_String*)this)->IsHex()); + return new CPDF_String(((CPDF_String*)this)->m_String, ((CPDF_String*)this)->IsHex()); case PDFOBJ_NAME: - return FX_NEW CPDF_Name(((CPDF_Name*)this)->m_Name); + return new CPDF_Name(((CPDF_Name*)this)->m_Name); case PDFOBJ_ARRAY: { - CPDF_Array* pCopy = FX_NEW CPDF_Array(); + CPDF_Array* pCopy = new CPDF_Array(); CPDF_Array* pThis = (CPDF_Array*)this; int n = pThis->GetCount(); for (int i = 0; i < n; i ++) { @@ -266,7 +266,7 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite return pCopy; } case PDFOBJ_DICTIONARY: { - CPDF_Dictionary* pCopy = FX_NEW CPDF_Dictionary(); + CPDF_Dictionary* pCopy = new CPDF_Dictionary(); CPDF_Dictionary* pThis = (CPDF_Dictionary*)this; FX_POSITION pos = pThis->m_Map.GetStartPosition(); while (pos) { @@ -278,7 +278,7 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite return pCopy; } case PDFOBJ_NULL: { - return FX_NEW CPDF_Null; + return new CPDF_Null; } case PDFOBJ_STREAM: { CPDF_Stream* pThis = (CPDF_Stream*)this; @@ -287,9 +287,9 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite FX_DWORD streamSize = acc.GetSize(); CPDF_Stream* pObj; if (pThis->GetDict()) - pObj = FX_NEW CPDF_Stream(acc.DetachData(), streamSize, (CPDF_Dictionary*)((CPDF_Object*)pThis->GetDict())->CloneInternal(bDirect, visited)); + pObj = new CPDF_Stream(acc.DetachData(), streamSize, (CPDF_Dictionary*)((CPDF_Object*)pThis->GetDict())->CloneInternal(bDirect, visited)); else - pObj = FX_NEW CPDF_Stream(acc.DetachData(), streamSize, NULL); + pObj = new CPDF_Stream(acc.DetachData(), streamSize, NULL); return pObj; } case PDFOBJ_REFERENCE: { @@ -304,7 +304,7 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite ret = NULL; return ret; } else { - return FX_NEW CPDF_Reference(pRef->m_pObjList, obj_num); + return new CPDF_Reference(pRef->m_pObjList, obj_num); } } } @@ -313,7 +313,7 @@ CPDF_Object* CPDF_Object::CloneInternal(FX_BOOL bDirect, CFX_MapPtrToPtr* visite CPDF_Object* CPDF_Object::CloneRef(CPDF_IndirectObjects* pDoc) const { if (m_ObjNum) { - return FX_NEW CPDF_Reference(pDoc, m_ObjNum); + return new CPDF_Reference(pDoc, m_ObjNum); } return Clone(); } @@ -531,29 +531,29 @@ void CPDF_Array::Add(CPDF_Object* pObj, CPDF_IndirectObjects* pObjs) void CPDF_Array::AddName(const CFX_ByteString& str) { ASSERT(m_Type == PDFOBJ_ARRAY); - Add(FX_NEW CPDF_Name(str)); + Add(new CPDF_Name(str)); } void CPDF_Array::AddString(const CFX_ByteString& str) { ASSERT(m_Type == PDFOBJ_ARRAY); - Add(FX_NEW CPDF_String(str)); + Add(new CPDF_String(str)); } void CPDF_Array::AddInteger(int i) { ASSERT(m_Type == PDFOBJ_ARRAY); - Add(FX_NEW CPDF_Number(i)); + Add(new CPDF_Number(i)); } void CPDF_Array::AddNumber(FX_FLOAT f) { ASSERT(m_Type == PDFOBJ_ARRAY); - CPDF_Number* pNumber = FX_NEW CPDF_Number; + CPDF_Number* pNumber = new CPDF_Number; pNumber->SetNumber(f); Add(pNumber); } void CPDF_Array::AddReference(CPDF_IndirectObjects* pDoc, FX_DWORD objnum) { ASSERT(m_Type == PDFOBJ_ARRAY); - Add(FX_NEW CPDF_Reference(pDoc, objnum)); + Add(new CPDF_Reference(pDoc, objnum)); } FX_BOOL CPDF_Array::Identical(CPDF_Array* pOther) const { @@ -809,37 +809,37 @@ FX_BOOL CPDF_Dictionary::Identical(CPDF_Dictionary* pOther) const } void CPDF_Dictionary::SetAtInteger(FX_BSTR key, int i) { - SetAt(key, FX_NEW CPDF_Number(i)); + SetAt(key, new CPDF_Number(i)); } void CPDF_Dictionary::SetAtName(FX_BSTR key, const CFX_ByteString& name) { - SetAt(key, FX_NEW CPDF_Name(name)); + SetAt(key, new CPDF_Name(name)); } void CPDF_Dictionary::SetAtString(FX_BSTR key, const CFX_ByteString& str) { - SetAt(key, FX_NEW CPDF_String(str)); + SetAt(key, new CPDF_String(str)); } void CPDF_Dictionary::SetAtReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum) { - SetAt(key, FX_NEW CPDF_Reference(pDoc, objnum)); + SetAt(key, new CPDF_Reference(pDoc, objnum)); } void CPDF_Dictionary::AddReference(FX_BSTR key, CPDF_IndirectObjects* pDoc, FX_DWORD objnum) { - AddValue(key, FX_NEW CPDF_Reference(pDoc, objnum)); + AddValue(key, new CPDF_Reference(pDoc, objnum)); } void CPDF_Dictionary::SetAtNumber(FX_BSTR key, FX_FLOAT f) { - CPDF_Number* pNumber = FX_NEW CPDF_Number; + CPDF_Number* pNumber = new CPDF_Number; pNumber->SetNumber(f); SetAt(key, pNumber); } void CPDF_Dictionary::SetAtBoolean(FX_BSTR key, FX_BOOL bValue) { - SetAt(key, FX_NEW CPDF_Boolean(bValue)); + SetAt(key, new CPDF_Boolean(bValue)); } void CPDF_Dictionary::SetAtRect(FX_BSTR key, const CFX_FloatRect& rect) { - CPDF_Array* pArray = FX_NEW CPDF_Array; + CPDF_Array* pArray = new CPDF_Array; pArray->AddNumber(rect.left); pArray->AddNumber(rect.bottom); pArray->AddNumber(rect.right); @@ -848,7 +848,7 @@ void CPDF_Dictionary::SetAtRect(FX_BSTR key, const CFX_FloatRect& rect) } void CPDF_Dictionary::SetAtMatrix(FX_BSTR key, const CFX_AffineMatrix& matrix) { - CPDF_Array* pArray = FX_NEW CPDF_Array; + CPDF_Array* pArray = new CPDF_Array; pArray->AddNumber16(matrix.a); pArray->AddNumber16(matrix.b); pArray->AddNumber16(matrix.c); @@ -925,7 +925,7 @@ void CPDF_Stream::SetData(FX_LPCBYTE pData, FX_DWORD size, FX_BOOL bCompressed, } m_dwSize = size; if (m_pDict == NULL) { - m_pDict = FX_NEW CPDF_Dictionary; + m_pDict = new CPDF_Dictionary; } m_pDict->SetAtInteger(FX_BSTRC("Length"), size); if (!bCompressed) { @@ -1035,10 +1035,9 @@ CPDF_Stream* CPDF_Stream::Clone(FX_BOOL bDirect, FPDF_LPFCloneStreamCallback lpf CPDF_StreamAcc acc; acc.LoadAllData(this, TRUE); FX_DWORD streamSize = acc.GetSize(); - CPDF_Stream* pObj = FX_NEW CPDF_Stream(acc.DetachData(), streamSize, pCloneDict); - return pObj; + return new CPDF_Stream(acc.DetachData(), streamSize, pCloneDict); } - CPDF_Stream* pObj = FX_NEW CPDF_Stream(NULL, 0, NULL); + CPDF_Stream* pObj = new CPDF_Stream(NULL, 0, NULL); CPDF_StreamFilter *pSF = GetStreamFilter(TRUE); if (pSF) { FX_LPBYTE pBuf = FX_Alloc(FX_BYTE, 4096); diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index cc517dd4c2..39e2d217b7 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -177,7 +177,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse, FX } m_Syntax.RestorePos(m_Syntax.m_FileLen - m_Syntax.m_HeaderOffset - 9); if (!bReParse) { - m_pDocument = FX_NEW CPDF_Document(this); + m_pDocument = new CPDF_Document(this); } FX_BOOL bXRefRebuilt = FALSE; if (m_Syntax.SearchWord(FX_BSTRC("startxref"), TRUE, FALSE, 4096)) { @@ -1241,7 +1241,7 @@ CPDF_StreamAcc* CPDF_Parser::GetObjectStream(FX_DWORD objnum) if (pStream == NULL || pStream->GetType() != PDFOBJ_STREAM) { return NULL; } - pStreamAcc = FX_NEW CPDF_StreamAcc; + pStreamAcc = new CPDF_StreamAcc; pStreamAcc->LoadAllData(pStream); m_ObjectStreamMap.SetAt((void*)(FX_UINTPTR)objnum, pStreamAcc); return pStreamAcc; @@ -1561,7 +1561,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess, FX_BOOL bReParse return StartParse(pFileAccess, bReParse, bOwnFileRead); } if (!bReParse) { - m_pDocument = FX_NEW CPDF_Document(this); + m_pDocument = new CPDF_Document(this); } FX_FILESIZE dwFirstXRefOffset = m_Syntax.SavePos(); FX_BOOL bXRefRebuilt = FALSE; @@ -2496,7 +2496,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT len = dest_buf.GetSize(); dest_buf.DetachBuffer(); } - pStream = FX_NEW CPDF_Stream(pData, len, pDict); + pStream = new CPDF_Stream(pData, len, pDict); if (pContext) { pContext->m_DataEnd = pContext->m_DataStart + len; } @@ -2923,7 +2923,7 @@ IPDF_DataAvail::IPDF_DataAvail(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRea // static IPDF_DataAvail* IPDF_DataAvail::Create(IFX_FileAvail* pFileAvail, IFX_FileRead* pFileRead) { - return FX_NEW CPDF_DataAvail(pFileAvail, pFileRead); + return new CPDF_DataAvail(pFileAvail, pFileRead); } // static @@ -3436,7 +3436,7 @@ FX_BOOL CPDF_DataAvail::PreparePageItem() FX_BOOL CPDF_DataAvail::IsFirstCheck(int iPage) { if (NULL == m_pageMapCheckState) { - m_pageMapCheckState = FX_NEW CFX_CMapDWordToDWord(); + m_pageMapCheckState = new CFX_CMapDWordToDWord(); } FX_DWORD dwValue = 0; if (!m_pageMapCheckState->Lookup(iPage, dwValue)) { @@ -3452,7 +3452,7 @@ FX_BOOL CPDF_DataAvail::IsFirstCheck(int iPage) void CPDF_DataAvail::ResetFirstCheck(int iPage) { if (NULL == m_pageMapCheckState) { - m_pageMapCheckState = FX_NEW CFX_CMapDWordToDWord(); + m_pageMapCheckState = new CFX_CMapDWordToDWord(); } FX_DWORD dwValue = 1; if (!m_pageMapCheckState->Lookup(iPage, dwValue)) { @@ -4140,7 +4140,7 @@ FX_BOOL CPDF_DataAvail::CheckArrayPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pPa if (!pKid || pKid->GetType() != PDFOBJ_REFERENCE) { continue; } - CPDF_PageNode *pNode = FX_NEW CPDF_PageNode(); + CPDF_PageNode *pNode = new CPDF_PageNode(); pPageNode->m_childNode.Add(pNode); pNode->m_dwPageNo = ((CPDF_Reference*)pKid)->GetRefObjNum(); } @@ -4186,7 +4186,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pP switch (pKids->GetType()) { case PDFOBJ_REFERENCE: { CPDF_Reference *pKid = (CPDF_Reference *)pKids; - CPDF_PageNode *pNode = FX_NEW CPDF_PageNode(); + CPDF_PageNode *pNode = new CPDF_PageNode(); pPageNode->m_childNode.Add(pNode); pNode->m_dwPageNo = pKid->GetRefObjNum(); } @@ -4198,7 +4198,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo, CPDF_PageNode *pP if (!pKid || pKid->GetType() != PDFOBJ_REFERENCE) { continue; } - CPDF_PageNode *pNode = FX_NEW CPDF_PageNode(); + CPDF_PageNode *pNode = new CPDF_PageNode(); pPageNode->m_childNode.Add(pNode); pNode->m_dwPageNo = ((CPDF_Reference*)pKid)->GetRefObjNum(); } @@ -4443,7 +4443,7 @@ FX_BOOL CPDF_DataAvail::IsPageAvail(FX_INT32 iPage, IFX_DownloadHints* pHints) m_objnum_array.RemoveAll(); } if (m_pagesLoadState == NULL) { - m_pagesLoadState = FX_NEW CFX_CMapDWordToDWord(); + m_pagesLoadState = new CFX_CMapDWordToDWord(); } FX_DWORD dwPageLoad = 0; if (m_pagesLoadState->Lookup(iPage, dwPageLoad) && dwPageLoad != 0) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index 490ceb9ee2..f8c4a41186 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -59,15 +59,15 @@ void CPDF_DocRenderData::Clear(FX_BOOL bRelease) } FX_BOOL CPDF_DocRenderData::Initialize() { - m_pFontCache = FX_NEW CFX_FontCache; + m_pFontCache = new CFX_FontCache; return TRUE; } CPDF_Type3Cache* CPDF_DocRenderData::GetCachedType3(CPDF_Type3Font* pFont) { CPDF_CountedObject<CPDF_Type3Cache*>* pCache; if (!m_Type3FaceMap.Lookup(pFont, pCache)) { - CPDF_Type3Cache* pType3 = FX_NEW CPDF_Type3Cache(pFont); - pCache = FX_NEW CPDF_CountedObject<CPDF_Type3Cache*>; + CPDF_Type3Cache* pType3 = new CPDF_Type3Cache(pFont); + pCache = new CPDF_CountedObject<CPDF_Type3Cache*>; pCache->m_Obj = pType3; pCache->m_nCount = 1; m_Type3FaceMap.SetAt(pFont, pCache); @@ -100,7 +100,7 @@ public: } virtual CPDF_PageRenderCache* CreatePageCache(CPDF_Page* pPage) { - return FX_NEW CPDF_PageRenderCache(pPage); + return new CPDF_PageRenderCache(pPage); } virtual void DestroyPageCache(CPDF_PageRenderCache* pCache); virtual CPDF_RenderConfig* GetConfig() @@ -113,7 +113,7 @@ private: }; CPDF_DocRenderData* CPDF_RenderModule::CreateDocData(CPDF_Document* pDoc) { - CPDF_DocRenderData* pData = FX_NEW CPDF_DocRenderData(pDoc); + CPDF_DocRenderData* pData = new CPDF_DocRenderData(pDoc); pData->Initialize(); return pData; } @@ -133,10 +133,8 @@ void CPDF_RenderModule::DestroyPageCache(CPDF_PageRenderCache* pCache) } void CPDF_ModuleMgr::InitRenderModule() { - if (m_pRenderModule) { - delete m_pRenderModule; - } - m_pRenderModule = FX_NEW CPDF_RenderModule; + delete m_pRenderModule; + m_pRenderModule = new CPDF_RenderModule; } CPDF_RenderOptions::CPDF_RenderOptions() : m_ColorMode(RENDER_COLOR_NORMAL) @@ -349,11 +347,10 @@ FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, con } IPDF_ObjectRenderer* IPDF_ObjectRenderer::Create(int type) { - IPDF_ObjectRenderer* pRenderer = NULL; - if (type == PDFPAGE_IMAGE) { - pRenderer = FX_NEW CPDF_ImageRenderer; + if (type != PDFPAGE_IMAGE) { + return NULL; } - return pRenderer; + return new CPDF_ImageRenderer; } FX_BOOL CPDF_RenderStatus::GetObjectClippedRect(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bLogical, FX_RECT &rect) const { @@ -668,7 +665,7 @@ void CPDF_RenderStatus::ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_Affine } } else { if (pTextClippingPath == NULL) { - pTextClippingPath = FX_NEW CFX_PathData; + pTextClippingPath = new CFX_PathData; } ProcessText(pText, pObj2Device, pTextClippingPath); } @@ -803,7 +800,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, CFX_FxgeDevice bitmap_device; CFX_DIBitmap* oriDevice = NULL; if (!isolated && (m_pDevice->GetRenderCaps() & FXRC_GET_BITS)) { - oriDevice = FX_NEW CFX_DIBitmap; + oriDevice = new CFX_DIBitmap; if (!m_pDevice->CreateCompatibleBitmap(oriDevice, width, height)) { return TRUE; } @@ -819,7 +816,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj, new_matrix.Scale(scaleX, scaleY); CFX_DIBitmap* pTextMask = NULL; if (bTextClip) { - pTextMask = FX_NEW CFX_DIBitmap; + pTextMask = new CFX_DIBitmap; if (!pTextMask->Create(width, height, FXDIB_8bppMask)) { delete pTextMask; return TRUE; @@ -884,7 +881,7 @@ CFX_DIBitmap* CPDF_RenderStatus::GetBackdrop(const CPDF_PageObject* pObj, const FX_FLOAT scaleY = FXSYS_fabs(deviceCTM.d); int width = FXSYS_round(bbox.Width() * scaleX); int height = FXSYS_round(bbox.Height() * scaleY); - CFX_DIBitmap* pBackdrop = FX_NEW CFX_DIBitmap; + CFX_DIBitmap* pBackdrop = new CFX_DIBitmap; if (bBackAlphaRequired && !m_bDropObjects) { pBackdrop->Create(width, height, FXDIB_Argb); } else { @@ -931,10 +928,7 @@ CPDF_GraphicStates* CPDF_RenderStatus::CloneObjStates(const CPDF_GraphicStates* if (!pSrcStates) { return NULL; } - CPDF_GraphicStates* pStates = FX_NEW CPDF_GraphicStates; - if (!pStates) { - return NULL; - } + CPDF_GraphicStates* pStates = new CPDF_GraphicStates; pStates->CopyStates(*pSrcStates); CPDF_Color* pObjColor = bStroke ? pSrcStates->m_ColorState.GetStrokeColor() : pSrcStates->m_ColorState.GetFillColor(); @@ -1119,7 +1113,7 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) if (m_pRenderer == NULL) { m_ObjectPos = pItem->m_pObjectList->GetFirstObjectPosition(); m_ObjectIndex = 0; - m_pRenderer = FX_NEW CPDF_RenderStatus(); + m_pRenderer = new CPDF_RenderStatus(); m_pRenderer->Initialize(m_pContext, m_pDevice, NULL, NULL, NULL, NULL, m_pOptions, pItem->m_pObjectList->m_Transparency, m_bDropObjects, NULL); m_pDevice->SaveState(); @@ -1221,9 +1215,9 @@ CPDF_TransferFunc* CPDF_DocRenderData::GetTransferFunc(CPDF_Object* pObj) return NULL; } } - pTransfer = FX_NEW CPDF_TransferFunc; + pTransfer = new CPDF_TransferFunc; pTransfer->m_pPDFDoc = m_pPDFDoc; - pTransferCounter = FX_NEW CPDF_CountedObject<CPDF_TransferFunc*>; + pTransferCounter = new CPDF_CountedObject<CPDF_TransferFunc*>; pTransferCounter->m_nCount = 1; pTransferCounter->m_Obj = pTransfer; m_TransferFuncMap.SetAt(pObj, pTransferCounter); @@ -1326,7 +1320,7 @@ FX_BOOL CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, CFX_RenderDe CFX_FloatRect rect(*pRect); m_Matrix.TransformRect(rect); FX_RECT bitmap_rect = rect.GetOutterRect(); - m_pBitmap = FX_NEW CFX_DIBitmap; + m_pBitmap = new CFX_DIBitmap; m_pBitmap->Create(bitmap_rect.Width(), bitmap_rect.Height(), FXDIB_Argb); return TRUE; } @@ -1381,7 +1375,7 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_Re m_Matrix.Scale(1.0f, (FX_FLOAT)(max_dpi) / (FX_FLOAT)dpiv); } } - m_pBitmapDevice = FX_NEW CFX_FxgeDevice; + m_pBitmapDevice = new CFX_FxgeDevice; FXDIB_Format dibFormat = FXDIB_Rgb; FX_INT32 bpp = 24; if (m_pDevice->GetDeviceCaps(FXDC_RENDER_CAPS) & FXRC_ALPHA_OUTPUT) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp index de2a409e1c..658fc47266 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -111,7 +111,7 @@ void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& CPDF_ImageCache* pImageCache; FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache); if (!bFind) { - pImageCache = FX_NEW CPDF_ImageCache(m_pPage->m_pDocument, pStream); + pImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream); } m_nTimeCount ++; FX_BOOL bCached = pImageCache->GetCachedBitmap(pBitmap, pMask, MatteColor, m_pPage->m_pPageResources, bStdCS, GroupFamily, bLoadMask, pRenderStatus, downsampleWidth, downsampleHeight); @@ -126,7 +126,7 @@ FX_BOOL CPDF_PageRenderCache::StartGetCachedBitmap(CPDF_Stream* pStream, FX_BOOL { m_bCurFindCache = m_ImageCaches.Lookup(pStream, (FX_LPVOID&)m_pCurImageCache); if (!m_bCurFindCache) { - m_pCurImageCache = FX_NEW CPDF_ImageCache(m_pPage->m_pDocument, pStream); + m_pCurImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream); } int ret = m_pCurImageCache->StartGetCachedBitmap(pRenderStatus->m_pFormResource, m_pPage->m_pPageResources, bStdCS, GroupFamily, bLoadMask, pRenderStatus, downsampleWidth, downsampleHeight); if (ret == 2) { @@ -163,7 +163,7 @@ void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* if (pBitmap == NULL) { return; } - pImageCache = FX_NEW CPDF_ImageCache(m_pPage->m_pDocument, pStream); + pImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream); m_ImageCaches.SetAt(pStream, pImageCache); } int oldsize = pImageCache->EstimateSize(); @@ -240,7 +240,7 @@ FX_BOOL CPDF_ImageCache::GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource* CPDF_RenderContext*pContext = pRenderStatus->GetContext(); CPDF_PageRenderCache* pPageRenderCache = pContext->m_pPageCache; m_dwTimeCount = pPageRenderCache->GetTimeCount(); - CPDF_DIBSource* pSrc = FX_NEW CPDF_DIBSource; + CPDF_DIBSource* pSrc = new CPDF_DIBSource; CPDF_DIBSource* pMaskSrc = NULL; if (!pSrc->Load(m_pDocument, m_pStream, &pMaskSrc, &MatteColor, pRenderStatus->m_pFormResource, pPageResources, bStdCS, GroupFamily, bLoadMask)) { delete pSrc; @@ -289,7 +289,7 @@ int CPDF_ImageCache::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_ return 0; } m_pRenderStatus = pRenderStatus; - m_pCurBitmap = FX_NEW CPDF_DIBSource; + m_pCurBitmap = new CPDF_DIBSource; int ret = ((CPDF_DIBSource*)m_pCurBitmap)->StartLoadDIBSource(m_pDocument, m_pStream, TRUE, pFormResources, pPageResources, bStdCS, GroupFamily, bLoadMask); if (ret == 2) { return ret; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index 663a74861a..9a11fa8798 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -103,7 +103,7 @@ void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int else pBackdrop->CompositeMask(left - back_left, top - back_top, pDIBitmap->GetWidth(), pDIBitmap->GetHeight(), pDIBitmap, mask_argb, 0, 0, blend_mode); - CFX_DIBitmap* pBackdrop1 = FX_NEW CFX_DIBitmap; + CFX_DIBitmap* pBackdrop1 = new CFX_DIBitmap; pBackdrop1->Create(pBackdrop->GetWidth(), pBackdrop->GetHeight(), FXDIB_Rgb32); pBackdrop1->Clear((FX_DWORD) - 1); pBackdrop1->CompositeBitmap(0, 0, pBackdrop->GetWidth(), pBackdrop->GetHeight(), pBackdrop, 0, 0); @@ -119,7 +119,7 @@ FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) } CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc) { - CPDF_DIBTransferFunc* pDest = FX_NEW CPDF_DIBTransferFunc(this); + CPDF_DIBTransferFunc* pDest = new CPDF_DIBTransferFunc(this); pDest->LoadSrc(pSrc, bAutoDropSrc); return pDest; } @@ -676,7 +676,7 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() FX_RECT clip_box = m_pRenderStatus->m_pDevice->GetClipBox(); clip_box.Intersect(image_rect); m_Status = 2; - m_pTransformer = FX_NEW CFX_ImageTransformer; + m_pTransformer = new CFX_ImageTransformer; m_pTransformer->Start(m_pDIBSource, &m_ImageMatrix, m_Flags, &clip_box); return TRUE; } @@ -891,7 +891,7 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix } m_pDecoder->DownScale(m_DestWidth, m_DestHeight); } - m_pBitmap = FX_NEW CFX_DIBitmap; + m_pBitmap = new CFX_DIBitmap; #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ m_pBitmap->Create(m_ResultWidth, m_ResultHeight, FXDIB_Rgb32); #else @@ -1043,7 +1043,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict, status.Initialize(m_pContext, &bitmap_device, NULL, NULL, NULL, NULL, &options, 0, m_bDropObjects, pFormResource, TRUE, NULL, 0, pCS ? pCS->GetFamily() : 0, bLuminosity); status.RenderObjectList(&form, &matrix); - pMask = FX_NEW CFX_DIBitmap; + pMask = new CFX_DIBitmap; if (!pMask->Create(width, height, FXDIB_8bppMask)) { delete pMask; return NULL; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp index 2e642bed1e..7093edae47 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp @@ -59,7 +59,7 @@ FX_SAFE_DWORD CalculatePitch32(int bpp, int width) CFX_DIBSource* CPDF_Image::LoadDIBSource(CFX_DIBSource** ppMask, FX_DWORD* pMatteColor, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask) const { - CPDF_DIBSource* pSource = FX_NEW CPDF_DIBSource; + CPDF_DIBSource* pSource = new CPDF_DIBSource; if (pSource->Load(m_pDocument, m_pStream, (CPDF_DIBSource**)ppMask, pMatteColor, NULL, NULL, bStdCS, GroupFamily, bLoadMask)) { return pSource; } @@ -80,7 +80,7 @@ CFX_DIBSource* CPDF_Image::DetachMask() } FX_BOOL CPDF_Image::StartLoadDIBSource(CPDF_Dictionary* pFormResource, CPDF_Dictionary* pPageResource, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask) { - m_pDIBSource = FX_NEW CPDF_DIBSource; + m_pDIBSource = new CPDF_DIBSource; int ret = ((CPDF_DIBSource*)m_pDIBSource)->StartLoadDIBSource(m_pDocument, m_pStream, TRUE, pFormResource, pPageResource, bStdCS, GroupFamily, bLoadMask); if (ret == 2) { return TRUE; @@ -206,7 +206,7 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, CP if (!src_pitch.IsValid()) { return FALSE; } - m_pStreamAcc = FX_NEW CPDF_StreamAcc; + m_pStreamAcc = new CPDF_StreamAcc; m_pStreamAcc->LoadAllData(pStream, FALSE, src_pitch.ValueOrDie(), TRUE); if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) { return FALSE; @@ -321,7 +321,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Stream* p if (!src_pitch.IsValid()) { return 0; } - m_pStreamAcc = FX_NEW CPDF_StreamAcc; + m_pStreamAcc = new CPDF_StreamAcc; m_pStreamAcc->LoadAllData(pStream, FALSE, src_pitch.ValueOrDie(), TRUE); if (m_pStreamAcc->GetSize() == 0 || m_pStreamAcc->GetData() == NULL) { return 0; @@ -367,7 +367,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) if (m_pStreamAcc->GetImageParam()) { CPDF_Stream* pGlobals = m_pStreamAcc->GetImageParam()->GetStream(FX_BSTRC("JBIG2Globals")); if (pGlobals) { - m_pGlobalStream = FX_NEW CPDF_StreamAcc; + m_pGlobalStream = new CPDF_StreamAcc; m_pGlobalStream->LoadAllData(pGlobals, FALSE); } } @@ -598,7 +598,7 @@ int CPDF_DIBSource::CreateDecoder() LoadJpxBitmap(); return m_pCachedBitmap != NULL ? 1 : 0; } else if (decoder == FX_BSTRC("JBIG2Decode")) { - m_pCachedBitmap = FX_NEW CFX_DIBitmap; + m_pCachedBitmap = new CFX_DIBitmap; if (!m_pCachedBitmap->Create(m_Width, m_Height, m_bImageMask ? FXDIB_1bppMask : FXDIB_1bppRgb)) { delete m_pCachedBitmap; m_pCachedBitmap = NULL; @@ -683,7 +683,7 @@ void CPDF_DIBSource::LoadJpxBitmap() width = (width * output_nComps + 2) / 3; format = FXDIB_Rgb; } - m_pCachedBitmap = FX_NEW CFX_DIBitmap; + m_pCachedBitmap = new CFX_DIBitmap; if (!m_pCachedBitmap->Create(width, height, format)) { delete m_pCachedBitmap; m_pCachedBitmap = NULL; @@ -798,7 +798,7 @@ CPDF_DIBSource* CPDF_DIBSource::DetachMask() } CPDF_DIBSource* CPDF_DIBSource::LoadMaskDIB(CPDF_Stream* pMask) { - CPDF_DIBSource* pMaskSource = FX_NEW CPDF_DIBSource; + CPDF_DIBSource* pMaskSource = new CPDF_DIBSource; if (!pMaskSource->Load(m_pDocument, pMask, NULL, NULL, NULL, NULL, TRUE)) { delete pMaskSource; return NULL; @@ -807,7 +807,7 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMaskDIB(CPDF_Stream* pMask) } int CPDF_DIBSource::StartLoadMaskDIB() { - m_pMask = FX_NEW CPDF_DIBSource; + m_pMask = new CPDF_DIBSource; int ret = m_pMask->StartLoadDIBSource(m_pDocument, (CPDF_Stream*)m_pMaskStream, FALSE, NULL, NULL, TRUE); if (ret == 2) { if (m_Status == 0) { @@ -1498,8 +1498,7 @@ FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage, CPDF_Pa { m_nDownsampleWidth = nDownsampleWidth; m_nDownsampleHeight = nDownsampleHeight; - CPDF_ProgressiveImageLoaderHandle* pLoaderHandle = NULL; - pLoaderHandle = FX_NEW CPDF_ProgressiveImageLoaderHandle; + CPDF_ProgressiveImageLoaderHandle* pLoaderHandle = new CPDF_ProgressiveImageLoaderHandle; FX_BOOL ret = pLoaderHandle->Start(this, pImage, pCache, bStdCS, GroupFamily, bLoadMask, pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight); LoadHandle = pLoaderHandle; return ret; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index 8024c991f4..7e2a13a406 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -887,7 +887,7 @@ static CFX_DIBitmap* DrawPatternBitmap(CPDF_Document* pDoc, CPDF_PageRenderCache CPDF_TilingPattern* pPattern, const CFX_AffineMatrix* pObject2Device, int width, int height, int flags) { - CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; + CFX_DIBitmap* pBitmap = new CFX_DIBitmap; if (!pBitmap->Create(width, height, pPattern->m_bColored ? FXDIB_Argb : FXDIB_8bppMask)) { delete pBitmap; return NULL; diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index 0ea7ea1672..09843c9c62 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -29,7 +29,7 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(FX_DWORD charcode, const CFX_AffineM CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); CPDF_Type3Glyphs* pSizeCache = NULL; if(!m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { - pSizeCache = FX_NEW CPDF_Type3Glyphs; + pSizeCache = new CPDF_Type3Glyphs; m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); } CFX_GlyphBitmap* pGlyphBitmap; @@ -167,7 +167,7 @@ CFX_GlyphBitmap* CPDF_Type3Cache::RenderGlyph(CPDF_Type3Glyphs* pSize, FX_DWORD if (pResBitmap == NULL) { return NULL; } - CFX_GlyphBitmap* pGlyph = FX_NEW CFX_GlyphBitmap; + CFX_GlyphBitmap* pGlyph = new CFX_GlyphBitmap; pGlyph->m_Left = left; pGlyph->m_Top = -top; pGlyph->m_Bitmap.TakeOver(pResBitmap); @@ -689,7 +689,7 @@ void CPDF_RenderStatus::DrawTextPathWithPattern(const CPDF_TextObject* textobj, { if (!bStroke) { CPDF_PathObject path; - CPDF_TextObject* pCopy = FX_NEW CPDF_TextObject; + CPDF_TextObject* pCopy = new CPDF_TextObject; pCopy->Copy(textobj); path.m_bStroke = FALSE; path.m_FillType = FXFILL_WINDING; |