connectivity/source/drivers/firebird/PreparedStatement.cxx | 30 +++---------- connectivity/source/drivers/firebird/PreparedStatement.hxx | 2 2 files changed, 10 insertions(+), 22 deletions(-)
New commits: commit 028ae168ca787e5c92560d051009a0f115911b57 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Sep 4 10:38:47 2024 +0500 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Sep 4 11:28:53 2024 +0200 Use value-initialization instead of conditional compilation Also fix loplugin:stringviewparam warning, unexpectedly appeared here - see https://ci.libreoffice.org/job/gerrit_linux_clang_dbgutil/169049/consoleFull#-882392342baec2b5c-2b20-4190-a3fa-ceac4be9cf93 Change-Id: I789f23c946a55194baa2b4e9a3f3c2a70385301d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172852 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/connectivity/source/drivers/firebird/PreparedStatement.cxx b/connectivity/source/drivers/firebird/PreparedStatement.cxx index 1c63cdb25fcc..c1ebd314ea7e 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.cxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.cxx @@ -660,11 +660,8 @@ void SAL_CALL OPreparedStatement::setClob(sal_Int32 nParameterIndex, const Refer ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); -#if SAL_TYPES_SIZEOFPOINTER == 8 - isc_blob_handle aBlobHandle = 0; -#else - isc_blob_handle aBlobHandle = nullptr; -#endif + // value-initialization: isc_blob_handle may be either a pointer of an integer + isc_blob_handle aBlobHandle{}; ISC_QUAD aBlobId; openBlobForWriting(aBlobHandle, aBlobId); @@ -709,17 +706,14 @@ void SAL_CALL OPreparedStatement::setClob(sal_Int32 nParameterIndex, const Refer setValue< ISC_QUAD >(nParameterIndex, aBlobId, SQL_BLOB); } -void OPreparedStatement::setClob( sal_Int32 nParameterIndex, const OUString& rStr ) +void OPreparedStatement::setClob(sal_Int32 nParameterIndex, std::u16string_view rStr) { ::osl::MutexGuard aGuard( m_aMutex ); checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); checkParameterIndex(nParameterIndex); -#if SAL_TYPES_SIZEOFPOINTER == 8 - isc_blob_handle aBlobHandle = 0; -#else - isc_blob_handle aBlobHandle = nullptr; -#endif + // value-initialization: isc_blob_handle may be either a pointer of an integer + isc_blob_handle aBlobHandle{}; ISC_QUAD aBlobId; openBlobForWriting(aBlobHandle, aBlobId); @@ -785,11 +779,8 @@ void SAL_CALL OPreparedStatement::setBlob(sal_Int32 nParameterIndex, checkDisposed(OStatementCommonBase_Base::rBHelper.bDisposed); checkParameterIndex(nParameterIndex); -#if SAL_TYPES_SIZEOFPOINTER == 8 - isc_blob_handle aBlobHandle = 0; -#else - isc_blob_handle aBlobHandle = nullptr; -#endif + // value-initialization: isc_blob_handle may be either a pointer of an integer + isc_blob_handle aBlobHandle{}; ISC_QUAD aBlobId; openBlobForWriting(aBlobHandle, aBlobId); @@ -919,11 +910,8 @@ void SAL_CALL OPreparedStatement::setBytes(sal_Int32 nParameterIndex, if( dType == SQL_BLOB ) { -#if SAL_TYPES_SIZEOFPOINTER == 8 - isc_blob_handle aBlobHandle = 0; -#else - isc_blob_handle aBlobHandle = nullptr; -#endif + // value-initialization: isc_blob_handle may be either a pointer of an integer + isc_blob_handle aBlobHandle{}; ISC_QUAD aBlobId; openBlobForWriting(aBlobHandle, aBlobId); diff --git a/connectivity/source/drivers/firebird/PreparedStatement.hxx b/connectivity/source/drivers/firebird/PreparedStatement.hxx index 3e61436b5874..42e540664dda 100644 --- a/connectivity/source/drivers/firebird/PreparedStatement.hxx +++ b/connectivity/source/drivers/firebird/PreparedStatement.hxx @@ -75,7 +75,7 @@ namespace connectivity::firebird * Assumes that all necessary mutexes have been taken. */ void closeBlobAfterWriting(isc_blob_handle& rBlobHandle); - void setClob(sal_Int32 nParamIndex, const OUString& rStr); + void setClob(sal_Int32 nParamIndex, std::u16string_view rStr); protected: virtual void SAL_CALL setFastPropertyValue_NoBroadcast(sal_Int32 nHandle,