summaryrefslogtreecommitdiff
path: root/fpdfsdk/src
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-18 17:05:11 -0800
committerLei Zhang <thestig@chromium.org>2015-12-18 17:05:11 -0800
commit4880d1a168729d42be736293fb93b514802e4f12 (patch)
tree9cfe5aa73113301487dce8bcef5139fb7295536a /fpdfsdk/src
parentaedd4555ec1a80121f176586cb72180337e4ccd8 (diff)
downloadpdfium-4880d1a168729d42be736293fb93b514802e4f12.tar.xz
Merge to XFA: Get rid of a few CPDF_Object Create() methods and just use new instead.
R=ochang@chromium.org Review URL: https://codereview.chromium.org/1540693002 . (cherry picked from commit d866ab0b44a571c884fdd8ba5a5319adaf607559) Review URL: https://codereview.chromium.org/1541563002 .
Diffstat (limited to 'fpdfsdk/src')
-rw-r--r--fpdfsdk/src/fpdfeditpage.cpp4
-rw-r--r--fpdfsdk/src/fpdfppo.cpp12
-rw-r--r--fpdfsdk/src/fpdfsave.cpp4
3 files changed, 9 insertions, 11 deletions
diff --git a/fpdfsdk/src/fpdfeditpage.cpp b/fpdfsdk/src/fpdfeditpage.cpp
index a1d5440b1e..40cf73c50a 100644
--- a/fpdfsdk/src/fpdfeditpage.cpp
+++ b/fpdfsdk/src/fpdfeditpage.cpp
@@ -43,7 +43,7 @@ DLLEXPORT FPDF_DOCUMENT STDCALL FPDF_CreateNewDocument() {
pInfoDict = pDoc->GetInfo();
if (pInfoDict) {
if (FSDK_IsSandBoxPolicyEnabled(FPDF_POLICY_MACHINETIME_ACCESS))
- pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr));
+ pInfoDict->SetAt("CreationDate", new CPDF_String(DateStr, FALSE));
pInfoDict->SetAt("Creator", new CPDF_String(L"PDFium"));
}
@@ -285,7 +285,7 @@ DLLEXPORT void STDCALL FPDFPage_TransformAnnots(FPDF_PAGE page,
CPDF_Array* pRectArray = NULL;
pRectArray = pAnnot->GetAnnotDict()->GetArray("Rect");
if (!pRectArray)
- pRectArray = CPDF_Array::Create();
+ pRectArray = new CPDF_Array;
pRectArray->SetAt(0, new CPDF_Number(rect.left));
pRectArray->SetAt(1, new CPDF_Number(rect.bottom));
pRectArray->SetAt(2, new CPDF_Number(rect.right));
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp
index 513ffc4ade..2fce7adfc4 100644
--- a/fpdfsdk/src/fpdfppo.cpp
+++ b/fpdfsdk/src/fpdfppo.cpp
@@ -43,17 +43,16 @@ FX_BOOL CPDF_PageOrganizer::PDFDocInit(CPDF_Document* pDestPDFDoc,
if (!pNewRoot)
return FALSE;
- // Set the document information////////////////////////////////////////////
-
+ // Set the document information
CPDF_Dictionary* DInfoDict = pDestPDFDoc->GetInfo();
if (!DInfoDict)
return FALSE;
CFX_ByteString producerstr;
producerstr.Format("PDFium");
- DInfoDict->SetAt("Producer", new CPDF_String(producerstr));
+ DInfoDict->SetAt("Producer", new CPDF_String(producerstr, FALSE));
- // Set type////////////////////////////////////////////////////////////////
+ // Set type
CFX_ByteString cbRootType = pNewRoot->GetString("Type", "");
if (cbRootType.Equal("")) {
pNewRoot->SetAt("Type", new CPDF_Name("Catalog"));
@@ -100,7 +99,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
if (!pSrcPageDict || !pCurPageDict)
return FALSE;
- // Clone the page dictionary///////////
+ // Clone the page dictionary
FX_POSITION SrcPos = pSrcPageDict->GetStartPos();
while (SrcPos) {
CFX_ByteString cbSrcKeyStr;
@@ -112,7 +111,7 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
}
}
- // inheritable item///////////////////////
+ // inheritable item
CPDF_Object* pInheritable = nullptr;
// 1 MediaBox //required
if (!pCurPageDict->KeyExist("MediaBox")) {
@@ -156,7 +155,6 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
pCurPageDict->SetAt("Rotate", pInheritable->Clone());
}
- /////////////////////////////////////////////
// Update the reference
FX_DWORD dwOldPageObj = pSrcPageDict->GetObjNum();
FX_DWORD dwNewPageObj = pCurPageDict->GetObjNum();
diff --git a/fpdfsdk/src/fpdfsave.cpp b/fpdfsdk/src/fpdfsave.cpp
index d1cc0a8c60..253c11690d 100644
--- a/fpdfsdk/src/fpdfsave.cpp
+++ b/fpdfsdk/src/fpdfsave.cpp
@@ -185,7 +185,7 @@ FX_BOOL _SaveXFADocumentData(CPDFXFA_Document* pDocument,
pData->InitStreamFromFile(pDsfileWrite, pDataDict);
pPDFDocument->AddIndirectObject(pData);
iLast = pArray->GetCount() - 2;
- pArray->InsertAt(iLast, CPDF_String::Create("datasets"));
+ pArray->InsertAt(iLast, new CPDF_String("datasets", FALSE));
pArray->InsertAt(iLast + 1, pData, pPDFDocument);
}
fileList.Add(pDsfileWrite);
@@ -212,7 +212,7 @@ FX_BOOL _SaveXFADocumentData(CPDFXFA_Document* pDocument,
pData->InitStreamFromFile(pfileWrite, pDataDict);
pPDFDocument->AddIndirectObject(pData);
iLast = pArray->GetCount() - 2;
- pArray->InsertAt(iLast, CPDF_String::Create("form"));
+ pArray->InsertAt(iLast, new CPDF_String("form", FALSE));
pArray->InsertAt(iLast + 1, pData, pPDFDocument);
}
fileList.Add(pfileWrite);