summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page/cpdf_docpagedata.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-18 16:22:41 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-18 16:22:41 -0800
commit0e606b5ecd6e45f74391f110cc1fe0cce0e80c64 (patch)
tree07c55fac710b191cf5d1d6595c63b90ca52e3cbb /core/fpdfapi/page/cpdf_docpagedata.cpp
parent430ab8363e77c48b2c2435af4d289f85e2be1b96 (diff)
downloadpdfium-0e606b5ecd6e45f74391f110cc1fe0cce0e80c64.tar.xz
Make CPDF_Dictionary use unique pointers.chromium/2926
Some changes were required to match underlying ctors as invoked by the templated methods. Many release() calls go away, a few WrapUniques() are introduced to avoid going deeper into other code. Review-Url: https://codereview.chromium.org/2510223002
Diffstat (limited to 'core/fpdfapi/page/cpdf_docpagedata.cpp')
-rw-r--r--core/fpdfapi/page/cpdf_docpagedata.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index b849bc4107..3df771070e 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -7,6 +7,7 @@
#include "core/fpdfapi/page/cpdf_docpagedata.h"
#include <algorithm>
+#include <memory>
#include <set>
#include "core/fdrm/crypto/fx_crypt.h"
@@ -21,6 +22,7 @@
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "third_party/base/stl_util.h"
@@ -176,12 +178,13 @@ CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteString& fontName,
}
CPDF_Dictionary* pDict = m_pPDFDoc->NewIndirect<CPDF_Dictionary>();
- pDict->SetNameFor("Type", "Font");
- pDict->SetNameFor("Subtype", "Type1");
- pDict->SetNameFor("BaseFont", fontName);
+ pDict->SetNewFor<CPDF_Name>("Type", "Font");
+ pDict->SetNewFor<CPDF_Name>("Subtype", "Type1");
+ pDict->SetNewFor<CPDF_Name>("BaseFont", fontName);
if (pEncoding) {
- pDict->SetFor("Encoding",
- pEncoding->Realize(m_pPDFDoc->GetByteStringPool()));
+ pDict->SetFor(
+ "Encoding",
+ pdfium::WrapUnique(pEncoding->Realize(m_pPDFDoc->GetByteStringPool())));
}
std::unique_ptr<CPDF_Font> pFont = CPDF_Font::Create(m_pPDFDoc, pDict);