Kaydet (Commit) 4eb4514e authored tarafından Caolán McNamara's avatar Caolán McNamara

This just can't be right, WriteByteString writes a pascal-style string

WriteLine just writes a line of text, WriteByteString writes
a 16bit length of following content. It can't make sense to
suddenly stick a pascal-style string in at the end of a file
that's otherwise plain text.

original git id that introduced the use of WriteByteString here
was ea76474a back in 2002

Perhaps this worked because partial strings never ended up
as trailing content, so only ever had an empty string as
the final partial string, so a 0x0000 got appended, as
opposed to a newline, so it appeared to do the right thing.
üst c1c3ef64
......@@ -429,13 +429,13 @@ sal_Bool Export::ConvertLineEnds(
while ( !aSource.IsEof())
{
aSource.ReadLine( sLine );
if ( !aSource.IsEof())
if ( !aSource.IsEof()) //a complete line
{
sLine = comphelper::string::remove(sLine, '\r');
aDestination.WriteLine( sLine );
}
else
aDestination.WriteByteString( sLine );
else //a final incomplete line, just copy it as-is
aDestination.Write( sLine.getStr(), sLine.getLength() );
}
aSource.Close();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment