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 --- comphelper/source/misc/docpasswordhelper.cxx | 6 ++---- comphelper/source/misc/syntaxhighlight.cxx | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'comphelper') diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index 7bae3a77aaf0..cf665dd6c147 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -331,8 +331,7 @@ OUString DocPasswordHelper::GetOoxHashAsBase64( uno::Sequence< sal_Int8 > aResultKey; if ( !aPassword.isEmpty() && aDocId.getLength() == 16 ) { - sal_uInt16 pPassData[16]; - memset( pPassData, 0, sizeof(pPassData) ); + sal_uInt16 pPassData[16] = {}; sal_Int32 nPassLen = std::min< sal_Int32 >( aPassword.getLength(), 15 ); memcpy( pPassData, aPassword.getStr(), nPassLen * sizeof(pPassData[0]) ); @@ -360,8 +359,7 @@ OUString DocPasswordHelper::GetOoxHashAsBase64( uno::Sequence< sal_Int8 > aResultKey; if ( pPassData[0] ) { - sal_uInt8 pKeyData[64]; - memset( pKeyData, 0, sizeof(pKeyData) ); + sal_uInt8 pKeyData[64] = {}; sal_Int32 nInd = 0; diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx index 3fb5bc057094..b3f62a70365b 100644 --- a/comphelper/source/misc/syntaxhighlight.cxx +++ b/comphelper/source/misc/syntaxhighlight.cxx @@ -268,7 +268,7 @@ namespace class SyntaxHighlighter::Tokenizer { // Character information tables - CharFlags aCharTypeTab[256]; + CharFlags aCharTypeTab[256] = {}; // Auxiliary function: testing of the character flags bool testCharFlags(sal_Unicode c, CharFlags nTestFlags) const; @@ -590,8 +590,6 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/ SyntaxHighlighter::Tokenizer::Tokenizer( HighlighterLanguage aLang ): aLanguage(aLang) { - memset( aCharTypeTab, 0, sizeof( aCharTypeTab ) ); - // Fill character table sal_uInt16 i; -- cgit