basic/source/runtime/dllmgr-x64.cxx              |    2 +-
 connectivity/source/drivers/odbc/OConnection.cxx |    8 ++++----
 dbaccess/source/core/api/RowSetBase.cxx          |    2 +-
 extensions/source/scanner/scanwin.cxx            |    7 ++++---
 oox/qa/unit/testscene3d.cxx                      |    6 +++---
 oox/source/drawingml/scene3dhelper.cxx           |    2 +-
 sfx2/source/doc/docfile.cxx                      |    3 ++-
 svx/source/gallery2/galtheme.cxx                 |    2 +-
 sw/source/core/SwNumberTree/SwNumberTree.cxx     |    2 +-
 sw/source/ui/dbui/addresslistdialog.cxx          |    2 +-
 vcl/source/control/combobox.cxx                  |    8 ++++----
 vcl/source/control/imp_listbox.cxx               |    2 +-
 vcl/source/control/listbox.cxx                   |   12 ++++++------
 vcl/source/window/builder.cxx                    |    6 +++---
 14 files changed, 33 insertions(+), 31 deletions(-)

New commits:
commit f093cad87e830fecae4322b06e75d5da2ff27bb3
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Feb 22 22:14:04 2024 +0600
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Feb 23 01:35:28 2024 +0100

    Fix warning C4312 when building with MSVC without -Wv:18
    
    Discovered by https://gerrit.libreoffice.org/c/core/+/163717
    
    Like these:
    
     C:/lo/core/oox/qa/unit/testscene3d.cxx(1): warning C4828: The file 
contains a character starting at offset 0x21ac that is illegal in the current 
source character set (codepage 65001).
    
    Change-Id: Id1f69b2644ecb5302e15603dd5353a34757e76dd
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163782
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/oox/qa/unit/testscene3d.cxx b/oox/qa/unit/testscene3d.cxx
index 27987089a339..6ca9e332d11f 100644
--- a/oox/qa/unit/testscene3d.cxx
+++ b/oox/qa/unit/testscene3d.cxx
@@ -164,8 +164,8 @@ CPPUNIT_TEST_FIXTURE(TestScene3d, test_obliqueTopRight)
     // MS Office applies the shape rotation after the camera rotations in case 
of oblique preset
     // camera types. That needs to be converted to the 'first shape rotation' 
specification of ODF.
     // That conversion results in angles not available in the UI of 
LibreOffice, but LO can
-    // render them. The shape has got these rotation in the UI of MS Office: 
60� shape ,
-    // 50� on x-axis, 10� on y-axis and 40� on z-axis.
+    // render them. The shape has got these rotation in the UI of MS Office: 
60° shape ,
+    // 50° on x-axis, 10° on y-axis and 40° on z-axis.
     loadFromFile(u"Scene3d_obliqueTopRight.pptx");
     uno::Reference<drawing::XShape> xShape(getShape(0, 0)); // shape 0 on page 0
 
@@ -184,7 +184,7 @@ CPPUNIT_TEST_FIXTURE(TestScene3d, test_obliqueTopRight)
     // Should be an oblique projection with non default skew values
     aExtrusionPropMap.getValue(u"Skew"_ustr) >>= aParaPair;
     CPPUNIT_ASSERT_DOUBLES_EQUAL(30.0, aParaPair.First.Value.get<double>(), 
1E-14);
-    // -135� from preset camera type, minus 60� shape rotation
+    // -135° from preset camera type, minus 60° shape rotation
     CPPUNIT_ASSERT_DOUBLES_EQUAL(-195.0, aParaPair.Second.Value.get<double>(), 
1E-14);
 
     // Because of the needed conversions the resulting angles are very 
