diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-01-18 15:54:12 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-01-21 09:37:44 +0100 |
commit | 113536e974d7ebbbc484b0ef40406f9b4d14e511 (patch) | |
tree | d43dc6f98ec4fb2fb87df156260710d6fb0f8479 /sd | |
parent | 5e1e912010f35ee9ba5f387bdee82363d32a8105 (diff) |
Avoid -Werror=format-{overflow,truncation}=
...as emitted by at least GCC 8.2 with --enable-optimized, by making the buffers
large enough for the (hypothetical) largest values of the various date/time
components
Change-Id: I82e9b08fa099546b2d6f29c702e1440df9e6c6e0
Reviewed-on: https://gerrit.libreoffice.org/66618
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sd')
-rw-r--r-- | sd/source/filter/eppt/pptx-epptooxml.cxx | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index d2a5231c7d2e..ee6fb0b81569 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -1001,9 +1001,10 @@ bool PowerPointExport::WriteComments(sal_uInt32 nPageNum) Reference< XText > xText(xAnnotation->getTextRange()); sal_Int32 nLastIndex; sal_Int32 nId = GetAuthorIdAndLastIndex(xAnnotation->getAuthor(), nLastIndex); - char cDateTime[32]; + char cDateTime[sizeof("-32768-65535-65535T65535:65535:65535.4294967295")]; + // reserve enough space for hypothetical max length - snprintf(cDateTime, 31, "%02d-%02d-%02dT%02d:%02d:%02d.%09" SAL_PRIuUINT32, aDateTime.Year, aDateTime.Month, aDateTime.Day, aDateTime.Hours, aDateTime.Minutes, aDateTime.Seconds, aDateTime.NanoSeconds); + snprintf(cDateTime, sizeof cDateTime, "%02" SAL_PRIdINT32 "-%02" SAL_PRIuUINT32 "-%02" SAL_PRIuUINT32 "T%02" SAL_PRIuUINT32 ":%02" SAL_PRIuUINT32 ":%02" SAL_PRIuUINT32 ".%09" SAL_PRIuUINT32, sal_Int32(aDateTime.Year), sal_uInt32(aDateTime.Month), sal_uInt32(aDateTime.Day), sal_uInt32(aDateTime.Hours), sal_uInt32(aDateTime.Minutes), sal_uInt32(aDateTime.Seconds), aDateTime.NanoSeconds); pFS->startElementNS(XML_p, XML_cm, XML_authorId, I32S(nId), |