summaryrefslogtreecommitdiff
path: root/core/fxge/apple
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-05-16 15:33:20 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-05-16 23:26:47 +0000
commitfe91c6c8211cec39f871d9202556e1957bf81983 (patch)
treeb7e763f7affe4c71de67393fbd320c1fed477e0f /core/fxge/apple
parent365333552cf67b7c97c4093177e7ed7b43f540ab (diff)
downloadpdfium-fe91c6c8211cec39f871d9202556e1957bf81983.tar.xz
Be skeptical of bare |new|s.
In particular, prefer an explicit .release() call when handing ownership of an object to a caller across a C-API. Change-Id: Ic3784e9d0b2d378a08d388989eaea7c9166bacd1 Reviewed-on: https://pdfium-review.googlesource.com/5470 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fxge/apple')
-rw-r--r--core/fxge/apple/fx_mac_imp.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp
index 0b32083126..ced08d2776 100644
--- a/core/fxge/apple/fx_mac_imp.cpp
+++ b/core/fxge/apple/fx_mac_imp.cpp
@@ -5,12 +5,14 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include <memory>
+#include <utility>
#include "core/fxcrt/fx_codepage.h"
#include "core/fxge/apple/apple_int.h"
#include "core/fxge/cfx_gemodule.h"
#include "core/fxge/ge/cfx_folderfontinfo.h"
#include "core/fxge/ifx_systemfontinfo.h"
+#include "third_party/base/ptr_util.h"
namespace {
@@ -122,11 +124,11 @@ void* CFX_MacFontInfo::MapFont(int weight,
std::unique_ptr<IFX_SystemFontInfo> IFX_SystemFontInfo::CreateDefault(
const char** pUnused) {
- CFX_MacFontInfo* pInfo(new CFX_MacFontInfo);
+ auto pInfo = pdfium::MakeUnique<CFX_MacFontInfo>();
pInfo->AddPath("~/Library/Fonts");
pInfo->AddPath("/Library/Fonts");
pInfo->AddPath("/System/Library/Fonts");
- return std::unique_ptr<CFX_MacFontInfo>(pInfo);
+ return std::move(pInfo);
}
void CFX_GEModule::InitPlatform() {