diff options
author | tsepez <tsepez@chromium.org> | 2017-01-19 06:56:13 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2017-01-19 06:56:13 -0800 |
commit | dd533baad22f5143c093b98e98463a0dc62899ea (patch) | |
tree | e5704fa1f4a8e08109d7d42d10b77a2eb8826e35 /core/fpdfapi/font/cpdf_cidfont.cpp | |
parent | e6cf01356e3336dc4f0717a391d9067693a418c1 (diff) | |
download | pdfium-dd533baad22f5143c093b98e98463a0dc62899ea.tar.xz |
use unique_ptr in fpdf_font_cid.cpp
Also return CFX_MaybeOwned<> from functions so to make cleanup automatic,
avoiding a theoretical leak.
Review-Url: https://codereview.chromium.org/2641853004
Diffstat (limited to 'core/fpdfapi/font/cpdf_cidfont.cpp')
-rw-r--r-- | core/fpdfapi/font/cpdf_cidfont.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp index c6c6992562..e96f824bd5 100644 --- a/core/fpdfapi/font/cpdf_cidfont.cpp +++ b/core/fpdfapi/font/cpdf_cidfont.cpp @@ -200,8 +200,7 @@ bool IsMetricForCID(const uint32_t* pEntry, uint16_t CID) { } // namespace CPDF_CIDFont::CPDF_CIDFont() - : m_pCMap(nullptr), - m_pCID2UnicodeMap(nullptr), + : m_pCID2UnicodeMap(nullptr), m_bCIDIsGID(false), m_bAnsiWidthsFixed(false), m_bAdobeCourierStd(false) { @@ -360,8 +359,7 @@ bool CPDF_CIDFont::Load() { if (!m_pCMap) return false; } else if (CPDF_Stream* pStream = pEncoding->AsStream()) { - m_pCMap = new CPDF_CMap; - m_pAllocatedCMap.reset(m_pCMap); + m_pCMap = pdfium::MakeUnique<CPDF_CMap>(); CPDF_StreamAcc acc; acc.LoadAllData(pStream, false); m_pCMap->LoadEmbedded(acc.GetData(), acc.GetSize()); |