connectivity/source/commontools/dbconversion.cxx | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-)
New commits: commit 3914b95c4cb9aa404918161f0654b0cbf65a2d83 Author: Caolán McNamara <caol...@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 <c...@libreoffice.org> Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@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)
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits