From 88e1e8fb06180fe070aaf0065d9c3403b477cfd7 Mon Sep 17 00:00:00 2001 From: Patrick Luby Date: Thu, 2 Feb 2023 17:21:56 -0500 Subject: Fix build errors by suppressing warnings when building with Xcode 14.2 Apple started marking sprintf as deprecated in Xcode 14 so we need to suppress the deprecated warnings in order to build on iOS and macOS with Xcode 14 and higher. This also fixes the inability to open documents in the iOS app. Loading a document would fail to load the following symbols: com_sun_star_xml_crypto_SEInitializer_get_implementation com_sun_star_security_DocumentDigitalSignatures_get_implementation The problem was that these symbols are within an #if HAVE_FEATURE_NSS block in the generated workdir/CustomTarget/ios/native-code.h so we need to add an #include in solenv/bin/native-code.py like was added in commit fa5db38ae5bbe9abfd41b6765074ca1200b8def2. Change-Id: I541279eb307e5a9d589e3b39c684a49bf8cca14d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146536 Tested-by: Jenkins CollaboraOffice Reviewed-by: Patrick Luby Reviewed-by: Michael Meeks --- tools/source/inet/inetmsg.cxx | 2 ++ tools/source/misc/json_writer.cxx | 2 ++ tools/source/ref/globname.cxx | 10 ++++++++++ tools/source/stream/stream.cxx | 4 ++++ 4 files changed, 18 insertions(+) (limited to 'tools/source') diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index bb8a700d16f1..5c669d8cd012 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -263,9 +263,11 @@ void INetMIMEMessage::EnableAttachMultipartFormDataChild() tools::Time aCurTime( tools::Time::SYSTEM ); sal_uInt64 nThis = reinterpret_cast< sal_uIntPtr >( this ); // we can be on a 64bit architecture nThis = ( ( nThis >> 32 ) ^ nThis ) & SAL_MAX_UINT32; + SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK) sprintf (sTail, "%08X%08X", static_cast< unsigned int >(aCurTime.GetTime()), static_cast< unsigned int >(nThis)); + SAL_WNODEPRECATED_DECLARATIONS_POP m_aBoundary = "------------_4D48"; m_aBoundary += sTail; diff --git a/tools/source/misc/json_writer.cxx b/tools/source/misc/json_writer.cxx index 7730a9a603d5..16b3e52cb703 100644 --- a/tools/source/misc/json_writer.cxx +++ b/tools/source/misc/json_writer.cxx @@ -327,7 +327,9 @@ void JsonWriter::put(const char* pPropName, sal_Int64 nPropVal) memcpy(mPos, "\": ", 3); mPos += 3; + SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK) mPos += sprintf(mPos, "%" SAL_PRIdINT64, nPropVal); + SAL_WNODEPRECATED_DECLARATIONS_POP validate(); } diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index fda6fafab53c..8356eeaf04e3 100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -229,24 +229,34 @@ OUString SvGlobalName::GetHexName() const OStringBuffer aHexBuffer(36); char buf[ 10 ]; + SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK) sprintf( buf, "%8.8" SAL_PRIXUINT32, pImp->szData.Data1 ); + SAL_WNODEPRECATED_DECLARATIONS_POP aHexBuffer.append(buf); aHexBuffer.append('-'); + SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK) sprintf( buf, "%4.4X", pImp->szData.Data2 ); + SAL_WNODEPRECATED_DECLARATIONS_POP aHexBuffer.append(buf); aHexBuffer.append('-'); + SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK) sprintf( buf, "%4.4X", pImp->szData.Data3 ); + SAL_WNODEPRECATED_DECLARATIONS_POP aHexBuffer.append(buf); aHexBuffer.append('-'); for( int i = 0; i < 2; i++ ) { + SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK) sprintf( buf, "%2.2x", pImp->szData.Data4[ i ] ); + SAL_WNODEPRECATED_DECLARATIONS_POP aHexBuffer.append(buf); } aHexBuffer.append('-'); for( int i = 2; i < 8; i++ ) { + SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK) sprintf( buf, "%2.2x", pImp->szData.Data4[ i ] ); + SAL_WNODEPRECATED_DECLARATIONS_POP aHexBuffer.append(buf); } return OStringToOUString(aHexBuffer.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index d42cefdf63cf..b31699e835df 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -1347,7 +1347,9 @@ void SvStream::RefreshBuffer() SvStream& SvStream::WriteInt32AsString(sal_Int32 nInt32) { char buffer[12]; + SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK) std::size_t nLen = sprintf(buffer, "%" SAL_PRIdINT32, nInt32); + SAL_WNODEPRECATED_DECLARATIONS_POP WriteBytes(buffer, nLen); return *this; } @@ -1355,7 +1357,9 @@ SvStream& SvStream::WriteInt32AsString(sal_Int32 nInt32) SvStream& SvStream::WriteUInt32AsString(sal_uInt32 nUInt32) { char buffer[11]; + SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK) std::size_t nLen = sprintf(buffer, "%" SAL_PRIuUINT32, nUInt32); + SAL_WNODEPRECATED_DECLARATIONS_POP WriteBytes(buffer, nLen); return *this; } -- cgit