make ReadUniOrByteString return a string

This commit is contained in:
Caolán McNamara 2012-01-06 08:50:03 +00:00
parent 0100280a5c
commit 2d3203b2db
28 changed files with 83 additions and 101 deletions

View File

@ -643,18 +643,15 @@ BasicLibInfo* BasicLibInfo::Create( SotStorageStream& rSStream )
pInfo->bDoLoad = bDoLoad;
// The name of the lib...
String aName;
rSStream.ReadUniOrByteString(aName, rSStream.GetStreamCharSet());
String aName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
pInfo->SetLibName( aName );
// Absolute path...
String aStorageName;
rSStream.ReadUniOrByteString(aStorageName, rSStream.GetStreamCharSet());
String aStorageName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
pInfo->SetStorageName( aStorageName );
// Relative path...
String aRelStorageName;
rSStream.ReadUniOrByteString(aRelStorageName, rSStream.GetStreamCharSet());
String aRelStorageName = rSStream.ReadUniOrByteString(rSStream.GetStreamCharSet());
pInfo->SetRelStorageName( aRelStorageName );
if ( nVer >= 2 )
@ -1041,8 +1038,7 @@ void BasicManager::LoadOldBasicManager( SotStorage& rStorage )
// and it proceeds ...
}
xManagerStream->Seek( nBasicEndOff+1 ); // +1: 0x00 as separator
String aLibs;
xManagerStream->ReadUniOrByteString(aLibs, xManagerStream->GetStreamCharSet());
String aLibs = xManagerStream->ReadUniOrByteString(xManagerStream->GetStreamCharSet());
xManagerStream->SetBufferSize( 0 );
xManagerStream.Clear(); // Close stream
@ -1235,8 +1231,7 @@ sal_Bool BasicManager::ImpLoadLibary( BasicLibInfo* pLibInfo, SotStorage* pCurSt
*xBasicStream >> nPasswordMarker;
if ( ( nPasswordMarker == PASSWORD_MARKER ) && !xBasicStream->IsEof() )
{
String aPassword;
xBasicStream->ReadUniOrByteString(aPassword,
String aPassword = xBasicStream->ReadUniOrByteString(
xBasicStream->GetStreamCharSet());
pLibInfo->SetPassword( aPassword );
}

View File

@ -147,24 +147,21 @@ sal_Bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion )
switch( nSign )
{
case B_NAME:
r.ReadUniOrByteString( aName, eCharSet );
aName = r.ReadUniOrByteString(eCharSet);
break;
case B_COMMENT:
r.ReadUniOrByteString( aComment, eCharSet );
aComment = r.ReadUniOrByteString(eCharSet );
break;
case B_SOURCE:
{
String aTmp;
r.ReadUniOrByteString( aTmp, eCharSet );
aOUSource = aTmp;
aOUSource = r.ReadUniOrByteString(eCharSet);
break;
}
case B_EXTSOURCE:
{
for( sal_uInt16 j = 0 ; j < nCount ; j++ )
{
String aTmp;
r.ReadUniOrByteString( aTmp, eCharSet );
String aTmp = r.ReadUniOrByteString(eCharSet);
aOUSource += aTmp;
}
break;

View File

@ -2001,9 +2001,7 @@ sal_Bool SbJScriptModule::LoadData( SvStream& rStrm, sal_uInt16 nVer )
return sal_False;
// Get the source string
String aTmp;
rStrm.ReadUniOrByteString( aTmp, osl_getThreadTextEncoding() );
aOUSource = aTmp;
aOUSource = rStrm.ReadUniOrByteString( osl_getThreadTextEncoding() );
return sal_True;
}

View File

@ -1106,8 +1106,7 @@ sal_Bool lcl_ReadSbxVariable( SbxVariable& rVar, SvStream* pStrm,
case SbxSTRING:
case SbxLPSTR:
{
String aStr;
pStrm->ReadUniOrByteString( aStr, osl_getThreadTextEncoding() );
String aStr = pStrm->ReadUniOrByteString(osl_getThreadTextEncoding());
rVar.PutString( aStr );
}
break;

View File

@ -169,13 +169,12 @@ namespace dbaui
{
OFieldDescription* pFieldDesc = new OFieldDescription();
_rRow.m_pActFieldDescr = pFieldDesc;
String sValue;
_rStr.ReadUniOrByteString(sValue, _rStr.GetStreamCharSet());
String sValue = _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet());
pFieldDesc->SetName(sValue);
_rStr.ReadUniOrByteString(sValue, _rStr.GetStreamCharSet());
sValue = _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet());
pFieldDesc->SetDescription(sValue);
_rStr.ReadUniOrByteString(sValue, _rStr.GetStreamCharSet());
sValue = _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet());
pFieldDesc->SetHelpText(sValue);
_rStr >> nValue;
@ -190,7 +189,7 @@ namespace dbaui
break;
}
case 2:
_rStr.ReadUniOrByteString(sValue, _rStr.GetStreamCharSet());
sValue = _rStr.ReadUniOrByteString(_rStr.GetStreamCharSet());
aControlDefault <<= ::rtl::OUString(sValue);
break;
}

