diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-12-21 10:44:56 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-12-21 13:44:52 +0000 |
commit | c4f0efc2378cebc3b581bc949da70a2b2f149961 (patch) | |
tree | 3c0a330f7811c9407a787cec45382993b4037a6f /vcl/source/gdi/metaact.cxx | |
parent | 073431d26d39216a7f5f85489ecd4eb60806ee88 (diff) |
convert ReadByteString/WriteByteString from ByteString to OString
Nobody ever used the return values anyway, so for reading just
return the string and for writing the number of bytes written
Doesn't need to be members, make standalone functions
Rename to
read_lenPrefixed_uInt8s_ToO[U]String and
write_lenPrefixed_uInt8s_FromO[U]String, lengthy,
but much less unambiguous, seeing as a lot of users of it don't
seem to be aware that they read/write pascal-style length
prefixed strings, which isn't surprising given the
apparent simplicity of their original name.
added a unit test
Diffstat (limited to 'vcl/source/gdi/metaact.cxx')
-rw-r--r-- | vcl/source/gdi/metaact.cxx | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index a0b6c3b27c6b..9961705cbb6c 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -4198,7 +4198,7 @@ sal_Bool MetaCommentAction::Compare( const MetaAction& rMetaAction ) const void MetaCommentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { WRITE_BASE_COMPAT( rOStm, 1, pData ); - rOStm.WriteByteString(maComment); + write_lenPrefixed_uInt8s_FromOString(rOStm, maComment); rOStm << mnValue << mnDataSize; if ( mnDataSize ) @@ -4210,13 +4210,10 @@ void MetaCommentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) void MetaCommentAction::Read( SvStream& rIStm, ImplMetaReadData* ) { COMPAT( rIStm ); - ByteString sTmp; - rIStm.ReadByteString(sTmp); - maComment = sTmp; + maComment = read_lenPrefixed_uInt8s_ToOString(rIStm); rIStm >> mnValue >> mnDataSize; - if( mpData ) - delete[] mpData; + delete[] mpData; if( mnDataSize ) { |