diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-11-05 16:08:39 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-11-06 01:13:45 +0100 |
commit | 4280a3257948e57cdf194a6e23718b46d907bbd6 (patch) | |
tree | 48196ddf19e5f9a00c916dde710e2b1200345131 /tools/source/stream/stream.cxx | |
parent | 5cbc2052815f6640a118d64202872a082ad558b3 (diff) |
-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>
Diffstat (limited to 'tools/source/stream/stream.cxx')
-rw-r--r-- | tools/source/stream/stream.cxx | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index f6d703423828..d5abf5e2d9e2 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -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; } |