View File

@ -1230,7 +1230,7 @@ void BinTextObject::CreateData( SvStream& rIStream )
pC->GetText() = rtl::OStringToOUString(aByteString, eSrcEncoding);
// StyleName and Family...
rIStream.ReadUniOrByteString( pC->GetStyle(), eSrcEncoding );
pC->GetStyle() = rIStream.ReadUniOrByteString(eSrcEncoding);
sal_uInt16 nStyleFamily;
rIStream >> nStyleFamily;
pC->GetFamily() = (SfxStyleFamily)nStyleFamily;
@ -1522,10 +1522,10 @@ void BinTextObject::CreateData300( SvStream& rIStream )
ContentInfo* pC = CreateAndInsertContent();
// The Text...
rIStream.ReadUniOrByteString( pC->GetText(), rIStream.GetStreamCharSet() );
pC->GetText() = rIStream.ReadUniOrByteString(rIStream.GetStreamCharSet());
// StyleName and Family...
rIStream.ReadUniOrByteString( pC->GetStyle(), rIStream.GetStreamCharSet() );
pC->GetStyle() = rIStream.ReadUniOrByteString(rIStream.GetStreamCharSet());
sal_uInt16 nStyleFamily;
rIStream >> nStyleFamily;
pC->GetFamily() = (SfxStyleFamily)nStyleFamily;

View File

@ -93,8 +93,7 @@ Font SvxBulletItem::CreateFont( SvStream& rStream, sal_uInt16 nVer )
rStream >> nTemp; aFont.SetItalic((FontItalic)nTemp);
// UNICODE: rStream >> aName; aFont.SetName( aName );
String aName;
rStream.ReadUniOrByteString(aName, rStream.GetStreamCharSet());
String aName = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
aFont.SetName( aName );
if( nVer == 1 )
@ -166,10 +165,10 @@ SvxBulletItem::SvxBulletItem( SvStream& rStrm, sal_uInt16 _nWhich ) :
rStrm >> nScale;
// UNICODE: rStrm >> aPrevText;
rStrm.ReadUniOrByteString(aPrevText, rStrm.GetStreamCharSet());
aPrevText = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> aFollowText;
rStrm.ReadUniOrByteString(aFollowText, rStrm.GetStreamCharSet());
aFollowText = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
nValidMask = 0xFFFF;
}

View File

@ -735,7 +735,7 @@ void SvxExtFileField::Load( SvPersistStream & rStm )
sal_uInt16 nType, nFormat;
// UNICODE: rStm >> aFile;
rStm.ReadUniOrByteString(aFile, rStm.GetStreamCharSet());
aFile = rStm.ReadUniOrByteString(rStm.GetStreamCharSet());
rStm >> nType;
rStm >> nFormat;

View File

