[Libreoffice] embedded nulls in SvStream::ReadLine

Caolán McNamara caolanm at redhat.com
Mon Jan 16 02:45:40 PST 2012


In tools/qa/cppunit/test_stream.cxx:Test I added test_readline and after
poking around adding some edge-cases I see that Stream::ReadLine has the
odd quirk that it ignores embedded nulls in lines it reads, i.e. 
foo\0bar\n is read as "foobar", not "foo\0bar" or even "foo". That seems
kind of odd to me. Guessing that the very original code used String+=
I'd feel the original omission of a 0 from the read string was due to
the quick of String itself that it doesn't append trailing nulls and its
probably not deliberate ?

caolanm->erack:, from" erAck 26.02.01: Old behavior was no special
treatment of '\0'..." I presume you noticed this weirdness ages ago as
well in converting it from += to Append. What do you think, worth
syncing ReadLine behavior with std::getline behavior here ?

C.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: readline.allow.embeddednulls.patch
Type: text/x-patch
Size: 3822 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/libreoffice/attachments/20120116/dd222647/attachment.bin>


More information about the LibreOffice mailing list