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

Unified Diff: core/fpdfapi/font/cpdf_cidfont.cpp

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase Created 4 years 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/edit/fpdf_edit_create.cpp ('k') | core/fpdfapi/font/cpdf_font.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/font/cpdf_cidfont.cpp
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index 0217391c12a8544c2d7d41908da9205a17450bc7..91df025e0ff2732654e8d994c1ef3c6b20dd50b6 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -19,6 +19,7 @@
#include "core/fpdfapi/parser/cpdf_dictionary.h"
#include "core/fpdfapi/parser/cpdf_stream_acc.h"
#include "third_party/base/numerics/safe_math.h"
+#include "third_party/base/ptr_util.h"
namespace {
@@ -398,7 +399,7 @@ bool CPDF_CIDFont::Load() {
CPDF_Object* pmap = pCIDFontDict->GetDirectObjectFor("CIDToGIDMap");
if (pmap) {
if (CPDF_Stream* pStream = pmap->AsStream()) {
- m_pStreamAcc.reset(new CPDF_StreamAcc);
+ m_pStreamAcc = pdfium::MakeUnique<CPDF_StreamAcc>();
m_pStreamAcc->LoadAllData(pStream, false);
} else if (pmap->GetString() == "Identity") {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
@@ -581,7 +582,7 @@ int CPDF_CIDFont::GetGlyphIndex(uint32_t unicode, bool* pVertGlyph) {
if (error || !m_Font.GetSubData())
return index;
- m_pTTGSUBTable.reset(new CFX_CTTGSUBTable);
+ m_pTTGSUBTable = pdfium::MakeUnique<CFX_CTTGSUBTable>();
m_pTTGSUBTable->LoadGSUBTable((FT_Bytes)m_Font.GetSubData());
return GetVerticalGlyph(index, pVertGlyph);
}
« no previous file with comments | « core/fpdfapi/edit/fpdf_edit_create.cpp ('k') | core/fpdfapi/font/cpdf_font.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698