fix ProString::mid() without second parameter

we need to interpret the -1 as unsigned for it to mean "unlimited".

Change-Id: I130b809749fa1679a5b2444286baf48cc095c7bf
Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
Oswald Buddenhagen
2012-08-24 14:49:13 +02:00
parent 662e6f1119
commit e382138052

View File

@@ -299,7 +299,7 @@ ProString ProString::mid(int off, int len) const
off = m_length; off = m_length;
ret.m_offset += off; ret.m_offset += off;
ret.m_length -= off; ret.m_length -= off;
if (ret.m_length > len) if ((uint)ret.m_length > (uint)len) // Unsigned comparison to interpret < 0 as infinite
ret.m_length = len; ret.m_length = len;
return ret; return ret;
} }