Kaydet (Commit) 5e1e9120 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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: 's avatarStephan Bergmann <sbergman@redhat.com>
üst 16739606
......@@ -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);
}
}
......
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