basic/source/sbx/sbxobj.cxx                          |    4 ++--
 basic/source/sbx/sbxvar.cxx                          |    2 +-
 bridges/source/cpp_uno/shared/component.cxx          |    4 ++--
 cppu/source/uno/lbenv.cxx                            |    4 ++--
 include/vcl/weld.hxx                                 |    2 +-
 slideshow/source/engine/animationnodes/nodetools.cxx |    2 +-
 sw/source/core/fields/cellfml.cxx                    |   12 ++++++------
 vcl/unx/gtk3/gtksalmenu.cxx                          |    2 +-
 8 files changed, 16 insertions(+), 16 deletions(-)

New commits:
commit ca550863f7d2e650116582dee298388ea3a97725
Author:     Stephan Bergmann <sberg...@redhat.com>
AuthorDate: Tue Aug 9 11:30:32 2022 +0200
Commit:     Stephan Bergmann <sberg...@redhat.com>
CommitDate: Wed Aug 10 13:40:09 2022 +0200

    Better cast to sal_[u]IntPtr when passing pointer to O[U]String::number
    
    Change-Id: I5b7a0fa060c1e0ae4aa194e0c1862f303dd8a2d7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138062
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sberg...@redhat.com>

diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index a6cbeaba5ca7..f83324a26bb8 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -700,7 +700,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
     OString aNameStr(OUStringToOString(GetName(), RTL_TEXTENCODING_ASCII_US));
     OString aClassNameStr(OUStringToOString(aClassName, 
RTL_TEXTENCODING_ASCII_US));
     rStrm.WriteCharPtr( "Object( " )
-         .WriteOString( OString::number(reinterpret_cast<sal_Int64>(this)) 
).WriteCharPtr( "=='" )
+         .WriteOString( OString::number(reinterpret_cast<sal_IntPtr>(this)) 
).WriteCharPtr( "=='" )
          .WriteCharPtr( aNameStr.isEmpty() ?  "<unnamed>" : aNameStr.getStr()  
).WriteCharPtr( "', " )
          .WriteCharPtr( "of class '" ).WriteOString( aClassNameStr 
).WriteCharPtr( "', " )
          .WriteCharPtr( "counts " )
@@ -710,7 +710,7 @@ void SbxObject::Dump( SvStream& rStrm, bool bFill )
     {
         OString aParentNameStr(OUStringToOString(GetName(), 
RTL_TEXTENCODING_ASCII_US));
         rStrm.WriteCharPtr( "in parent " )
-             .WriteOString( 
OString::number(reinterpret_cast<sal_Int64>(GetParent())) )
+             .WriteOString( 
OString::number(reinterpret_cast<sal_IntPtr>(GetParent())) )
              .WriteCharPtr( "=='" ).WriteCharPtr( aParentNameStr.isEmpty() ? 
"<unnamed>" : aParentNameStr.getStr()   ).WriteCharPtr( "'" );
     }
     else
