diff options
author | Michael Stahl <mstahl@redhat.com> | 2013-11-06 13:46:42 +0100 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2013-11-07 01:34:35 +0100 |
commit | 7a273a59f73df057d2fd20fca40ae060ffbaffa3 (patch) | |
tree | 70ce18feee60d50009789cf838e8cbed0a5b3a42 /include/rtl | |
parent | OString::operator[]: make this consistent with OUString (diff) | |
download | core-7a273a59f73df057d2fd20fca40ae060ffbaffa3.tar.gz core-7a273a59f73df057d2fd20fca40ae060ffbaffa3.zip |
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
Diffstat (limited to 'include/rtl')
-rw-r--r-- | include/rtl/string.hxx | 3 | ||||
-rw-r--r-- | include/rtl/ustring.hxx | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/include/rtl/string.hxx b/include/rtl/string.hxx index e5ac7d6821d7..8b7eca4b34dd 100644 --- a/include/rtl/string.hxx +++ b/include/rtl/string.hxx @@ -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]; } diff --git a/include/rtl/ustring.hxx b/include/rtl/ustring.hxx index 327f455f1648..79ddfb0ca788 100644 --- a/include/rtl/ustring.hxx +++ b/include/rtl/ustring.hxx @@ -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]; } |