[Libreoffice-commits] core.git: 2 commits - chart2/uiconfig vcl/inc vcl/source
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 24 19:37:32 UTC 2021
chart2/uiconfig/ui/tp_Trendline.ui | 25 ++++++-------------------
vcl/inc/sft.hxx | 4 ++--
vcl/source/fontsubset/sft.cxx | 12 ++++++------
3 files changed, 14 insertions(+), 27 deletions(-)
New commits:
commit 6c13e5a92ed4b6a10458cd5d5741ddb3d816df4e
Author: Noel <noel.grandin at collabora.co.uk>
AuthorDate: Tue Mar 23 12:17:16 2021 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Wed Mar 24 20:36:35 2021 +0100
convert m_pFileName to std::string
which simplifies the code and fixes a problem with using
strdup(), because strdup() allocates with malloc, while
unique_ptr will free it with delete[], and we'll get
a mismatch error from ASAN
(spotted by Mike Kaganski)
Change-Id: I0f21828ef3482898b81aa3f0745b2bd855a2c286
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112980
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx
index 877b94713a8f..fb43e51a174a 100644
--- a/vcl/inc/sft.hxx
+++ b/vcl/inc/sft.hxx
@@ -720,7 +720,7 @@ constexpr int NUM_TAGS = 17;
class VCL_DLLPUBLIC AbstractTrueTypeFont
{
- std::unique_ptr<char[]> m_pFileName;
+ std::string m_sFileName;
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.get(); }
+ std::string const & fileName() const { return m_sFileName; }
sal_uInt32 glyphCount() const { return m_nGlyphs; }
sal_uInt32 glyphOffset(sal_uInt32 glyphID) const;
sal_uInt32 horzMetricCount() const { return m_nHorzMetrics; }
diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx
index 5208b46adb28..fe0f0ef1562a 100644
--- a/vcl/source/fontsubset/sft.cxx
+++ b/vcl/source/fontsubset/sft.cxx
@@ -925,9 +925,9 @@ static void GetNames(TrueTypeFont *t)
}
if ( ! t->psname )
{
- if (t->fileName())
+ if (!t->fileName().empty())
{
- const char* pReverse = t->fileName() + strlen(t->fileName());
+ const char* pReverse = t->fileName().data() + t->fileName().length();
/* take only last token of filename */
while (pReverse != t->fileName() && *pReverse != '/') pReverse--;
if(*pReverse == '/') pReverse++;
@@ -1034,7 +1034,7 @@ SFErrCodes OpenTTFontFile(const char* fname, sal_uInt32 facenum, TrueTypeFont**
if( ! *ttf )
return SFErrCodes::Memory;
- if( ! (*ttf)->fileName() )
+ if( (*ttf)->fileName().empty() )
{
ret = SFErrCodes::Memory;
goto cleanup;
@@ -1121,7 +1121,7 @@ AbstractTrueTypeFont::AbstractTrueTypeFont(const char* pFileName, const FontChar
, m_xCharMap(xCharMap)
{
if (pFileName)
- m_pFileName.reset(strdup(pFileName));
+ m_sFileName = pFileName;
}
AbstractTrueTypeFont::~AbstractTrueTypeFont()
@@ -1144,7 +1144,7 @@ TrueTypeFont::TrueTypeFont(const char* pFileName, const FontCharMapRef xCharMap)
TrueTypeFont::~TrueTypeFont()
{
#if !defined(_WIN32)
- if (fileName())
+ if (!fileName().empty())
munmap(ptr, fsize);
#endif
free(psname);
@@ -1897,7 +1897,7 @@ SFErrCodes CreateT42FromTTGlyphs(TrueTypeFont *ttf,
fprintf(outf, "%%!PS-TrueTypeFont-%d.%d-%d.%d\n", static_cast<int>(ver), static_cast<int>(ver & 0xFF), static_cast<int>(rev>>16), static_cast<int>(rev & 0xFFFF));
fprintf(outf, "%%%%Creator: %s %s %s\n", modname, modver, modextra);
- fprintf(outf, "%%- Font subset generated from a source font file: '%s'\n", ttf->fileName());
+ fprintf(outf, "%%- Font subset generated from a source font file: '%s'\n", ttf->fileName().data());
fprintf(outf, "%%- Original font name: %s\n", ttf->psname);
fprintf(outf, "%%- Original font family: %s\n", ttf->family);
fprintf(outf, "%%- Original font sub-family: %s\n", ttf->subfamily);
commit 4f28ca3e16de71e279fc54cd4a95e8181479c263
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Mar 23 10:12:15 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Mar 24 20:36:24 2021 +0100
tdf#141191 use plain GtkComboBoxText for standard case
Change-Id: I0afa3c59737eb44a8775f2958ebf2fc813b23af9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112979
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/chart2/uiconfig/ui/tp_Trendline.ui b/chart2/uiconfig/ui/tp_Trendline.ui
index 9b16231f7b46..af630ba12137 100644
--- a/chart2/uiconfig/ui/tp_Trendline.ui
+++ b/chart2/uiconfig/ui/tp_Trendline.ui
@@ -332,10 +332,14 @@
</packing>
</child>
<child>
- <object class="GtkComboBox" id="combo_moving_type">
+ <object class="GtkComboBoxText" id="combo_moving_type">
<property name="visible">True</property>
<property name="can-focus">False</property>
- <property name="model">liststore_moving_type</property>
+ <items>
+ <item translatable="yes" context="tp_Trendline|liststore_moving_type">Prior</item>
+ <item translatable="yes" context="tp_Trendline|liststore_moving_type">Central</item>
+ <item translatable="yes" context="tp_Trendline|liststore_moving_type">Averaged Abscissa</item>
+ </items>
</object>
<packing>
<property name="left-attach">2</property>
@@ -698,21 +702,4 @@
<property name="step-increment">1</property>
<property name="page-increment">10</property>
</object>
- <object class="GtkListStore" id="liststore_moving_type">
- <columns>
- <!-- column-name moving_type -->
- <column type="gchararray"/>
- </columns>
- <data>
- <row>
- <col id="0" translatable="yes" context="tp_Trendline|liststore_moving_type">Prior</col>
- </row>
- <row>
- <col id="0" translatable="yes" context="tp_Trendline|liststore_moving_type">Central</col>
- </row>
- <row>
- <col id="0" translatable="yes" context="tp_Trendline|liststore_moving_type">Averaged Abscissa</col>
- </row>
- </data>
- </object>
</interface>
More information about the Libreoffice-commits
mailing list