diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2013-04-18 23:08:53 +0200 |
---|---|---|
committer | Lionel Elie Mamane <lionel@mamane.lu> | 2013-04-18 23:09:08 +0200 |
commit | fa7ba55605e6a0d415830ff970bb0429426e9880 (patch) | |
tree | d30e2691a58225aff08559702fcec4dd4ea9557a /connectivity | |
parent | f805afcf4c3056feb1690393d907442cf337b484 (diff) |
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
Diffstat (limited to 'connectivity')
-rw-r--r-- | connectivity/source/commontools/dbconversion.cxx | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/connectivity/source/commontools/dbconversion.cxx b/connectivity/source/commontools/dbconversion.cxx index cb8715102864..b23cd3b0de8b 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()); } //------------------------------------------------------------------ |