@ -3441,9 +3441,8 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
if ( nDoLoad & LOAD_LINK )
{
String aRel;
// UNICODE: rStream >> aRel;
rStream.ReadUniOrByteString(aRel, rStream.GetStreamCharSet());
String aRel = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
// TODO/MBA: how can we get a BaseURL here?!
OSL_FAIL("No BaseURL!");
@ -3456,7 +3455,7 @@ SvxBrushItem::SvxBrushItem( SvStream& rStream, sal_uInt16 nVersion,
{
pStrFilter = new String;
// UNICODE: rStream >> *pStrFilter;
rStream.ReadUniOrByteString(*pStrFilter, rStream.GetStreamCharSet());
*pStrFilter = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
}
rStream >> nPos;

View File

@ -424,10 +424,10 @@ SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const
rStrm >> eFontTextEncoding;
// UNICODE: rStrm >> aName;
rStrm.ReadUniOrByteString(aName, rStrm.GetStreamCharSet());
aName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> aStyle;
rStrm.ReadUniOrByteString(aStyle, rStrm.GetStreamCharSet());
aStyle = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// Set the "correct" textencoding
eFontTextEncoding = (sal_uInt8)GetSOLoadTextEncoding( eFontTextEncoding, (sal_uInt16)rStrm.GetVersion() );
@ -442,8 +442,8 @@ SfxPoolItem* SvxFontItem::Create(SvStream& rStrm, sal_uInt16) const
rStrm >> nMagic;
if ( nMagic == STORE_UNICODE_MAGIC_MARKER )
{
rStrm.ReadUniOrByteString( aName, RTL_TEXTENCODING_UNICODE );
rStrm.ReadUniOrByteString( aStyle, RTL_TEXTENCODING_UNICODE );
aName = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE );
aStyle = rStrm.ReadUniOrByteString( RTL_TEXTENCODING_UNICODE );
}
else
{

View File

@ -65,7 +65,7 @@ void SvMetaModule::Load( SvPersistStream & rStm )
rStm >> aTypeList;
rStm >> aAttrList;
// browser
rStm.ReadUniOrByteString( aIdlFileName, rStm.GetStreamCharSet() );
aIdlFileName = rStm.ReadUniOrByteString( rStm.GetStreamCharSet() );
aHelpFileName.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm));
aSlotIdFile.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm));
aModulePrefix.setString(read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(rStm));

View File

