diff options
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
5 files changed, 58 insertions, 59 deletions
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 028e5e2972..db4d0dba43 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 18f06d6a14..db3d382a1f 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -241,15 +241,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 ++) { @@ -259,7 +259,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) { @@ -271,7 +271,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; @@ -280,9 +280,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: { @@ -297,7 +297,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); } } } @@ -306,7 +306,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(); } @@ -524,29 +524,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 { @@ -802,37 +802,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); @@ -841,7 +841,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); @@ -918,7 +918,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) { @@ -1028,10 +1028,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 c6383e559e..1a49ffd6b7 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -173,7 +173,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)) { @@ -1237,7 +1237,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; @@ -1557,7 +1557,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; @@ -2492,7 +2492,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; } @@ -2919,7 +2919,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 @@ -3432,7 +3432,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)) { @@ -3448,7 +3448,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)) { @@ -4136,7 +4136,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(); } @@ -4182,7 +4182,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(); } @@ -4194,7 +4194,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(); } @@ -4439,7 +4439,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) { |