summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-09-23 07:26:29 -0700
committerCommit bot <commit-bot@chromium.org>2016-09-23 07:26:29 -0700
commit3f4111fbff1233de9f5c67eda433bee0f5f88c4e (patch)
tree5cb30b258413915f8b800c871d235c123df1ad95 /core/fpdfapi/fpdf_page
parent917d24852841f4919f418076c0277d2742f961ca (diff)
downloadpdfium-3f4111fbff1233de9f5c67eda433bee0f5f88c4e.tar.xz
Make CPDF_Font::Create() return a std::unique_ptr.
Review-Url: https://codereview.chromium.org/2364643003
Diffstat (limited to 'core/fpdfapi/fpdf_page')
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_doc.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 77c18df5fa..c4e2a24424 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());
} 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();
}