mirror of
https://github.com/LibreOffice/core.git
synced 2025-07-22 01:09:00 +00:00
-Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): tools
(The "clang-format off" in tools/source/misc/json_writer.cxx is necessary because otherwise the code between the SAL_WNODEPRECATED_DECLARATIONS_PUSH/POP macros would be ill-formatted in a way that would trigger loplugin:indentation.) Change-Id: Ic96787865d4c96be07c41f4939893420dfa04046 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142339 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
@ -23,6 +23,7 @@
|
||||
#include <comphelper/string.hxx>
|
||||
#include <rtl/character.hxx>
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <o3tl/sprintf.hxx>
|
||||
#include <o3tl/string_view.hxx>
|
||||
|
||||
#include <map>
|
||||
@ -265,7 +266,7 @@ 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;
|
||||
sprintf (sTail, "%08X%08X",
|
||||
o3tl::sprintf (sTail, "%08X%08X",
|
||||
static_cast< unsigned int >(aCurTime.GetTime()),
|
||||
static_cast< unsigned int >(nThis));
|
||||
m_aBoundary = "------------_4D48";
|
||||
|
@ -326,7 +326,11 @@ void JsonWriter::put(const char* pPropName, sal_Int64 nPropVal)
|
||||
memcpy(mPos, "\": ", 3);
|
||||
mPos += 3;
|
||||
|
||||
// clang-format off
|
||||
SAL_WNODEPRECATED_DECLARATIONS_PUSH // sprintf (macOS 13 SDK)
|
||||
mPos += sprintf(mPos, "%" SAL_PRIdINT64, nPropVal);
|
||||
SAL_WNODEPRECATED_DECLARATIONS_POP
|
||||
// clang-format on
|
||||
|
||||
validate();
|
||||
}
|
||||
|
@ -17,10 +17,10 @@
|
||||
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <comphelper/mimeconfighelper.hxx>
|
||||
#include <o3tl/sprintf.hxx>
|
||||
#include <rtl/character.hxx>
|
||||
|
||||
#include <tools/stream.hxx>
|
||||
@ -153,7 +153,7 @@ bool SvGlobalName::MakeId( std::u16string_view rIdStr )
|
||||
OUString SvGlobalName::GetHexName() const
|
||||
{
|
||||
char buf[ 37 ];
|
||||
int n = sprintf(buf,
|
||||
int n = o3tl::sprintf(buf,
|
||||
"%8.8" SAL_PRIXUINT32 "-%4.4X-%4.4X-%2.2x%2.2x-%2.2x%2.2x%2.2x%2.2x%2.2x%2.2x",
|
||||
m_aData.Data1, m_aData.Data2, m_aData.Data3,
|
||||
m_aData.Data4[0], m_aData.Data4[1], m_aData.Data4[2], m_aData.Data4[3],
|
||||
|
@ -26,12 +26,12 @@
|
||||
#include <memory>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <o3tl/safeint.hxx>
|
||||
#include <osl/endian.h>
|
||||
#include <osl/diagnose.h>
|
||||
#include <rtl/strbuf.hxx>
|
||||
#include <rtl/string.hxx>
|
||||
#include <rtl/ustrbuf.hxx>
|
||||
#include <sal/log.hxx>
|
||||
#include <tools/long.hxx>
|
||||
@ -1361,17 +1361,15 @@ void SvStream::RefreshBuffer()
|
||||
|
||||
SvStream& SvStream::WriteInt32AsString(sal_Int32 nInt32)
|
||||
{
|
||||
char buffer[12];
|
||||
std::size_t nLen = sprintf(buffer, "%" SAL_PRIdINT32, nInt32);
|
||||
WriteBytes(buffer, nLen);
|
||||
auto const buffer = OString::number(nInt32);
|
||||
WriteBytes(buffer.getStr(), buffer.length);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SvStream& SvStream::WriteUInt32AsString(sal_uInt32 nUInt32)
|
||||
{
|
||||
char buffer[11];
|
||||
std::size_t nLen = sprintf(buffer, "%" SAL_PRIuUINT32, nUInt32);
|
||||
WriteBytes(buffer, nLen);
|
||||
auto const buffer = OString::number(nUInt32);
|
||||
WriteBytes(buffer.getStr(), buffer.length);
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user