sw/source/core/doc/dbgoutsw.cxx | 22 ++++------------------ sw/source/filter/ww8/WW8TableInfo.cxx | 6 ++++-- 2 files changed, 8 insertions(+), 20 deletions(-)
New commits: commit 5cbc2052815f6640a118d64202872a082ad558b3 Author: Stephan Bergmann <sberg...@redhat.com> AuthorDate: Sat Nov 5 16:04:06 2022 +0100 Commit: Stephan Bergmann <sberg...@redhat.com> CommitDate: Sun Nov 6 01:13:15 2022 +0100 -Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): sw Change-Id: I64ff2d2c78e09b4fdeaeef7cc82c96572f049ceb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142336 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sberg...@redhat.com> diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx index 9b7f37a219fc..eecb4cd05545 100644 --- a/sw/source/core/doc/dbgoutsw.cxx +++ b/sw/source/core/doc/dbgoutsw.cxx @@ -70,13 +70,7 @@ static OUString lcl_dbg_out_SvPtrArr(const T & rArr) const char * dbg_out(const void * pVoid) { - char sBuffer[1024]; - - sprintf(sBuffer, "%p", pVoid); - - OUString aTmpStr(sBuffer, strlen(sBuffer), RTL_TEXTENCODING_ASCII_US); - - return dbg_out(aTmpStr); + return dbg_out(OUString::number(reinterpret_cast<sal_uIntPtr>(pVoid), 16)); } const char * dbg_out(std::u16string_view aStr) @@ -386,11 +380,8 @@ const char * dbg_out(const SwRect & rRect) static OUString lcl_dbg_out(const SwFrameFormat & rFrameFormat) { - char sBuffer[256]; - sprintf(sBuffer, "%p", &rFrameFormat); - OUString aResult = "[ " + - OUString(sBuffer, strlen(sBuffer), RTL_TEXTENCODING_ASCII_US) + + OUString::number(reinterpret_cast<sal_uIntPtr>(&rFrameFormat), 16) + "(" + rFrameFormat.GetName() + ")"; @@ -481,9 +472,6 @@ static OUString lcl_dbg_out_NumType(sal_Int16 nType) static OUString lcl_dbg_out(const SwNode & rNode) { - char aBuffer[128]; - sprintf(aBuffer, "%p", &rNode); - OUString aTmpStr = "<node " "index=\"" + OUString::number(sal_Int32(rNode.GetIndex())) + @@ -495,7 +483,7 @@ static OUString lcl_dbg_out(const SwNode & rNode) OUString::number(sal_Int32( rNode.GetNodeType() ) ) + "\"" " pointer=\"" + - OUString(aBuffer, strlen(aBuffer), RTL_TEXTENCODING_ASCII_US) + + OUString::number(reinterpret_cast<sal_uIntPtr>(&rNode), 16) + "\">"; const SwTextNode * pTextNode = rNode.GetTextNode(); @@ -732,9 +720,7 @@ static OUString lcl_dbg_out(const SwNumRuleTable & rTable) aResult.append(rTable[n]->GetName()); - char sBuffer[256]; - sprintf(sBuffer, "(%p)", rTable[n]); - aResult.appendAscii(sBuffer); + aResult.append("(" + OUString::number(reinterpret_cast<sal_uIntPtr>(rTable[n]), 16) + ")"); } aResult.append("]"); diff --git a/sw/source/filter/ww8/WW8TableInfo.cxx b/sw/source/filter/ww8/WW8TableInfo.cxx index e087d515fc5f..56aef2e1e8a6 100644 --- a/sw/source/filter/ww8/WW8TableInfo.cxx +++ b/sw/source/filter/ww8/WW8TableInfo.cxx @@ -28,6 +28,7 @@ #include <dbgoutsw.hxx> #include <sal/log.hxx> #include <osl/diagnose.h> +#include <rtl/string.hxx> namespace ww8 { @@ -1274,8 +1275,9 @@ std::string WW8TableCellGrid::toString() static char sBuffer[1024]; while (aTopsIt != getRowTopsEnd()) { - sprintf(sBuffer, "<row y=\"%" SAL_PRIdINT64 "\">", sal_Int64(*aTopsIt)); - sResult += sBuffer; + sResult += "<row y=\""; + sResult += OString::number(*aTopsIt).getStr(); + sResult += "\">"; CellInfoMultiSet::const_iterator aCellIt = getCellsBegin(*aTopsIt); CellInfoMultiSet::const_iterator aCellsEnd = getCellsEnd(*aTopsIt);