idl/source/objects/object.cxx |    9 ++++++++-
 sfx2/source/control/msg.cxx   |    3 +--
 2 files changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 11db9b5fd5c20a6c3107583332f583370a7a6846
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Wed Jul 9 15:42:23 2025 +0100
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Sat Jul 12 11:19:47 2025 +0200

    use constexpr for idl "a ... Slots_Impl" objects
    
    after const clean up of the Slot* argument
    
    objdump -t instdir/program/libsclo.so |grep -v data.rel.ro|grep 
\\.data|c++filt|grep -v s_cd|wc
    
    before: 96
    after: 78
    
    while:
    
    pmap -px PID|grep 'rw.--'|grep -v anon|awk '{ sum+=$4 } END { print sum }'
    
    for a --with-distro=CPLinux-LOKit build and spawned kit calc process from
    2352 to 1860 pages
    
    Change-Id: Ic0ea3e7934ac469f7c6225c252506adb5b62a4c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187742
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>

diff --git a/idl/source/objects/object.cxx b/idl/source/objects/object.cxx
index 1f430cc393b7..92ed643ded30 100644
--- a/idl/source/objects/object.cxx
+++ b/idl/source/objects/object.cxx
@@ -311,7 +311,14 @@ void SvMetaClass::WriteSfx( SvIdlDataBase & rBase, 
SvStream & rOutStm )
     rOutStm << endl;
 
     // write slotmap
-    rOutStm.WriteOString("static SfxSlot a").WriteOString(GetName())
+    rOutStm.WriteOString("static ");
+#if defined(_MSC_VER) && _MSC_VER < 1931
+    
//https://developercommunity.visualstudio.com/t/Taking-the-address-of-a-constexpr-variab/1550408
+    rOutStm.WriteOString("const");
+#else
+    rOutStm.WriteOString("constexpr");
+#endif
+    rOutStm.WriteOString(" SfxSlot a").WriteOString(GetName())
         .WriteOString("Slots_Impl[").WriteOString(OString::number(nSlotCount 
== 0 ? 1 : nSlotCount)).WriteOString("] =") << endl;
     rOutStm.WriteChar( '{' ) << endl;
 
diff --git a/sfx2/source/control/msg.cxx b/sfx2/source/control/msg.cxx
index 9df69d00c5d4..a2404d297eae 100644
--- a/sfx2/source/control/msg.cxx
+++ b/sfx2/source/control/msg.cxx
@@ -35,11 +35,10 @@ SfxSlotKind SfxSlot::GetKind() const
         return SfxSlotKind::Attribute;
 }
 
-
 sal_uInt16 SfxSlot::GetWhich( const SfxItemPool &rPool ) const
 {
     if ( !nMasterSlotId || nMasterSlotId == USHRT_MAX )
-        const_cast<SfxSlot*>(this) -> nMasterSlotId = 
rPool.GetWhichIDFromSlotID(nSlotId);
+        return rPool.GetWhichIDFromSlotID(nSlotId);
     return nMasterSlotId;
 }
 

Reply via email to