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 /sc | |
parent | More removal from TTProperties (diff) | |
download | core-c4f0efc2378cebc3b581bc949da70a2b2f149961.tar.gz core-c4f0efc2378cebc3b581bc949da70a2b2f149961.zip |
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 'sc')
-rw-r--r-- | sc/source/filter/ftools/ftools.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/inc/ftools.hxx | 6 | ||||
-rw-r--r-- | sc/source/filter/lotus/lotform.cxx | 6 | ||||
-rw-r--r-- | sc/source/filter/qpro/qproform.cxx | 2 | ||||
-rw-r--r-- | sc/source/ui/unoobj/scdetect.cxx | 2 |
5 files changed, 11 insertions, 11 deletions
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index 21d3e12fc803..bbfbe41a2881 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -276,9 +276,9 @@ ScStyleSheet& ScfTools::MakePageStyleSheet( ScStyleSheetPool& rPool, const Strin // *** byte string import operations *** -------------------------------------- -rtl::OString ScfTools::read_zeroTerminated_uInt8s_AsOString(SvStream& rStrm, sal_Int32& rnBytesLeft) +rtl::OString ScfTools::read_zeroTerminated_uInt8s_ToOString(SvStream& rStrm, sal_Int32& rnBytesLeft) { - rtl::OString aRet(::read_zeroTerminated_uInt8s_AsOString(rStrm)); + rtl::OString aRet(::read_zeroTerminated_uInt8s_ToOString(rStrm)); rnBytesLeft -= aRet.getLength(); //we read this number of bytes anyway if (rStrm.good()) //if the stream is happy we read the null terminator as well --rnBytesLeft; @@ -287,7 +287,7 @@ rtl::OString ScfTools::read_zeroTerminated_uInt8s_AsOString(SvStream& rStrm, sal void ScfTools::AppendCString( SvStream& rStrm, String& rString, rtl_TextEncoding eTextEnc ) { - rString += ::read_zeroTerminated_uInt8s_AsOUString(rStrm, eTextEnc); + rString += ::read_zeroTerminated_uInt8s_ToOUString(rStrm, eTextEnc); } // *** HTML table names <-> named range names *** ----------------------------- diff --git a/sc/source/filter/inc/ftools.hxx b/sc/source/filter/inc/ftools.hxx index e57d42c27599..4bfac0961c83 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -237,11 +237,11 @@ public: // *** byte string import operations *** -------------------------------------- /** Reads and returns a zero terminated byte string and decreases a stream counter. */ - static rtl::OString read_zeroTerminated_uInt8s_AsOString(SvStream& rStrm, sal_Int32& rnBytesLeft); + static rtl::OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStrm, sal_Int32& rnBytesLeft); /** Reads and returns a zero terminated byte string and decreases a stream counter. */ - inline static rtl::OUString read_zeroTerminated_uInt8s_AsOUString(SvStream& rStrm, sal_Int32& rnBytesLeft, rtl_TextEncoding eTextEnc) + inline static rtl::OUString read_zeroTerminated_uInt8s_ToOUString(SvStream& rStrm, sal_Int32& rnBytesLeft, rtl_TextEncoding eTextEnc) { - return rtl::OStringToOUString(read_zeroTerminated_uInt8s_AsOString(rStrm, rnBytesLeft), eTextEnc); + return rtl::OStringToOUString(read_zeroTerminated_uInt8s_ToOString(rStrm, rnBytesLeft), eTextEnc); } /** Appends a zero terminated byte string. */ diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx index 5bd02b10d99e..d649c447ff65 100644 --- a/sc/source/filter/lotus/lotform.cxx +++ b/sc/source/filter/lotus/lotform.cxx @@ -542,7 +542,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest, break; case FT_ConstString: { - String aTmp(ScfTools::read_zeroTerminated_uInt8s_AsOUString(aIn, nBytesLeft, eSrcChar)); + String aTmp(ScfTools::read_zeroTerminated_uInt8s_ToOUString(aIn, nBytesLeft, eSrcChar)); aStack << aPool.Store( aTmp ); } break; @@ -561,7 +561,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest, break; case FT_Nrref: { - String aTmp(ScfTools::read_zeroTerminated_uInt8s_AsOUString(aIn, nBytesLeft, eSrcChar)); + String aTmp(ScfTools::read_zeroTerminated_uInt8s_ToOUString(aIn, nBytesLeft, eSrcChar)); if( rRangeNameBufferWK3.FindRel( aTmp, nRngIndex ) ) aStack << aPool.Store( nRngIndex ); else @@ -574,7 +574,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest, break; case FT_Absnref: { - String aTmp(ScfTools::read_zeroTerminated_uInt8s_AsOUString(aIn, nBytesLeft, eSrcChar)); + String aTmp(ScfTools::read_zeroTerminated_uInt8s_ToOUString(aIn, nBytesLeft, eSrcChar)); if( rRangeNameBufferWK3.FindAbs( aTmp, nRngIndex ) ) aStack << aPool.Store( nRngIndex ); else diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx index 30b7d6032745..6c8e8b7d371c 100644 --- a/sc/source/filter/qpro/qproform.cxx +++ b/sc/source/filter/qpro/qproform.cxx @@ -249,7 +249,7 @@ ConvErr QProToSc::Convert( const ScTokenArray*& pArray, sal_uInt16 /*nLen*/, con } if( nFmla[ i ] == 0x06 ) { - String aTmp(::read_zeroTerminated_uInt8s_AsOUString(maIn, maIn.GetStreamCharSet())); + String aTmp(::read_zeroTerminated_uInt8s_ToOUString(maIn, maIn.GetStreamCharSet())); sStringArray[ nStringCount ] = aTmp; nStringCount++; SAFEDEC_OR_RET(nRef, aTmp.Len() + 1, ConvErrCount); diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx index 9d33f09eca2f..fd3b0d264ebd 100644 --- a/sc/source/ui/unoobj/scdetect.cxx +++ b/sc/source/ui/unoobj/scdetect.cxx @@ -734,7 +734,7 @@ static sal_Bool lcl_MayBeDBase( SvStream& rStream ) // get file header rStr.Seek( 0 ); const sal_Size nTrySize = 80; - ByteString aHeader = read_uInt8s_AsOString(rStr, nTrySize); + ByteString aHeader = read_uInt8s_ToOString(rStr, nTrySize); if ( HTMLParser::IsHTMLFormat( aHeader.GetBuffer() ) ) { |