Kaydet (Commit) 9467f10d authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:useuniqueptr in FreetypeManager

Change-Id: Idf8f843f2740bc20e6b0877b62dbfc778e31acd8
Reviewed-on: https://gerrit.libreoffice.org/59018
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 40ab9800
......@@ -100,7 +100,7 @@ public:
FreetypeFont* CreateFont( const FontSelectPattern& );
private:
typedef std::unordered_map<sal_IntPtr,FreetypeFontInfo*> FontList;
typedef std::unordered_map<sal_IntPtr, std::unique_ptr<FreetypeFontInfo>> FontList;
FontList maFontList;
sal_IntPtr mnMaxFontId;
......
......@@ -308,7 +308,7 @@ void FreetypeManager::AddFontFile( const OString& rNormalizedName,
FreetypeFontInfo* pFontInfo = new FreetypeFontInfo( rDevFontAttr,
rNormalizedName, nFaceNum, nFontId);
maFontList[ nFontId ] = pFontInfo;
maFontList[ nFontId ].reset(pFontInfo);
if( mnMaxFontId < nFontId )
mnMaxFontId = nFontId;
}
......@@ -317,18 +317,13 @@ void FreetypeManager::AnnounceFonts( PhysicalFontCollection* pToAdd ) const
{
for (auto const& font : maFontList)
{
FreetypeFontInfo* pFreetypeFontInfo = font.second;
FreetypeFontInfo* pFreetypeFontInfo = font.second.get();
pFreetypeFontInfo->AnnounceFont( pToAdd );
}
}
void FreetypeManager::ClearFontList( )
{
for (auto const& font : maFontList)
{
FreetypeFontInfo* pFreetypeFontInfo = font.second;
delete pFreetypeFontInfo;
}
maFontList.clear();
}
......@@ -344,7 +339,7 @@ FreetypeFont* FreetypeManager::CreateFont( const FontSelectPattern& rFSD )
sal_IntPtr nFontId = pFontFace->GetFontId();
FontList::iterator it = maFontList.find(nFontId);
FreetypeFontInfo* pFontInfo = it != maFontList.end() ? it->second : nullptr;
FreetypeFontInfo* pFontInfo = it != maFontList.end() ? it->second.get() : nullptr;
if (!pFontInfo)
return nullptr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment