extensions/source/propctrlr/formcomponenthandler.cxx | 18 +++++++++--------- sal/osl/w32/socket.cxx | 16 ++++++++-------- sc/source/filter/xml/xmlimprt.cxx | 4 ++-- sd/source/filter/ppt/pptinanimations.cxx | 2 +- solenv/bin/native-code.py | 2 +- sw/source/core/unocore/unomap.cxx | 2 +- sw/source/filter/ww8/wrtww8.cxx | 2 +- tools/source/stream/strmwnt.cxx | 2 +- vcl/source/filter/FilterConfigCache.cxx | 4 ++-- vcl/source/filter/FilterConfigCache.hxx | 2 +- vcl/source/gdi/mapmod.cxx | 2 +- vcl/source/window/builder.cxx | 2 +- vcl/unx/generic/app/saldisp.cxx | 4 ++-- xmloff/source/draw/sdxmlimp.cxx | 4 ++-- 14 files changed, 33 insertions(+), 33 deletions(-)
New commits: commit 58b9b2fa7a1f4daebb6107f7faed452bac321dd3 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Sun Jul 13 21:47:07 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Wed Jul 23 15:55:16 2025 +0200 const up various static locals Change-Id: I0bbfd1daca973cc158f8d3a60b8df44cd5565f57 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187825 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 195a08e0b81d..0aecf98f5a0c 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -3021,7 +3021,7 @@ namespace pcr whose UI is to be disabled while the SQL command property is being edited. */ - virtual OUString* getPropertiesToDisable() = 0; + virtual const OUString* getPropertiesToDisable() = 0; }; @@ -3056,7 +3056,7 @@ namespace pcr virtual void setEscapeProcessing( const bool _bEscapeProcessing ) const override; // ISQLCommandPropertyUI - virtual OUString* getPropertiesToDisable() override; + virtual const OUString* getPropertiesToDisable() override; }; @@ -3099,14 +3099,14 @@ namespace pcr } - OUString* FormSQLCommandUI::getPropertiesToDisable() + const OUString* FormSQLCommandUI::getPropertiesToDisable() { - static OUString s_aCommandProps[] = { + static constexpr OUString s_aCommandProps[] = { PROPERTY_DATASOURCE, PROPERTY_COMMAND, PROPERTY_COMMANDTYPE, PROPERTY_ESCAPE_PROCESSING, - OUString() + u""_ustr }; return s_aCommandProps; } @@ -3125,7 +3125,7 @@ namespace pcr virtual void setEscapeProcessing( const bool _bEscapeProcessing ) const override; // ISQLCommandPropertyUI - virtual OUString* getPropertiesToDisable() override; + virtual const OUString* getPropertiesToDisable() override; private: mutable bool m_bPropertyValueIsList; }; @@ -3194,12 +3194,12 @@ namespace pcr } - OUString* ValueListCommandUI::getPropertiesToDisable() + const OUString* ValueListCommandUI::getPropertiesToDisable() { - static OUString s_aListSourceProps[] = { + static constexpr OUString s_aListSourceProps[] = { PROPERTY_LISTSOURCETYPE, PROPERTY_LISTSOURCE, - OUString() + u""_ustr }; return s_aListSourceProps; } diff --git a/sal/osl/w32/socket.cxx b/sal/osl/w32/socket.cxx index 354ce2db5942..8f6ef2b925da 100644 --- a/sal/osl/w32/socket.cxx +++ b/sal/osl/w32/socket.cxx @@ -64,7 +64,7 @@ #define OSL_INVALID_SOCKET INVALID_SOCKET /* WIN32 */ #define OSL_SOCKET_ERROR SOCKET_ERROR /* WIN32 */ -static DWORD FamilyMap[]= { +static const DWORD FamilyMap[]= { AF_INET, /* osl_Socket_FamilyInet */ AF_IPX, /* osl_Socket_FamilyIpx */ 0 /* osl_Socket_FamilyInvalid */ @@ -85,7 +85,7 @@ static oslAddrFamily osl_AddrFamilyFromNative(DWORD nativeType) #define FAMILY_FROM_NATIVE(y) osl_AddrFamilyFromNative(y) #define FAMILY_TO_NATIVE(x) static_cast<short>(FamilyMap[x]) -static DWORD ProtocolMap[]= { +static const DWORD ProtocolMap[]= { 0, /* osl_Socket_FamilyInet */ NSPROTO_IPX, /* osl_Socket_FamilyIpx */ NSPROTO_SPX, /* osl_Socket_ProtocolSpx */ @@ -95,7 +95,7 @@ static DWORD ProtocolMap[]= { #define PROTOCOL_TO_NATIVE(x) ProtocolMap[x] -static DWORD TypeMap[]= { +static const DWORD TypeMap[]= { SOCK_STREAM, /* osl_Socket_TypeStream */ SOCK_DGRAM, /* osl_Socket_TypeDgram */ SOCK_RAW, /* osl_Socket_TypeRaw */ @@ -119,7 +119,7 @@ static oslSocketType osl_SocketTypeFromNative(DWORD nativeType) #define TYPE_TO_NATIVE(x) TypeMap[x] #define TYPE_FROM_NATIVE(y) osl_SocketTypeFromNative(y) -static DWORD OptionMap[]= { +static const DWORD OptionMap[]= { SO_DEBUG, /* osl_Socket_OptionDebug */ SO_ACCEPTCONN, /* osl_Socket_OptionAcceptConn */ SO_REUSEADDR, /* osl_Socket_OptionReuseAddr */ @@ -143,7 +143,7 @@ static DWORD OptionMap[]= { #define OPTION_TO_NATIVE(x) OptionMap[x] -static DWORD OptionLevelMap[]= { +static const DWORD OptionLevelMap[]= { SOL_SOCKET, /* osl_Socket_LevelSocket */ IPPROTO_TCP, /* osl_Socket_LevelTcp */ 0 /* osl_invalid_SocketLevel */ @@ -151,7 +151,7 @@ static DWORD OptionLevelMap[]= { #define OPTION_LEVEL_TO_NATIVE(x) OptionLevelMap[x] -static DWORD SocketMsgFlagMap[]= { +static const DWORD SocketMsgFlagMap[]= { 0, /* osl_Socket_MsgNormal */ MSG_OOB, /* osl_Socket_MsgOOB */ MSG_PEEK, /* osl_Socket_MsgPeek */ @@ -161,7 +161,7 @@ static DWORD SocketMsgFlagMap[]= { #define MSG_FLAG_TO_NATIVE(x) SocketMsgFlagMap[x] -static DWORD SocketDirection[]= { +static const DWORD SocketDirection[]= { SD_RECEIVE, /* osl_Socket_DirRead */ SD_SEND, /* osl_Socket_DirWrite */ SD_BOTH /* osl_Socket_DirReadwrite */ @@ -169,7 +169,7 @@ static DWORD SocketDirection[]= { #define DIRECTION_TO_NATIVE(x) SocketDirection[x] -static int SocketError[]= { +static const int SocketError[]= { 0, /* no error */ WSAENOTSOCK, /* Socket operation on non-socket */ WSAEDESTADDRREQ, /* Destination address required */ diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 4fe9904f6db0..501deb66de35 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -475,14 +475,14 @@ SvXMLImportContext *ScXMLImport::CreateScriptContext() void ScXMLImport::SetStatistics(const uno::Sequence<beans::NamedValue> & i_rStats) { - static const char* s_stats[] = + static const char* const s_stats[] = { "TableCount", "CellCount", "ObjectCount", nullptr }; SvXMLImport::SetStatistics(i_rStats); sal_uInt64 nCount(0); for (const auto& rStat : i_rStats) { - for (const char** pStat = s_stats; *pStat != nullptr; ++pStat) { + for (const char*const* pStat = s_stats; *pStat != nullptr; ++pStat) { if (rStat.Name.equalsAscii(*pStat)) { sal_Int32 val = 0; if (rStat.Value >>= val) { diff --git a/sd/source/filter/ppt/pptinanimations.cxx b/sd/source/filter/ppt/pptinanimations.cxx index 68abaa7933bb..a4e86d7bdb53 100644 --- a/sd/source/filter/ppt/pptinanimations.cxx +++ b/sd/source/filter/ppt/pptinanimations.cxx @@ -2894,7 +2894,7 @@ void AnimationImporter::dump( Any& rAny ) { if( aEvent.Trigger != EventTrigger::NONE ) { - static const char* triggers[] = + static const char* const triggers[] = { "none","onbegin","onend","begin", "end","onclick","ondoubleclick","onmouseenter", diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 0026ad1943a3..7e77d45b4dc3 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -887,7 +887,7 @@ for entry in sorted(custom_widgets): print ('void make' + entry + '();') print ('typedef void (*custom_widget_func)();') print ('#if !ENABLE_FUZZERS') -print ('static struct { const char *name; custom_widget_func func; } custom_widgets[] = {') +print ('static struct { const char *name; custom_widget_func func; } const custom_widgets[] = {') for entry in sorted(custom_widgets): print (' { "make' + entry + '", make' + entry + ' },') print ('};') diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx index 977028ceb9de..1804773e6a8a 100644 --- a/sw/source/core/unocore/unomap.cxx +++ b/sw/source/core/unocore/unomap.cxx @@ -1414,7 +1414,7 @@ std::span<const SfxItemPropertyMapEntry> SwUnoPropertyMapProvider::GetPropertyMa break; case PROPERTY_MAP_TEXT_VIEW : { - static SfxItemPropertyMapEntry pTextViewMap[] = + static SfxItemPropertyMapEntry const pTextViewMap[] = { {UNO_NAME_PAGE_COUNT, WID_PAGE_COUNT, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY, 0}, {UNO_NAME_LINE_COUNT, WID_LINE_COUNT, cppu::UnoType<sal_Int32>::get(), PropertyAttribute::READONLY, 0}, diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index 91f74fc27b12..48a1b24fdf12 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2543,7 +2543,7 @@ void WW8AttributeOutput::TableDefinition(const ww8::WW8TableNodeInfoInner::Point lcl_TCFlags(m_rWW8Export.m_rDoc, pTabBox1, *aItRowSpans); m_rWW8Export.InsUInt16( nFlags ); - static sal_uInt8 aNullBytes[] = { 0x0, 0x0 }; + static const sal_uInt8 aNullBytes[] = { 0x0, 0x0 }; m_rWW8Export.m_pO->insert( m_rWW8Export.m_pO->end(), aNullBytes, aNullBytes+2 ); // dummy if (pBoxFormat != nullptr) diff --git a/tools/source/stream/strmwnt.cxx b/tools/source/stream/strmwnt.cxx index d7d3a73ed2ce..aa39a7f4434e 100644 --- a/tools/source/stream/strmwnt.cxx +++ b/tools/source/stream/strmwnt.cxx @@ -38,7 +38,7 @@ using namespace osl; static ErrCode GetSvError( DWORD nWntError ) { - static struct { DWORD wnt; ErrCode sv; } errArr[] = + static const struct { DWORD wnt; ErrCode sv; } errArr[] = { { ERROR_SUCCESS, ERRCODE_NONE }, { ERROR_ACCESS_DENIED, SVSTREAM_ACCESS_DENIED }, diff --git a/vcl/source/filter/FilterConfigCache.cxx b/vcl/source/filter/FilterConfigCache.cxx index 4ea3ebb859e4..6bbf80415673 100644 --- a/vcl/source/filter/FilterConfigCache.cxx +++ b/vcl/source/filter/FilterConfigCache.cxx @@ -40,7 +40,7 @@ using namespace ::com::sun::star::uno ; // Reference using namespace ::com::sun::star::beans ; // PropertyValue using namespace ::com::sun::star::configuration ; -const char* FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameList[] = +const char* const FilterConfigCache::FilterConfigCacheEntry::InternalPixelFilterNameList[] = { IMP_BMP, IMP_GIF, IMP_PNG, IMP_JPEG, IMP_TIFF, IMP_WEBP, IMP_XBM, IMP_XPM, IMP_TGA, IMP_PICT, IMP_MET, IMP_RAS, @@ -53,7 +53,7 @@ void FilterConfigCache::FilterConfigCacheEntry::CreateFilterName( const OUString { bIsPixelFormat = false; sFilterName = rUserDataEntry; - const char** pPtr; + const char*const* pPtr; for ( pPtr = InternalPixelFilterNameList; *pPtr; pPtr++ ) { if ( sFilterName.equalsIgnoreAsciiCaseAscii( *pPtr ) ) diff --git a/vcl/source/filter/FilterConfigCache.hxx b/vcl/source/filter/FilterConfigCache.hxx index ce2e8432416d..3dae6f81ab75 100644 --- a/vcl/source/filter/FilterConfigCache.hxx +++ b/vcl/source/filter/FilterConfigCache.hxx @@ -44,7 +44,7 @@ class FilterConfigCache void CreateFilterName( const OUString& rUserDataEntry ); OUString GetShortName( ); - static const char* InternalPixelFilterNameList[]; + static const char* const InternalPixelFilterNameList[]; }; diff --git a/vcl/source/gdi/mapmod.cxx b/vcl/source/gdi/mapmod.cxx index 45c7a29a817d..85d8b6d48914 100644 --- a/vcl/source/gdi/mapmod.cxx +++ b/vcl/source/gdi/mapmod.cxx @@ -83,7 +83,7 @@ namespace } MapMode::ImplType GetUnitDefault(MapUnit mapUnit) { - static MapMode::ImplType defaults[] + static const MapMode::ImplType defaults[] { MapMode::ImplType( MapMode::ImplMapMode(MapUnit::Map100thMM) ), MapMode::ImplType( MapMode::ImplMapMode(MapUnit::Map10thMM) ), diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 878907cdc5ec..ec7d5ca49dd1 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1305,7 +1305,7 @@ extern "C" VclBuilder::customMakeWidget lo_get_custom_widget_func(const char* na extern "C" void makeNotebookbarTabControl(VclPtr<vcl::Window> &rRet, const VclPtr<vcl::Window> &pParent, VclBuilder::stringmap &rVec); extern "C" void makeNotebookbarToolBox(VclPtr<vcl::Window> &rRet, const VclPtr<vcl::Window> &pParent, VclBuilder::stringmap &rVec); -static struct { const char *name; VclBuilder::customMakeWidget func; } custom_widgets[] = { +static struct { const char *name; VclBuilder::customMakeWidget func; } const custom_widgets[] = { { "makeNotebookbarTabControl", makeNotebookbarTabControl }, { "makeNotebookbarToolBox", makeNotebookbarToolBox }, }; diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index cd55a26eef4c..f972beb46165 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -1447,8 +1447,8 @@ KeySym SalDisplay::GetKeySym( XKeyEvent *pEvent, } // Pointer -static unsigned char nullmask_bits[] = { 0x00, 0x00, 0x00, 0x00 }; -static unsigned char nullcurs_bits[] = { 0x00, 0x00, 0x00, 0x00 }; +const unsigned char nullmask_bits[] = { 0x00, 0x00, 0x00, 0x00 }; +const unsigned char nullcurs_bits[] = { 0x00, 0x00, 0x00, 0x00 }; #define MAKE_BITMAP( name ) \ XCreateBitmapFromData( pDisp_, \ diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index 2cf82579f078..c46d397c1167 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -580,14 +580,14 @@ void SdXMLImport::SetConfigurationSettings(const css::uno::Sequence<css::beans:: void SdXMLImport::SetStatistics( const uno::Sequence<beans::NamedValue> & i_rStats) { - static const char* s_stats[] = + static const char* const s_stats[] = { "ObjectCount", nullptr }; SvXMLImport::SetStatistics(i_rStats); sal_uInt32 nCount(10); for (const auto& rStat : i_rStats) { - for (const char** pStat = s_stats; *pStat != nullptr; ++pStat) { + for (const char*const* pStat = s_stats; *pStat != nullptr; ++pStat) { if (rStat.Name.equalsAscii(*pStat)) { sal_Int32 val = 0; if (rStat.Value >>= val) {