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

Unified Diff: core/fpdfapi/fpdf_page/fpdf_page_doc.cpp

Issue 2364643003: Make CPDF_Font::Create() return a std::unique_ptr. (Closed)
Patch Set: Stray file Created 4 years, 3 months 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/fpdf_font/include/cpdf_font.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 77c18df5fa2dbff067d5e3e8e391e6228cf78d19..c4e2a244249716fd5d11f215384fa4d201d662b8 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();
}
« no previous file with comments | « core/fpdfapi/fpdf_font/include/cpdf_font.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698