summaryrefslogtreecommitdiff
path: root/sal/inc
diff options
context:
space:
mode:
authorJens-Heiner Rechtien <hr@openoffice.org>2003-08-07 13:56:01 +0000
committerJens-Heiner Rechtien <hr@openoffice.org>2003-08-07 13:56:01 +0000
commit1466b5f15c662af92043f591a982d5388983cb57 (patch)
tree99b032034efb9e3605dd52f0ffba258d32a078ee /sal/inc
parent54f8f152f33ccc621688dfe8dd2ac0685c3668b6 (diff)
INTEGRATION: CWS sb5 (1.6.124); FILE MERGED
2003/06/17 14:40:48 sb 1.6.124.3: #105353# Clarified valid ranges for some sal_Int32 length/offset arguments. 2003/06/16 14:56:27 sb 1.6.124.2: #105109# Clarified documentation of ensureCapacity. 2003/06/16 14:43:47 sb 1.6.124.1: #105352# Assert valid setCharAt parameters.
Diffstat (limited to 'sal/inc')
-rw-r--r--sal/inc/rtl/strbuf.hxx36
1 files changed, 22 insertions, 14 deletions
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index fc32b57cb172..fa0d5d10937f 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: strbuf.hxx,v $
*
- * $Revision: 1.6 $
+ * $Revision: 1.7 $
*
- * last change: $Author: sb $ $Date: 2001-10-30 13:41:07 $
+ * last change: $Author: hr $ $Date: 2003-08-07 14:56:01 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -62,6 +62,7 @@
#ifndef _RTL_STRBUF_HXX_
#define _RTL_STRBUF_HXX_
+#include "osl/diagnose.h"
#ifndef _RTL_STRBUF_H_
#include <rtl/strbuf.h>
#endif
@@ -238,15 +239,10 @@ public:
Ensures that the capacity of the buffer is at least equal to the
specified minimum.
- If the current capacity of this string buffer is less than the
- argument, then a new internal buffer is allocated with greater
- capacity. The new capacity is the larger of:
- <ul>
- <li>The <code>minimumCapacity</code> argument.
- <li>Twice the old capacity, plus <code>2</code>.
- </ul>
- If the <code>minimumCapacity</code> argument is nonpositive, this
- method takes no action and simply returns.
+ The new capacity will be at least as large as the maximum of the current
+ length (so that no contents of the buffer is destroyed) and the given
+ minimumCapacity. If the given minimumCapacity is negative, nothing is
+ changed.
@param minimumCapacity the minimum desired capacity.
*/
@@ -275,6 +271,7 @@ public:
*/
void setLength(sal_Int32 newLength)
{
+ OSL_ASSERT(newLength >= 0);
if( newLength > nCapacity )
rtl_stringbuffer_ensureCapacity(&pData, &nCapacity, newLength);
else
@@ -297,6 +294,7 @@ public:
*/
sal_Char charAt( sal_Int32 index )
{
+ OSL_ASSERT(index >= 0 && index < pData->length);
return pData->buffer[ index ];
}
@@ -315,7 +313,7 @@ public:
The character at the specified index of this string buffer is set
to <code>ch</code>.
- The offset argument must be greater than or equal to
+ The index argument must be greater than or equal to
<code>0</code>, and less than the length of this string buffer.
@param index the index of the character to modify.
@@ -323,6 +321,7 @@ public:
*/
OStringBuffer & setCharAt(sal_Int32 index, sal_Char ch)
{
+ OSL_ASSERT(index >= 0 && index < pData->length);
pData->buffer[ index ] = ch;
return *this;
}
@@ -366,8 +365,9 @@ public:
in order, to the contents of this string buffer. The length of this
string buffer increases by the value of <code>len</code>.
- @param str the characters to be appended.
- @param len the number of characters to append.
+ @param str the characters to be appended; must be non-null, and must
+ point to at least len characters
+ @param len the number of characters to append; must be non-negative
@return this string buffer.
*/
OStringBuffer & append( const sal_Char * str, sal_Int32 len)
@@ -505,6 +505,10 @@ public:
contents of this string buffer at the position indicated by
<code>offset</code>. The length of this string buffer increases by
the length of the argument.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
@param offset the offset.
@param ch a character array.
@@ -523,6 +527,10 @@ public:
contents of this string buffer at the position indicated by
<code>offset</code>. The length of this string buffer increases by
the length of the argument.
+ <p>
+ The offset argument must be greater than or equal to
+ <code>0</code>, and less than or equal to the length of this
+ string buffer.
@param offset the offset.
@param ch a character array.