summaryrefslogtreecommitdiff
path: root/sal/inc
diff options
context:
space:
mode:
authorOliver Bolte <obo@openoffice.org>2007-03-14 07:27:49 +0000
committerOliver Bolte <obo@openoffice.org>2007-03-14 07:27:49 +0000
commitba500afdc52a4161571055419e6dbb3cf216d4e7 (patch)
treee03b8d7b474515922aa9a7f820058b76e3dc4ad3 /sal/inc
parent5355fef3aaa36ba916f418aeec9bbf6677b8ece2 (diff)
INTEGRATION: CWS sb69 (1.9.92); FILE MERGED
2007/01/26 08:58:22 sb 1.9.92.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/strbuf.hxx18
1 files changed, 11 insertions, 7 deletions
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 0375be40e02b..b521f5182360 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -4,9 +4,9 @@
*
* $RCSfile: strbuf.hxx,v $
*
- * $Revision: 1.9 $
+ * $Revision: 1.10 $
*
- * last change: $Author: hr $ $Date: 2006-06-20 04:14:15 $
+ * last change: $Author: obo $ $Date: 2007-03-14 08:27:49 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -246,11 +246,15 @@ public:
void setLength(sal_Int32 newLength)
{
OSL_ASSERT(newLength >= 0);
- if( newLength > nCapacity )
- rtl_stringbuffer_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_stringbuffer_ensureCapacity(&pData, &nCapacity, newLength);
+ else
+ pData->buffer[newLength] = '\0';
+ pData->length = newLength;
+ }
}
/**