Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Unified Diff: fpdfsdk/fpdf_flatten.cpp

Issue 2345063002: Use string pools in some dictionaries (Closed)
Patch Set: windows compilation Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: fpdfsdk/fpdf_flatten.cpp
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index aa21b280edcc5d3a5ae85a656ec7a85ec4b44aaa..d739290a52472e637542fb6759a20178f5c7c5bc 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -193,8 +193,8 @@ void SetPageContents(CFX_ByteString key,
if (!pContentsObj) {
// Create a new contents dictionary
if (!key.IsEmpty()) {
- CPDF_Stream* pNewContents =
- new CPDF_Stream(nullptr, 0, new CPDF_Dictionary);
+ CPDF_Stream* pNewContents = new CPDF_Stream(
+ nullptr, 0, new CPDF_Dictionary(pDocument->GetByteStringPool()));
pPage->SetReferenceFor("Contents", pDocument,
pDocument->AddIndirectObject(pNewContents));
@@ -206,7 +206,6 @@ void SetPageContents(CFX_ByteString key,
}
CPDF_Array* pContentsArray = nullptr;
-
switch (pContentsObj->GetType()) {
case CPDF_Object::STREAM: {
pContentsArray = new CPDF_Array;
@@ -238,8 +237,8 @@ void SetPageContents(CFX_ByteString key,
pPage->SetReferenceFor("Contents", pDocument, dwObjNum);
if (!key.IsEmpty()) {
- CPDF_Stream* pNewContents =
- new CPDF_Stream(nullptr, 0, new CPDF_Dictionary);
+ CPDF_Stream* pNewContents = new CPDF_Stream(
+ nullptr, 0, new CPDF_Dictionary(pDocument->GetByteStringPool()));
dwObjNum = pDocument->AddIndirectObject(pNewContents);
pContentsArray->AddReference(pDocument, dwObjNum);
@@ -372,15 +371,17 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CPDF_Dictionary* pRes = pPageDict->GetDictFor("Resources");
if (!pRes) {
- pRes = new CPDF_Dictionary;
+ pRes = new CPDF_Dictionary(pDocument->GetByteStringPool());
pPageDict->SetFor("Resources", pRes);
}
- CPDF_Stream* pNewXObject = new CPDF_Stream(nullptr, 0, new CPDF_Dictionary);
+ CPDF_Stream* pNewXObject = new CPDF_Stream(
+ nullptr, 0, new CPDF_Dictionary(pDocument->GetByteStringPool()));
+
uint32_t dwObjNum = pDocument->AddIndirectObject(pNewXObject);
CPDF_Dictionary* pPageXObject = pRes->GetDictFor("XObject");
if (!pPageXObject) {
- pPageXObject = new CPDF_Dictionary;
+ pPageXObject = new CPDF_Dictionary(pDocument->GetByteStringPool());
pRes->SetFor("XObject", pPageXObject);
}
@@ -404,7 +405,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
if (!key.IsEmpty()) {
pPageXObject->SetReferenceFor(key, pDocument, dwObjNum);
CPDF_Dictionary* pNewOXbjectDic = pNewXObject->GetDict();
- pNewXORes = new CPDF_Dictionary;
+ pNewXORes = new CPDF_Dictionary(pDocument->GetByteStringPool());
pNewOXbjectDic->SetFor("Resources", pNewXORes);
pNewOXbjectDic->SetNameFor("Type", "XObject");
pNewOXbjectDic->SetNameFor("Subtype", "Form");
@@ -476,7 +477,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CPDF_Dictionary* pXObject = pNewXORes->GetDictFor("XObject");
if (!pXObject) {
- pXObject = new CPDF_Dictionary;
+ pXObject = new CPDF_Dictionary(pDocument->GetByteStringPool());
pNewXORes->SetFor("XObject", pXObject);
}

Powered by Google App Engine
This is Rietveld 408576698