use unique_ptr in AbstractTrueTypeFont
Change-Id: I57dcc1a247e01f1a31fcadc7f998833af42a0466 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112932 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
parent
140192fd5a
commit
109420d420
2 changed files with 4 additions and 6 deletions
|
@ -720,7 +720,7 @@ constexpr int NUM_TAGS = 17;
|
|||
|
||||
class VCL_DLLPUBLIC AbstractTrueTypeFont
|
||||
{
|
||||
char* m_pFileName;
|
||||
std::unique_ptr<char[]> m_pFileName;
|
||||
sal_uInt32 m_nGlyphs;
|
||||
sal_uInt32 m_nHorzMetrics;
|
||||
sal_uInt32 m_nVertMetrics; /* if not 0 => font has vertical metrics information */
|
||||
|
@ -735,7 +735,7 @@ public:
|
|||
AbstractTrueTypeFont(const char* fileName = nullptr, const FontCharMapRef xCharMap = nullptr);
|
||||
virtual ~AbstractTrueTypeFont();
|
||||
|
||||
const char* fileName() const { return m_pFileName; }
|
||||
const char* fileName() const { return m_pFileName.get(); }
|
||||
sal_uInt32 glyphCount() const { return m_nGlyphs; }
|
||||
sal_uInt32 glyphOffset(sal_uInt32 glyphID) const;
|
||||
sal_uInt32 horzMetricCount() const { return m_nHorzMetrics; }
|
||||
|
|
|
@ -1114,20 +1114,18 @@ bool withinBounds(sal_uInt32 tdoffset, sal_uInt32 moreoffset, sal_uInt32 len, sa
|
|||
}
|
||||
|
||||
AbstractTrueTypeFont::AbstractTrueTypeFont(const char* pFileName, const FontCharMapRef xCharMap)
|
||||
: m_pFileName(nullptr)
|
||||
, m_nGlyphs(0xFFFFFFFF)
|
||||
: m_nGlyphs(0xFFFFFFFF)
|
||||
, m_nHorzMetrics(0)
|
||||
, m_nVertMetrics(0)
|
||||
, m_nUnitsPerEm(0)
|
||||
, m_xCharMap(xCharMap)
|
||||
{
|
||||
if (pFileName)
|
||||
m_pFileName = strdup(pFileName);
|
||||
m_pFileName.reset(strdup(pFileName));
|
||||
}
|
||||
|
||||
AbstractTrueTypeFont::~AbstractTrueTypeFont()
|
||||
{
|
||||
free(m_pFileName);
|
||||
}
|
||||
|
||||
TrueTypeFont::TrueTypeFont(const char* pFileName, const FontCharMapRef xCharMap)
|
||||
|
|
Loading…
Reference in a new issue