From 66c3655a07e109d88183002192410bcc9866c0f2 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 14 Dec 2011 22:52:07 +0000 Subject: convert ReadCString from ByteString to OString Nobody ever checked the return value anyway, so just return the string and use the stream state bits if necessary to find failures. Doesn't need to be a member, make a standalone function Rename it to read_zeroTerminated_uInt8s_AsO[U]String, stupid perhaps, but *shrug*, unambiguous. Drop misleading overloaded String variants use: read_zeroTerminated_uInt8s_AsOString or read_zeroTerminated_uInt8s_AsOUString added a unit test, valgrinded it, found and fixed invalid read in original implementation. --- sw/source/ui/dochdl/swdtflvr.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'sw') diff --git a/sw/source/ui/dochdl/swdtflvr.cxx b/sw/source/ui/dochdl/swdtflvr.cxx index e5fdd55a98fc..f9bb431670f0 100755 --- a/sw/source/ui/dochdl/swdtflvr.cxx +++ b/sw/source/ui/dochdl/swdtflvr.cxx @@ -1993,9 +1993,9 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData, } // report useful error!! rtl_TextEncoding eEncoding = DDE_TXT_ENCODING; - xStrm->ReadCString( aApp, eEncoding ); - xStrm->ReadCString( aTopic, eEncoding ); - xStrm->ReadCString( aItem, eEncoding ); + aApp = read_zeroTerminated_uInt8s_AsOUString(*xStrm, eEncoding); + aTopic = read_zeroTerminated_uInt8s_AsOUString(*xStrm, eEncoding); + aItem = read_zeroTerminated_uInt8s_AsOUString(*xStrm, eEncoding); } String aCmd; -- cgit