diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-01-18 15:42:26 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-01-21 09:37:33 +0100 |
commit | 5e1e912010f35ee9ba5f387bdee82363d32a8105 (patch) | |
tree | 6433f2f038d1d58a1596d26e0899dbda67471d31 /forms | |
parent | 167396065da5668f5eb569225d0ea1b5f7d94efb (diff) |
Avoid -Werror=format-truncation=
...as emitted by at least GCC 8.2 with --enable-optimized, about trying to
output up to 4 bytes into a destionation of size 3
Change-Id: I42c3c9bb7a0355a7d4a1574c6c65d6f74a97f1dc
Reviewed-on: https://gerrit.libreoffice.org/66617
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/xforms/submission/serialization_urlencoded.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/forms/source/xforms/submission/serialization_urlencoded.cxx b/forms/source/xforms/submission/serialization_urlencoded.cxx index 626569aec2aa..43dafdc714c6 100644 --- a/forms/source/xforms/submission/serialization_urlencoded.cxx +++ b/forms/source/xforms/submission/serialization_urlencoded.cxx @@ -73,7 +73,7 @@ void CSerializationURLEncoded::encode_and_append(const OUString& aString, OStri { OString utf8String = OUStringToOString(aString, RTL_TEXTENCODING_UTF8); const sal_uInt8 *pString = reinterpret_cast< const sal_uInt8 * >( utf8String.getStr() ); - sal_Char tmpChar[4]; tmpChar[3] = 0; + sal_Char tmpChar[4]; while( *pString != 0) { @@ -89,16 +89,16 @@ void CSerializationURLEncoded::encode_and_append(const OUString& aString, OStri } else if (*pString == 0x0a) { aBuffer.append("%0D%0A"); } else { - snprintf(tmpChar, 3, "%%%X", *pString % 0x100); + snprintf(tmpChar, 4, "%%%X", *pString % 0x100); aBuffer.append(tmpChar); } } else { - snprintf(tmpChar, 3, "%%%X", *pString % 0x100); + snprintf(tmpChar, 4, "%%%X", *pString % 0x100); aBuffer.append(tmpChar); while (*pString >= 0x80) { // continuation... pString++; - snprintf(tmpChar, 3, "%%%X", *pString % 0x100); + snprintf(tmpChar, 4, "%%%X", *pString % 0x100); aBuffer.append(tmpChar); } } |