From d51db77c8d87f210785a8a8c6dd875f7bacddb3c Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Tue, 15 Oct 2019 01:57:12 +0300 Subject: 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 --- lotuswordpro/source/filter/lwpgrfobj.cxx | 2 -- lotuswordpro/source/filter/lwpgrfobj.hxx | 4 ++-- lotuswordpro/source/filter/lwpsdwdrawheader.hxx | 16 +++++----------- lotuswordpro/source/filter/xfilter/xfcolor.cxx | 4 +--- 4 files changed, 8 insertions(+), 18 deletions(-) (limited to 'lotuswordpro') diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx index 29339e04857e..13745c206740 100644 --- a/lotuswordpro/source/filter/lwpgrfobj.cxx +++ b/lotuswordpro/source/filter/lwpgrfobj.cxx @@ -93,8 +93,6 @@ LwpGraphicObject::LwpGraphicObject(LwpObjectHeader const &objHdr, LwpSvStream* p , m_bIsLinked(0) , m_bCompressed(0) { - memset(m_sDataFormat, 0, sizeof(m_sDataFormat)); - memset(m_sServerContextFormat, 0, sizeof(m_sServerContextFormat)); } LwpGraphicObject::~LwpGraphicObject() diff --git a/lotuswordpro/source/filter/lwpgrfobj.hxx b/lotuswordpro/source/filter/lwpgrfobj.hxx index 3332124f4ad5..0c26f1c6e062 100644 --- a/lotuswordpro/source/filter/lwpgrfobj.hxx +++ b/lotuswordpro/source/filter/lwpgrfobj.hxx @@ -94,8 +94,8 @@ public: LwpGraphicObject(LwpObjectHeader const &objHdr, LwpSvStream* pStrm); virtual ~LwpGraphicObject() override; private: - unsigned char m_sDataFormat[AFID_MAX_FILE_FORMAT_SIZE]; - unsigned char m_sServerContextFormat[AFID_MAX_CONTEXT_FORMAT_SIZE]; + unsigned char m_sDataFormat[AFID_MAX_FILE_FORMAT_SIZE] = {}; + unsigned char m_sServerContextFormat[AFID_MAX_CONTEXT_FORMAT_SIZE] = {}; sal_Int32 m_nCachedBaseLine; sal_Int16 m_bIsLinked; AFID_CACHE m_Cache; diff --git a/lotuswordpro/source/filter/lwpsdwdrawheader.hxx b/lotuswordpro/source/filter/lwpsdwdrawheader.hxx index c1c13a15f603..36ab257c256e 100644 --- a/lotuswordpro/source/filter/lwpsdwdrawheader.hxx +++ b/lotuswordpro/source/filter/lwpsdwdrawheader.hxx @@ -180,20 +180,14 @@ struct SdwColor struct SdwClosedObjStyleRec { - sal_uInt8 nLineWidth; - sal_uInt8 nLineStyle; + sal_uInt8 nLineWidth = 0; + sal_uInt8 nLineStyle = 0; SdwColor aPenColor; SdwColor aForeColor; SdwColor aBackColor; - sal_uInt16 nFillType; - sal_uInt8 pFillPattern[8]; - SdwClosedObjStyleRec() - : nLineWidth(0) - , nLineStyle(0) - , nFillType(0) - { - memset(pFillPattern, 0, sizeof(pFillPattern)); - } + sal_uInt16 nFillType = 0; + sal_uInt8 pFillPattern[8] = {}; + SdwClosedObjStyleRec() = default; }; struct SdwDrawObjHeader diff --git a/lotuswordpro/source/filter/xfilter/xfcolor.cxx b/lotuswordpro/source/filter/xfilter/xfcolor.cxx index dc96c73851b9..357e659fbeae 100644 --- a/lotuswordpro/source/filter/xfilter/xfcolor.cxx +++ b/lotuswordpro/source/filter/xfilter/xfcolor.cxx @@ -63,9 +63,7 @@ OUString XFColor::ToString() const { - char buf[8]; - - memset(buf, 0, 8); + char buf[8] = {}; sprintf(buf,"#%2x%2x%2x",m_nRed, m_nGreen, m_nBlue); for( int i=1; i<7;i++ ) { -- cgit