Kaydet (Commit) 7a273a59 authored tarafından Michael Stahl's avatar Michael Stahl

OUString::operator[] silence -Werror=strict-overflow warnings

GCC 4.8.2 warns when index is a subtraction expression; the real
problems in that case will be found by the "index >= 0" check.

Change-Id: Iac2796badf88b7bdf6c273ddb800a8af0d3eaa6a
üst b5aa7f71
......@@ -362,7 +362,8 @@ public:
@since LibreOffice 3.5
*/
sal_Char operator [](sal_Int32 index) const {
assert(index >= 0 && index < getLength());
// silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
return getStr()[index];
}
......
......@@ -417,7 +417,8 @@ public:
@since LibreOffice 3.5
*/
sal_Unicode operator [](sal_Int32 index) const {
assert(index >= 0 && index < getLength());
// silence spurious -Werror=strict-overflow warnings from GCC 4.8.2
assert(index >= 0 && static_cast<sal_uInt32>(index) < static_cast<sal_uInt32>(getLength()));
return getStr()[index];
}
......
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