Chromium Code Reviews| Index: core/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
| diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
| index e050060a9e4befcb46a0ec38ff33a5a35241334e..aa99f490884d6712604e2211ec26bea29ee452c3 100644 |
| --- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
| +++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp |
| @@ -145,14 +145,14 @@ CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict, |
| if (findOnly) |
| return nullptr; |
| - CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pFontDict); |
| + std::unique_ptr<CPDF_Font> pFont = CPDF_Font::Create(m_pPDFDoc, pFontDict); |
| if (!pFont) |
| return nullptr; |
| if (pFontData) { |
| - pFontData->reset(pFont); |
| + pFontData->reset(pFont.release()); |
|
Tom Sepez
2016/09/22 21:08:04
note: these become std::move() down the road.
|
| } else { |
| - pFontData = new CPDF_CountedFont(pFont); |
| + pFontData = new CPDF_CountedFont(pFont.release()); |
| m_FontMap[pFontDict] = pFontData; |
| } |
| return pFontData->AddRef(); |
| @@ -192,11 +192,11 @@ CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteString& fontName, |
| pDict->SetFor("Encoding", pEncoding->Realize()); |
| } |
| m_pPDFDoc->AddIndirectObject(pDict); |
| - CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pDict); |
| - if (!pFont) { |
| + std::unique_ptr<CPDF_Font> pFont = CPDF_Font::Create(m_pPDFDoc, pDict); |
| + if (!pFont) |
| return nullptr; |
| - } |
| - CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont); |
| + |
| + CPDF_CountedFont* fontData = new CPDF_CountedFont(pFont.release()); |
| m_FontMap[pDict] = fontData; |
| return fontData->AddRef(); |
| } |