Kaydet (Commit) fa7ba556 authored tarafından Lionel Elie Mamane's avatar Lionel Elie Mamane

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
üst f805afcf
......@@ -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());
}
//------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment