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

Unified Diff: core/fpdfapi/font/cpdf_fontencoding.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 | « core/fpdfapi/font/cpdf_font.cpp ('k') | core/fpdfapi/page/cpdf_allstates.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/font/cpdf_fontencoding.cpp
diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp
index da607e6aa8e404acf9dc20c8a1dd7b3149a8e380..df21267e1da56eea466286c281f5522d318d9016 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;
}
« no previous file with comments | « core/fpdfapi/font/cpdf_font.cpp ('k') | core/fpdfapi/page/cpdf_allstates.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698