different from
diff --git a/oox/source/drawingml/scene3dhelper.cxx 
b/oox/source/drawingml/scene3dhelper.cxx
index b72ca4a38f78..ac7f0fd0450e 100644
--- a/oox/source/drawingml/scene3dhelper.cxx
+++ b/oox/source/drawingml/scene3dhelper.cxx
@@ -356,7 +356,7 @@ void Scene3DHelper::addProjectionGeometryToMap(
         {
             double fFov = (*p3DProperties).mfFieldOfVision.value();
             fFov = std::clamp(fFov, 0.5, 179.5);
-            // 15976 = 25000 * tan(32.5�) as in legacy. Better ideas to 
calculate the distance are
+            // 15976 = 25000 * tan(32.5°) as in legacy. Better ideas to 
calculate the distance are
             // welcome.
             aViewPoint.PositionZ = 15976.0 / tan(basegfx::deg2rad(fFov / 2.0));
         }
commit d37df8fd1a681db758de6f4acfe6479e8e78b2dd
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Feb 22 22:12:53 2024 +0600
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Fri Feb 23 01:35:14 2024 +0100

    Fix warning C4312 when building with MSVC without -Wv:18
    
    Discovered by https://gerrit.libreoffice.org/c/core/+/163717
    
    Like these:
    
     C:/lo/core/sw/source/ui/dbui/addresslistdialog.cxx(426): warning C4312: 
'reinterpret_cast': conversion from 'int' to 'void *' of greater size
    
    Change-Id: Idbfbe8add89c8e219bdabcf28b741e2e31a5e345
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163781
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/basic/source/runtime/dllmgr-x64.cxx 
b/basic/source/runtime/dllmgr-x64.cxx
index 0a3d334ce49d..ec5f79c4ab3e 100644
--- a/basic/source/runtime/dllmgr-x64.cxx
+++ b/basic/source/runtime/dllmgr-x64.cxx
@@ -611,7 +611,7 @@ ErrCode getProcData(HMODULE handle, OUString const & name, 
ProcData * proc)
 {
     assert(proc != nullptr);
     if (name.getLength() != 0 && name[0] == '@') { //TODO: "@" vs. "#"???
-        sal_Int32 n = o3tl::toInt32(name.subView(1)); //TODO: handle bad input
+        sal_IntPtr n = o3tl::toInt32(name.subView(1)); //TODO: handle bad input
         if (n <= 0 || n > 0xFFFF) {
             return ERRCODE_BASIC_BAD_ARGUMENT; //TODO: more specific errcode?
         }
diff --git a/connectivity/source/drivers/odbc/OConnection.cxx 
b/connectivity/source/drivers/odbc/OConnection.cxx
index 7ae8c46802e2..1189ba88b6cf 100644
--- a/connectivity/source/drivers/odbc/OConnection.cxx
+++ b/connectivity/source/drivers/odbc/OConnection.cxx
@@ -98,7 +98,7 @@ SQLRETURN OConnection::OpenConnection(const OUString& 
aConnectStr, sal_Int32 nTi
     memcpy(szConnStrIn, aConStr.getStr(), 
std::min<sal_Int32>(sal_Int32(2048),aConStr.getLength()));
 
 #ifndef MACOSX
-    
N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,reinterpret_cast<SQLPOINTER>(nTimeOut),SQL_IS_UINTEGER);
+    
N3SQLSetConnectAttr(m_aConnectionHandle,SQL_ATTR_LOGIN_TIMEOUT,reinterpret_cast<SQLPOINTER>(static_cast<sal_IntPtr>(nTimeOut)),SQL_IS_UINTEGER);
 #else
     (void)nTimeOut; /* WaE */
 #endif
@@ -312,10 +312,10 @@ void SAL_CALL OConnection::setAutoCommit( sal_Bool 
autoCommit )
     ::osl::MutexGuard aGuard( m_aMutex );
     checkDisposed(OConnection_BASE::rBHelper.bDisposed);
 
-
+    const sal_IntPtr nAutocommit = autoCommit ? SQL_AUTOCOMMIT_ON : 
SQL_AUTOCOMMIT_OFF;
     OTools::ThrowException(this,N3SQLSetConnectAttr(m_aConnectionHandle,
                                    SQL_ATTR_AUTOCOMMIT,
-                                   reinterpret_cast<SQLPOINTER>((autoCommit) ? 
SQL_AUTOCOMMIT_ON : SQL_AUTOCOMMIT_OFF) ,SQL_IS_INTEGER),
+                                   reinterpret_cast<SQLPOINTER>(nAutocommit) 
,SQL_IS_INTEGER),
                                    m_aConnectionHandle,SQL_HANDLE_DBC,*this);
 }
 
@@ -423,7 +423,7 @@ void SAL_CALL OConnection::setTransactionIsolation( 
sal_Int32 level )
 
     OTools::ThrowException(this,N3SQLSetConnectAttr(m_aConnectionHandle,
                                    SQL_ATTR_TXN_ISOLATION,
-                                   
reinterpret_cast<SQLPOINTER>(level),SQL_IS_INTEGER),
+                                   
reinterpret_cast<SQLPOINTER>(static_cast<sal_IntPtr>(level)),SQL_IS_INTEGER),
                                    m_aConnectionHandle,SQL_HANDLE_DBC,*this);
 }
 
