diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-10 11:54:27 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-10 18:50:52 +0200 |
commit | 241bee7e4be6a205fae0d3f5508e084462c7ca55 (patch) | |
tree | 7d8771a5cbbe7021106852f1a54496faeea6ad4e /include/tools/stream.hxx | |
parent | 36567d58115e21c111b45c011524ddbae540fd91 (diff) |
convert WriteCharPtr..getStr to WriteOString
and improve the WriteOString method, we can avoid the strlen here, we
already have the length
One change in behaviour to be noted - if the string contains
trailing zero bytes, which ARE INCLUDED IN THE STRING LENGTH,
i.e. I'm not talking about the normal terminating zero, then this
patch changes behaviour because we will now write those zeros to
the stream.
Change-Id: I4668b9b9eb877f820b1dc70d6cd10ba2623bc0a2
Reviewed-on: https://gerrit.libreoffice.org/80597
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'include/tools/stream.hxx')
-rw-r--r-- | include/tools/stream.hxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/tools/stream.hxx b/include/tools/stream.hxx index 5667dfb6ef43..195119d70d5a 100644 --- a/include/tools/stream.hxx +++ b/include/tools/stream.hxx @@ -24,6 +24,7 @@ #include <tools/ref.hxx> #include <vcl/errcode.hxx> #include <rtl/string.hxx> +#include <rtl/strbuf.hxx> #include <o3tl/typed_flags_set.hxx> #include <memory> @@ -246,7 +247,9 @@ public: SvStream& WriteUInt8( sal_uInt8 nuInt8 ); SvStream& WriteUnicode( sal_Unicode ); SvStream& WriteOString(const OString& rStr) - { return WriteCharPtr(rStr.getStr()); } + { WriteBytes(rStr.getStr(), rStr.getLength()); return *this; } + SvStream& WriteOStringBuffer(const OStringBuffer& rStr) + { WriteBytes(rStr.getStr(), rStr.getLength()); return *this; } SvStream& WriteStream( SvStream& rStream ); sal_uInt64 WriteStream( SvStream& rStream, sal_uInt64 nSize ); |