summaryrefslogtreecommitdiff
path: root/sal/inc
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2007-03-14 07:28:00 +0000
committerOliver Bolte <obo@openoffice.org>2007-03-14 07:28:00 +0000
commit964e8fb9bb28f012cd82c7609f0eec9eecb9beb9 (patch)
tree93f6ab3e69c4a2d06c6aaa9d6b005899e81c918c /sal/inc
parentba500afdc52a4161571055419e6dbb3cf216d4e7 (diff)
INTEGRATION: CWS sb69 (1.11.202); FILE MERGED
2007/01/26 08:58:23 sb 1.11.202.1: #i64835# Fixed rtl::O[U]StringBuffer::setLength(0) for the (now-)const empty string.
Diffstat (limited to 'sal/inc')
-rw-r--r--sal/inc/rtl/ustrbuf.hxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index ef103739237e..1f5a1a079922 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: ustrbuf.hxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: rt $ $Date: 2005-09-08 14:44:49 $
+ * last change: $Author: obo $ $Date: 2007-03-14 08:28:00 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -247,11 +247,15 @@ public:
void setLength(sal_Int32 newLength)
{
OSL_ASSERT(newLength >= 0);
- if( newLength > nCapacity )
- rtl_uStringbuffer_ensureCapacity(&pData, &nCapacity, newLength);
- else
- pData->buffer[newLength] = 0;
- pData->length = newLength;
+ // Avoid modifications if pData points to const empty string:
+ if( newLength != pData->length )
+ {
+ if( newLength > nCapacity )
+ rtl_uStringbuffer_ensureCapacity(&pData, &nCapacity, newLength);
+ else
+ pData->buffer[newLength] = 0;
+ pData->length = newLength;
+ }
}
/**