diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-12-15 00:15:02 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-12-15 12:22:49 +0000 |
commit | 0a2565b8def7afd2c5dc631e7f87e1613e11a40a (patch) | |
tree | bebcb27ddb488d526011e8b6233e07e04e4e302a /sc | |
parent | cf880b3f1f5e9a08ef6be30791dbf28d2d74cfcf (diff) |
rename and refactor ScfTools::ReadCString
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/filter/ftools/ftools.cxx | 11 | ||||
-rw-r--r-- | sc/source/filter/inc/ftools.hxx | 14 | ||||
-rw-r--r-- | sc/source/filter/lotus/lotform.cxx | 7 | ||||
-rw-r--r-- | sc/source/filter/qpro/qproform.cxx | 2 |
4 files changed, 12 insertions, 22 deletions
diff --git a/sc/source/filter/ftools/ftools.cxx b/sc/source/filter/ftools/ftools.cxx index a1ca318a0125..21d3e12fc803 100644 --- a/sc/source/filter/ftools/ftools.cxx +++ b/sc/source/filter/ftools/ftools.cxx @@ -276,14 +276,9 @@ ScStyleSheet& ScfTools::MakePageStyleSheet( ScStyleSheetPool& rPool, const Strin // *** byte string import operations *** -------------------------------------- -ByteString ScfTools::ReadCString( SvStream& rStrm ) +rtl::OString ScfTools::read_zeroTerminated_uInt8s_AsOString(SvStream& rStrm, sal_Int32& rnBytesLeft) { - return read_zeroTerminated_uInt8s_AsOString(rStrm); -} - -ByteString ScfTools::ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft ) -{ - rtl::OString aRet(read_zeroTerminated_uInt8s_AsOString(rStrm)); + rtl::OString aRet(::read_zeroTerminated_uInt8s_AsOString(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; @@ -292,7 +287,7 @@ ByteString ScfTools::ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft ) void ScfTools::AppendCString( SvStream& rStrm, String& rString, rtl_TextEncoding eTextEnc ) { - rString += read_zeroTerminated_uInt8s_AsOUString(rStrm, eTextEnc); + rString += ::read_zeroTerminated_uInt8s_AsOUString(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 39c49dcdaac1..8388cf63dc90 100644 --- a/sc/source/filter/inc/ftools.hxx +++ b/sc/source/filter/inc/ftools.hxx @@ -236,17 +236,13 @@ public: // *** byte string import operations *** -------------------------------------- - /** Reads and returns a zero terminted byte string. */ - static ByteString ReadCString( SvStream& rStrm ); - /** Reads and returns a zero terminted byte string. */ - inline static String ReadCString( SvStream& rStrm, rtl_TextEncoding eTextEnc ) - { return String( ReadCString( rStrm ), eTextEnc ); } - /** Reads and returns a zero terminted byte string and decreases a stream counter. */ - static ByteString ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft ); + static rtl::OString read_zeroTerminated_uInt8s_AsOString(SvStream& rStrm, sal_Int32& rnBytesLeft); /** Reads and returns a zero terminted byte string and decreases a stream counter. */ - inline static String ReadCString( SvStream& rStrm, sal_Int32& rnBytesLeft, rtl_TextEncoding eTextEnc ) - { return String( ReadCString( rStrm, rnBytesLeft ), eTextEnc ); } + inline static rtl::OUString read_zeroTerminated_uInt8s_AsOUString(SvStream& rStrm, sal_Int32& rnBytesLeft, rtl_TextEncoding eTextEnc) + { + return rtl::OStringToOUString(read_zeroTerminated_uInt8s_AsOString(rStrm, rnBytesLeft), eTextEnc); + } /** Appends a zero terminted byte string. */ static void AppendCString( SvStream& rStrm, String& rString, rtl_TextEncoding eTextEnc ); diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx index 8f8e4791865d..5bd02b10d99e 100644 --- a/sc/source/filter/lotus/lotform.cxx +++ b/sc/source/filter/lotus/lotform.cxx @@ -542,8 +542,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest, break; case FT_ConstString: { - String aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) ); - + String aTmp(ScfTools::read_zeroTerminated_uInt8s_AsOUString(aIn, nBytesLeft, eSrcChar)); aStack << aPool.Store( aTmp ); } break; @@ -562,7 +561,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest, break; case FT_Nrref: { - String aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) ); + String aTmp(ScfTools::read_zeroTerminated_uInt8s_AsOUString(aIn, nBytesLeft, eSrcChar)); if( rRangeNameBufferWK3.FindRel( aTmp, nRngIndex ) ) aStack << aPool.Store( nRngIndex ); else @@ -575,7 +574,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest, break; case FT_Absnref: { - String aTmp( ScfTools::ReadCString( aIn, nBytesLeft, eSrcChar ) ); + String aTmp(ScfTools::read_zeroTerminated_uInt8s_AsOUString(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 472d041df794..30b7d6032745 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( ScfTools::ReadCString( maIn ), maIn.GetStreamCharSet() ); + String aTmp(::read_zeroTerminated_uInt8s_AsOUString(maIn, maIn.GetStreamCharSet())); sStringArray[ nStringCount ] = aTmp; nStringCount++; SAFEDEC_OR_RET(nRef, aTmp.Len() + 1, ConvErrCount); |