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

Unified Diff: fpdfsdk/javascript/Document.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: rebase Created 4 years, 1 month 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
« no previous file with comments | « fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp ('k') | testing/libfuzzer/pdf_hint_table_fuzzer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/javascript/Document.cpp
diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp
index 54761a2647f4e605f0099b8c1165767a7f107bf6..29f97648063381c2609b8c447336af2674bba997 100644
--- a/fpdfsdk/javascript/Document.cpp
+++ b/fpdfsdk/javascript/Document.cpp
@@ -13,6 +13,7 @@
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fpdfapi/parser/cpdf_string.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fpdfdoc/cpdf_interform.h"
#include "core/fpdfdoc/cpdf_nametree.h"
@@ -809,7 +810,7 @@ bool Document::info(IJS_Context* cc,
// It's to be compatible to non-standard info dictionary.
for (const auto& it : *pDictionary) {
const CFX_ByteString& bsKey = it.first;
- CPDF_Object* pValueObj = it.second;
+ CPDF_Object* pValueObj = it.second.get();
CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey.AsStringC());
if (pValueObj->IsString() || pValueObj->IsName()) {
pRuntime->PutObjectString(pObj, wsKey, pValueObj->GetUnicodeText());
@@ -844,7 +845,8 @@ bool Document::getPropertyInternal(IJS_Context* cc,
}
CFX_WideString csProperty;
vp >> csProperty;
- pDictionary->SetStringFor(propName, PDF_EncodeText(csProperty));
+ pDictionary->SetNewFor<CPDF_String>(propName, PDF_EncodeText(csProperty),
+ false);
m_pFormFillEnv->SetChangeMark();
}
return true;
« no previous file with comments | « fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp ('k') | testing/libfuzzer/pdf_hint_table_fuzzer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698