diff --git a/dbaccess/source/core/api/RowSetBase.cxx 
b/dbaccess/source/core/api/RowSetBase.cxx
index 753c857eecc0..042f1fabc2d0 100644
--- a/dbaccess/source/core/api/RowSetBase.cxx
+++ b/dbaccess/source/core/api/RowSetBase.cxx
@@ -228,7 +228,7 @@ const ORowSetValue& ORowSetBase::impl_getValue(sal_Int32 
columnIndex)
         for (; k != m_pCache->getEnd(); ++k)
         {
             ORowSetValueVector* pTemp = k->get();
-            OSL_ENSURE( pTemp != reinterpret_cast<void*>(0xfeeefeee),"HALT!" );
+            OSL_ENSURE( pTemp != 
reinterpret_cast<void*>(sal_uIntPtr(0xfeeefeee)),"HALT!" );
         }
         OSL_ENSURE(!m_aCurrentRow.isNull() && m_aCurrentRow < 
m_pCache->getEnd() && aCacheIter != m_pCache->m_aCacheIterators.end(),"Invalid 
iterator set for currentrow!");
 #endif
diff --git a/extensions/source/scanner/scanwin.cxx 
b/extensions/source/scanner/scanwin.cxx
index 109f2944a3b5..198b092846cd 100644
--- a/extensions/source/scanner/scanwin.cxx
+++ b/extensions/source/scanner/scanwin.cxx
@@ -253,9 +253,10 @@ void Twain::ShimListenerThread::execute()
                 ThrowLastError("DuplicateHandle");
             // we will not need our copy as soon as shim has its own inherited 
one
             ScopedHANDLE hScopedDup(hDup);
-            DWORD nDup = 
static_cast<DWORD>(reinterpret_cast<sal_uIntPtr>(hDup));
-            if (reinterpret_cast<HANDLE>(nDup) != hDup)
-                throw std::exception("HANDLE does not fit to 32 bit - cannot 
pass to shim!");
+            sal_uIntPtr nDup = reinterpret_cast<sal_uIntPtr>(hDup);
+            if constexpr (sizeof(sal_uIntPtr) > 4)
+                if (nDup > 0xFFFFFFFF)
+                    throw std::exception("HANDLE does not fit to 32 bit - 
cannot pass to shim!");
 
             // Send this thread handle as the first parameter
             sCmdLine = "\"" + sCmdLine + "\" " + OUString::number(nDup);
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index 88f712e6989b..c90fb794f690 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -3042,7 +3042,8 @@ void SfxMedium::GetMedium_Impl()
     pImpl->bDownloadDone = true;
     pImpl->aDoneLink.ClearPendingCall();
     ErrCodeMsg nError = GetErrorIgnoreWarning();
-    pImpl->aDoneLink.Call( 
reinterpret_cast<void*>(sal_uInt32(nError.GetCode())) );
+    sal_uIntPtr nErrorCode = sal_uInt32(nError.GetCode());
+    pImpl->aDoneLink.Call( reinterpret_cast<void*>(nErrorCode) );
 }
 
 bool SfxMedium::IsRemote() const
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 1fd04b454249..4b6d0c86200a 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -88,7 +88,7 @@ void GalleryTheme::ImplBroadcast(sal_uInt32 nUpdatePos)
         if( GetObjectCount() && ( nUpdatePos >= GetObjectCount() ) )
             nUpdatePos = GetObjectCount() - 1;
 
-        Broadcast( GalleryHint( GalleryHintType::THEME_UPDATEVIEW, GetName(), 
reinterpret_cast<void*>(nUpdatePos) ) );
+        Broadcast( GalleryHint( GalleryHintType::THEME_UPDATEVIEW, GetName(), 
reinterpret_cast<void*>(static_cast<sal_uIntPtr>(nUpdatePos)) ) );
     }
 }
 
