diff options
92 files changed, 166 insertions, 368 deletions
diff --git a/bridges/inc/cppinterfaceproxy.hxx b/bridges/inc/cppinterfaceproxy.hxx index f4966d5a2eae..4755ea90bced 100644 --- a/bridges/inc/cppinterfaceproxy.hxx +++ b/bridges/inc/cppinterfaceproxy.hxx @@ -95,7 +95,7 @@ private: typelib_InterfaceTypeDescription * pTypeDescr; OUString oid; - VtableFactory::Slot * vtables[1]; + VtableFactory::Slot * vtables[1] = {}; friend void freeCppInterfaceProxy( uno_ExtEnvironment * pEnv, void * pInterface); diff --git a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx index bb5f268179a7..422b6893b3a2 100644 --- a/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx +++ b/bridges/source/cpp_uno/shared/cppinterfaceproxy.cxx @@ -149,7 +149,6 @@ CppInterfaceProxy::CppInterfaceProxy( , pTypeDescr( pTypeDescr_ ) , oid( rOId_ ) { - memset(vtables, 0, sizeof(vtables)); pBridge->acquire(); ::typelib_typedescription_acquire( &pTypeDescr->aBase ); (*pUnoI->acquire)( pUnoI ); 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; diff --git a/connectivity/source/drivers/dbase/DIndex.cxx b/connectivity/source/drivers/dbase/DIndex.cxx index 2626830cb4f7..5e4afbc94eb8 100644 --- a/connectivity/source/drivers/dbase/DIndex.cxx +++ b/connectivity/source/drivers/dbase/DIndex.cxx @@ -64,7 +64,6 @@ ODbaseIndex::ODbaseIndex(ODbaseTable* _pTable) , m_pTable(_pTable) , m_bUseCollector(false) { - memset(&m_aHeader, 0, sizeof(m_aHeader)); construct(); } diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index c6c6626a4965..ffd4eb2ab30f 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -437,7 +437,6 @@ ODbaseTable::ODbaseTable(sdbcx::OCollection* _pTables, ODbaseConnection* _pConne : ODbaseTable_BASE(_pTables,_pConnection) { // initialize the header - memset(&m_aHeader, 0, sizeof(m_aHeader)); m_aHeader.type = dBaseIII; m_eEncoding = getConnection()->getTextEncoding(); } @@ -454,7 +453,6 @@ ODbaseTable::ODbaseTable(sdbcx::OCollection* _pTables, ODbaseConnection* _pConne SchemaName, CatalogName) { - memset(&m_aHeader, 0, sizeof(m_aHeader)); m_eEncoding = getConnection()->getTextEncoding(); } @@ -1171,8 +1169,7 @@ bool ODbaseTable::CreateFile(const INetURLObject& aFile, bool& bCreateMemo) throw; } - char aBuffer[21]; // write buffer - memset(aBuffer,0,sizeof(aBuffer)); + char aBuffer[21] = {}; // write buffer m_pFileStream->Seek(0); (*m_pFileStream).WriteUChar( nDbaseType ); // dBase format diff --git a/connectivity/source/drivers/dbase/dindexnode.cxx b/connectivity/source/drivers/dbase/dindexnode.cxx index 10231a835ff9..251563e4d1d5 100644 --- a/connectivity/source/drivers/dbase/dindexnode.cxx +++ b/connectivity/source/drivers/dbase/dindexnode.cxx @@ -698,8 +698,7 @@ void ONDXNode::Write(SvStream &rStream, const ONDXPage& rPage) const } if (aKey.getValue().isNull()) { - sal_uInt8 buf[sizeof(double)]; - memset(&buf[0], 0, sizeof(double)); + sal_uInt8 buf[sizeof(double)] = {}; rStream.WriteBytes(&buf[0], sizeof(double)); } else @@ -890,8 +889,7 @@ SvStream& connectivity::dbase::WriteONDXPage(SvStream &rStream, const ONDXPage& rStream.SetStreamSize(nSize); rStream.Seek(rPage.GetPagePos() * DINDEX_PAGE_SIZE); - char aEmptyData[DINDEX_PAGE_SIZE]; - memset(aEmptyData,0x00,DINDEX_PAGE_SIZE); + char aEmptyData[DINDEX_PAGE_SIZE] = {}; rStream.WriteBytes(aEmptyData, DINDEX_PAGE_SIZE); } rStream.Seek(rPage.GetPagePos() * DINDEX_PAGE_SIZE); diff --git a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx index 08da8640178d..e9082dfa05e9 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_preparedstatement.cxx @@ -65,9 +65,7 @@ OPreparedStatement::OPreparedStatement(OConnection* _pConnection, MYSQL_STMT* pS m_bindMetas.reserve(m_paramCount); for (unsigned i = 0; i < m_paramCount; ++i) { - MYSQL_BIND bind; - memset(&bind, 0, sizeof(MYSQL_BIND)); - m_binds.push_back(bind); + m_binds.push_back(MYSQL_BIND{}); m_bindMetas.push_back(BindMetaData{}); m_binds.back().is_null = &m_bindMetas.back().is_null; m_binds.back().length = &m_bindMetas.back().length; @@ -287,8 +285,7 @@ void SAL_CALL OPreparedStatement::setTimestamp(sal_Int32 parameter, const DateTi checkDisposed(OPreparedStatement::rBHelper.bDisposed); checkParameterIndex(parameter); - MYSQL_TIME my_time; - memset(&my_time, 0, sizeof(MYSQL_TIME)); + MYSQL_TIME my_time = {}; my_time.hour = aVal.Hours; my_time.minute = aVal.Minutes; diff --git a/connectivity/source/drivers/odbc/OConnection.cxx b/connectivity/source/drivers/odbc/OConnection.cxx index 589697f7ff72..4017a0c66041 100644 --- a/connectivity/source/drivers/odbc/OConnection.cxx +++ b/connectivity/source/drivers/odbc/OConnection.cxx @@ -92,11 +92,9 @@ SQLRETURN OConnection::OpenConnection(const OUString& aConnectStr, sal_Int32 nTi return -1; SQLRETURN nSQLRETURN = 0; - SDB_ODBC_CHAR szConnStrOut[4096]; - SDB_ODBC_CHAR szConnStrIn[2048]; + SDB_ODBC_CHAR szConnStrOut[4096] = {}; + SDB_ODBC_CHAR szConnStrIn[2048] = {}; SQLSMALLINT cbConnStrOut; - memset(szConnStrOut,'\0',4096); - memset(szConnStrIn,'\0',2048); OString aConStr(OUStringToOString(aConnectStr,getTextEncoding())); memcpy(szConnStrIn, aConStr.getStr(), std::min<sal_Int32>(sal_Int32(2048),aConStr.getLength())); diff --git a/connectivity/source/inc/dbase/DIndex.hxx b/connectivity/source/inc/dbase/DIndex.hxx index ce2a3c594998..2132f7807e1c 100644 --- a/connectivity/source/inc/dbase/DIndex.hxx +++ b/connectivity/source/inc/dbase/DIndex.hxx @@ -69,7 +69,7 @@ namespace connectivity private: std::unique_ptr<SvStream> m_pFileStream; // Stream to read/write the index - NDXHeader m_aHeader; + NDXHeader m_aHeader = {}; std::vector<ONDXPage*> m_aCollector; // Pool of obsolete pages ONDXPagePtr m_aRoot, // Root of the B+ tree diff --git a/connectivity/source/inc/dbase/DTable.hxx b/connectivity/source/inc/dbase/DTable.hxx index 7551dd01b527..f2897c19223a 100644 --- a/connectivity/source/inc/dbase/DTable.hxx +++ b/connectivity/source/inc/dbase/DTable.hxx @@ -105,7 +105,7 @@ namespace connectivity std::vector<sal_Int32> m_aPrecisions; // same as above std::vector<sal_Int32> m_aScales; std::vector<sal_Int32> m_aRealFieldLengths; - DBFHeader m_aHeader; + DBFHeader m_aHeader = {}; DBFMemoHeader m_aMemoHeader; std::unique_ptr<SvStream> m_pMemoStream; rtl_TextEncoding m_eEncoding; diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx index b5c4bd00dc9e..8eba66953a5d 100644 --- a/embeddedobj/source/msole/xdialogcreator.cxx +++ b/embeddedobj/source/msole/xdialogcreator.cxx @@ -150,12 +150,10 @@ embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDia InitializedOleGuard aGuard; - OLEUIINSERTOBJECT io; + OLEUIINSERTOBJECT io = {}; char szFile[MAX_PATH]; UINT uTemp; - memset(&io, 0, sizeof(io)); - io.cbStruct = sizeof(io); io.hWndOwner = GetActiveWindow(); diff --git a/embedserv/source/embed/docholder.cxx b/embedserv/source/embed/docholder.cxx index 1f1f619cd302..96659ca754fb 100644 --- a/embedserv/source/embed/docholder.cxx +++ b/embedserv/source/embed/docholder.cxx @@ -509,8 +509,7 @@ static void CopyToOLEMenu(HMENU hOrig,WORD origPos,HMENU hDest,WORD destPos) InsertMenuW(hDest,destPos,MF_BYPOSITION | MF_POPUP, reinterpret_cast<UINT_PTR>(subMenu),buffer); - MENUITEMINFOW mi; - memset(&mi,0,sizeof(mi)); + MENUITEMINFOW mi = {}; mi.cbSize = sizeof(mi); mi.fMask = MIIM_DATA; if(GetMenuItemInfoW(hOrig,origPos,TRUE,&mi)) @@ -1140,8 +1139,7 @@ HRESULT DocumentHolder::GetExtent( SIZEL *pSize ) HRESULT DocumentHolder::SetContRects(LPCRECT aRect) { if(m_xContainerWindow.is()) { - RECT wi; - memset(&wi,0,sizeof(wi)); + RECT wi = {}; if(m_pIOleIPFrame) { m_pIOleIPFrame->GetBorder(&wi); m_xContainerWindow->setPosSize( @@ -1216,8 +1214,7 @@ css::uno::Reference< css::awt::XWindow> SAL_CALL DocumentHolder::getContainerWin lang::SystemDependent::SYSTEM_WIN32), uno::UNO_QUERY); - RECT wi; - memset(&wi,0,sizeof(wi)); + RECT wi = {}; if(xWin.is() && m_pIOleIPFrame->GetBorder(&wi) == NOERROR) { xWin->setVisible(true); xWin->setPosSize( diff --git a/extensions/source/ole/windata.hxx b/extensions/source/ole/windata.hxx index 396e51077f9b..ed673c465dc8 100644 --- a/extensions/source/ole/windata.hxx +++ b/extensions/source/ole/windata.hxx @@ -146,8 +146,8 @@ class ExcepInfo : public EXCEPINFO ExcepInfo(const ExcepInfo &); public: ExcepInfo() + : EXCEPINFO{} { - memset(this, 0, sizeof(ExcepInfo)); } ~ExcepInfo() { diff --git a/filter/source/msfilter/mscodec.cxx b/filter/source/msfilter/mscodec.cxx index b99e6cc4d63c..50b2de6dedb0 100644 --- a/filter/source/msfilter/mscodec.cxx +++ b/filter/source/msfilter/mscodec.cxx @@ -123,7 +123,6 @@ MSCodec_Xor95::MSCodec_Xor95(int nRotateDistance) : mnHash( 0 ), mnRotateDistance( nRotateDistance ) { - (void)memset( mpnKey, 0, sizeof( mpnKey ) ); } MSCodec_Xor95::~MSCodec_Xor95() @@ -435,10 +434,7 @@ void MSCodec_CryptoAPI::GetDigestFromSalt(const sal_uInt8* pSaltData, sal_uInt8* bool MSCodec_Std97::InitCipher(sal_uInt32 nCounter) { - sal_uInt8 pKeyData[64]; // 512-bit message block - - // Initialize KeyData array. - (void)memset (pKeyData, 0, sizeof(pKeyData)); + sal_uInt8 pKeyData[64] = {}; // 512-bit message block // Fill 40 bit of DigestValue into [0..4]. (void)memcpy (pKeyData, m_aDigestValue.data(), 5); @@ -631,18 +627,12 @@ EncryptionVerifierAES::EncryptionVerifierAES() : saltSize(SALT_LENGTH) , encryptedVerifierHashSize(SHA1_HASH_LENGTH) { - memset(salt, 0, sizeof(salt)); - memset(encryptedVerifier, 0, sizeof(encryptedVerifier)); - memset(encryptedVerifierHash, 0, sizeof(encryptedVerifierHash)); } EncryptionVerifierRC4::EncryptionVerifierRC4() : saltSize(SALT_LENGTH) , encryptedVerifierHashSize(SHA1_HASH_LENGTH) { - memset(salt, 0, sizeof(salt)); - memset(encryptedVerifier, 0, sizeof(encryptedVerifier)); - memset(encryptedVerifierHash, 0, sizeof(encryptedVerifierHash)); } } diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx index 5cfa5a968650..bb47254d46a3 100644 --- a/filter/source/msfilter/svdfppt.cxx +++ b/filter/source/msfilter/svdfppt.cxx @@ -370,7 +370,6 @@ void PptNotesAtom::Clear() PptColorSchemeAtom::PptColorSchemeAtom() { - memset(&aData[0], 0, 32); } Color PptColorSchemeAtom::GetColor( sal_uInt16 nNum ) const @@ -4532,8 +4531,6 @@ PPTRuler::PPTRuler() , nDefaultTab(0x240) , nTabCount(0) { - memset(nTextOfs, 0, sizeof(nTextOfs)); - memset(nBulletOfs, 0, sizeof(nBulletOfs)); } PPTRuler::~PPTRuler() diff --git a/hwpfilter/source/hbox.cxx b/hwpfilter/source/hbox.cxx index d3a2033290a5..2af25d8793c3 100644 --- a/hwpfilter/source/hbox.cxx +++ b/hwpfilter/source/hbox.cxx @@ -354,7 +354,6 @@ Picture::Picture() , pictype(0) , ishyper(false) { - memset(&picinfo, 0, sizeof(picinfo)); } Picture::~Picture() diff --git a/hwpfilter/source/hbox.h b/hwpfilter/source/hbox.h index 2c8489a14d0f..344c5594e2e0 100644 --- a/hwpfilter/source/hbox.h +++ b/hwpfilter/source/hbox.h @@ -257,7 +257,7 @@ struct FBoxStyle * [0-2][] : out/in/cell margin * [][0-3] : left/right/top/bottom */ - short margin[3][4]; // out : left, right, top, bottom + short margin[3][4] = {}; // out : left, right, top, bottom /** * Index of floating object */ @@ -280,7 +280,6 @@ struct FBoxStyle , cap_len(0) , cell(nullptr) { - memset(margin, 0, sizeof(margin)); } }; @@ -619,7 +618,7 @@ struct Picture: public FBox * Ratio of magnification or reduction. */ hunit scale[2]; - PicDef picinfo; + PicDef picinfo = {}; char reserved3[9]; std::vector<std::unique_ptr<HWPPara>> caption; @@ -827,7 +826,7 @@ struct PageNumCtrl: public HBox */ struct MailMerge: public HBox { - unsigned char field_name[20]; + unsigned char field_name[20] = {}; hchar dummy; MailMerge(); @@ -892,8 +891,8 @@ struct TocMark: public HBox */ struct IndexMark: public HBox { - hchar keyword1[60]; - hchar keyword2[60]; + hchar keyword1[60] = {}; + hchar keyword2[60] = {}; unsigned short pgno; hchar dummy; diff --git a/hwpfilter/source/hinfo.cxx b/hwpfilter/source/hinfo.cxx index 7ca6648d8221..025e54b7a6de 100644 --- a/hwpfilter/source/hinfo.cxx +++ b/hwpfilter/source/hinfo.cxx @@ -58,9 +58,6 @@ HWPInfo::HWPInfo() , info_block_len(0) { back_info.isset = false; - memset(reserved1, 0, sizeof(reserved1)); - memset(annotation, 0, sizeof(annotation)); - memset(bordermargin, 0, sizeof(bordermargin)); } HWPInfo::~HWPInfo() diff --git a/hwpfilter/source/hinfo.h b/hwpfilter/source/hinfo.h index 2cdaba65b2da..c415783e26a2 100644 --- a/hwpfilter/source/hinfo.h +++ b/hwpfilter/source/hinfo.h @@ -69,16 +69,16 @@ struct PaperInfo struct PaperBackInfo { char type; // 0- background color, 1 - external image, 2- embedded image - char reserved1[8]; + char reserved1[8] = {}; int luminance; /* ???? ( -100 ~ 100 ) */ int contrast; /* ???? ( -100 ~ 100 ) */ char effect; /* 0-????????, 1-????????????, 2-???? */ - char reserved2[8]; - char filename[260 + 1]; // filename - unsigned char color[3]; //0 - red, 1 - green, 2 - blue + char reserved2[8] = {}; + char filename[260 + 1] = {}; // filename + unsigned char color[3] = {}; //0 - red, 1 - green, 2 - blue unsigned short flag; /* 0 - ????????, 1 - ????????, 2 - ??????, 3 - ???????? */ int range; /* 0-????, 1-????????, 3-??????, 4-?????? */ - char reserved3[27]; + char reserved3[27] = {}; int size; std::vector<char> data; // image data bool isset; @@ -92,11 +92,6 @@ struct PaperBackInfo , size(0) , isset(false) { - memset(reserved1, 0, sizeof(reserved1)); - memset(reserved2, 0, sizeof(reserved2)); - memset(filename, 0, sizeof(filename)); - memset(color, 0, sizeof(color)); - memset(reserved3, 0, sizeof(reserved3)); } }; @@ -108,12 +103,11 @@ struct DocChainInfo { unsigned char chain_page_no; unsigned char chain_footnote_no; - unsigned char chain_filename[CHAIN_MAX_PATH]; + unsigned char chain_filename[CHAIN_MAX_PATH] = {}; DocChainInfo() : chain_page_no(0) , chain_footnote_no(0) { - memset(chain_filename, 0, sizeof(chain_filename)); } }; @@ -167,12 +161,12 @@ class DLLEXPORT HWPInfo * Sets the attribute of read-only or read/write. */ short readonly; - unsigned char reserved1[4]; + unsigned char reserved1[4] = {}; /** * Information about document chain */ DocChainInfo chain_info; - unsigned char annotation[ANNOTATION_LEN]; + unsigned char annotation[ANNOTATION_LEN] = {}; short encrypted; // unsigned char reserved2[6]; short beginpagenum; /* ?????????? ???? */ @@ -189,7 +183,7 @@ class DLLEXPORT HWPInfo /** * Information about page layout */ - hunit bordermargin[4]; + hunit bordermargin[4] = {}; short borderline; unsigned char empty_line_hide; diff --git a/hwpfilter/source/hwpread.cxx b/hwpfilter/source/hwpread.cxx index d734d58f0335..43a15635ba9d 100644 --- a/hwpfilter/source/hwpread.cxx +++ b/hwpfilter/source/hwpread.cxx @@ -745,7 +745,6 @@ MailMerge::MailMerge() : HBox(CH_MAIL_MERGE) , dummy(0) { - memset(field_name, 0, sizeof(field_name)); } bool MailMerge::Read(HWPFile & hwpf) @@ -823,8 +822,6 @@ IndexMark::IndexMark() , pgno(0) , dummy(0) { - memset(keyword1, 0, sizeof(keyword1)); - memset(keyword2, 0, sizeof(keyword2)); } bool IndexMark::Read(HWPFile & hwpf) diff --git a/include/editeng/numitem.hxx b/include/editeng/numitem.hxx index 7757948a54aa..777f877f0ce5 100644 --- a/include/editeng/numitem.hxx +++ b/include/editeng/numitem.hxx @@ -312,11 +312,11 @@ public: class SvxNodeNum { - sal_uInt16 nLevelVal[ SVX_MAX_NUM ]; // Numbers of all levels - sal_uInt8 nMyLevel; // Current Level + sal_uInt16 nLevelVal[ SVX_MAX_NUM ] = {}; // Numbers of all levels + sal_uInt8 nMyLevel = 0; // Current Level public: - explicit inline SvxNodeNum(); + explicit inline SvxNodeNum() = default; inline SvxNodeNum& operator=( const SvxNodeNum& rCpy ); sal_uInt8 GetLevel() const { return nMyLevel; } @@ -326,12 +326,6 @@ public: sal_uInt16* GetLevelVal() { return nLevelVal; } }; -SvxNodeNum::SvxNodeNum() - : nMyLevel( 0 ) -{ - memset( nLevelVal, 0, sizeof( nLevelVal ) ); -} - inline SvxNodeNum& SvxNodeNum::operator=( const SvxNodeNum& rCpy ) { if ( &rCpy != this) diff --git a/include/filter/msfilter/mscodec.hxx b/include/filter/msfilter/mscodec.hxx index bc0240ae20eb..a56694e9e1bd 100644 --- a/include/filter/msfilter/mscodec.hxx +++ b/include/filter/msfilter/mscodec.hxx @@ -121,7 +121,7 @@ public: void Skip( std::size_t nBytes ); protected: - sal_uInt8 mpnKey[ 16 ]; /// Encryption key. + sal_uInt8 mpnKey[ 16 ] = {}; /// Encryption key. std::size_t mnOffset; /// Key offset. private: @@ -463,10 +463,10 @@ struct MSFILTER_DLLPUBLIC EncryptionStandardHeader struct MSFILTER_DLLPUBLIC EncryptionVerifierAES { sal_uInt32 saltSize; // must be 0x00000010 - sal_uInt8 salt[SALT_LENGTH]; // random generated salt value - sal_uInt8 encryptedVerifier[ENCRYPTED_VERIFIER_LENGTH]; // randomly generated verifier value + sal_uInt8 salt[SALT_LENGTH] = {}; // random generated salt value + sal_uInt8 encryptedVerifier[ENCRYPTED_VERIFIER_LENGTH] = {}; // randomly generated verifier value sal_uInt32 encryptedVerifierHashSize; // actually written hash size - depends on algorithm - sal_uInt8 encryptedVerifierHash[SHA256_HASH_LENGTH]; // verifier value hash - itself also encrypted + sal_uInt8 encryptedVerifierHash[SHA256_HASH_LENGTH] = {}; // verifier value hash - itself also encrypted EncryptionVerifierAES(); }; @@ -474,10 +474,10 @@ struct MSFILTER_DLLPUBLIC EncryptionVerifierAES struct MSFILTER_DLLPUBLIC EncryptionVerifierRC4 { sal_uInt32 saltSize; // must be 0x00000010 - sal_uInt8 salt[SALT_LENGTH]; // random generated salt value - sal_uInt8 encryptedVerifier[ENCRYPTED_VERIFIER_LENGTH]; // randomly generated verifier value + sal_uInt8 salt[SALT_LENGTH] = {}; // random generated salt value + sal_uInt8 encryptedVerifier[ENCRYPTED_VERIFIER_LENGTH] = {}; // randomly generated verifier value sal_uInt32 encryptedVerifierHashSize; // actually written hash size - depends on algorithm - sal_uInt8 encryptedVerifierHash[SHA1_HASH_LENGTH]; // verifier value hash - itself also encrypted + sal_uInt8 encryptedVerifierHash[SHA1_HASH_LENGTH] = {}; // verifier value hash - itself also encrypted EncryptionVerifierRC4(); }; diff --git a/include/filter/msfilter/svdfppt.hxx b/include/filter/msfilter/svdfppt.hxx index 070aecae01ce..2720a0612c21 100644 --- a/include/filter/msfilter/svdfppt.hxx +++ b/include/filter/msfilter/svdfppt.hxx @@ -257,7 +257,7 @@ public: struct PptColorSchemeAtom { - sal_uInt8 aData[32]; + sal_uInt8 aData[32] = {}; public: PptColorSchemeAtom(); @@ -979,8 +979,8 @@ struct PPTRuler : public salhelper::SimpleReferenceObject { sal_Int32 nFlags; sal_uInt16 nDefaultTab; - sal_uInt16 nTextOfs[nMaxPPTLevels]; - sal_uInt16 nBulletOfs[nMaxPPTLevels]; + sal_uInt16 nTextOfs[nMaxPPTLevels] = {}; + sal_uInt16 nBulletOfs[nMaxPPTLevels] = {}; std::unique_ptr<PPTTabEntry[]> pTab; sal_uInt16 nTabCount; diff --git a/include/tools/globname.hxx b/include/tools/globname.hxx index 9672f444ccad..88a5e492d923 100644 --- a/include/tools/globname.hxx +++ b/include/tools/globname.hxx @@ -33,7 +33,7 @@ struct SAL_WARN_UNUSED SvGUID struct SAL_WARN_UNUSED ImpSvGlobalName { - struct SvGUID szData; + struct SvGUID szData = {}; ImpSvGlobalName(const SvGUID &rData) : szData(rData) @@ -43,7 +43,7 @@ struct SAL_WARN_UNUSED ImpSvGlobalName sal_uInt8 b8, sal_uInt8 b9, sal_uInt8 b10, sal_uInt8 b11, sal_uInt8 b12, sal_uInt8 b13, sal_uInt8 b14, sal_uInt8 b15); ImpSvGlobalName( const ImpSvGlobalName & rObj ); - ImpSvGlobalName(); + ImpSvGlobalName() = default; bool operator == ( const ImpSvGlobalName & rObj ) const; }; diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx index d87bd86a235a..2d972f1cc5ef 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.cxx @@ -40,14 +40,12 @@ public: SunVersion::SunVersion(const OUString &usVer): m_nUpdateSpecial(0), m_preRelease(Rel_NONE) { - memset(m_arVersionParts, 0, sizeof(m_arVersionParts)); OString sVersion= OUStringToOString(usVer, osl_getThreadTextEncoding()); m_bValid = init(sVersion.getStr()); } SunVersion::SunVersion(const char * szVer): m_nUpdateSpecial(0), m_preRelease(Rel_NONE) { - memset(m_arVersionParts, 0, sizeof(m_arVersionParts)); m_bValid = init(szVer); } diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx index 9da8e44a510e..a493fb5a8b1c 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunversion.hxx @@ -74,7 +74,7 @@ class SunVersion final }; //contains major,minor,micro,update - int m_arVersionParts[4]; + int m_arVersionParts[4] = {}; // The update can be followed by a char, e.g. 1.4.1_01a char m_nUpdateSpecial; 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++ ) { diff --git a/oox/source/crypto/CryptTools.cxx b/oox/source/crypto/CryptTools.cxx index 5862bed9476a..6ca316b0a9b6 100644 --- a/oox/source/crypto/CryptTools.cxx +++ b/oox/source/crypto/CryptTools.cxx @@ -193,8 +193,7 @@ struct CryptoImpl /* * Initialization of IV is not needed because PK11_GetBestWrapMechanism should return ECB mode */ - SECItem tmp_sec_item; - memset(&tmp_sec_item, 0, sizeof(tmp_sec_item)); + SECItem tmp_sec_item = {}; mWrapKeyContext = PK11_CreateContextBySymKey(wrap_mechanism, CKA_ENCRYPT, mWrapKey, &tmp_sec_item); if (!mWrapKeyContext) throw css::uno::RuntimeException("PK11_CreateContextBySymKey failure", css::uno::Reference<css::uno::XInterface>()); @@ -214,8 +213,7 @@ struct CryptoImpl /* * Finally unwrap sym key */ - SECItem wrapped_key; - memset(&tmp_sec_item, 0, sizeof(tmp_sec_item)); + SECItem wrapped_key = {}; wrapped_key.data = wrapped_key_data; wrapped_key.len = wrapped_key_len; diff --git a/oox/source/export/vmlexport.cxx b/oox/source/export/vmlexport.cxx index c4b0fe42249e..a5dc0f403271 100644 --- a/oox/source/export/vmlexport.cxx +++ b/oox/source/export/vmlexport.cxx @@ -402,8 +402,7 @@ void VMLExport::Commit( EscherPropertyContainer& rProps, const tools::Rectangle& } // properties - bool bAlreadyWritten[ 0xFFF ]; - memset( bAlreadyWritten, 0, sizeof( bAlreadyWritten ) ); + bool bAlreadyWritten[ 0xFFF ] = {}; const EscherProperties &rOpts = rProps.GetOpts(); for (auto const& opt : rOpts) { diff --git a/opencl/source/openclwrapper.cxx b/opencl/source/openclwrapper.cxx index a1aa5e90950c..179e6bda4da6 100644 --- a/opencl/source/openclwrapper.cxx +++ b/opencl/source/openclwrapper.cxx @@ -496,8 +496,7 @@ bool initOpenCLRunEnv( GPUEnv *gpuInfo ) const bool bIsNotWinOrIsWin8OrGreater = IsWindows8OrGreater(); # else bool bIsNotWinOrIsWin8OrGreater = true; - OSVERSIONINFOW aVersionInfo; - memset( &aVersionInfo, 0, sizeof(aVersionInfo) ); + OSVERSIONINFOW aVersionInfo = {}; aVersionInfo.dwOSVersionInfoSize = sizeof( aVersionInfo ); if (GetVersionExW( &aVersionInfo )) { diff --git a/sal/osl/w32/file.cxx b/sal/osl/w32/file.cxx index 7fda6107adeb..1c219f8f00af 100644 --- a/sal/osl/w32/file.cxx +++ b/sal/osl/w32/file.cxx @@ -156,9 +156,7 @@ FileHandle_Impl::FileHandle_Impl(HANDLE hFile) m_buffer (nullptr) { ::InitializeCriticalSection (&m_mutex); - m_buffer = static_cast<sal_uInt8 *>(malloc(m_bufsiz)); - if (m_buffer) - memset (m_buffer, 0, m_bufsiz); + m_buffer = static_cast<sal_uInt8 *>(calloc(m_bufsiz, 1)); } FileHandle_Impl::~FileHandle_Impl() diff --git a/sal/osl/w32/file_dirvol.cxx b/sal/osl/w32/file_dirvol.cxx index 96a2a473e731..c8ccd4001126 100644 --- a/sal/osl/w32/file_dirvol.cxx +++ b/sal/osl/w32/file_dirvol.cxx @@ -862,11 +862,10 @@ static oslFileError osl_getNextFileItem( if ( !pDirImpl ) return osl_File_E_INVAL; - pItemImpl = static_cast<DirectoryItem_Impl*>(malloc(sizeof(DirectoryItem_Impl))); + pItemImpl = static_cast<DirectoryItem_Impl*>(calloc(1, sizeof(DirectoryItem_Impl))); if ( !pItemImpl ) return osl_File_E_NOMEM; - memset( pItemImpl, 0, sizeof(DirectoryItem_Impl) ); fFound = EnumDirectory( pDirImpl->hDirectory, &pItemImpl->FindData ); if ( fFound ) diff --git a/sal/osl/w32/pipe.cxx b/sal/osl/w32/pipe.cxx index f02a8951f3cb..7c3471888527 100644 --- a/sal/osl/w32/pipe.cxx +++ b/sal/osl/w32/pipe.cxx @@ -292,7 +292,7 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe) { oslPipe pAcceptedPipe = nullptr; - OVERLAPPED os; + OVERLAPPED os = {}; DWORD nBytesTransfered; rtl_uString* path = nullptr; @@ -304,7 +304,6 @@ oslPipe SAL_CALL osl_acceptPipe(oslPipe pPipe) SAL_WARN_IF(pPipe->m_File == INVALID_HANDLE_VALUE, "sal.osl.pipe", "osl_acceptPipe: invalid handle"); - memset(&os, 0, sizeof(OVERLAPPED)); os.hEvent = pPipe->m_AcceptEvent; ResetEvent(pPipe->m_AcceptEvent); @@ -372,11 +371,10 @@ sal_Int32 SAL_CALL osl_receivePipe(oslPipe pPipe, sal_Int32 BytesToRead) { DWORD nBytes; - OVERLAPPED os; + OVERLAPPED os = {}; assert(pPipe); - memset(&os, 0, sizeof(OVERLAPPED)); os.hEvent = pPipe->m_ReadEvent; ResetEvent(pPipe->m_ReadEvent); @@ -410,11 +408,10 @@ sal_Int32 SAL_CALL osl_sendPipe(oslPipe pPipe, sal_Int32 BytesToSend) { DWORD nBytes; - OVERLAPPED os; + OVERLAPPED os = {}; assert(pPipe); - memset(&os, 0, sizeof(OVERLAPPED)); os.hEvent = pPipe->m_WriteEvent; ResetEvent(pPipe->m_WriteEvent); diff --git a/sal/osl/w32/procimpl.cxx b/sal/osl/w32/procimpl.cxx index d01b060e31c4..fa490a7c29bf 100644 --- a/sal/osl/w32/procimpl.cxx +++ b/sal/osl/w32/procimpl.cxx @@ -468,9 +468,7 @@ oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( if ((Options & osl_Process_DETACHED) && !(flags & CREATE_NEW_CONSOLE)) flags |= DETACHED_PROCESS; - STARTUPINFOW startup_info; - memset(&startup_info, 0, sizeof(startup_info)); - + STARTUPINFOW startup_info = {}; startup_info.cb = sizeof(startup_info); startup_info.dwFlags = STARTF_USESHOWWINDOW; startup_info.lpDesktop = const_cast<LPWSTR>(L""); diff --git a/sal/osl/w32/profile.cxx b/sal/osl/w32/profile.cxx index 90db6d437a16..55b7ea0d7c06 100644 --- a/sal/osl/w32/profile.cxx +++ b/sal/osl/w32/profile.cxx @@ -1036,13 +1036,11 @@ static osl_TStamp getFileStamp(osl_TFile* pFile) static bool lockFile(const osl_TFile* pFile, osl_TLockMode eMode) { bool status = false; - OVERLAPPED Overlapped; + OVERLAPPED Overlapped = {}; if (pFile->m_Handle == INVALID_HANDLE_VALUE) return false; - memset(&Overlapped, 0, sizeof(Overlapped)); - switch (eMode) { case un_lock: diff --git a/sc/source/filter/excel/xeroot.cxx b/sc/source/filter/excel/xeroot.cxx index 4268bbd97830..15082d46a226 100644 --- a/sc/source/filter/excel/xeroot.cxx +++ b/sc/source/filter/excel/xeroot.cxx @@ -317,8 +317,7 @@ uno::Sequence< beans::NamedValue > XclExpRoot::GenerateEncryptionData( const OUS rtl_random_destroyPool( aRandomPool ); - sal_uInt16 pnPasswd[16]; - memset( pnPasswd, 0, sizeof( pnPasswd ) ); + sal_uInt16 pnPasswd[16] = {}; for( sal_Int32 nChar = 0; nChar < aPass.getLength(); ++nChar ) pnPasswd[nChar] = aPass[nChar]; diff --git a/sc/source/filter/inc/qprostyle.hxx b/sc/source/filter/inc/qprostyle.hxx index ea62390b0669..4912dcb6e986 100644 --- a/sc/source/filter/inc/qprostyle.hxx +++ b/sc/source/filter/inc/qprostyle.hxx @@ -29,14 +29,14 @@ class ScDocument; class ScQProStyle { enum limits { maxsize = 256 }; - sal_uInt8 maAlign[ maxsize ]; - sal_uInt8 maFont[ maxsize ]; - sal_uInt16 maFontRecord[ maxsize ]; - sal_uInt16 maFontHeight[ maxsize ]; + sal_uInt8 maAlign[ maxsize ] = {}; + sal_uInt8 maFont[ maxsize ] = {}; + sal_uInt16 maFontRecord[ maxsize ] = {}; + sal_uInt16 maFontHeight[ maxsize ] = {}; OUString maFontType[ maxsize ]; public: - ScQProStyle(); + ScQProStyle() = default; void SetFormat( ScDocument *pDoc, sal_uInt8 nCol, sal_uInt16 nRow, SCTAB nTab, sal_uInt16 nStyle ); void setFontRecord(sal_uInt16 nIndex, sal_uInt16 nData, sal_uInt16 nPtSize) { diff --git a/sc/source/filter/qpro/qprostyle.cxx b/sc/source/filter/qpro/qprostyle.cxx index 4a309b9eec54..af6628162e9a 100644 --- a/sc/source/filter/qpro/qprostyle.cxx +++ b/sc/source/filter/qpro/qprostyle.cxx @@ -35,14 +35,6 @@ #include <patattr.hxx> #include <document.hxx> -ScQProStyle::ScQProStyle() -{ - memset (maAlign, 0, sizeof (maAlign)); - memset (maFont, 0, sizeof (maFont)); - memset (maFontRecord, 0, sizeof (maFontRecord)); - memset (maFontHeight, 0, sizeof (maFontHeight)); -} - void ScQProStyle::SetFormat( ScDocument *pDoc, sal_uInt8 nCol, sal_uInt16 nRow, SCTAB nTab, sal_uInt16 nStyle ) { if (nStyle >= maxsize) diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx index 4f684df3bd4c..12f94aee3c95 100644 --- a/sd/source/ui/remotecontrol/BluetoothServer.cxx +++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx @@ -1329,8 +1329,7 @@ void SAL_CALL BluetoothServer::run() int aNameSize = sizeof(aName); getsockname( aSocket, reinterpret_cast<SOCKADDR*>(&aName), &aNameSize ); // Retrieve the local address and port - CSADDR_INFO aAddrInfo; - memset( &aAddrInfo, 0, sizeof(aAddrInfo) ); + CSADDR_INFO aAddrInfo = {}; aAddrInfo.LocalAddr.lpSockaddr = reinterpret_cast<SOCKADDR*>(&aName); aAddrInfo.LocalAddr.iSockaddrLength = sizeof( SOCKADDR_BTH ); aAddrInfo.iSocketType = SOCK_STREAM; @@ -1345,8 +1344,7 @@ void SAL_CALL BluetoothServer::run() // ULONGLONG aData4 = 0x800000805F9B34FB; // memcpy( uuid.Data4, &aData4, sizeof(uuid.Data4) ); - WSAQUERYSETW aRecord; - memset( &aRecord, 0, sizeof(aRecord)); + WSAQUERYSETW aRecord = {}; aRecord.dwSize = sizeof(aRecord); aRecord.lpszServiceInstanceName = const_cast<wchar_t *>( L"LibreOffice Impress Remote Control"); diff --git a/sd/source/ui/remotecontrol/DiscoveryService.cxx b/sd/source/ui/remotecontrol/DiscoveryService.cxx index 275e23556737..90f88a6c5374 100644 --- a/sd/source/ui/remotecontrol/DiscoveryService.cxx +++ b/sd/source/ui/remotecontrol/DiscoveryService.cxx @@ -104,8 +104,7 @@ void DiscoveryService::setupSockets() return; // would be better to throw, but unsure if caller handles that } - sockaddr_in aAddr; - memset(&aAddr, 0, sizeof(aAddr)); + sockaddr_in aAddr = {}; aAddr.sin_family = AF_INET; aAddr.sin_addr.s_addr = htonl(INADDR_ANY); aAddr.sin_port = htons( PORT_DISCOVERY ); @@ -155,10 +154,9 @@ void SAL_CALL DiscoveryService::run() setupSockets(); // Kept for backward compatibility - char aBuffer[BUFFER_SIZE]; while ( true ) { - memset( aBuffer, 0, sizeof(char) * BUFFER_SIZE ); + char aBuffer[BUFFER_SIZE] = {}; sockaddr_in aAddr; socklen_t aLen = sizeof( aAddr ); if(recvfrom( mSocket, aBuffer, BUFFER_SIZE, 0, reinterpret_cast<sockaddr*>(&aAddr), &aLen ) > 0) diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index e57cf3f701b7..b9c3c822c45a 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -1018,13 +1018,13 @@ struct PDFFileImplData sal_uInt32 m_nAlgoVersion; sal_uInt32 m_nStandardRevision; sal_uInt32 m_nKeyLength; - sal_uInt8 m_aOEntry[32]; - sal_uInt8 m_aUEntry[32]; + sal_uInt8 m_aOEntry[32] = {}; + sal_uInt8 m_aUEntry[32] = {}; sal_uInt32 m_nPEntry; OString m_aDocID; rtlCipher m_aCipher; - sal_uInt8 m_aDecryptionKey[ENCRYPTION_KEY_LEN+5]; // maximum handled key length + sal_uInt8 m_aDecryptionKey[ENCRYPTION_KEY_LEN+5] = {}; // maximum handled key length PDFFileImplData() : m_bIsEncrypted( false ), @@ -1035,9 +1035,6 @@ struct PDFFileImplData m_nPEntry( 0 ), m_aCipher( nullptr ) { - memset( m_aOEntry, 0, sizeof( m_aOEntry ) ); - memset( m_aUEntry, 0, sizeof( m_aUEntry ) ); - memset( m_aDecryptionKey, 0, sizeof( m_aDecryptionKey ) ); } ~PDFFileImplData() @@ -1160,8 +1157,7 @@ static bool check_user_password( const OString& rPwd, PDFFileImplData* pData ) memcpy( pData->m_aDecryptionKey, aKey, nKeyLen ); if( pData->m_nStandardRevision == 2 ) { - sal_uInt8 nEncryptedEntry[ENCRYPTION_BUF_LEN]; - memset( nEncryptedEntry, 0, sizeof(nEncryptedEntry) ); + sal_uInt8 nEncryptedEntry[ENCRYPTION_BUF_LEN] = {}; // see PDF reference 1.4 Algorithm 3.4 // encrypt pad string if (rtl_cipher_initARCFOUR( pData->m_aCipher, rtl_Cipher_DirectionEncode, @@ -1241,8 +1237,7 @@ bool PDFFile::setupDecryptionData( const OString& rPwd ) const // try owner password // see PDF reference 1.4 Algorithm 3.7 sal_uInt8 aKey[ENCRYPTION_KEY_LEN]; - sal_uInt8 nPwd[ENCRYPTION_BUF_LEN]; - memset( nPwd, 0, sizeof(nPwd) ); + sal_uInt8 nPwd[ENCRYPTION_BUF_LEN] = {}; sal_uInt32 nKeyLen = password_to_key( rPwd, aKey, m_pData.get(), true ); if( m_pData->m_nStandardRevision == 2 ) { diff --git a/sfx2/source/appl/shutdowniconw32.cxx b/sfx2/source/appl/shutdowniconw32.cxx index f5e836dfbc5a..deea7b4373f5 100644 --- a/sfx2/source/appl/shutdowniconw32.cxx +++ b/sfx2/source/appl/shutdowniconw32.cxx @@ -90,8 +90,7 @@ typedef struct tagMYITEM static void addMenuItem( HMENU hMenu, UINT id, UINT iconId, const OUString& text, int& pos, bool bOwnerdraw, const OUString& module ) { - MENUITEMINFOW mi; - memset( &mi, 0, sizeof( mi ) ); + MENUITEMINFOW mi = {}; mi.cbSize = sizeof( mi ); if( id == static_cast<UINT>( -1 ) ) @@ -218,9 +217,8 @@ static void deleteSystrayMenu( HMENU hMenu ) if( !hMenu || !IsMenu( hMenu )) return; - MENUITEMINFOW mi; + MENUITEMINFOW mi = {}; int pos=0; - memset( &mi, 0, sizeof( mi ) ); mi.cbSize = sizeof( mi ); mi.fMask = MIIM_DATA; @@ -552,8 +550,7 @@ void OnMeasureItem(HWND hwnd, LPMEASUREITEMSTRUCT lpmis) HDC hdc = GetDC(hwnd); SIZE size; - NONCLIENTMETRICSW ncm; - memset(&ncm, 0, sizeof(ncm)); + NONCLIENTMETRICSW ncm = {}; ncm.cbSize = sizeof(ncm); SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); @@ -639,8 +636,7 @@ void OnDrawItem(HWND /*hwnd*/, LPDRAWITEMSTRUCT lpdis) x += cx + 4; // space for icon aRect.left = x; - NONCLIENTMETRICSW ncm; - memset(&ncm, 0, sizeof(ncm)); + NONCLIENTMETRICSW ncm = {}; ncm.cbSize = sizeof(ncm); SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0); diff --git a/shell/source/win32/shlxthandler/ooofilt/propspec.cxx b/shell/source/win32/shlxthandler/ooofilt/propspec.cxx index f96d363d6542..bfb924803a1f 100644 --- a/shell/source/win32/shlxthandler/ooofilt/propspec.cxx +++ b/shell/source/win32/shlxthandler/ooofilt/propspec.cxx @@ -50,7 +50,6 @@ CFullPropSpec::CFullPropSpec() { - memset( &_guidPropSet, 0, sizeof( _guidPropSet ) ); _psProperty.ulKind = PRSPEC_PROPID; _psProperty.propid = 0; } diff --git a/shell/source/win32/shlxthandler/ooofilt/propspec.hxx b/shell/source/win32/shlxthandler/ooofilt/propspec.hxx index 7004c9c871f5..aa14257d779d 100644 --- a/shell/source/win32/shlxthandler/ooofilt/propspec.hxx +++ b/shell/source/win32/shlxthandler/ooofilt/propspec.hxx @@ -74,7 +74,7 @@ public: inline BOOL IsPropertyName() const; inline BOOL IsPropertyPropid() const; private: - GUID _guidPropSet; + GUID _guidPropSet = {}; PROPSPEC _psProperty; }; // Inline methods for CFullPropSpec diff --git a/shell/source/win32/spsupp/COMOpenDocuments.cxx b/shell/source/win32/spsupp/COMOpenDocuments.cxx index 92ad732bfda0..b851f0e5b8b9 100644 --- a/shell/source/win32/spsupp/COMOpenDocuments.cxx +++ b/shell/source/win32/spsupp/COMOpenDocuments.cxx @@ -26,8 +26,7 @@ HRESULT LOStart(Args... args) std::wstring sCmdLine((quote(GetHelperExe()) + ... + (L" " + quote(args)))); LPWSTR pCmdLine = const_cast<LPWSTR>(sCmdLine.c_str()); - STARTUPINFOW si; - std::memset(&si, 0, sizeof si); + STARTUPINFOW si = {}; si.cb = sizeof si; si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_SHOW; diff --git a/shell/source/win32/spsupp/spsuppHelper.cxx b/shell/source/win32/spsupp/spsuppHelper.cxx index 57b7c9a8cf86..b60f9dc528da 100644 --- a/shell/source/win32/spsupp/spsuppHelper.cxx +++ b/shell/source/win32/spsupp/spsuppHelper.cxx @@ -124,8 +124,7 @@ DWORD LOStart(const wchar_t* sModeArg, const wchar_t* sFilePath) + OUString(o3tl::toU(sFilePath)) + "\""; LPWSTR pCmdLine = const_cast<LPWSTR>(o3tl::toW(sCmdLine.getStr())); - STARTUPINFOW si; - std::memset(&si, 0, sizeof si); + STARTUPINFOW si = {}; si.cb = sizeof si; si.dwFlags = STARTF_USESHOWWINDOW; si.wShowWindow = SW_SHOW; diff --git a/sot/source/sdstor/stgelem.cxx b/sot/source/sdstor/stgelem.cxx index 6ad0d9a6f438..f902c5f1944a 100644 --- a/sot/source/sdstor/stgelem.cxx +++ b/sot/source/sdstor/stgelem.cxx @@ -81,10 +81,6 @@ StgHeader::StgHeader() , m_nMasterChain( 0 ) , m_nMaster( 0 ) { - memset( m_cSignature, 0, sizeof( m_cSignature ) ); - memset( &m_aClsId, 0, sizeof( ClsId ) ); - memset( m_cReserved, 0, sizeof( m_cReserved ) ); - memset( m_nMasterFAT, 0, sizeof( m_nMasterFAT ) ); } void StgHeader::Init() diff --git a/sot/source/sdstor/stgelem.hxx b/sot/source/sdstor/stgelem.hxx index 7dce8863a824..855b2b8795a2 100644 --- a/sot/source/sdstor/stgelem.hxx +++ b/sot/source/sdstor/stgelem.hxx @@ -35,8 +35,8 @@ class StgHeader { static const sal_uInt8 cFATPagesInHeader = 109; - sal_uInt8 m_cSignature[ 8 ]; // 00 signature (see below) - ClsId m_aClsId; // 08 Class ID + sal_uInt8 m_cSignature[ 8 ] = {}; // 00 signature (see below) + ClsId m_aClsId = {}; // 08 Class ID sal_Int32 m_nVersion; // 18 version number sal_uInt16 m_nByteOrder; // 1C Unicode byte order indicator sal_Int16 m_nPageSize; // 1E 1 << nPageSize = block size @@ -44,7 +44,7 @@ class StgHeader sal_uInt8 m_bDirty; // 22 internal dirty flag (should be // bool, but probably required to // be exactly one byte) - sal_uInt8 m_cReserved[ 9 ]; // 23 + sal_uInt8 m_cReserved[ 9 ] = {}; // 23 sal_Int32 m_nFATSize; // 2C total number of FAT pages sal_Int32 m_nTOCstrm; // 30 starting page for the TOC stream sal_Int32 m_nReserved; // 34 @@ -53,7 +53,7 @@ class StgHeader sal_Int32 m_nDataFATSize; // 40 # of data fat blocks sal_Int32 m_nMasterChain; // 44 chain to the next master block sal_Int32 m_nMaster; // 48 # of additional master blocks - sal_Int32 m_nMasterFAT[ cFATPagesInHeader ]; // 4C first [cFATPagesInHeader] master FAT pages + sal_Int32 m_nMasterFAT[ cFATPagesInHeader ] = {}; // 4C first [cFATPagesInHeader] master FAT pages public: StgHeader(); diff --git a/sot/source/sdstor/stgole.cxx b/sot/source/sdstor/stgole.cxx index f91da70ba66e..62c586a20773 100644 --- a/sot/source/sdstor/stgole.cxx +++ b/sot/source/sdstor/stgole.cxx @@ -92,8 +92,6 @@ void StgInternalStream::Commit() StgCompObjStream::StgCompObjStream( BaseStorage& rStg, bool bWr ) : StgInternalStream( rStg, "\1CompObj", bWr ) { - memset( &m_aClsId, 0, sizeof( ClsId ) ); - m_nCbFormat = SotClipboardFormatId::NONE; } bool StgCompObjStream::Load() diff --git a/sot/source/sdstor/stgole.hxx b/sot/source/sdstor/stgole.hxx index b6888823e4af..899b07fcd97e 100644 --- a/sot/source/sdstor/stgole.hxx +++ b/sot/source/sdstor/stgole.hxx @@ -41,9 +41,9 @@ public: class StgCompObjStream : public StgInternalStream { - ClsId m_aClsId; + ClsId m_aClsId = {}; OUString m_aUserName; - SotClipboardFormatId m_nCbFormat; + SotClipboardFormatId m_nCbFormat = SotClipboardFormatId::NONE; public: StgCompObjStream( BaseStorage&, bool ); ClsId& GetClsId() { return m_aClsId; } diff --git a/store/source/storcach.cxx b/store/source/storcach.cxx index 76a0c6d185c8..08f63a46e0fb 100644 --- a/store/source/storcach.cxx +++ b/store/source/storcach.cxx @@ -181,7 +181,6 @@ PageCache::PageCache (sal_uInt16 nPageSize) { static size_t const theSize = SAL_N_ELEMENTS(m_hash_table_0); static_assert(theSize == theTableSize, "must be equal"); - memset(m_hash_table_0, 0, sizeof(m_hash_table_0)); } PageCache::~PageCache() diff --git a/store/source/storcach.hxx b/store/source/storcach.hxx index ec7d6d138aa3..7032ade7b2dd 100644 --- a/store/source/storcach.hxx +++ b/store/source/storcach.hxx @@ -45,7 +45,7 @@ class PageCache : static_assert((theTableSize & (theTableSize-1)) == 0, "table size should be a power of 2"); Entry ** m_hash_table; - Entry * m_hash_table_0[theTableSize]; + Entry * m_hash_table_0[theTableSize] = {}; size_t m_hash_size; size_t m_hash_shift; size_t const m_page_shift; diff --git a/store/source/stordata.hxx b/store/source/stordata.hxx index 4e4741d509d7..6255fc1adccd 100644 --- a/store/source/stordata.hxx +++ b/store/source/stordata.hxx @@ -278,8 +278,8 @@ struct OStorePageNameBlock */ G m_aGuard; K m_aKey; - sal_uInt32 m_nAttrib; - sal_Char m_pData[STORE_MAXIMUM_NAMESIZE]; + sal_uInt32 m_nAttrib = 0; + sal_Char m_pData[STORE_MAXIMUM_NAMESIZE] = {}; /** size. */ @@ -287,11 +287,7 @@ struct OStorePageNameBlock /** Construction. */ - OStorePageNameBlock() - : m_aGuard(), m_aKey(), m_nAttrib (0) - { - memset (m_pData, 0, sizeof(m_pData)); - } + OStorePageNameBlock() = default; /** guard (external representation). */ diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx index 4f6d757183ef..5a3f0271c40d 100644 --- a/svl/source/crypto/cryptosign.cxx +++ b/svl/source/crypto/cryptosign.cxx @@ -1393,9 +1393,7 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer) return false; } - CRYPT_SIGN_MESSAGE_PARA aPara; - - memset(&aPara, 0, sizeof(aPara)); + CRYPT_SIGN_MESSAGE_PARA aPara = {}; aPara.cbSize = sizeof(aPara); aPara.dwMsgEncodingType = PKCS_7_ASN_ENCODING | X509_ASN_ENCODING; aPara.pSigningCert = pCertContext; @@ -1423,9 +1421,7 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer) } assert(!bFreeNeeded); - CMSG_SIGNER_ENCODE_INFO aSignerInfo; - - memset(&aSignerInfo, 0, sizeof(aSignerInfo)); + CMSG_SIGNER_ENCODE_INFO aSignerInfo = {}; aSignerInfo.cbSize = sizeof(aSignerInfo); aSignerInfo.pCertInfo = pCertContext->pCertInfo; aSignerInfo.hNCryptKey = hCryptKey; @@ -1455,8 +1451,7 @@ bool Signing::Sign(OStringBuffer& rCMSHexBuffer) aSignerInfo.cAuthAttr = 1; aSignerInfo.rgAuthAttr = &aCertificateAttribute; - CMSG_SIGNED_ENCODE_INFO aSignedInfo; - memset(&aSignedInfo, 0, sizeof(aSignedInfo)); + CMSG_SIGNED_ENCODE_INFO aSignedInfo = {}; aSignedInfo.cbSize = sizeof(aSignedInfo); aSignedInfo.cSigners = 1; aSignedInfo.rgSigners = &aSignerInfo; diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx index 32862c2e5be2..2ebd1f8ed2b4 100644 --- a/svx/source/dialog/imapwnd.cxx +++ b/svx/source/dialog/imapwnd.cxx @@ -60,7 +60,6 @@ IMapWindow::IMapWindow(const Reference< XFrame >& rxDocumentFrame, weld::Dialog* : GraphCtrl(pDialog) , mxDocumentFrame(rxDocumentFrame) { - memset( maItemInfos, 0, sizeof( SfxItemInfo ) ); pIMapPool = new SfxItemPool( "IMapItemPool", SID_ATTR_MACROITEM, SID_ATTR_MACROITEM, maItemInfos ); pIMapPool->FreezeIdRanges(); diff --git a/svx/source/dialog/imapwnd.hxx b/svx/source/dialog/imapwnd.hxx index 62242c9ffd1b..62a49188e2ad 100644 --- a/svx/source/dialog/imapwnd.hxx +++ b/svx/source/dialog/imapwnd.hxx @@ -84,7 +84,7 @@ class IMapWindow final : public GraphCtrl TargetList aTargetList; Link<IMapWindow&,void> aInfoLink; SfxItemPool* pIMapPool; - SfxItemInfo maItemInfos[1]; + SfxItemInfo maItemInfos[1] = {}; css::uno::Reference< css::frame::XFrame > mxDocumentFrame; std::unique_ptr<IMapDropTargetHelper> mxDropTargetHelper; diff --git a/sw/inc/tblafmt.hxx b/sw/inc/tblafmt.hxx index 23fdbe395c14..3e8382930c13 100644 --- a/sw/inc/tblafmt.hxx +++ b/sw/inc/tblafmt.hxx @@ -170,7 +170,7 @@ class SW_DLLPUBLIC SwTableAutoFormat // Calc specific flags. bool m_bInclWidthHeight : 1; - SwBoxAutoFormat* m_aBoxAutoFormat[ 16 ]; + SwBoxAutoFormat* m_aBoxAutoFormat[ 16 ] = {}; // Writer-specific options std::shared_ptr<SvxFormatBreakItem> m_aBreak; diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx index 26fc7db4256f..53f1e006900a 100644 --- a/sw/source/core/doc/tblafmt.cxx +++ b/sw/source/core/doc/tblafmt.cxx @@ -388,8 +388,6 @@ SwTableAutoFormat::SwTableAutoFormat( const OUString& rName ) m_bInclBackground = true; m_bInclValueFormat = true; m_bInclWidthHeight = true; - - memset( m_aBoxAutoFormat, 0, sizeof( m_aBoxAutoFormat ) ); } SwTableAutoFormat::SwTableAutoFormat( const SwTableAutoFormat& rNew ) diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index a964cfb9d51a..11338d9a8c39 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -1083,8 +1083,6 @@ SwCombinedPortion::SwCombinedPortion( const OUString &rText ) } aScrType[i] = nScr; } - - memset( &aWidth, 0, sizeof(aWidth) ); } void SwCombinedPortion::Paint( const SwTextPaintInfo &rInf ) const diff --git a/sw/source/core/text/porfld.hxx b/sw/source/core/text/porfld.hxx index 225f686f8eb7..c8d7b7942ac5 100644 --- a/sw/source/core/text/porfld.hxx +++ b/sw/source/core/text/porfld.hxx @@ -199,7 +199,7 @@ public: class SwCombinedPortion : public SwFieldPortion { sal_uInt16 aPos[6]; // up to six X positions - o3tl::enumarray<SwFontScript,sal_uInt16> aWidth; // one width for every scripttype + o3tl::enumarray<SwFontScript,sal_uInt16> aWidth = {}; // one width for every scripttype SwFontScript aScrType[6]; // scripttype of every character sal_uInt16 nUpPos; // the Y position of the upper baseline sal_uInt16 nLowPos; // the Y position of the lower baseline diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 65bdc2dd0e5a..4a3c425560fc 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -696,24 +696,17 @@ void SwTextPainter::PaintDropPortion() class SwDropCapCache { - const void* aFontCacheId[ DROP_CACHE_SIZE ]; + const void* aFontCacheId[ DROP_CACHE_SIZE ] = {}; OUString aText[ DROP_CACHE_SIZE ]; sal_uInt16 aFactor[ DROP_CACHE_SIZE ]; - sal_uInt16 aWishedHeight[ DROP_CACHE_SIZE ]; + sal_uInt16 aWishedHeight[ DROP_CACHE_SIZE ] = {}; short aDescent[ DROP_CACHE_SIZE ]; - sal_uInt16 nIndex; + sal_uInt16 nIndex = 0; public: - SwDropCapCache(); + SwDropCapCache() = default; void CalcFontSize( SwDropPortion* pDrop, SwTextFormatInfo &rInf ); }; -// SwDropCapCache Ctor / Dtor -SwDropCapCache::SwDropCapCache() : nIndex( 0 ) -{ - memset( &aFontCacheId, 0, sizeof(aFontCacheId) ); - memset( &aWishedHeight, 0, sizeof(aWishedHeight) ); -} - void SwDropPortion::DeleteDropCapCache() { delete pDropCapCache; @@ -997,7 +990,7 @@ bool SwDropPortion::Format( SwTextFormatInfo &rInf ) if( nDropHeight && pPart && nLines!=1 ) { if( !pDropCapCache ) - pDropCapCache = new SwDropCapCache(); + pDropCapCache = new SwDropCapCache; // adjust font sizes to fit into the rectangle pDropCapCache->CalcFontSize( this, rInf ); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 8d321ddd9b45..e39432ca13a4 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -1245,8 +1245,7 @@ void SwTextNode::Update( const int coArrSz = RES_TXTATR_WITHEND_END - RES_CHRATR_BEGIN; std::vector<SwTextInputField*> aTextInputFields; - bool aDontExp[ coArrSz ]; - memset( &aDontExp, 0, coArrSz * sizeof(bool) ); + bool aDontExp[ coArrSz ] = {}; for ( size_t n = 0; n < m_pSwpHints->Count(); ++n ) { diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 2e67ac47e5a8..ca492efdd6b5 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -404,9 +404,8 @@ void WW8AttributeOutput::EndStyle() void WW8AttributeOutput::StartStyle( const OUString& rName, StyleType eType, sal_uInt16 nWwBase, sal_uInt16 nWwNext, sal_uInt16 nWwId, sal_uInt16 /*nId*/, bool bAutoUpdate ) { - sal_uInt8 aWW8_STD[ sizeof( WW8_STD ) ]; + sal_uInt8 aWW8_STD[ sizeof( WW8_STD ) ] = {}; sal_uInt8* pData = aWW8_STD; - memset( &aWW8_STD, 0, sizeof( WW8_STD ) ); sal_uInt16 nBit16 = 0x1000; // fInvalHeight nBit16 |= (ww::stiNil & nWwId); @@ -729,8 +728,6 @@ wwFont::wwFont(const OUString &rFamilyName, FontPitch ePitch, FontFamily eFamily mbAlt = true; } - memset(maWW8_FFN, 0, sizeof(maWW8_FFN)); - maWW8_FFN[0] = static_cast<sal_uInt8>( 6 - 1 + 0x22 + ( 2 * ( 1 + msFamilyNm.getLength() ) )); if (mbAlt) maWW8_FFN[0] = static_cast< sal_uInt8 >(maWW8_FFN[0] + 2 * ( 1 + msAltNm.getLength())); diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 542d24d7a64b..e908cab35162 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -3334,8 +3334,7 @@ bool SwWW8Writer::InitStd97CodecUpdateMedium( ::msfilter::MSCodec_Std97& rCodec rtl_random_destroyPool( aRandomPool ); - sal_uInt16 aPassword[16]; - memset( aPassword, 0, sizeof( aPassword ) ); + sal_uInt16 aPassword[16] = {}; const OUString& sPassword(pPasswordItem->GetValue()); for ( sal_Int32 nChar = 0; nChar < sPassword.getLength(); ++nChar ) diff --git a/sw/source/filter/ww8/wrtww8.hxx b/sw/source/filter/ww8/wrtww8.hxx index 13661d22e748..9824f52b7d84 100644 --- a/sw/source/filter/ww8/wrtww8.hxx +++ b/sw/source/filter/ww8/wrtww8.hxx @@ -301,7 +301,7 @@ class wwFont //In some future land the stream could be converted to a nice stream interface //and we could have harmony private: -sal_uInt8 maWW8_FFN[6]; + sal_uInt8 maWW8_FFN[6] = {}; OUString msFamilyNm; OUString msAltNm; bool mbAlt; diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index ad5f7ef5e3d6..5de49fadf67e 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -5613,8 +5613,7 @@ namespace rtl_random_destroyPool( aRandomPool ); - sal_uInt16 pStd97Pass[16]; - memset( pStd97Pass, 0, sizeof( pStd97Pass ) ); + sal_uInt16 pStd97Pass[16] = {}; for( sal_Int32 nChar = 0; nChar < nLen; ++nChar ) pStd97Pass[nChar] = sUniPassword[nChar]; @@ -5644,8 +5643,7 @@ namespace sal_Int32 nLen = sUniPassword.getLength(); if ( nLen <= 15 ) { - sal_uInt16 pPassword[16]; - memset( pPassword, 0, sizeof( pPassword ) ); + sal_uInt16 pPassword[16] = {}; for( sal_Int32 nChar = 0; nChar < nLen; ++nChar ) pPassword[nChar] = sUniPassword[nChar]; diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index d9cce7602e21..97701b5a2ea6 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -393,7 +393,7 @@ struct WW8LSTInfo // sorted by nIdLst (in WW8 used list-Id) { std::vector<ww::bytes> maParaSprms; WW8aIdSty aIdSty; // Style Id's for each level - WW8aCFormat aCharFormat; // Character Style Pointer + WW8aCFormat aCharFormat = {}; // Character Style Pointer SwNumRule* pNumRule; // Pointer to list-template in Writer sal_uInt32 nIdLst; // WW8Id of this list @@ -406,7 +406,6 @@ struct WW8LSTInfo // sorted by nIdLst (in WW8 used list-Id) bSimpleList(aLST.bSimpleList), bUsedInDoc(false) { memcpy( aIdSty, aLST.aIdSty, sizeof( aIdSty )); - memset(&aCharFormat, 0, sizeof( aCharFormat )); } }; @@ -530,11 +529,10 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet OUString sPrefix; OUString sPostfix; - WW8LVL aLVL; + WW8LVL aLVL = {}; // 1. read LVLF - memset(&aLVL, 0, sizeof( aLVL )); rSt.ReadInt32( aLVL.nStartAt ); rSt.ReadUChar( aLVL.nNFC ); rSt.ReadUChar( aBits1 ); @@ -672,8 +670,7 @@ bool WW8ListManager::ReadLVL(SwNumFormat& rNumFormat, std::unique_ptr<SfxItemSet if( aLVL.nLenGrpprlChpx ) { - sal_uInt8 aGrpprlChpx[ 255 ]; - memset(&aGrpprlChpx, 0, sizeof( aGrpprlChpx )); + sal_uInt8 aGrpprlChpx[ 255 ] = {}; if (aLVL.nLenGrpprlChpx != rSt.ReadBytes(&aGrpprlChpx, aLVL.nLenGrpprlChpx)) return false; @@ -1182,8 +1179,7 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_) if (nRemainingPlcfLst < cbLSTF) break; - WW8LST aLST; - memset(&aLST, 0, sizeof( aLST )); + WW8LST aLST = {}; // 1.1.1 read Data @@ -1290,8 +1286,7 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_) { bOk = false; - WW8LFO aLFO; - memset(&aLFO, 0, sizeof( aLFO )); + WW8LFO aLFO = {}; rSt.ReadUInt32( aLFO.nIdLst ); rSt.SeekRel( 8 ); @@ -1375,8 +1370,7 @@ WW8ListManager::WW8ListManager(SvStream& rSt_, SwWW8ImplReader& rReader_) // 2.2.2 read all LFOLVL (and LVL) for the new NumRule WW8aISet aItemSet; // Character attributes from GrpprlChpx - WW8aCFormat aCharFormat; // Character Style Pointer - memset(&aCharFormat, 0, sizeof( aCharFormat )); + WW8aCFormat aCharFormat = {}; // Character Style Pointer //2.2.2.0 skip inter-group of override header ? //See #i25438# for why I moved this here, compare diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 1e0a1fc066a9..38e3db7377be 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -8063,8 +8063,7 @@ void WW8Dop::Write(SvStream& rStrm, WW8Fib& rFib) const rFib.m_fcDop = rStrm.Tell(); rFib.m_lcbDop = nLen; - sal_uInt8 aData[ nMaxDopLen ]; - memset( aData, 0, nMaxDopLen ); + sal_uInt8 aData[ nMaxDopLen ] = {}; sal_uInt8* pData = aData; // analyse the data @@ -8507,7 +8506,6 @@ SEPr::SEPr() : dxaColumns(720), dxaColumnWidth(0), dmOrientFirst(0), fLayout(0), reserved4(0) { - memset(rgdxaColumnWidthSpacing, 0, sizeof(rgdxaColumnWidthSpacing)); } bool checkRead(SvStream &rSt, void *pDest, sal_uInt32 nLength) diff --git a/sw/source/filter/ww8/ww8scan.hxx b/sw/source/filter/ww8/ww8scan.hxx index 1c7545ae4e0d..1a5b024c12fb 100644 --- a/sw/source/filter/ww8/ww8scan.hxx +++ b/sw/source/filter/ww8/ww8scan.hxx @@ -1012,11 +1012,8 @@ public: struct WW8PLCFxSaveAll { - WW8PLCFxSave1 aS[WW8PLCFMan::MAN_PLCF_COUNT]; - WW8PLCFxSaveAll() - { - memset(aS, 0, sizeof(aS)); - } + WW8PLCFxSave1 aS[WW8PLCFMan::MAN_PLCF_COUNT] = {}; + WW8PLCFxSaveAll() = default; }; class WW8ScannerBase diff --git a/sw/source/filter/ww8/ww8struc.hxx b/sw/source/filter/ww8/ww8struc.hxx index d8b0d026bcbc..3a65cb33c915 100644 --- a/sw/source/filter/ww8/ww8struc.hxx +++ b/sw/source/filter/ww8/ww8struc.hxx @@ -233,7 +233,7 @@ struct WW8_FFN struct WW8_BRCVer6 // BoRder Code (WW6 version) { - SVBT16 aBits1; + SVBT16 aBits1 = {}; // sal_uInt16 dxpLineWidth : 3;// 0007 When dxpLineWidth is 0, 1, 2, 3, 4, or 5, this field is the width of // a single line of border in units of 0.75 points // Must be nonzero when brcType is nonzero. @@ -243,10 +243,7 @@ struct WW8_BRCVer6 // BoRder Code (WW6 version) // sal_uInt16 ico : 5; // 07C0 color code (see chp.ico) // sal_uInt16 dxpSpace : 5; // F800 width of space to maintain between border and text within border. // Must be 0 when BRC is a substructure of the TC. Stored in points for Windows. - WW8_BRCVer6() - { - memset(aBits1, 0, sizeof(aBits1)); - } + WW8_BRCVer6() = default; sal_uInt8 dxpLineWidth() const { return aBits1[0] & 0x07; } @@ -263,8 +260,8 @@ struct WW8_BRCVer6 // BoRder Code (WW6 version) struct WW8_BRC // BoRder Code (WW8 version) // Documented at http://msdn.microsoft.com/en-us/library/dd952599.aspx { - SVBT16 aBits1; - SVBT16 aBits2; + SVBT16 aBits1 = {}; + SVBT16 aBits2 = {}; // sal_uInt8 dptLineWidth; // sal_uInt8 brcType; // sal_uInt8 ico; @@ -272,11 +269,7 @@ struct WW8_BRC // BoRder Code (WW8 version) // bool fShadow : 1; // bool fFrame : 1; // bool fReserved : 1; - WW8_BRC() - { - memset(aBits1, 0, sizeof(aBits1)); - memset(aBits2, 0, sizeof(aBits2)); - } + WW8_BRC() = default; sal_uInt8 dptLineWidth() const // border line width (1/8pt) { return aBits1[0]; } @@ -315,19 +308,15 @@ typedef WW8_BRC WW8_BRC5[5]; // 5 * Border Code struct WW8_BRCVer9 // BoRder Code (WW9 version) // Documented at http://msdn.microsoft.com/en-us/library/dd907496.aspx { - SVBT32 aBits1; // border colour (RGB) - SVBT32 aBits2; + SVBT32 aBits1 = {}; // border colour (RGB) + SVBT32 aBits2 = {}; // sal_uInt8 dptLineWidth; // border line width (1/8pt) // sal_uInt8 brcType; // border type (eg single, double, dotted) // sal_uInt8 dptSpace : 5; // space between text & border (pt) // bool fShadow : 1; // border has shadow effect // bool fFrame : 1; // border has 3D effect // sal_uInt16 fReserved : 9; // unused - WW8_BRCVer9() - { - memset(aBits1, 0, sizeof(aBits1)); - memset(aBits2, 0, sizeof(aBits2)); - } + WW8_BRCVer9() = default; sal_uInt32 cv() const // colour value (BGR) { return SVBT32ToUInt32(aBits1); } @@ -1076,7 +1065,7 @@ struct SEPr // At odd index values [1,3,5,...] the column widths are stored. // At even index values [2,4,6,...] the spacings to the next columns are stored. // Value at index 0 is initialized with 0 and used for easier iteration on the array - sal_Int32 rgdxaColumnWidthSpacing[MAX_NO_OF_SEP_COLUMNS*2 + 1]; + sal_Int32 rgdxaColumnWidthSpacing[MAX_NO_OF_SEP_COLUMNS*2 + 1] = {}; sal_Int32 dxaColumnWidth; sal_uInt8 dmOrientFirst; diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index 0a87bcf17b5d..6cbff020669c 100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -27,11 +27,6 @@ #include <tools/globname.hxx> // ImpSvGlobalName ------------------------------------------------------------ -ImpSvGlobalName::ImpSvGlobalName() -{ - memset( &szData, 0, sizeof( szData ) ); -} - ImpSvGlobalName::ImpSvGlobalName( const ImpSvGlobalName & rObj ) : szData(rObj.szData) { @@ -80,8 +75,7 @@ SvGlobalName::SvGlobalName( sal_uInt32 n1, sal_uInt16 n2, sal_uInt16 n3, SvGlobalName::SvGlobalName( const css::uno::Sequence < sal_Int8 >& aSeq ) { // create SvGlobalName from a platform independent representation - SvGUID aResult; - memset( &aResult, 0, sizeof( aResult ) ); + SvGUID aResult = {}; if ( aSeq.getLength() == 16 ) { aResult.Data1 = ( ( ( ( ( static_cast<sal_uInt8>(aSeq[0]) << 8 ) + static_cast<sal_uInt8>(aSeq[1]) ) << 8 ) + static_cast<sal_uInt8>(aSeq[2]) ) << 8 ) + static_cast<sal_uInt8>(aSeq[3]); @@ -206,8 +200,7 @@ bool SvGlobalName::MakeId( const OUString & rIdStr ) pStr++; } - sal_Int8 szRemain[ 8 ]; - memset( szRemain, 0, sizeof( szRemain ) ); + sal_Int8 szRemain[ 8 ] = {}; pStr++; for( i = 0; i < 16; i++ ) { diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx index 631f4595738d..ee59d4b0291b 100644 --- a/ucb/source/ucp/webdav-neon/NeonSession.cxx +++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx @@ -2372,8 +2372,7 @@ OUString NeonSession::makeAbsoluteURL( OUString const & rURL ) const } else { - ne_uri aUri; - memset( &aUri, 0, sizeof( aUri ) ); + ne_uri aUri = {}; ne_fill_server_uri( m_pHttpSession, &aUri ); aUri.path diff --git a/vcl/inc/salframe.hxx b/vcl/inc/salframe.hxx index d4cdcba9b545..4b540d61ca0e 100644 --- a/vcl/inc/salframe.hxx +++ b/vcl/inc/salframe.hxx @@ -124,7 +124,7 @@ public: SalFrame(); virtual ~SalFrame() override; - SalFrameGeometry maGeometry; ///< absolute, unmirrored values + SalFrameGeometry maGeometry = {}; ///< absolute, unmirrored values // SalGeometryProvider virtual long GetWidth() const override { return maGeometry.nWidth; } diff --git a/vcl/inc/win/salframe.h b/vcl/inc/win/salframe.h index 76b3e1e69f54..25c6819bb7e2 100644 --- a/vcl/inc/win/salframe.h +++ b/vcl/inc/win/salframe.h @@ -39,7 +39,7 @@ public: HMENU mSelectedhMenu; // the menu where highlighting is currently going on HMENU mLastActivatedhMenu; // the menu that was most recently opened SystemEnvData maSysData; // system data - SalFrameState maState; // frame state + SalFrameState maState = {}; // frame state int mnShowState; // show state long mnWidth; // client width in pixeln long mnHeight; // client height in pixeln 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() diff --git a/vcl/win/gdi/salfont.cxx b/vcl/win/gdi/salfont.cxx index b09c6848a58d..9d8439c7387c 100644 --- a/vcl/win/gdi/salfont.cxx +++ b/vcl/win/gdi/salfont.cxx @@ -1177,8 +1177,7 @@ bool WinSalGraphics::AddTempDevFont(PhysicalFontCollection* pFontCollection, aInfo.mnFontCount = pFontCollection->Count(); const int nExpectedFontCount = aInfo.mnFontCount + nFonts; - LOGFONTW aLogFont; - memset(&aLogFont, 0, sizeof(aLogFont)); + LOGFONTW aLogFont = {}; aLogFont.lfCharSet = DEFAULT_CHARSET; aInfo.mpLogFont = &aLogFont; @@ -1233,8 +1232,7 @@ void WinSalGraphics::GetDevFontList( PhysicalFontCollection* pFontCollection ) aInfo.mbPrinter = mbPrinter; aInfo.mnFontCount = 0; - LOGFONTW aLogFont; - memset( &aLogFont, 0, sizeof( aLogFont ) ); + LOGFONTW aLogFont = {}; aLogFont.lfCharSet = DEFAULT_CHARSET; aInfo.mpLogFont = &aLogFont; diff --git a/vcl/win/gdi/salprn.cxx b/vcl/win/gdi/salprn.cxx index 73ade5080c55..83d5aa749e14 100644 --- a/vcl/win/gdi/salprn.cxx +++ b/vcl/win/gdi/salprn.cxx @@ -1488,8 +1488,7 @@ bool WinSalPrinter::StartJob( const OUString* pFileName, } } - DOCINFOW aInfo; - memset( &aInfo, 0, sizeof( DOCINFOW ) ); + DOCINFOW aInfo = {}; aInfo.cbSize = sizeof( aInfo ); aInfo.lpszDocName = o3tl::toW(rJobName.getStr()); if ( pFileName || aOutFileName.getLength() ) diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 73028b8a48ec..e021bfd216e9 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -868,10 +868,6 @@ WinSalFrame::WinSalFrame() mnDisplay = 0; mbPropertiesStored = false; - memset( &maState, 0, sizeof( SalFrameState ) ); - - memset( &maGeometry, 0, sizeof( maGeometry ) ); - // get data, when making 1st frame if ( !pSalData->mpFirstFrame ) { @@ -4341,8 +4337,7 @@ static bool ImplHandleMinMax( HWND hWnd, LPARAM lParam ) // if bByPosition is false then nPos denotes a menu id instead of a position static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, bool bByPosition=true ) { - MENUITEMINFOW mi; - memset(&mi, 0, sizeof(mi)); + MENUITEMINFOW mi = {}; mi.cbSize = sizeof( mi ); mi.fMask = MIIM_DATA; if( !GetMenuItemInfoW( hMenu, nPos, bByPosition, &mi) ) @@ -4354,8 +4349,7 @@ static WinSalMenuItem* ImplGetSalMenuItem( HMENU hMenu, UINT nPos, bool bByPosit // returns the index of the currently selected item if any or -1 static int ImplGetSelectedIndex( HMENU hMenu ) { - MENUITEMINFOW mi; - memset(&mi, 0, sizeof(mi)); + MENUITEMINFOW mi = {}; mi.cbSize = sizeof( mi ); mi.fMask = MIIM_STATE; int n = GetMenuItemCount( hMenu ); @@ -4430,8 +4424,7 @@ static LRESULT ImplMeasureItem( HWND hWnd, WPARAM wParam, LPARAM lParam ) HDC hdc = GetDC( hWnd ); SIZE strSize; - NONCLIENTMETRICSW ncm; - memset( &ncm, 0, sizeof(ncm) ); + NONCLIENTMETRICSW ncm = {}; ncm.cbSize = sizeof( ncm ); SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 ); @@ -4569,8 +4562,7 @@ static LRESULT ImplDrawItem(HWND, WPARAM wParam, LPARAM lParam ) x += bmpSize.Width() + 3; aRect.left = x; - NONCLIENTMETRICSW ncm; - memset( &ncm, 0, sizeof(ncm) ); + NONCLIENTMETRICSW ncm = {}; ncm.cbSize = sizeof( ncm ); SystemParametersInfoW( SPI_GETNONCLIENTMETRICS, 0, &ncm, 0 ); @@ -4703,8 +4695,7 @@ static bool ImplHandleMenuSelect( HWND hWnd, WPARAM wParam, LPARAM lParam ) { // submenu selected // wParam now carries an index instead of an id -> retrieve id - MENUITEMINFOW mi; - memset(&mi, 0, sizeof(mi)); + MENUITEMINFOW mi = {}; mi.cbSize = sizeof( mi ); mi.fMask = MIIM_ID; if( GetMenuItemInfoW( hMenu, LOWORD(wParam), TRUE, &mi) ) @@ -4892,8 +4883,7 @@ static void ImplHandleInputLangChange( HWND hWnd, WPARAM, LPARAM lParam ) static void ImplUpdateIMECursorPos( WinSalFrame* pFrame, HIMC hIMC ) { - COMPOSITIONFORM aForm; - memset( &aForm, 0, sizeof( aForm ) ); + COMPOSITIONFORM aForm = {}; // get cursor position and from it calculate default position // for the composition window diff --git a/vcl/win/window/salmenu.cxx b/vcl/win/window/salmenu.cxx index 9466d0cf8052..190f50730474 100644 --- a/vcl/win/window/salmenu.cxx +++ b/vcl/win/window/salmenu.cxx @@ -179,8 +179,7 @@ void WinSalMenu::RemoveItem( unsigned nPos ) { WinSalMenuItem *pSalMenuItem = nullptr; - MENUITEMINFOW mi; - memset( &mi, 0, sizeof(mi) ); + MENUITEMINFOW mi = {}; mi.cbSize = sizeof( mi ); mi.fMask = MIIM_DATA; if( !GetMenuItemInfoW( mhMenu, nPos, TRUE, &mi) ) @@ -206,8 +205,7 @@ static void ImplRemoveItemById( WinSalMenu *pSalMenu, unsigned nItemId ) WinSalMenuItem *pSalMenuItem = nullptr; - MENUITEMINFOW mi; - memset( &mi, 0, sizeof(mi) ); + MENUITEMINFOW mi = {}; mi.cbSize = sizeof( mi ); mi.fMask = MIIM_DATA; if( !GetMenuItemInfoW( pSalMenu->mhMenu, nItemId, FALSE, &mi) ) diff --git a/xmlhelp/source/cxxhelp/inc/tvread.hxx b/xmlhelp/source/cxxhelp/inc/tvread.hxx index c466fbba682b..5f87ca5cf542 100644 --- a/xmlhelp/source/cxxhelp/inc/tvread.hxx +++ b/xmlhelp/source/cxxhelp/inc/tvread.hxx @@ -44,7 +44,7 @@ namespace treeview { PRODUCTNAME, PRODUCTVERSION, VENDORNAME, VENDORVERSION, VENDORSHORT }; ConfigData(); - int m_vAdd[5]; + int m_vAdd[5] = {}; OUString m_vReplacement[5]; OUString prodName,prodVersion,vendName,vendVersion,vendShort; diff --git a/xmlhelp/source/treeview/tvread.cxx b/xmlhelp/source/treeview/tvread.cxx index d791692fc782..a01dd66a51ef 100644 --- a/xmlhelp/source/treeview/tvread.cxx +++ b/xmlhelp/source/treeview/tvread.cxx @@ -161,7 +161,6 @@ ConfigData::ConfigData() vendVersion("%VENDORVERSION"), vendShort("%VENDORSHORT") { - memset(m_vAdd, 0, sizeof(m_vAdd)); } void ConfigData::replaceName( OUString& oustring ) const diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx index 301415cea228..8bee4b376ba1 100644 --- a/xmloff/source/draw/ximpshap.cxx +++ b/xmloff/source/draw/ximpshap.cxx @@ -3872,7 +3872,6 @@ SvXMLImportContextRef SdXMLCustomShapeContext::CreateChildContext( SdXMLTableShapeContext::SdXMLTableShapeContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList>& xAttrList, css::uno::Reference< css::drawing::XShapes > const & rShapes ) : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, false ) { - memset( &maTemplateStylesUsed, 0, sizeof( maTemplateStylesUsed ) ); } SdXMLTableShapeContext::~SdXMLTableShapeContext() diff --git a/xmloff/source/draw/ximpshap.hxx b/xmloff/source/draw/ximpshap.hxx index acdd2de8ff13..fae45f88f00a 100644 --- a/xmloff/source/draw/ximpshap.hxx +++ b/xmloff/source/draw/ximpshap.hxx @@ -609,7 +609,7 @@ public: private: SvXMLImportContextRef mxTableImportContext; OUString msTemplateStyleName; - bool maTemplateStylesUsed[6]; + bool maTemplateStylesUsed[6] = {}; }; extern SvXMLEnumMapEntry<css::drawing::Alignment> const aXML_GlueAlignment_EnumMap[]; diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index 565f372a5219..d9b657891b96 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -773,8 +773,7 @@ sal_Int32 SecurityEnvironment_MSCryptImpl::verifyCertificate( CERT_ENHKEY_USAGE enhKeyUsage ; CERT_USAGE_MATCH certUsage ; - CERT_CHAIN_PARA chainPara ; - memset(&chainPara, 0, sizeof(CERT_CHAIN_PARA)); + CERT_CHAIN_PARA chainPara = {}; //Prepare parameter for CertGetCertificateChain enhKeyUsage.cUsageIdentifier = 0 ; |