summaryrefslogtreecommitdiff
path: root/basic
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2022-11-05 15:54:12 +0100
committerStephan Bergmann <sbergman@redhat.com>2022-11-05 17:17:54 +0100
commite88cb2d41fa8cbd4513285d0b2521f91561dd971 (patch)
treedec02943799e9914e1bb90843d4aba7d3f00e388 /basic
parent90e1bf18aa33af9de8be8e489be8b5a3a8f8e940 (diff)
-Werror,-Wdeprecated-declarations (sprintf, macOS 13 SDK): basic
Change-Id: If70c3bf8d7d6c855baf23b02cccb3f3b5ccb9f64 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142321 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r--basic/source/sbx/sbxform.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/basic/source/sbx/sbxform.cxx b/basic/source/sbx/sbxform.cxx
index 76372bf23f2a..e97524a019e3 100644
--- a/basic/source/sbx/sbxform.cxx
+++ b/basic/source/sbx/sbxform.cxx
@@ -24,7 +24,9 @@
#include <rtl/ustrbuf.hxx>
#include <rtl/character.hxx>
+#include <o3tl/sprintf.hxx>
#include <o3tl/string_view.hxx>
+#include <string_view>
#include <utility>
/*
@@ -234,17 +236,16 @@ void SbxBasicFormater::InitScan( double _dNum )
dNum = _dNum;
InitExp( get_number_of_digits( dNum ) );
// maximum of 15 positions behind the decimal point, example: -1.234000000000000E-001
- /*int nCount =*/ sprintf( sBuffer,"%+22.15lE",dNum );
+ /*int nCount =*/ o3tl::sprintf( sBuffer,"%+22.15lE",dNum );
sSciNumStrg = OUString::createFromAscii( sBuffer );
}
void SbxBasicFormater::InitExp( double _dNewExp )
{
- char sBuffer[ MAX_DOUBLE_BUFFER_LENGTH ];
nNumExp = static_cast<short>(_dNewExp);
- /*int nCount =*/ sprintf( sBuffer,"%+i",nNumExp );
- sNumExpStrg = OUString::createFromAscii( sBuffer );
+ sNumExpStrg = (nNumExp >= 0 ? std::u16string_view(u"+") : std::u16string_view(u""))
+ + OUString::number(nNumExp);
nExpExp = static_cast<short>(get_number_of_digits( static_cast<double>(nNumExp) ));
}