diff --git a/sw/source/core/SwNumberTree/SwNumberTree.cxx 
b/sw/source/core/SwNumberTree/SwNumberTree.cxx
index 30cdff34b7bc..423a12bf582e 100644
--- a/sw/source/core/SwNumberTree/SwNumberTree.cxx
+++ b/sw/source/core/SwNumberTree/SwNumberTree.cxx
@@ -55,7 +55,7 @@ SwNumberTreeNode::~SwNumberTreeNode()
 
     OSL_ENSURE( IsPhantom() || mpParent == nullptr, ": I'm not supposed to 
have a parent.");
 
-    mpParent = reinterpret_cast<SwNumberTreeNode *>(0xdeadbeef);
+    mpParent = reinterpret_cast<SwNumberTreeNode *>(sal_uIntPtr(0xdeadbeef));
 
     OSL_ENSURE(mChildren.empty(), "children left!");
 }
diff --git a/sw/source/ui/dbui/addresslistdialog.cxx 
b/sw/source/ui/dbui/addresslistdialog.cxx
index 1f4f99a8b590..30df8ce37ce2 100644
--- a/sw/source/ui/dbui/addresslistdialog.cxx
+++ b/sw/source/ui/dbui/addresslistdialog.cxx
@@ -421,7 +421,7 @@ IMPL_LINK_NOARG(SwAddressListDialog, EditHdl_Impl, 
weld::Button&, void)
 
 IMPL_LINK_NOARG(SwAddressListDialog, ListBoxSelectHdl_Impl, weld::TreeView&, 
void)
 {
-    int nSelect = m_xListLB->get_selected_index();
+    sal_IntPtr nSelect = m_xListLB->get_selected_index();
     Application::PostUserEvent( LINK( this, SwAddressListDialog,
                                       StaticListBoxSelectHdl_Impl ), 
reinterpret_cast<void*>(nSelect) );
 }
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx
index 2a979b70b0a3..db66391d2cc4 100644
--- a/vcl/source/control/combobox.cxx
+++ b/vcl/source/control/combobox.cxx
@@ -895,7 +895,7 @@ sal_Int32 ComboBox::InsertEntry(const OUString& rStr, 
sal_Int32 const nPos)
 
     nRealPos = m_pImpl->m_pImplLB->InsertEntry( nRealPos, rStr );
     nRealPos -= m_pImpl->m_pImplLB->GetEntryList().GetMRUCount();
-    CallEventListeners( VclEventId::ComboboxItemAdded, 
reinterpret_cast<void*>(nRealPos) );
+    CallEventListeners( VclEventId::ComboboxItemAdded, 
reinterpret_cast<void*>(static_cast<sal_IntPtr>(nRealPos)) );
     return nRealPos;
 }
 
