summaryrefslogtreecommitdiffstats
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-03-08 08:22:27 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-03-08 08:22:27 +0100
commitb62541a083158cf1d30337ba5e751c1cbd2c649e (patch)
treeedf0f7cb6bd3c852426f52e30c8cdd5d582163c7 /sal
parentAssignment of function parameter has no effect outside the function (diff)
downloadcore-b62541a083158cf1d30337ba5e751c1cbd2c649e.tar.gz
core-b62541a083158cf1d30337ba5e751c1cbd2c649e.zip
Assert OUStringBuffer::copy preconditions
Change-Id: I46ccba35be6695dba14721303b5eb52f69fc3dfa
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/rtl/ustrbuf.hxx4
1 files changed, 4 insertions, 0 deletions
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index 8a509466371c..8e4ca1d80ba4 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -1322,8 +1322,10 @@ public:
*/
OUStringBuffer copy( sal_Int32 beginIndex ) const SAL_THROW(())
{
+ assert(beginIndex >= 0 && beginIndex <= getLength());
return copy( beginIndex, getLength() - beginIndex );
}
+
/**
Returns a new string buffer that is a substring of this string.
@@ -1339,6 +1341,8 @@ public:
*/
OUStringBuffer copy( sal_Int32 beginIndex, sal_Int32 count ) const SAL_THROW(())
{
+ assert(beginIndex >= 0 && beginIndex <= getLength());
+ assert(count >= 0 && count <= getLength() - beginIndex);
rtl_uString *pNew = 0;
rtl_uStringbuffer_newFromStr_WithLength( &pNew, getStr() + beginIndex, count );
return OUStringBuffer( pNew, count + 16 );