@ -172,7 +172,7 @@ SfxPoolItem* ScPatternAttr::Create( SvStream& rStream, sal_uInt16 /* nVersion */
{
short eFamDummy;
pStr = new String;
rStream.ReadUniOrByteString( *pStr, rStream.GetStreamCharSet() );
*pStr = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
rStream >> eFamDummy; // wg. altem Dateiformat
}
else

View File

@ -803,7 +803,7 @@ sal_Bool ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersion
RTL_TEXTENCODING_UTF8);
}
else
rStream.ReadUniOrByteString( aName, rStream.GetStreamCharSet() );
aName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
if( AUTOFORMAT_DATA_ID_552 <= nVer )
{
@ -844,7 +844,7 @@ sal_Bool ScAutoFormatData::LoadOld( SvStream& rStream, const ScAfVersions& rVers
bRet = (rStream.GetError() == 0);
if (bRet && (nVal == AUTOFORMAT_OLD_DATA_ID))
{
rStream.ReadUniOrByteString( aName, rStream.GetStreamCharSet() );
aName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
sal_Bool b;
rStream >> b; bIncludeFont = b;
rStream >> b; bIncludeJustify = b;

View File

@ -93,9 +93,9 @@ ScDdeLink::ScDdeLink( ScDocument* pD, SvStream& rStream, ScMultipleReadHeader& r
rHdr.StartEntry();
rtl_TextEncoding eCharSet = rStream.GetStreamCharSet();
rStream.ReadUniOrByteString( aAppl, eCharSet );
rStream.ReadUniOrByteString( aTopic, eCharSet );
rStream.ReadUniOrByteString( aItem, eCharSet );
aAppl = rStream.ReadUniOrByteString( eCharSet );
aTopic = rStream.ReadUniOrByteString( eCharSet );
aItem = rStream.ReadUniOrByteString( eCharSet );
sal_Bool bHasValue;
rStream >> bHasValue;

View File

@ -61,7 +61,7 @@ ScNumFormatAbbrev::ScNumFormatAbbrev(sal_uLong nFormat,
void ScNumFormatAbbrev::Load( SvStream& rStream, CharSet eByteStrSet )
{
sal_uInt16 nSysLang, nLang;
rStream.ReadUniOrByteString( sFormatstring, eByteStrSet );
sFormatstring = rStream.ReadUniOrByteString( eByteStrSet );
rStream >> nSysLang >> nLang;
eLnge = (LanguageType) nLang;
eSysLnge = (LanguageType) nSysLang;

View File

@ -190,8 +190,7 @@ std::vector<sal_uInt16>* SfxApplication::GetDisabledSlotList_Impl()
if( bSlots && bSlotsEnabled )
{
// Read Slot file
String aTitle;
pStream->ReadUniOrByteString(aTitle, pStream->GetStreamCharSet());
String aTitle = pStream->ReadUniOrByteString(pStream->GetStreamCharSet());
if ( aTitle.CompareToAscii("SfxSlotFile" ) == COMPARE_EQUAL )
{
sal_uInt16 nCount;
@ -206,7 +205,7 @@ std::vector<sal_uInt16>* SfxApplication::GetDisabledSlotList_Impl()
pList->push_back( nSlot );
}
pStream->ReadUniOrByteString(aTitle, pStream->GetStreamCharSet());
aTitle = pStream->ReadUniOrByteString(pStream->GetStreamCharSet());
if ( aTitle.CompareToAscii("END" ) != COMPARE_EQUAL || pStream->GetError() )
{
// Read failed

View File

@ -187,7 +187,7 @@ SvStream& SfxPoolItem::Store(SvStream &rStream, sal_uInt16 ) const
// static
bool SfxPoolItem::readByteString(SvStream & rStream, UniString & rString)
{
rStream.ReadUniOrByteString(rString, rStream.GetStreamCharSet());
rString = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
return rStream.GetError() == ERRCODE_NONE;
}
@ -204,8 +204,7 @@ void SfxPoolItem::writeByteString(SvStream & rStream,
bool SfxPoolItem::readUnicodeString(SvStream & rStream, UniString & rString,
bool bUnicode)
{
rStream.ReadUniOrByteString(rString,
bUnicode ? RTL_TEXTENCODING_UCS2 :
rString = rStream.ReadUniOrByteString(bUnicode ? RTL_TEXTENCODING_UCS2 :
rStream.GetStreamCharSet());
return rStream.GetError() == ERRCODE_NONE;
}

View File

@ -402,7 +402,7 @@ void ImpSvNumFor::Load(SvStream& rStream, ImpSvNumberformatScan& rSc,
rStream >> nAnz; //! noch nicht direkt nAnzStrings wg. Enlarge
Enlarge( nAnz );
aI.Load( rStream, nAnz );
rStream.ReadUniOrByteString( sColorName, rStream.GetStreamCharSet() );
sColorName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
rLoadedColorName = sColorName;
pColor = rSc.GetColor(sColorName);
}

View File

@ -417,8 +417,7 @@ namespace svt
// initialize them with their (local) names
while ( nChildren-- )
{
String sURL;
m_rStorage.ReadUniOrByteString( sURL, m_rStorage.GetStreamCharSet() );
String sURL = m_rStorage.ReadUniOrByteString(m_rStorage.GetStreamCharSet());
sURL = m_xOfficeInstDirs->makeAbsoluteURL( sURL );
INetURLObject aChildURL( sURL );
rChildren.push_back( new TemplateContent( aChildURL ) );
@ -735,8 +734,7 @@ namespace svt
m_aPreviousState.reserve( nRootDirectories );
while ( nRootDirectories-- )
{
String sURL;
m_pCacheStream->ReadUniOrByteString( sURL, m_pCacheStream->GetStreamCharSet() );
String sURL = m_pCacheStream->ReadUniOrByteString(m_pCacheStream->GetStreamCharSet());
// #116281# Keep office installtion relocatable. Never store
// any direct references to office installation directory.
sURL = getOfficeInstDirs()->makeAbsoluteURL( sURL );

View File

@ -96,8 +96,8 @@ SvStream& operator>>( SvStream& rIStm, TransferableObjectDescriptor& rObjDesc )
rIStm >> rObjDesc.maSize.Height();
rIStm >> rObjDesc.maDragStartPos.X();
rIStm >> rObjDesc.maDragStartPos.Y();
rIStm.ReadUniOrByteString( rObjDesc.maTypeName, osl_getThreadTextEncoding() );
rIStm.ReadUniOrByteString( rObjDesc.maDisplayName, osl_getThreadTextEncoding() );
rObjDesc.maTypeName = rIStm.ReadUniOrByteString(osl_getThreadTextEncoding());
rObjDesc.maDisplayName = rIStm.ReadUniOrByteString(osl_getThreadTextEncoding());
rIStm >> nSig1 >> nSig2;
rObjDesc.mnViewAspect = static_cast< sal_uInt16 >( nViewAspect );

View File

@ -131,13 +131,13 @@ SfxPoolItem* SvxHyperlinkItem::Create( SvStream &rStrm, sal_uInt16 /*nItemVer
// simple data-types
// UNICODE: rStrm >> pNew->sName;
rStrm.ReadUniOrByteString(pNew->sName, rStrm.GetStreamCharSet());
pNew->sName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> pNew->sURL;
rStrm.ReadUniOrByteString(pNew->sURL, rStrm.GetStreamCharSet());
pNew->sURL = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> pNew->sTarget;
rStrm.ReadUniOrByteString(pNew->sTarget, rStrm.GetStreamCharSet());
pNew->sTarget = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
rStrm >> nType;
pNew->eType = (SvxLinkInsertMode) nType;
@ -149,7 +149,7 @@ SfxPoolItem* SvxHyperlinkItem::Create( SvStream &rStrm, sal_uInt16 /*nItemVer
{
// new data
// UNICODE: rStrm >> pNew->sIntName;
rStrm.ReadUniOrByteString(pNew->sIntName, rStrm.GetStreamCharSet());
pNew->sIntName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// macro-events
rStrm >> pNew->nMacroEvents;
@ -164,10 +164,10 @@ SfxPoolItem* SvxHyperlinkItem::Create( SvStream &rStrm, sal_uInt16 /*nItemVer
rStrm >> nCurKey;
// UNICODE: rStrm >> aLibName;
rStrm.ReadUniOrByteString(aLibName, rStrm.GetStreamCharSet());
aLibName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> aMacName;
rStrm.ReadUniOrByteString(aMacName, rStrm.GetStreamCharSet());
aMacName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
pNew->SetMacro( nCurKey, SvxMacro( aMacName, aLibName, STARBASIC ) );
}
@ -181,10 +181,10 @@ SfxPoolItem* SvxHyperlinkItem::Create( SvStream &rStrm, sal_uInt16 /*nItemVer
rStrm >> nCurKey;
// UNICODE: rStrm >> aLibName;
rStrm.ReadUniOrByteString(aLibName, rStrm.GetStreamCharSet());
aLibName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
// UNICODE: rStrm >> aMacName;
rStrm.ReadUniOrByteString(aMacName, rStrm.GetStreamCharSet());
aMacName = rStrm.ReadUniOrByteString(rStrm.GetStreamCharSet());
rStrm >> nScriptType;

View File

@ -245,13 +245,12 @@ bool SvxPageItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
SfxPoolItem* SvxPageItem::Create( SvStream& rStream, sal_uInt16 ) const
{
XubString sStr;
sal_uInt8 eType;
sal_Bool bLand;
sal_uInt16 nUse;
// UNICODE: rStream >> sStr;
rStream.ReadUniOrByteString( sStr, rStream.GetStreamCharSet() );
XubString sStr = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
rStream >> eType;
rStream >> bLand;

View File

@ -401,8 +401,8 @@ sal_Bool SwBoxAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions, s
sal_uInt16 eSys, eLge;
// --- from 680/dr25 on: store strings as UTF-8
CharSet eCharSet = (nVer >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
rStream.ReadUniOrByteString( sNumFmtString, eCharSet )
>> eSys >> eLge;
sNumFmtString = rStream.ReadUniOrByteString( eCharSet );
rStream >> eSys >> eLge;
eSysLanguage = (LanguageType) eSys;
eNumFmtLanguage = (LanguageType) eLge;
if ( eSysLanguage == LANGUAGE_SYSTEM ) // von alten Versionen (Calc)
@ -780,7 +780,7 @@ sal_Bool SwTableAutoFmt::Load( SvStream& rStream, const SwAfVersions& rVersions
sal_Bool b;
// --- from 680/dr25 on: store strings as UTF-8
CharSet eCharSet = (nVal >= AUTOFORMAT_ID_680DR25) ? RTL_TEXTENCODING_UTF8 : rStream.GetStreamCharSet();
rStream.ReadUniOrByteString( aName, eCharSet );
aName = rStream.ReadUniOrByteString( eCharSet );
if( AUTOFORMAT_DATA_ID_552 <= nVal )
{
rStream >> nStrResId;
@ -830,7 +830,7 @@ sal_Bool SwTableAutoFmt::LoadOld( SvStream& rStream, sal_uInt16 aLoadVer[] )
if( bRet && ( AUTOFORMAT_OLD_DATA_ID == nVal ))
{
sal_Bool b;
rStream.ReadUniOrByteString( aName, rStream.GetStreamCharSet() );
aName = rStream.ReadUniOrByteString( rStream.GetStreamCharSet() );
rStream >> b; bInclFont = b;
rStream >> b; bInclJustify = b;
rStream >> b; bInclFrame = b;

View File

@ -235,7 +235,7 @@ const SwNumRulesWithName& SwNumRulesWithName::operator=(const SwNumRulesWithName
SwNumRulesWithName::SwNumRulesWithName( SvStream &rStream, sal_uInt16 nVersion )
{
CharSet eEncoding = osl_getThreadTextEncoding();
rStream.ReadUniOrByteString(aName, eEncoding);
aName = rStream.ReadUniOrByteString(eEncoding);
char c;
for(sal_uInt16 n = 0; n < MAXLEVEL; ++n )
@ -354,9 +354,9 @@ SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
long nL;
rStream >> cChar; aFmt.SetStart( (sal_uInt16)cChar );
rStream.ReadUniOrByteString(sStr, eEncoding);
sStr = rStream.ReadUniOrByteString(eEncoding);
aFmt.SetPrefix( sStr );
rStream.ReadUniOrByteString(sStr, eEncoding);
sStr = rStream.ReadUniOrByteString(eEncoding);
aFmt.SetSuffix( sStr );
rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) );
rStream >> nL; aFmt.SetLSpace( lNumIndent );
@ -366,9 +366,9 @@ SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
{
short nShort;
rStream >> nUS; aFmt.SetStart( nUS );
rStream.ReadUniOrByteString(sStr, eEncoding);
sStr = rStream.ReadUniOrByteString(eEncoding);
aFmt.SetPrefix( sStr );
rStream.ReadUniOrByteString(sStr, eEncoding);
sStr = rStream.ReadUniOrByteString(eEncoding);
aFmt.SetSuffix( sStr );
rStream >> nUS; aFmt.SetNumAdjust( SvxAdjust( nUS ) );
rStream >> nUS; aFmt.SetAbsLSpace( nUS );
@ -385,7 +385,7 @@ SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
sal_uInt16 nPitch;
String aName;
rStream.ReadUniOrByteString(aName, eEncoding);
aName = rStream.ReadUniOrByteString(eEncoding);
rStream >> nFamily >> nCharSet >> nWidth >> nHeight >> nPitch;
if( aName.Len() )
@ -411,7 +411,7 @@ SwNumRulesWithName::_SwNumFmtGlobal::_SwNumFmtGlobal( SvStream& rStream,
{
sal_uInt16 nItemCount;
rStream >> nCharPoolId;
rStream.ReadUniOrByteString(sCharFmtName, eEncoding);
sCharFmtName = rStream.ReadUniOrByteString(eEncoding);
rStream >> nItemCount;
while( nItemCount-- )

View File

@ -409,7 +409,7 @@ public:
sal_Bool ReadUniStringLine( String& rStr );
/// Read a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE,
/// otherwise read a 16bit length prefixed sequence of bytes and convert from eSrcCharSet
SvStream& ReadUniOrByteString( UniString& rStr, rtl_TextEncoding eSrcCharSet );
String ReadUniOrByteString(rtl_TextEncoding eSrcCharSet);
/// Write a 32bit length prefixed sequence of utf-16 if eSrcCharSet==RTL_TEXTENCODING_UNICODE,
/// otherwise convert to eSrcCharSet and write a 16bit length prefixed sequence of bytes
SvStream& WriteUniOrByteString( const UniString& rStr, rtl_TextEncoding eDestCharSet );

View File

@ -1489,36 +1489,37 @@ SvStream& SvStream::operator<< ( SvStream& rStream )
// -----------------------------------------------------------------------
SvStream& SvStream::ReadUniOrByteString( UniString& rStr, rtl_TextEncoding eSrcCharSet )
String SvStream::ReadUniOrByteString( rtl_TextEncoding eSrcCharSet )
{
// read UTF-16 string directly from stream ?
if (eSrcCharSet == RTL_TEXTENCODING_UNICODE)
{
sal_uInt32 nLen;
String aStr;
sal_uInt32 nLen(0);
operator>> (nLen);
if (nLen)
{
if (nLen > STRING_MAXLEN) {
if (nLen > STRING_MAXLEN)
{
SetError(SVSTREAM_GENERALERROR);
return *this;
return aStr;
}
sal_Unicode *pStr = rStr.AllocBuffer(
sal_Unicode *pStr = aStr.AllocBuffer(
static_cast< xub_StrLen >(nLen));
BOOST_STATIC_ASSERT(STRING_MAXLEN <= SAL_MAX_SIZE / 2);
Read( pStr, nLen << 1 );
if (bSwap)
{
for (sal_Unicode *pEnd = pStr + nLen; pStr < pEnd; pStr++)
SwapUShort(*pStr);
}
}
else
rStr.Erase();
return *this;
return aStr;
}
rStr = read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(*this, eSrcCharSet);
return *this;
return read_lenPrefixed_uInt8s_ToOUString<sal_uInt16>(*this, eSrcCharSet);
}
// -----------------------------------------------------------------------

View File

@ -780,8 +780,8 @@ SvStream& operator>>( SvStream& rIStm, Impl_Font& rImpl_Font )
sal_Bool bTmp;
sal_uInt8 nTmp8;
rIStm.ReadUniOrByteString( rImpl_Font.maFamilyName, rIStm.GetStreamCharSet() );
rIStm.ReadUniOrByteString( rImpl_Font.maStyleName, rIStm.GetStreamCharSet() );
rImpl_Font.maFamilyName = rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet());
rImpl_Font.maStyleName = rIStm.ReadUniOrByteString(rIStm.GetStreamCharSet());
rIStm >> rImpl_Font.maSize;
rIStm >> nTmp16; rImpl_Font.meCharSet = (rtl_TextEncoding) nTmp16;

View File

@ -1278,7 +1278,7 @@ void MetaTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
{
COMPAT( rIStm );
rIStm >> maPt;
rIStm.ReadUniOrByteString( maStr, pData->meActualCharSet );
maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
rIStm >> mnIndex;
rIStm >> mnLen;
@ -1435,7 +1435,7 @@ void MetaTextArrayAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
COMPAT( rIStm );
rIStm >> maStartPt;
rIStm.ReadUniOrByteString( maStr, pData->meActualCharSet );
maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
rIStm >> mnIndex;
rIStm >> mnLen;
rIStm >> nAryLen;
@ -1575,7 +1575,7 @@ void MetaStretchTextAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
{
COMPAT( rIStm );
rIStm >> maPt;
rIStm.ReadUniOrByteString( maStr, pData->meActualCharSet );
maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
rIStm >> mnWidth;
rIStm >> mnIndex;
rIStm >> mnLen;
@ -1668,7 +1668,7 @@ void MetaTextRectAction::Read( SvStream& rIStm, ImplMetaReadData* pData )
{
COMPAT( rIStm );
rIStm >> maRect;
rIStm.ReadUniOrByteString( maStr, pData->meActualCharSet );
maStr = rIStm.ReadUniOrByteString(pData->meActualCharSet);
rIStm >> mnStyle;
if ( aCompat.GetVersion() >= 2 ) // Version 2