@@ -916,7 +916,7 @@ sal_Int32 ComboBox::InsertEntryWithImage(
 
     nRealPos = m_pImpl->m_pImplLB->InsertEntry( nRealPos, rStr, rImage );
     nRealPos -= m_pImpl->m_pImplLB->GetEntryList().GetMRUCount();
-    CallEventListeners( VclEventId::ComboboxItemAdded, 
reinterpret_cast<void*>(nRealPos) );
+    CallEventListeners( VclEventId::ComboboxItemAdded, 
reinterpret_cast<void*>(static_cast<sal_IntPtr>(nRealPos)) );
     return nRealPos;
 }
 
@@ -925,7 +925,7 @@ void ComboBox::RemoveEntryAt(sal_Int32 const nPos)
     const sal_Int32 nMRUCount = 
m_pImpl->m_pImplLB->GetEntryList().GetMRUCount();
     assert(nPos >= 0 && nPos <= COMBOBOX_MAX_ENTRIES - nMRUCount);
     m_pImpl->m_pImplLB->RemoveEntry( nPos + nMRUCount );
-    CallEventListeners( VclEventId::ComboboxItemRemoved, 
reinterpret_cast<void*>(nPos) );
+    CallEventListeners( VclEventId::ComboboxItemRemoved, 
reinterpret_cast<void*>(static_cast<sal_IntPtr>(nPos)) );
 }
 
 void ComboBox::Clear()
@@ -933,7 +933,7 @@ void ComboBox::Clear()
     if (!m_pImpl->m_pImplLB)
         return;
     m_pImpl->m_pImplLB->Clear();
-    CallEventListeners( VclEventId::ComboboxItemRemoved, 
reinterpret_cast<void*>(-1) );
+    CallEventListeners( VclEventId::ComboboxItemRemoved, 
reinterpret_cast<void*>(sal_IntPtr(-1)) );
 }
 
 Image ComboBox::GetEntryImage( sal_Int32 nPos ) const
diff --git a/vcl/source/control/imp_listbox.cxx 
b/vcl/source/control/imp_listbox.cxx
index bb4da51859b0..488c032a89f6 100644
--- a/vcl/source/control/imp_listbox.cxx
+++ b/vcl/source/control/imp_listbox.cxx
@@ -1552,7 +1552,7 @@ namespace
 
         // vcl::StringEntryIdentifier does not allow for 0 values, but our 
position is 0-based
         // => normalize
-        return reinterpret_cast< vcl::StringEntryIdentifier >( _nPos + 1 );
+        return reinterpret_cast< vcl::StringEntryIdentifier >( _nPos + 
sal_IntPtr(1) );
     }
 
     sal_Int32 lcl_getEntryPos( vcl::StringEntryIdentifier _entry )
diff --git a/vcl/source/control/listbox.cxx b/vcl/source/control/listbox.cxx
index e189c8480f05..81e9eafdc33e 100644
--- a/vcl/source/control/listbox.cxx
+++ b/vcl/source/control/listbox.cxx
@@ -191,7 +191,7 @@ IMPL_LINK_NOARG(ListBox, ImplSelectHdl, LinkParamNone*, 
void)
 
 IMPL_LINK( ListBox, ImplFocusHdl, sal_Int32, nPos, void )
 {
-    CallEventListeners( VclEventId::ListboxFocus, 
reinterpret_cast<void*>(nPos) );
+    CallEventListeners( VclEventId::ListboxFocus, 
reinterpret_cast<void*>(static_cast<sal_IntPtr>(nPos)) );
 }
 
 IMPL_LINK_NOARG( ListBox, ImplListItemSelectHdl, LinkParamNone*, void )
