summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-09-23 21:56:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-09-26 10:18:38 +0100
commit8ec3318688aabdca875e2671e68d5f31205bfe5d (patch)
tree883315e0a16df2452a63b8046557fc09fc10211b /sal
parentdea0b22a4639a2ef9c75ed6f04d61ca9d99fcb95 (diff)
make sure these are safe wrt embedded NULLs
something of a micro optimization as well I guess
Diffstat (limited to 'sal')
-rw-r--r--sal/inc/rtl/strbuf.hxx5
-rw-r--r--sal/inc/rtl/ustrbuf.hxx5
2 files changed, 8 insertions, 2 deletions
diff --git a/sal/inc/rtl/strbuf.hxx b/sal/inc/rtl/strbuf.hxx
index 7079ddbed8b5..63ae448478b1 100644
--- a/sal/inc/rtl/strbuf.hxx
+++ b/sal/inc/rtl/strbuf.hxx
@@ -298,7 +298,10 @@ public:
Return a OString instance reflecting the current content
of this OStringBuffer.
*/
- const OString toString() const { return OString(pData->buffer); }
+ const OString toString() const
+ {
+ return OString(pData->buffer, pData->length);
+ }
/**
The character at the specified index of this string buffer is set
diff --git a/sal/inc/rtl/ustrbuf.hxx b/sal/inc/rtl/ustrbuf.hxx
index e6e523b64c54..a356309c30d8 100644
--- a/sal/inc/rtl/ustrbuf.hxx
+++ b/sal/inc/rtl/ustrbuf.hxx
@@ -278,7 +278,10 @@ public:
Return a OUString instance reflecting the current content
of this OUStringBuffer.
*/
- const OUString toString() const { return OUString(pData->buffer); }
+ const OUString toString() const
+ {
+ return OUString(pData->buffer, pData->length);
+ }
/**
The character at the specified index of this string buffer is set