summaryrefslogtreecommitdiff
path: root/core/fxcrt
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-26 15:14:35 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-27 19:53:13 +0000
commit6e72b2ecdb95f000dede3c80e0c32496c0b27a18 (patch)
tree36350bea8b8ee81449693f8667c62fff1cedbcea /core/fxcrt
parent827db14d7f3d0085253b686587717361ffbcad1b (diff)
downloadpdfium-6e72b2ecdb95f000dede3c80e0c32496c0b27a18.tar.xz
Remove more |new|s, part 2
Change-Id: I13b43ceafc6a35bcc1e366546a4a408ea01fe4ab Reviewed-on: https://pdfium-review.googlesource.com/4534 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt')
-rw-r--r--core/fxcrt/fx_bidi.cpp6
-rw-r--r--core/fxcrt/fx_stream.cpp4
-rw-r--r--core/fxcrt/fxcrt_posix.cpp7
-rw-r--r--core/fxcrt/fxcrt_windows.cpp7
-rw-r--r--core/fxcrt/ifxcrt_fileaccess.h2
5 files changed, 17 insertions, 9 deletions
diff --git a/core/fxcrt/fx_bidi.cpp b/core/fxcrt/fx_bidi.cpp
index 49333f6a76..25544546d3 100644
--- a/core/fxcrt/fx_bidi.cpp
+++ b/core/fxcrt/fx_bidi.cpp
@@ -5,10 +5,12 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "core/fxcrt/fx_bidi.h"
-#include "core/fxcrt/fx_ucd.h"
#include <algorithm>
+#include "core/fxcrt/fx_ucd.h"
+#include "third_party/base/ptr_util.h"
+
CFX_BidiChar::CFX_BidiChar()
: m_CurrentSegment({0, 0, NEUTRAL}), m_LastSegment({0, 0, NEUTRAL}) {}
@@ -50,7 +52,7 @@ void CFX_BidiChar::StartNewSegment(CFX_BidiChar::Direction direction) {
CFX_BidiString::CFX_BidiString(const CFX_WideString& str)
: m_Str(str),
- m_pBidiChar(new CFX_BidiChar),
+ m_pBidiChar(pdfium::MakeUnique<CFX_BidiChar>()),
m_eOverallDirection(CFX_BidiChar::LEFT) {
for (const auto& c : m_Str) {
if (m_pBidiChar->AppendChar(c))
diff --git a/core/fxcrt/fx_stream.cpp b/core/fxcrt/fx_stream.cpp
index 2c451c67b8..32b6ca3495 100644
--- a/core/fxcrt/fx_stream.cpp
+++ b/core/fxcrt/fx_stream.cpp
@@ -52,7 +52,7 @@ class CFX_CRTFileStream final : public IFX_SeekableStream {
CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename(
const char* filename,
uint32_t dwModes) {
- std::unique_ptr<IFXCRT_FileAccess> pFA(IFXCRT_FileAccess::Create());
+ std::unique_ptr<IFXCRT_FileAccess> pFA = IFXCRT_FileAccess::Create();
if (!pFA->Open(filename, dwModes))
return nullptr;
return pdfium::MakeRetain<CFX_CRTFileStream>(std::move(pFA));
@@ -62,7 +62,7 @@ CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename(
CFX_RetainPtr<IFX_SeekableStream> IFX_SeekableStream::CreateFromFilename(
const wchar_t* filename,
uint32_t dwModes) {
- std::unique_ptr<IFXCRT_FileAccess> pFA(IFXCRT_FileAccess::Create());
+ std::unique_ptr<IFXCRT_FileAccess> pFA = IFXCRT_FileAccess::Create();
if (!pFA->Open(filename, dwModes))
return nullptr;
return pdfium::MakeRetain<CFX_CRTFileStream>(std::move(pFA));
diff --git a/core/fxcrt/fxcrt_posix.cpp b/core/fxcrt/fxcrt_posix.cpp
index 562c70c23e..3afe2c32d5 100644
--- a/core/fxcrt/fxcrt_posix.cpp
+++ b/core/fxcrt/fxcrt_posix.cpp
@@ -6,15 +6,18 @@
#include "core/fxcrt/fxcrt_posix.h"
+#include <memory>
+
#include "core/fxcrt/fx_basic.h"
+#include "third_party/base/ptr_util.h"
#if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_
// static
-IFXCRT_FileAccess* IFXCRT_FileAccess::Create() {
- return new CFXCRT_FileAccess_Posix;
+std::unique_ptr<IFXCRT_FileAccess> IFXCRT_FileAccess::Create() {
+ return pdfium::MakeUnique<CFXCRT_FileAccess_Posix>();
}
void FXCRT_Posix_GetFileMode(uint32_t dwModes,
diff --git a/core/fxcrt/fxcrt_windows.cpp b/core/fxcrt/fxcrt_windows.cpp
index 638338706e..6230c74eb7 100644
--- a/core/fxcrt/fxcrt_windows.cpp
+++ b/core/fxcrt/fxcrt_windows.cpp
@@ -6,13 +6,16 @@
#include "core/fxcrt/fxcrt_windows.h"
+#include <memory>
+
#include "core/fxcrt/fx_string.h"
+#include "third_party/base/ptr_util.h"
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
// static
-IFXCRT_FileAccess* IFXCRT_FileAccess::Create() {
- return new CFXCRT_FileAccess_Win64;
+std::unique_ptr<IFXCRT_FileAccess> IFXCRT_FileAccess::Create() {
+ return pdfium::MakeUnique<CFXCRT_FileAccess_Win64>();
}
void FXCRT_Windows_GetFileMode(uint32_t dwMode,
diff --git a/core/fxcrt/ifxcrt_fileaccess.h b/core/fxcrt/ifxcrt_fileaccess.h
index 9528b3b377..340c2d1eeb 100644
--- a/core/fxcrt/ifxcrt_fileaccess.h
+++ b/core/fxcrt/ifxcrt_fileaccess.h
@@ -15,7 +15,7 @@
class IFXCRT_FileAccess {
public:
- static IFXCRT_FileAccess* Create();
+ static std::unique_ptr<IFXCRT_FileAccess> Create();
virtual ~IFXCRT_FileAccess() {}
virtual bool Open(const CFX_ByteStringC& fileName, uint32_t dwMode) = 0;