diff --git a/basic/source/sbx/sbxvar.cxx b/basic/source/sbx/sbxvar.cxx
index 947b24ff9421..b73b93c0733d 100644
--- a/basic/source/sbx/sbxvar.cxx
+++ b/basic/source/sbx/sbxvar.cxx
@@ -572,7 +572,7 @@ void SbxVariable::Dump( SvStream& rStrm, bool bFill )
 {
     OString aBNameStr(OUStringToOString(GetName( SbxNameType::ShortTypes ), 
RTL_TEXTENCODING_ASCII_US));
     rStrm.WriteCharPtr( "Variable( " )
-         .WriteOString( OString::number(reinterpret_cast<sal_Int64>(this)) 
).WriteCharPtr( "==" )
+         .WriteOString( OString::number(reinterpret_cast<sal_IntPtr>(this)) 
).WriteCharPtr( "==" )
          .WriteOString( aBNameStr );
     OString aBParentNameStr(OUStringToOString(GetParent()->GetName(), 
RTL_TEXTENCODING_ASCII_US));
     if ( GetParent() )
diff --git a/bridges/source/cpp_uno/shared/component.cxx 
b/bridges/source/cpp_uno/shared/component.cxx
index cef72d8b6a8e..0a2f1a25150f 100644
--- a/bridges/source/cpp_uno/shared/component.cxx
+++ b/bridges/source/cpp_uno/shared/component.cxx
@@ -88,12 +88,12 @@ static void s_stub_computeObjectIdentifier(va_list * pParam)
         {
             // interface
             OUString aRet =
-                OUString::number( reinterpret_cast< sal_Int64 >(xHome.get()), 
16 ) +
+                OUString::number( reinterpret_cast< sal_IntPtr >(xHome.get()), 
16 ) +
                 ";" +
                 // ;environment[context]
                 OUString::unacquired(&pEnv->aBase.pTypeName) +
                 "[" +
-                OUString::number( reinterpret_cast< sal_Int64 
>(pEnv->aBase.pContext), 16 ) +
+                OUString::number( reinterpret_cast< sal_IntPtr 
>(pEnv->aBase.pContext), 16 ) +
                 // ];good guid
                 cppu_cppenv_getStaticOIdPart();
             *ppOId = aRet.pData;
diff --git a/cppu/source/uno/lbenv.cxx b/cppu/source/uno/lbenv.cxx
index 3e0152c969a1..55195bc228b7 100644
--- a/cppu/source/uno/lbenv.cxx
+++ b/cppu/source/uno/lbenv.cxx
@@ -850,10 +850,10 @@ static void unoenv_computeObjectIdentifier(
     (*pUnoI->release)( pUnoI );
     OUString aStr(
         // interface
-        OUString::number( reinterpret_cast< sal_Int64 >(pUnoI), 16 ) + ";"
+        OUString::number( reinterpret_cast< sal_IntPtr >(pUnoI), 16 ) + ";"
         // environment[context]
         + OUString::unacquired(&pEnv->aBase.pTypeName) + "["
-        + OUString::number( reinterpret_cast< sal_Int64 >(
+        + OUString::number( reinterpret_cast< sal_IntPtr >(
                     reinterpret_cast<
                     uno_Environment * >(pEnv)->pContext ), 16 )
         // process;good guid
diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx
index 1ffa2d877408..b3bbe60a7390 100644
--- a/include/vcl/weld.hxx
+++ b/include/vcl/weld.hxx
@@ -654,7 +654,7 @@ public:
 
 inline OUString toId(const void* pValue)
 {
-    return OUString::number(reinterpret_cast<sal_uInt64>(pValue));
+    return OUString::number(reinterpret_cast<sal_uIntPtr>(pValue));
 }
 
 template <typename T> T fromId(const OUString& rValue)
diff --git a/slideshow/source/engine/animationnodes/nodetools.cxx 
b/slideshow/source/engine/animationnodes/nodetools.cxx
index f509e680c04b..c6b5c86f737f 100644
--- a/slideshow/source/engine/animationnodes/nodetools.cxx
+++ b/slideshow/source/engine/animationnodes/nodetools.cxx
@@ -34,7 +34,7 @@ namespace slideshow::internal
         {
             return OUString::number(lcl_nOffset) +
                 " - 0x" +
-                OUString::number(reinterpret_cast<sal_Int64>(pNode), 16);
+                OUString::number(reinterpret_cast<sal_IntPtr>(pNode), 16);
         }
 
         void debugNodesShowTree( const BaseNode* pNode )
diff --git a/sw/source/core/fields/cellfml.cxx 
b/sw/source/core/fields/cellfml.cxx
index 6cf4f48f3bf9..0b25bf75e90d 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -471,7 +471,7 @@ void SwTableFormula::RelBoxNmsToPtr( const SwTable& rTable, 
OUStringBuffer& rNew
     {
         const SwTableBox *pRelLastBox = lcl_RelToBox( rTable, pBox, *pLastBox 
);
         if ( pRelLastBox )
-            rNewStr.append(reinterpret_cast<sal_PtrDiff>(pRelLastBox));
+            rNewStr.append(reinterpret_cast<sal_IntPtr>(pRelLastBox));
         else
             rNewStr.append("0");
         rNewStr.append(":");
@@ -480,7 +480,7 @@ void SwTableFormula::RelBoxNmsToPtr( const SwTable& rTable, 
OUStringBuffer& rNew
 
     const SwTableBox *pRelFirstBox = lcl_RelToBox( rTable, pBox, rFirstBox );
     if ( pRelFirstBox )
-        rNewStr.append(reinterpret_cast<sal_PtrDiff>(pRelFirstBox));
+        rNewStr.append(reinterpret_cast<sal_IntPtr>(pRelFirstBox));
     else
         rNewStr.append("0");
 
@@ -565,13 +565,13 @@ void SwTableFormula::BoxNmsToPtr( const SwTable& rTable, 
OUStringBuffer& rNewStr
     if( pLastBox )
     {
         pBox = rTable.GetTableBox( *pLastBox );
-        rNewStr.append(OUString::number(reinterpret_cast<sal_PtrDiff>(pBox)) +
+        rNewStr.append(OUString::number(reinterpret_cast<sal_IntPtr>(pBox)) +
                     ":");
         rFirstBox = rFirstBox.copy( pLastBox->getLength()+1 );
     }
 
     pBox = rTable.GetTableBox( rFirstBox );
-    rNewStr.append(reinterpret_cast<sal_PtrDiff>(pBox))
+    rNewStr.append(reinterpret_cast<sal_IntPtr>(pBox))
             .append(rFirstBox[ rFirstBox.getLength()-1 ]); // get label for 
the box
 }
 
@@ -1230,9 +1230,9 @@ void SwTableFormula::SplitMergeBoxNm_( const SwTable& 
rTable, OUStringBuffer& rN
     }
 
     if( pLastBox )
-        
rNewStr.append(OUString::number(reinterpret_cast<sal_PtrDiff>(pEndBox)) + ":");
+        rNewStr.append(OUString::number(reinterpret_cast<sal_IntPtr>(pEndBox)) 
+ ":");
 
-    rNewStr.append(reinterpret_cast<sal_PtrDiff>(pSttBox))
+    rNewStr.append(reinterpret_cast<sal_IntPtr>(pSttBox))
             .append(rFirstBox[ rFirstBox.getLength()-1] );
 }
 
diff --git a/vcl/unx/gtk3/gtksalmenu.cxx b/vcl/unx/gtk3/gtksalmenu.cxx
index 53c1f66504cd..ca515f51eb9e 100644
--- a/vcl/unx/gtk3/gtksalmenu.cxx
+++ b/vcl/unx/gtk3/gtksalmenu.cxx
@@ -31,7 +31,7 @@ static bool bUnityMode = false;
 static gchar* GetCommandForItem(GtkSalMenu* pParentMenu, sal_uInt16 nItemId)
 {
     OString aCommand = "window-" +
-        OString::number(reinterpret_cast<unsigned long>(pParentMenu)) +
+        OString::number(reinterpret_cast<sal_uIntPtr>(pParentMenu)) +
         "-" + OString::number(nItemId);
     return g_strdup(aCommand.getStr());
 }

Reply via email to