summaryrefslogtreecommitdiff
path: root/core/fpdfapi/font/cpdf_fontencoding.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/font/cpdf_fontencoding.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/font/cpdf_fontencoding.cpp')
-rw-r--r--core/fpdfapi/font/cpdf_fontencoding.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp
index da607e6aa8..df21267e1d 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.cpp
+++ b/core/fpdfapi/font/cpdf_fontencoding.cpp
@@ -6,6 +6,8 @@
#include "core/fpdfapi/font/cpdf_fontencoding.h"
+#include <utility>
+
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_name.h"
@@ -1701,7 +1703,7 @@ CPDF_Object* CPDF_FontEncoding::Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool) {
}
const uint16_t* pStandard =
PDF_UnicodesForPredefinedCharSet(PDFFONT_ENCODING_WINANSI);
- CPDF_Array* pDiff = new CPDF_Array;
+ auto pDiff = pdfium::MakeUnique<CPDF_Array>();
for (int i = 0; i < 256; i++) {
if (pStandard[i] == m_Unicodes[i])
continue;
@@ -1711,8 +1713,8 @@ CPDF_Object* CPDF_FontEncoding::Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool) {
}
CPDF_Dictionary* pDict = new CPDF_Dictionary(pPool);
- pDict->SetNameFor("BaseEncoding", "WinAnsiEncoding");
- pDict->SetFor("Differences", pDiff);
+ pDict->SetNewFor<CPDF_Name>("BaseEncoding", "WinAnsiEncoding");
+ pDict->SetFor("Differences", std::move(pDiff));
return pDict;
}