diff options
-rw-r--r-- | core/include/fpdfapi/fpdf_objects.h | 30 | ||||
-rw-r--r-- | core/include/fxcrt/fx_memory.h | 2 | ||||
-rw-r--r-- | core/src/fxcrt/fx_arabic.cpp | 2 | ||||
-rw-r--r-- | core/src/fxcrt/fx_extension.cpp | 8 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_platforms.cpp | 2 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_posix.cpp | 2 | ||||
-rw-r--r-- | core/src/fxcrt/fxcrt_windows.cpp | 2 | ||||
-rw-r--r-- | core/src/fxge/agg/agg23/fx_agg_driver.cpp | 39 | ||||
-rw-r--r-- | core/src/fxge/android/fpf_skiafontmgr.cpp | 19 | ||||
-rw-r--r-- | core/src/fxge/android/fpf_skiamodule.cpp | 7 | ||||
-rw-r--r-- | core/src/fxge/android/fx_android_imp.cpp | 5 | ||||
-rw-r--r-- | core/src/reflow/autoreflow.cpp | 12 | ||||
-rw-r--r-- | core/src/reflow/layoutprocessor_reflow.cpp | 19 | ||||
-rw-r--r-- | core/src/reflow/layoutprovider_taggedpdf.cpp | 17 | ||||
-rw-r--r-- | core/src/reflow/reflowedpage.cpp | 19 | ||||
-rw-r--r-- | core/src/reflow/reflowedtextpage.cpp | 19 | ||||
-rw-r--r-- | core/src/reflow/reflowengine.cpp | 10 | ||||
-rw-r--r-- | fpdfsdk/src/fpdf_flatten.cpp | 10 |
18 files changed, 75 insertions, 149 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h index df5803c76c..0315465367 100644 --- a/core/include/fpdfapi/fpdf_objects.h +++ b/core/include/fpdfapi/fpdf_objects.h @@ -113,7 +113,7 @@ public: static CPDF_Boolean* Create(FX_BOOL value) { - return FX_NEW CPDF_Boolean(value); + return new CPDF_Boolean(value); } CPDF_Boolean() : CPDF_Object(PDFOBJ_BOOLEAN), m_bValue(false) { } @@ -134,22 +134,22 @@ public: static CPDF_Number* Create(int value) { - return FX_NEW CPDF_Number(value); + return new CPDF_Number(value); } static CPDF_Number* Create(FX_FLOAT value) { - return FX_NEW CPDF_Number(value); + return new CPDF_Number(value); } static CPDF_Number* Create(FX_BSTR str) { - return FX_NEW CPDF_Number(str); + return new CPDF_Number(str); } static CPDF_Number* Create(FX_BOOL bInteger, void* pData) { - return FX_NEW CPDF_Number(bInteger, pData); + return new CPDF_Number(bInteger, pData); } CPDF_Number() : CPDF_Object(PDFOBJ_NUMBER), m_bInteger(false), m_Integer(0) { } @@ -212,12 +212,12 @@ public: static CPDF_String* Create(const CFX_ByteString& str, FX_BOOL bHex = FALSE) { - return FX_NEW CPDF_String(str, bHex); + return new CPDF_String(str, bHex); } static CPDF_String* Create(const CFX_WideString& str) { - return FX_NEW CPDF_String(str); + return new CPDF_String(str); } CPDF_String() : CPDF_Object(PDFOBJ_STRING), m_bHex(FALSE) { } @@ -255,17 +255,17 @@ public: static CPDF_Name* Create(const CFX_ByteString& str) { - return FX_NEW CPDF_Name(str); + return new CPDF_Name(str); } static CPDF_Name* Create(FX_BSTR str) { - return FX_NEW CPDF_Name(str); + return new CPDF_Name(str); } static CPDF_Name* Create(FX_LPCSTR str) { - return FX_NEW CPDF_Name(str); + return new CPDF_Name(str); } CPDF_Name(const CFX_ByteString& str) : CPDF_Object(PDFOBJ_NAME), m_Name(str) { } @@ -292,7 +292,7 @@ public: static CPDF_Array* Create() { - return FX_NEW CPDF_Array(); + return new CPDF_Array(); } CPDF_Array() : CPDF_Object(PDFOBJ_ARRAY) { } @@ -389,7 +389,7 @@ public: static CPDF_Dictionary* Create() { - return FX_NEW CPDF_Dictionary(); + return new CPDF_Dictionary(); } CPDF_Dictionary() : CPDF_Object(PDFOBJ_DICTIONARY) { } @@ -506,7 +506,7 @@ public: static CPDF_Stream* Create(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict) { - return FX_NEW CPDF_Stream(pData, size, pDict); + return new CPDF_Stream(pData, size, pDict); } CPDF_Stream(FX_LPBYTE pData, FX_DWORD size, CPDF_Dictionary* pDict); @@ -664,7 +664,7 @@ public: static CPDF_Null* Create() { - return FX_NEW CPDF_Null(); + return new CPDF_Null(); } CPDF_Null() : CPDF_Object(PDFOBJ_NULL) { } @@ -675,7 +675,7 @@ public: static CPDF_Reference* Create(CPDF_IndirectObjects* pDoc, int objnum) { - return FX_NEW CPDF_Reference(pDoc, objnum); + return new CPDF_Reference(pDoc, objnum); } CPDF_Reference(CPDF_IndirectObjects* pDoc, int objnum) diff --git a/core/include/fxcrt/fx_memory.h b/core/include/fxcrt/fx_memory.h index 4d56736011..4e7c501318 100644 --- a/core/include/fxcrt/fx_memory.h +++ b/core/include/fxcrt/fx_memory.h @@ -25,7 +25,7 @@ void FXMEM_DefaultFree(void* pointer, int flags); } #define FX_NEW new -#define FX_NEW_VECTOR(Pointer, Class, Count) (Pointer = FX_NEW Class[Count]) +#define FX_NEW_VECTOR(Pointer, Class, Count) (Pointer = new Class[Count]) #define FX_DELETE_VECTOR(Pointer, Class, Count) delete[] Pointer class CFX_DestructObject diff --git a/core/src/fxcrt/fx_arabic.cpp b/core/src/fxcrt/fx_arabic.cpp index 583ce817cf..04ce172c3f 100644 --- a/core/src/fxcrt/fx_arabic.cpp +++ b/core/src/fxcrt/fx_arabic.cpp @@ -9,7 +9,7 @@ extern const FX_DWORD gs_FX_TextLayout_CodeProperties[65536]; IFX_BidiChar* IFX_BidiChar::Create() { - return FX_NEW CFX_BidiChar; + return new CFX_BidiChar; } CFX_BidiChar::CFX_BidiChar() : m_bSeparateNeutral(TRUE) diff --git a/core/src/fxcrt/fx_extension.cpp b/core/src/fxcrt/fx_extension.cpp index 6e82ab3d5c..4790aee00d 100644 --- a/core/src/fxcrt/fx_extension.cpp +++ b/core/src/fxcrt/fx_extension.cpp @@ -90,7 +90,7 @@ IFX_FileStream* FX_CreateFileStream(FX_LPCSTR filename, FX_DWORD dwModes) pFA->Release(); return NULL; } - return FX_NEW CFX_CRTFileStream(pFA); + return new CFX_CRTFileStream(pFA); } IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes) { @@ -102,7 +102,7 @@ IFX_FileStream* FX_CreateFileStream(FX_LPCWSTR filename, FX_DWORD dwModes) pFA->Release(); return NULL; } - return FX_NEW CFX_CRTFileStream(pFA); + return new CFX_CRTFileStream(pFA); } IFX_FileWrite* FX_CreateFileWrite(FX_LPCSTR filename) { @@ -122,11 +122,11 @@ IFX_FileRead* FX_CreateFileRead(FX_LPCWSTR filename) } IFX_MemoryStream* FX_CreateMemoryStream(FX_LPBYTE pBuffer, size_t dwSize, FX_BOOL bTakeOver) { - return FX_NEW CFX_MemoryStream(pBuffer, dwSize, bTakeOver); + return new CFX_MemoryStream(pBuffer, dwSize, bTakeOver); } IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive) { - return FX_NEW CFX_MemoryStream(bConsecutive); + return new CFX_MemoryStream(bConsecutive); } #ifdef __cplusplus extern "C" { diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp index cdf3d421f5..d9b99624d3 100644 --- a/core/src/fxcrt/fxcrt_platforms.cpp +++ b/core/src/fxcrt/fxcrt_platforms.cpp @@ -9,7 +9,7 @@ #if (_FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ && _FXM_PLATFORM_ != _FXM_PLATFORM_LINUX_ && _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ && _FXM_PLATFORM_ != _FXM_PLATFORM_ANDROID_) IFXCRT_FileAccess* FXCRT_FileAccess_Create() { - return FX_NEW CFXCRT_FileAccess_CRT; + return new CFXCRT_FileAccess_CRT; } void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_ByteString &bsMode) { diff --git a/core/src/fxcrt/fxcrt_posix.cpp b/core/src/fxcrt/fxcrt_posix.cpp index 98f9a71c6c..2982435c96 100644 --- a/core/src/fxcrt/fxcrt_posix.cpp +++ b/core/src/fxcrt/fxcrt_posix.cpp @@ -9,7 +9,7 @@ #if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || _FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ IFXCRT_FileAccess* FXCRT_FileAccess_Create() { - return FX_NEW CFXCRT_FileAccess_Posix; + return new CFXCRT_FileAccess_Posix; } void FXCRT_Posix_GetFileMode(FX_DWORD dwModes, FX_INT32 &nFlags, FX_INT32 &nMasks) { diff --git a/core/src/fxcrt/fxcrt_windows.cpp b/core/src/fxcrt/fxcrt_windows.cpp index 6b0f0f290d..05ed6196dd 100644 --- a/core/src/fxcrt/fxcrt_windows.cpp +++ b/core/src/fxcrt/fxcrt_windows.cpp @@ -25,7 +25,7 @@ FX_BOOL FX_File_Exist(FX_WSTR fileName) } IFXCRT_FileAccess* FXCRT_FileAccess_Create() { - return FX_NEW CFXCRT_FileAccess_Win64; + return new CFXCRT_FileAccess_Win64; } void FXCRT_Windows_GetFileMode(FX_DWORD dwMode, FX_DWORD &dwAccess, FX_DWORD &dwShare, FX_DWORD &dwCreation) { diff --git a/core/src/fxge/agg/agg23/fx_agg_driver.cpp b/core/src/fxge/agg/agg23/fx_agg_driver.cpp index 5944332fd8..08f76bf8e1 100644 --- a/core/src/fxge/agg/agg23/fx_agg_driver.cpp +++ b/core/src/fxge/agg/agg23/fx_agg_driver.cpp @@ -187,7 +187,7 @@ static void RasterizeStroke(agg::rasterizer_scanline_aa& rasterizer, agg::path_s } IFX_RenderDeviceDriver* IFX_RenderDeviceDriver::CreateFxgeDriver(CFX_DIBitmap* pBitmap, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) { - return FX_NEW CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice, bGroupKnockout); + return new CFX_AggDeviceDriver(pBitmap, 0, bRgbByteOrder, pOriDevice, bGroupKnockout); } CFX_AggDeviceDriver::CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout) { @@ -267,10 +267,7 @@ void CFX_AggDeviceDriver::SaveState() { void* pClip = NULL; if (m_pClipRgn) { - pClip = FX_NEW CFX_ClipRgn(*m_pClipRgn); - if (!pClip) { - return; - } + pClip = new CFX_ClipRgn(*m_pClipRgn); } m_StateStack.Add(pClip); } @@ -290,7 +287,7 @@ void CFX_AggDeviceDriver::RestoreState(FX_BOOL bKeepSaved) } if (bKeepSaved) { if (pSavedClip) { - m_pClipRgn = FX_NEW CFX_ClipRgn(*pSavedClip); + m_pClipRgn = new CFX_ClipRgn(*pSavedClip); } } else { m_StateStack.RemoveAt(m_StateStack.GetSize() - 1); @@ -325,10 +322,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathFill(const CFX_PathData* pPathData, { m_FillFlags = fill_mode; if (m_pClipRgn == NULL) { - m_pClipRgn = FX_NEW CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); - if (!m_pClipRgn) { - return FALSE; - } + m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); } if (pPathData->GetPointCount() == 5 || pPathData->GetPointCount() == 4) { CFX_FloatRect rectf; @@ -355,10 +349,7 @@ FX_BOOL CFX_AggDeviceDriver::SetClip_PathStroke(const CFX_PathData* pPathData, ) { if (m_pClipRgn == NULL) { - m_pClipRgn = FX_NEW CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); - if (!m_pClipRgn) { - return FALSE; - } + m_pClipRgn = new CFX_ClipRgn(GetDeviceCaps(FXDC_PIXEL_WIDTH), GetDeviceCaps(FXDC_PIXEL_HEIGHT)); } CAgg_PathData path_data; path_data.BuildPath(pPathData, NULL); @@ -1565,10 +1556,7 @@ FX_BOOL CFX_AggDeviceDriver::StartDIBits(const CFX_DIBSource* pSource, int bitma if (m_pBitmap->GetBuffer() == NULL) { return TRUE; } - CFX_ImageRenderer* pRenderer = FX_NEW CFX_ImageRenderer; - if (!pRenderer) { - return FALSE; - } + CFX_ImageRenderer* pRenderer = new CFX_ImageRenderer; pRenderer->Start(m_pBitmap, m_pClipRgn, pSource, bitmap_alpha, argb, pMatrix, render_flags, m_bRgbByteOrder, alpha_flag, pIccTransform); handle = pRenderer; return TRUE; @@ -1597,29 +1585,20 @@ FX_BOOL CFX_FxgeDevice::Attach(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL b return FALSE; } SetBitmap(pBitmap); - IFX_RenderDeviceDriver* pDriver = FX_NEW CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout); - if (!pDriver) { - return FALSE; - } + IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, bRgbByteOrder, pOriDevice, bGroupKnockout); SetDeviceDriver(pDriver); return TRUE; } FX_BOOL CFX_FxgeDevice::Create(int width, int height, FXDIB_Format format, int dither_bits, CFX_DIBitmap* pOriDevice) { m_bOwnedBitmap = TRUE; - CFX_DIBitmap* pBitmap = FX_NEW CFX_DIBitmap; - if (!pBitmap) { - return FALSE; - } + CFX_DIBitmap* pBitmap = new CFX_DIBitmap; if (!pBitmap->Create(width, height, format)) { delete pBitmap; return FALSE; } SetBitmap(pBitmap); - IFX_RenderDeviceDriver* pDriver = FX_NEW CFX_AggDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); - if (!pDriver) { - return FALSE; - } + IFX_RenderDeviceDriver* pDriver = new CFX_AggDeviceDriver(pBitmap, dither_bits, FALSE, pOriDevice, FALSE); SetDeviceDriver(pDriver); return TRUE; } diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index a9bef8a2b8..fc012ea9ac 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -352,16 +352,12 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(FX_BSTR bsFamilyname, FX_BYTE uCharset, } if (nItem > -1) { CFPF_SkiaFontDescriptor *pFontDes = (CFPF_SkiaFontDescriptor*)m_FontFaces.ElementAt(nItem); - CFPF_SkiaFont *pFont = FX_NEW CFPF_SkiaFont; - if (pFont) { - if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) { - m_FamilyFonts.SetAt((void*)(FX_UINTPTR)dwHash, (void*)pFont); - return pFont->Retain(); - } - pFont->Release(); - pFont = NULL; + CFPF_SkiaFont *pFont = new CFPF_SkiaFont; + if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) { + m_FamilyFonts.SetAt((void*)(FX_UINTPTR)dwHash, (void*)pFont); + return pFont->Retain(); } - return pFont; + pFont->Release(); } return NULL; } @@ -464,10 +460,7 @@ void CFPF_SkiaFontMgr::ScanFile(FX_BSTR file) { FXFT_Face face = GetFontFace(file); if (face) { - CFPF_SkiaPathFont *pFontDesc = FX_NEW CFPF_SkiaPathFont; - if (!pFontDesc) { - return; - } + CFPF_SkiaPathFont *pFontDesc = new CFPF_SkiaPathFont; pFontDesc->SetPath(file.GetCStr()); ReportFace(face, pFontDesc); m_FontFaces.Add(pFontDesc); diff --git a/core/src/fxge/android/fpf_skiamodule.cpp b/core/src/fxge/android/fpf_skiamodule.cpp index 94e68885fc..6b5987d1b7 100644 --- a/core/src/fxge/android/fpf_skiamodule.cpp +++ b/core/src/fxge/android/fpf_skiamodule.cpp @@ -12,7 +12,7 @@ static IFPF_DeviceModule *gs_pPFModule = NULL; IFPF_DeviceModule* FPF_GetDeviceModule() { if (!gs_pPFModule) { - gs_pPFModule = FX_NEW CFPF_SkiaDeviceModule; + gs_pPFModule = new CFPF_SkiaDeviceModule; } return gs_pPFModule; } @@ -32,10 +32,7 @@ void CFPF_SkiaDeviceModule::Destroy() IFPF_FontMgr* CFPF_SkiaDeviceModule::GetFontMgr() { if (!m_pFontMgr) { - m_pFontMgr = FX_NEW CFPF_SkiaFontMgr; - if (!m_pFontMgr) { - return NULL; - } + m_pFontMgr = new CFPF_SkiaFontMgr; if (!m_pFontMgr->InitFTLibrary()) { delete m_pFontMgr; return NULL; diff --git a/core/src/fxge/android/fx_android_imp.cpp b/core/src/fxge/android/fx_android_imp.cpp index 528877ef89..a1631ab8f0 100644 --- a/core/src/fxge/android/fx_android_imp.cpp +++ b/core/src/fxge/android/fx_android_imp.cpp @@ -14,10 +14,7 @@ void CFX_GEModule::InitPlatform() } IFPF_FontMgr *pFontMgr = pDeviceModule->GetFontMgr(); if (pFontMgr) { - CFX_AndroidFontInfo *pFontInfo = FX_NEW CFX_AndroidFontInfo; - if (!pFontInfo) { - return; - } + CFX_AndroidFontInfo *pFontInfo = new CFX_AndroidFontInfo; pFontInfo->Init(pFontMgr); m_pFontMgr->SetSystemFontInfo(pFontInfo); } diff --git a/core/src/reflow/autoreflow.cpp b/core/src/reflow/autoreflow.cpp index 8c37960932..a10175525c 100644 --- a/core/src/reflow/autoreflow.cpp +++ b/core/src/reflow/autoreflow.cpp @@ -100,7 +100,7 @@ void CPDF_AutoReflowLayoutProvider::Conver2AppreceOrder(const CPDF_PageObjects* } IPDF_LayoutProvider* IPDF_LayoutProvider::Create_LayoutProvider_AutoReflow(CPDF_PageObjects* pPage, FX_BOOL bReadOrder) { - return FX_NEW CPDF_AutoReflowLayoutProvider(pPage, bReadOrder); + return new CPDF_AutoReflowLayoutProvider(pPage, bReadOrder); } CPDF_AutoReflowElement::CPDF_AutoReflowElement(LayoutType layoutType , CPDF_AutoReflowElement* pParent) { @@ -251,8 +251,7 @@ void CPDF_AutoReflowLayoutProvider::CreateElement() } else { pNextCell = NULL; } - pCurrElm = NULL; - pCurrElm = FX_NEW CPDF_AutoReflowElement(LayoutParagraph, pParent); + pCurrElm = new CPDF_AutoReflowElement(LayoutParagraph, pParent); if(pCurrElm->GetType() == LayoutParagraph && plastCell) { int SpaceBefore = 0; if(pCell->m_CellWritingMode != plastCell->m_CellWritingMode ) { @@ -561,7 +560,7 @@ void CPDF_AutoReflowLayoutProvider::GenerateLine(CFX_PtrArray& cellArray) pPerObj = pObj; if(bNewLine) { int c = pCell ? pCell->m_ObjList.GetCount() : 0; - pCell = FX_NEW CRF_CELL; + pCell = new CRF_CELL; pCell->m_CellWritingMode = m_WritingMode; pCell->m_BBox = ObjBBox; if(pObj->m_Type == PDFPAGE_TEXT) { @@ -719,10 +718,7 @@ int CPDF_AutoReflowLayoutProvider::GetWritingMode(CPDF_PageObject* pPreObj, CPDF LayoutStatus CPDF_AutoReflowLayoutProvider::StartLoad(IFX_Pause* pPause) { m_pPause = pPause; - m_pRoot = FX_NEW CPDF_AutoReflowElement(LayoutDocument); - if(!m_pRoot) { - return LayoutError; - } + m_pRoot = new CPDF_AutoReflowElement(LayoutDocument); m_Step = 0; return Continue(); } diff --git a/core/src/reflow/layoutprocessor_reflow.cpp b/core/src/reflow/layoutprocessor_reflow.cpp index d2fa7e9371..218d301f0f 100644 --- a/core/src/reflow/layoutprocessor_reflow.cpp +++ b/core/src/reflow/layoutprocessor_reflow.cpp @@ -12,10 +12,7 @@ IPDF_LayoutProcessor* IPDF_LayoutProcessor::Create_LayoutProcessor_Reflow(FX_FLO if(pReflowedPage == NULL || fWidth <= 20) { return NULL; } - CPDF_LayoutProcessor_Reflow* pReflowEngine = FX_NEW CPDF_LayoutProcessor_Reflow(); - if (NULL == pReflowEngine) { - return NULL; - } + CPDF_LayoutProcessor_Reflow* pReflowEngine = new CPDF_LayoutProcessor_Reflow(); pReflowEngine->Init(TopIndent, fWidth, fHeight, (CPDF_ReflowedPage*)pReflowedPage, flags, lineSpace); return pReflowEngine; } @@ -29,8 +26,8 @@ CPDF_LayoutProcessor_Reflow::CPDF_LayoutProcessor_Reflow() m_fCurrLineHeight = 0; m_bIllustration = FALSE; m_pPreObj = NULL; - m_pCurrLine = FX_NEW CRF_DataPtrArray(50); - m_pTempLine = FX_NEW CRF_DataPtrArray(50); + m_pCurrLine = new CRF_DataPtrArray(50); + m_pTempLine = new CRF_DataPtrArray(50); m_StartIndent = 0; m_PausePosition = 0; } @@ -557,10 +554,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessElement(IPDF_LayoutElement* pElement, F } switch(layoutType) { case LayoutTable: { - CRF_Table* pTable = FX_NEW CRF_Table; - if (NULL == pTable) { - break; - } + CRF_Table* pTable = new CRF_Table; m_TableArray.Add(pTable); pTable->m_ReflowPageHeight = m_pReflowedPage->m_PageHeight; pTable->m_TableWidth = GetElmWidth(pElement); @@ -771,10 +765,7 @@ void CPDF_LayoutProcessor_Reflow::ProcessObject(CPDF_PageObject* pObj, FX_FLOAT if(!(m_flags & RF_PARSER_IMAGE)) { return; } - CPDF_PageObjects* pObjs = FX_NEW CPDF_PageObjects(FALSE); - if (NULL == pObjs) { - return; - } + CPDF_PageObjects* pObjs = new CPDF_PageObjects(FALSE); FX_POSITION pos = pObjs->GetLastObjectPosition(); pos = pObjs->InsertObject(pos, pObj); CFX_AffineMatrix matrix; diff --git a/core/src/reflow/layoutprovider_taggedpdf.cpp b/core/src/reflow/layoutprovider_taggedpdf.cpp index c40c1cdb64..4a5a22bd61 100644 --- a/core/src/reflow/layoutprovider_taggedpdf.cpp +++ b/core/src/reflow/layoutprovider_taggedpdf.cpp @@ -636,10 +636,7 @@ IPDF_LayoutProvider* IPDF_LayoutProvider::Create_LayoutProvider_TaggedPDF(CPDF_P if(pPage == NULL) { return NULL; } - CPDF_LayoutProvider_TaggedPDF* pProvider = FX_NEW CPDF_LayoutProvider_TaggedPDF; - if (!pProvider) { - return NULL; - } + CPDF_LayoutProvider_TaggedPDF* pProvider = new CPDF_LayoutProvider_TaggedPDF; pProvider->Init(pPage); return pProvider; } @@ -672,11 +669,7 @@ void CPDF_LayoutProvider_TaggedPDF::ProcessElement(CPDF_LayoutElement*pParent, C m_Status = LayoutError; return; } - CPDF_LayoutElement* pElement = FX_NEW CPDF_LayoutElement; - if (!pElement) { - m_Status = LayoutError; - return; - } + CPDF_LayoutElement* pElement = new CPDF_LayoutElement; pElement->m_pParentElement = pParent; pElement->m_pTaggedElement = pTaggedElement; pParent->m_ChildArray.Add(pElement); @@ -729,11 +722,7 @@ LayoutStatus CPDF_LayoutProvider_TaggedPDF::StartLoad(IFX_Pause* pPause) m_Status = LayoutError; return LayoutError; } - m_pRoot = FX_NEW CPDF_LayoutElement; - if (!m_pRoot) { - m_Status = LayoutError; - return LayoutError; - } + m_pRoot = new CPDF_LayoutElement; for(int i = 0; i < count; i++) { CPDF_StructElement* pElement = m_pPageTree->GetTopElement(i); if(pElement) { diff --git a/core/src/reflow/reflowedpage.cpp b/core/src/reflow/reflowedpage.cpp index 11baef8718..ba2667f074 100644 --- a/core/src/reflow/reflowedpage.cpp +++ b/core/src/reflow/reflowedpage.cpp @@ -36,11 +36,11 @@ CPDF_ReflowedPage::CPDF_ReflowedPage(CFX_GrowOnlyPool* pMemoryPool) m_pMemoryPool = pMemoryPool; m_bCreateMemoryPool = FALSE; } else { - m_pMemoryPool = FX_NEW CFX_GrowOnlyPool; + m_pMemoryPool = new CFX_GrowOnlyPool; m_bCreateMemoryPool = TRUE; } - m_pCharState = FX_NEW CRF_CharStateArray(10); - m_pReflowed = FX_NEW CRF_DataPtrArray(500); + m_pCharState = new CRF_CharStateArray(10); + m_pReflowed = new CRF_DataPtrArray(500); m_pPageInfos = NULL; } CPDF_ReflowedPage::~CPDF_ReflowedPage() @@ -79,7 +79,7 @@ FX_BOOL CPDF_ReflowedPage::RetainPageObjsMemberShip() return FALSE; } if (NULL == m_pPageInfos) { - m_pPageInfos = FX_NEW CFX_MapPtrToPtr(); + m_pPageInfos = new CFX_MapPtrToPtr(); } else { return TRUE; } @@ -100,10 +100,7 @@ void CPDF_ReflowedPage::MarkPageObjMemberShip(CPDF_PageObject* pObj, CRF_PageInf if (NULL == m_pPageInfos) { return; } - CRF_PageInfo* pPageInfo = FX_NEW CRF_PageInfo(pObj, pParent); - if (NULL == pPageInfo) { - return; - } + CRF_PageInfo* pPageInfo = new CRF_PageInfo(pObj, pParent); m_pPageInfos->SetAt(pObj, pPageInfo); if (PDFPAGE_FORM != pObj->m_Type) { return; @@ -593,11 +590,9 @@ void CPDF_ProgressiveReflowPageRender::Start(IPDF_ReflowedPage* pReflowPage, CFX m_pReflowPage = (CPDF_ReflowedPage*)pReflowPage; m_pFXDevice = pDevice; if(NULL == m_pDisplayMatrix) { - m_pDisplayMatrix = FX_NEW CFX_AffineMatrix; - } - if (m_pDisplayMatrix) { - m_pDisplayMatrix->Copy(*pMatrix); + m_pDisplayMatrix = new CFX_AffineMatrix; } + m_pDisplayMatrix->Copy(*pMatrix); m_Status = ToBeContinued; Display(pPause); } diff --git a/core/src/reflow/reflowedtextpage.cpp b/core/src/reflow/reflowedtextpage.cpp index a5ad0be948..0844f780b6 100644 --- a/core/src/reflow/reflowedtextpage.cpp +++ b/core/src/reflow/reflowedtextpage.cpp @@ -4,10 +4,13 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com +#include <algorithm> + #include "reflowedtextpage.h" + IPDF_TextPage* IPDF_TextPage::CreateReflowTextPage(IPDF_ReflowedPage* pRefPage) { - return FX_NEW CRF_TextPage(pRefPage); + return new CRF_TextPage(pRefPage); } CRF_TextPage::CRF_TextPage(IPDF_ReflowedPage* pRefPage) { @@ -32,24 +35,14 @@ FX_BOOL CRF_TextPage::ParseTextPage() return FALSE; } int count = m_pRefPage->m_pReflowed->GetSize(); - if(count < 500) { - m_pDataList = FX_NEW CRF_CharDataPtrArray(count); - } else { - m_pDataList = FX_NEW CRF_CharDataPtrArray(500); - } - if (NULL == m_pDataList) { - return FALSE; - } + m_pDataList = new CRF_CharDataPtrArray(std::min(count, 500)); for(int i = 0; i < count; i++) { CRF_Data* pData = (*(m_pRefPage->m_pReflowed))[i]; if(pData->GetType() == CRF_Data::Text) { m_pDataList->Add((CRF_CharData*)pData); } } - m_CountBSArray = FX_NEW CFX_CountBSINT32Array(20); - if(NULL == m_CountBSArray) { - return FALSE; - } + m_CountBSArray = new CFX_CountBSINT32Array(20); return TRUE; } FX_BOOL CRF_TextPage::IsParsered() const diff --git a/core/src/reflow/reflowengine.cpp b/core/src/reflow/reflowengine.cpp index 11007c904b..7f766caefb 100644 --- a/core/src/reflow/reflowengine.cpp +++ b/core/src/reflow/reflowengine.cpp @@ -8,8 +8,7 @@ #include "reflowedpage.h" IPDF_ReflowedPage* IPDF_ReflowedPage::Create() { - CPDF_ReflowedPage* pRefPage = FX_NEW CPDF_ReflowedPage(NULL); - return pRefPage; + return new CPDF_ReflowedPage(NULL); } IPDF_ReflowedPage* Create_ReflowPage() { @@ -21,10 +20,7 @@ IPDF_ProgressiveReflowPageParser* Create_ReflowPageParser() } IPDF_ProgressiveReflowPageParser* IPDF_ProgressiveReflowPageParser::Create() { - CPDF_ProgressiveReflowPageParser* pParser = FX_NEW CPDF_ProgressiveReflowPageParser; - if (NULL == pParser) { - return NULL; - } + CPDF_ProgressiveReflowPageParser* pParser = new CPDF_ProgressiveReflowPageParser; pParser->Init(); return pParser; } @@ -34,5 +30,5 @@ IPDF_ProgressiveReflowPageRender* Create_ReflowPageRender() } IPDF_ProgressiveReflowPageRender* IPDF_ProgressiveReflowPageRender::Create() { - return FX_NEW CPDF_ProgressiveReflowPageRender; + return new CPDF_ProgressiveReflowPageRender; } diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp index 26ea294617..51e208fc93 100644 --- a/fpdfsdk/src/fpdf_flatten.cpp +++ b/fpdfsdk/src/fpdf_flatten.cpp @@ -215,7 +215,7 @@ void SetPageContents(CFX_ByteString key, CPDF_Dictionary* pPage, CPDF_Document* //Create a new contents dictionary if (!key.IsEmpty()) { - CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, FX_NEW CPDF_Dictionary); + CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, new CPDF_Dictionary); pPage->SetAtReference("Contents", pDocument, pDocument->AddIndirectObject(pNewContents)); CFX_ByteString sStream; @@ -261,10 +261,10 @@ void SetPageContents(CFX_ByteString key, CPDF_Dictionary* pPage, CPDF_Document* if (!key.IsEmpty()) { - CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, FX_NEW CPDF_Dictionary); + CPDF_Stream* pNewContents = new CPDF_Stream(NULL, 0, new CPDF_Dictionary); dwObjNum = pDocument->AddIndirectObject(pNewContents); pContentsArray->AddReference(pDocument, dwObjNum); - + CFX_ByteString sStream; sStream.Format("q 1 0 0 1 0 0 cm /%s Do Q", key.c_str()); pNewContents->SetData((FX_LPCBYTE)sStream, sStream.GetLength(), FALSE, FALSE); @@ -399,10 +399,10 @@ DLLEXPORT int STDCALL FPDFPage_Flatten( FPDF_PAGE page, int nFlag) if (!pRes) { pRes = new CPDF_Dictionary; - pPageDict->SetAt("Resources", pRes); + pPageDict->SetAt("Resources", pRes ); } - CPDF_Stream* pNewXObject = new CPDF_Stream(NULL, 0, FX_NEW CPDF_Dictionary); + CPDF_Stream* pNewXObject = new CPDF_Stream(NULL, 0, new CPDF_Dictionary); FX_DWORD dwObjNum = pDocument->AddIndirectObject(pNewXObject); CPDF_Dictionary* pPageXObject = pRes->GetDict("XObject"); if (!pPageXObject) |