diff options
author | tsepez <tsepez@chromium.org> | 2016-12-14 05:57:10 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-12-14 05:57:10 -0800 |
commit | a9caab94c1f16929e5acf2676117224617d80f53 (patch) | |
tree | d71ff9a82fae6e6080deb76375f43056127b3ee2 /core/fpdfapi/font/cpdf_font.cpp | |
parent | 992ecf7c189e5cabf43e5ad862511cf63d030966 (diff) | |
download | pdfium-a9caab94c1f16929e5acf2676117224617d80f53.tar.xz |
Avoid the ptr.reset(new XXX()) anti-pattern
Be suspicious of |new|. This removes some of the
easy cases.
Review-Url: https://codereview.chromium.org/2571913002
Diffstat (limited to 'core/fpdfapi/font/cpdf_font.cpp')
-rw-r--r-- | core/fpdfapi/font/cpdf_font.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp index 0b76ceedff..5563202455 100644 --- a/core/fpdfapi/font/cpdf_font.cpp +++ b/core/fpdfapi/font/cpdf_font.cpp @@ -279,7 +279,7 @@ void CPDF_Font::LoadUnicodeMap() const { if (!pStream) { return; } - m_pToUnicodeMap.reset(new CPDF_ToUnicodeMap); + m_pToUnicodeMap = pdfium::MakeUnique<CPDF_ToUnicodeMap>(); m_pToUnicodeMap->Load(pStream); } @@ -324,18 +324,18 @@ std::unique_ptr<CPDF_Font> CPDF_Font::Create(CPDF_Document* pDoc, if (tag == CFX_ByteString(kChineseFontNames[i], 4)) { CPDF_Dictionary* pFontDesc = pFontDict->GetDictFor("FontDescriptor"); if (!pFontDesc || !pFontDesc->KeyExist("FontFile2")) - pFont.reset(new CPDF_CIDFont); + pFont = pdfium::MakeUnique<CPDF_CIDFont>(); break; } } if (!pFont) - pFont.reset(new CPDF_TrueTypeFont); + pFont = pdfium::MakeUnique<CPDF_TrueTypeFont>(); } else if (type == "Type3") { - pFont.reset(new CPDF_Type3Font); + pFont = pdfium::MakeUnique<CPDF_Type3Font>(); } else if (type == "Type0") { - pFont.reset(new CPDF_CIDFont); + pFont = pdfium::MakeUnique<CPDF_CIDFont>(); } else { - pFont.reset(new CPDF_Type1Font); + pFont = pdfium::MakeUnique<CPDF_Type1Font>(); } pFont->m_pFontDict = pFontDict; pFont->m_pDocument = pDoc; |