summaryrefslogtreecommitdiffstats
path: root/filter
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-01-13 16:08:31 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-01-13 16:46:32 +0000
commit8ca94d31d1d6317e182ecdf360f744f70640cbfc (patch)
tree44fb1cdbc1189b0374375bb43ed1250ffb04e588 /filter
parentthese are length prefixed strings (diff)
downloadcore-8ca94d31d1d6317e182ecdf360f744f70640cbfc.tar.gz
core-8ca94d31d1d6317e182ecdf360f744f70640cbfc.zip
simply MSDFFReadZString and friends
Diffstat (limited to 'filter')
-rw-r--r--filter/inc/filter/msfilter/msdffimp.hxx2
-rw-r--r--filter/source/msfilter/msdffimp.cxx22
2 files changed, 5 insertions, 19 deletions
diff --git a/filter/inc/filter/msfilter/msdffimp.hxx b/filter/inc/filter/msfilter/msdffimp.hxx
index 4e4021deca89..35bfb0997fa3 100644
--- a/filter/inc/filter/msfilter/msdffimp.hxx
+++ b/filter/inc/filter/msfilter/msdffimp.hxx
@@ -588,7 +588,7 @@ public:
bool SeekToRec( SvStream& rSt, sal_uInt16 nRecId, sal_uLong nMaxFilePos, DffRecordHeader* pRecHd = NULL, sal_uLong nSkipCount = 0 ) const;
bool SeekToRec2( sal_uInt16 nRecId1, sal_uInt16 nRecId2, sal_uLong nMaxFilePos, DffRecordHeader* pRecHd = NULL, sal_uLong nSkipCount = 0 ) const;
- static rtl::OUString MSDFFReadZString( SvStream& rIn, sal_uLong nMaxLen, bool bUniCode = sal_False );
+ static rtl::OUString MSDFFReadZString(SvStream& rIn, sal_uInt32 nMaxLen, bool bUniCode = sal_False);
static bool ReadCommonRecordHeader(DffRecordHeader& rRec, SvStream& rIn)
SAL_WARN_UNUSED_RESULT;
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 361fe74a6b86..7c4284f7f4fa 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -3744,7 +3744,7 @@ rtl::OUString SvxMSDffManager::ReadDffString(SvStream& rSt, DffRecordHeader aStr
else if ( aStrHd.nRecType == DFF_PST_TextBytesAtom || aStrHd.nRecType == DFF_PST_TextCharsAtom )
{
bool bUniCode=aStrHd.nRecType==DFF_PST_TextCharsAtom;
- sal_uLong nBytes = aStrHd.nRecLen;
+ sal_uInt32 nBytes = aStrHd.nRecLen;
aRet = MSDFFReadZString( rSt, nBytes, bUniCode );
if( !bUniCode )
{
@@ -4006,31 +4006,17 @@ bool SvxMSDffManager::ReadObjText(SvStream& rSt, SdrObject* pObj)
//static
rtl::OUString SvxMSDffManager::MSDFFReadZString(SvStream& rIn,
- sal_uLong nRecLen, bool bUniCode)
+ sal_uInt32 nLen, bool bUniCode)
{
- sal_uInt16 nLen = (sal_uInt16)nRecLen;
if (!nLen)
return rtl::OUString();
String sBuf;
if( bUniCode )
- {
- nLen >>= 1;
-
- sal_Unicode* pBuf = sBuf.AllocBuffer(nLen);
- rIn.Read( (sal_Char*)pBuf, nLen << 1 );
-#ifdef OSL_BIGENDIAN
- for( sal_uInt16 n = 0; n < nLen; ++n, ++pBuf )
- *pBuf = SWAPSHORT( *pBuf );
-#endif // ifdef OSL_BIGENDIAN
- }
+ sBuf = read_LEuInt16s_ToOUString(rIn, nLen/2);
else
- {
- boost::scoped_array<sal_Char> xBuffer(new sal_Char[nLen]);
- nLen = rIn.Read(xBuffer.get(), nLen);
- sBuf = rtl::OUString(xBuffer.get(), nLen, RTL_TEXTENCODING_MS_1252);
- }
+ sBuf = read_uInt8s_ToOUString(rIn, nLen, RTL_TEXTENCODING_MS_1252);
return sBuf.EraseTrailingChars( 0 );
}