[Libreoffice-commits] core.git: connectivity/source
Caolán McNamara
caolanm at redhat.com
Sat Aug 5 15:27:41 UTC 2017
connectivity/source/commontools/dbconversion.cxx | 16 +++++++---------
1 file changed, 7 insertions(+), 9 deletions(-)
New commits:
commit 3914b95c4cb9aa404918161f0654b0cbf65a2d83
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Aug 3 16:32:37 2017 +0100
silence snprintf warning
"note: ‘snprintf’ output between 11 and 19 bytes into a destination of size 11"
Change-Id: I2ff3661ddd9c2729a76856e576ba83580b0143ea
Reviewed-on: https://gerrit.libreoffice.org/40731
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index 964b98672eb2..4d24bc3a7829 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -75,15 +75,13 @@ namespace dbtools
OUString DBTypeConversion::toDateString(const css::util::Date& rDate)
{
- sal_Char s[11];
- snprintf(s,
- sizeof(s),
- "%04d-%02d-%02d",
- (int)rDate.Year,
- (int)rDate.Month,
- (int)rDate.Day);
- s[10] = 0;
- return OUString::createFromAscii(s);
+ std::ostringstream ostr;
+ using std::setw;
+ ostr.fill('0');
+ ostr << setw(4) << rDate.Year << "-"
+ << setw(2) << rDate.Month << "-"
+ << setw(2) << rDate.Day;
+ return OUString::createFromAscii(ostr.str().c_str());
}
OUString DBTypeConversion::toTimeStringS(const css::util::Time& rTime)
More information about the Libreoffice-commits
mailing list