summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-10-15 01:57:12 +0300
committerStephan Bergmann <sbergman@redhat.com>2019-10-17 09:53:42 +0200
commitd51db77c8d87f210785a8a8c6dd875f7bacddb3c (patch)
treefd1ab208d49e85371fc9bb321539ce137bdaf719 /vcl/source
parentc8eaadb5d70f42723517bb028f363e37726be256 (diff)
Remove some memset calls
Replace them with default initialization or calloc Change-Id: I747f53c2ced2d0473fd5a5ede4f8520a0633dcc1 Reviewed-on: https://gerrit.libreoffice.org/80805 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/filter/graphicfilter2.cxx3
-rw-r--r--vcl/source/font/fontmetric.cxx3
-rw-r--r--vcl/source/gdi/jobset.cxx3
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx25
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx4
5 files changed, 12 insertions, 26 deletions
diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx
index 40b5de05d7be..03e1ac228067 100644
--- a/vcl/source/filter/graphicfilter2.cxx
+++ b/vcl/source/filter/graphicfilter2.cxx
@@ -900,9 +900,8 @@ bool GraphicDescriptor::ImpDetectEPS( SvStream& rStm, bool )
{
// check the EPS preview and the file extension
sal_uInt32 nFirstLong = 0;
- sal_uInt8 nFirstBytes[20];
+ sal_uInt8 nFirstBytes[20] = {};
bool bRet = false;
- memset(nFirstBytes, 0, sizeof (nFirstBytes));
sal_Int32 nStmPos = rStm.Tell();
rStm.SetEndian( SvStreamEndian::BIG );
diff --git a/vcl/source/font/fontmetric.cxx b/vcl/source/font/fontmetric.cxx
index 4da3575d7597..2e477927a7b8 100644
--- a/vcl/source/font/fontmetric.cxx
+++ b/vcl/source/font/fontmetric.cxx
@@ -330,8 +330,7 @@ void ImplFontMetricData::ImplCalcLineSpacing(LogicalFontInstance *pFontInstance)
hb_blob_t* pHhea = hb_face_reference_table(pHbFace, HB_TAG('h', 'h', 'e', 'a'));
hb_blob_t* pOS2 = hb_face_reference_table(pHbFace, HB_TAG('O', 'S', '/', '2'));
- vcl::TTGlobalFontInfo rInfo;
- memset(&rInfo, 0, sizeof(vcl::TTGlobalFontInfo));
+ vcl::TTGlobalFontInfo rInfo = {};
GetTTFontMetrics(reinterpret_cast<const uint8_t*>(hb_blob_get_data(pHhea, nullptr)), hb_blob_get_length(pHhea),
reinterpret_cast<const uint8_t*>(hb_blob_get_data(pOS2, nullptr)), hb_blob_get_length(pOS2),
&rInfo);
diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx
index a532a6cf8132..b1ca8e3f80f7 100644
--- a/vcl/source/gdi/jobset.cxx
+++ b/vcl/source/gdi/jobset.cxx
@@ -341,8 +341,7 @@ SvStream& WriteJobSetup( SvStream& rOStream, const JobSetup& rJobSetup )
UInt32ToSVBT32( static_cast<sal_uLong>(rJobData.GetPaperWidth()), aOldJobData.nPaperWidth );
UInt32ToSVBT32( static_cast<sal_uLong>(rJobData.GetPaperHeight()), aOldJobData.nPaperHeight );
- ImplOldJobSetupData aOldData;
- memset( &aOldData, 0, sizeof( aOldData ) );
+ ImplOldJobSetupData aOldData = {};
OString aPrnByteName(OUStringToOString(rJobData.GetPrinterName(), RTL_TEXTENCODING_UTF8));
strncpy(aOldData.cPrinterName, aPrnByteName.getStr(), SAL_N_ELEMENTS(aOldData.cPrinterName) - 1);
OString aDriverByteName(OUStringToOString(rJobData.GetDriver(), RTL_TEXTENCODING_UTF8));
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index d937244532fc..52fa15422494 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -2421,8 +2421,7 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const PhysicalFo
aInfo.m_nCapHeight = 1000;
aInfo.m_aFontBBox = tools::Rectangle( Point( -200, -200 ), Size( 1700, 1700 ) );
aInfo.m_aPSName = pFont->GetFamilyName();
- sal_Int32 pWidths[256];
- memset( pWidths, 0, sizeof(pWidths) );
+ sal_Int32 pWidths[256] = {};
SalGraphics *pGraphics = GetGraphics();
@@ -2435,13 +2434,9 @@ std::map< sal_Int32, sal_Int32 > PDFWriterImpl::emitSystemFont( const PhysicalFo
OUString aTmpName;
osl_createTempFile( nullptr, nullptr, &aTmpName.pData );
- sal_GlyphId aGlyphIds[ 256 ];
- sal_uInt8 pEncoding[ 256 ];
- sal_Int32 pDuWidths[ 256 ];
-
- memset( aGlyphIds, 0, sizeof( aGlyphIds ) );
- memset( pEncoding, 0, sizeof( pEncoding ) );
- memset( pDuWidths, 0, sizeof( pDuWidths ) );
+ sal_GlyphId aGlyphIds[ 256 ] = {};
+ sal_uInt8 pEncoding[ 256 ] = {};
+ sal_Int32 pDuWidths[ 256 ] = {};
for( sal_Ucs c = 32; c < 256; c++ )
{
@@ -2761,21 +2756,17 @@ bool PDFWriterImpl::emitFonts()
{
for (auto & s_subset :subset.second.m_aSubsets)
{
- sal_GlyphId aGlyphIds[ 256 ];
+ sal_GlyphId aGlyphIds[ 256 ] = {};
sal_Int32 pWidths[ 256 ];
- sal_uInt8 pEncoding[ 256 ];
- sal_Int32 pEncToUnicodeIndex[ 256 ];
- sal_Int32 pCodeUnitsPerGlyph[ 256 ];
+ sal_uInt8 pEncoding[ 256 ] = {};
+ sal_Int32 pEncToUnicodeIndex[ 256 ] = {};
+ sal_Int32 pCodeUnitsPerGlyph[ 256 ] = {};
std::vector<sal_Ucs> aCodeUnits;
aCodeUnits.reserve( 256 );
int nGlyphs = 1;
// fill arrays and prepare encoding index map
sal_Int32 nToUnicodeStream = 0;
- memset( aGlyphIds, 0, sizeof( aGlyphIds ) );
- memset( pEncoding, 0, sizeof( pEncoding ) );
- memset( pCodeUnitsPerGlyph, 0, sizeof( pCodeUnitsPerGlyph ) );
- memset( pEncToUnicodeIndex, 0, sizeof( pEncToUnicodeIndex ) );
for (auto const& item : s_subset.m_aMapping)
{
sal_uInt8 nEnc = item.second.getGlyphId();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 8d98e21b56f1..afb464367832 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -391,9 +391,7 @@ void OpenGLContext::reset()
SystemWindowData OpenGLContext::generateWinData(vcl::Window* /*pParent*/, bool /*bRequestLegacyContext*/)
{
- SystemWindowData aWinData;
- memset(&aWinData, 0, sizeof(aWinData));
- return aWinData;
+ return {};
}
bool OpenGLContext::isCurrent()