sal: work around spurious signed overflow warnings

gcc version 4.6.3 20120306 (Red Hat 4.6.3-2) (GCC):
/rtl/string.hxx:1037:67: error: assuming signed overflow does not occur
when assuming that (X + c) < X is always false [-Werror=strict-overflow]
This commit is contained in:
Michael Stahl
2012-05-08 10:58:02 +02:00
parent aea14bd071
commit 3c598c4064

View File

@@ -1033,8 +1033,9 @@ public:
*/
OString copy( sal_Int32 beginIndex, sal_Int32 count ) const SAL_THROW(())
{
assert(beginIndex >= 0 && beginIndex <= getLength()
&& count >= 0 && count <= getLength() - beginIndex);
assert(beginIndex >= 0 && beginIndex <= getLength() && count >= 0
&& sal::static_int_cast<sal_uInt32>(count) <=
sal::static_int_cast<sal_uInt32>(getLength() - beginIndex));
if ( (beginIndex == 0) && (count == getLength()) )
return *this;
else