[Libreoffice-commits] core.git: connectivity/source
Lionel Elie Mamane
lionel at mamane.lu
Thu Apr 18 14:11:18 PDT 2013
connectivity/source/commontools/dbconversion.cxx | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
New commits:
commit fa7ba55605e6a0d415830ff970bb0429426e9880
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date: Thu Apr 18 23:08:53 2013 +0200
WaE use std streams instead of C-style format strings
Cannot satisfy all platforms warning-free with one C format string
(sometimes it is "unsigned int" and sometimes "unsigned long"),
so avoid the problem altogether and use C++ streams.
Change-Id: I898d776c753dedbd79d4a56c580912613e865dda
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx
index cb87151..b23cd3b 100644
--- a/connectivity/source/commontools/dbconversion.cxx
+++ b/connectivity/source/commontools/dbconversion.cxx
@@ -82,16 +82,13 @@ namespace dbtools
//------------------------------------------------------------------
OUString DBTypeConversion::toTimeString(const Time& rTime)
{
- const size_t buflen = 19;
- sal_Char s[buflen];
- snprintf(s,
- buflen,
- "%02d:%02d:%02d.%09d",
- rTime.Hours,
- rTime.Minutes,
- rTime.Seconds,
- rTime.NanoSeconds);
- return OUString::createFromAscii(s);
+ std::ostringstream ostr;
+ ostr.fill('0');
+ ostr.width(2);
+ ostr << rTime.Hours << ":" << rTime.Minutes << ":" << rTime.Seconds;
+ ostr.width(9);
+ ostr << "." << rTime.NanoSeconds;
+ return OUString::createFromAscii(ostr.str().c_str());
}
//------------------------------------------------------------------
More information about the Libreoffice-commits
mailing list