@@ -945,7 +945,7 @@ sal_Int32 ListBox::InsertEntry( const OUString& rStr, 
sal_Int32 nPos )
 {
     sal_Int32 nRealPos = mpImplLB->InsertEntry( nPos + 
mpImplLB->GetEntryList().GetMRUCount(), rStr );
     nRealPos = sal::static_int_cast<sal_Int32>(nRealPos - 
mpImplLB->GetEntryList().GetMRUCount());
-    CallEventListeners( VclEventId::ListboxItemAdded, 
reinterpret_cast<void*>(nRealPos) );
+    CallEventListeners( VclEventId::ListboxItemAdded, 
reinterpret_cast<void*>(static_cast<sal_IntPtr>(nRealPos)) );
     return nRealPos;
 }
 
@@ -953,14 +953,14 @@ sal_Int32 ListBox::InsertEntry( const OUString& rStr, 
const Image& rImage, sal_I
 {
     sal_Int32 nRealPos = mpImplLB->InsertEntry( nPos + 
mpImplLB->GetEntryList().GetMRUCount(), rStr, rImage );
     nRealPos = sal::static_int_cast<sal_Int32>(nRealPos - 
mpImplLB->GetEntryList().GetMRUCount());
-    CallEventListeners( VclEventId::ListboxItemAdded, 
reinterpret_cast<void*>(nRealPos) );
+    CallEventListeners( VclEventId::ListboxItemAdded, 
reinterpret_cast<void*>(static_cast<sal_IntPtr>(nRealPos)) );
     return nRealPos;
 }
 
 void ListBox::RemoveEntry( sal_Int32 nPos )
 {
     mpImplLB->RemoveEntry( nPos + mpImplLB->GetEntryList().GetMRUCount() );
-    CallEventListeners( VclEventId::ListboxItemRemoved, 
reinterpret_cast<void*>(nPos) );
+    CallEventListeners( VclEventId::ListboxItemRemoved, 
reinterpret_cast<void*>(static_cast<sal_IntPtr>(nPos)) );
 }
 
 Image ListBox::GetEntryImage( sal_Int32 nPos ) const
@@ -1043,9 +1043,9 @@ void ListBox::SelectEntryPos( sal_Int32 nPos, bool 
bSelect )
         //Only when bSelect == true, send both Selection & Focus events
         if (nCurrentPos != nPos && bSelect)
         {
-            CallEventListeners( VclEventId::ListboxSelect, 
reinterpret_cast<void*>(nPos));
+            CallEventListeners( VclEventId::ListboxSelect, 
reinterpret_cast<void*>(static_cast<sal_IntPtr>(nPos)));
             if (HasFocus())
-                CallEventListeners( VclEventId::ListboxFocus, 
reinterpret_cast<void*>(nPos));
+                CallEventListeners( VclEventId::ListboxFocus, 
reinterpret_cast<void*>(static_cast<sal_IntPtr>(nPos)));
         }
     }
 }
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 28d789f64b8f..88e82ac52138 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -4202,7 +4202,7 @@ void VclBuilder::mungeModel(ComboBox &rTarget, const 
ListStore &rStore, sal_uInt
         {
             if (m_bLegacy)
             {
-                sal_Int32 nValue = rRow[1].toInt32();
+                sal_IntPtr nValue = rRow[1].toInt32();
                 rTarget.SetEntryData(nEntry, reinterpret_cast<void*>(nValue));
             }
             else
@@ -4229,7 +4229,7 @@ void VclBuilder::mungeModel(ListBox &rTarget, const 
ListStore &rStore, sal_uInt1
         {
             if (m_bLegacy)
             {
-                sal_Int32 nValue = rRow[1].toInt32();
+                sal_IntPtr nValue = rRow[1].toInt32();
                 rTarget.SetEntryData(nEntry, reinterpret_cast<void*>(nValue));
             }
             else
@@ -4256,7 +4256,7 @@ void VclBuilder::mungeModel(SvTabListBox& rTarget, const 
ListStore &rStore, sal_
         {
             if (m_bLegacy)
             {
-                sal_Int32 nValue = rRow[1].toInt32();
+                sal_IntPtr nValue = rRow[1].toInt32();
                 pEntry->SetUserData(reinterpret_cast<void*>(nValue));
             }
             else

Reply via email to