needs more work first

This reverts commit 92f396733ebc518bcb7a9eae2dd3169d333b82b9.
This commit is contained in:
Caolán McNamara 2011-12-21 10:30:10 +00:00
parent fffae28952
commit 6708977331
46 changed files with 327 additions and 353 deletions

View File

@ -656,7 +656,7 @@ SbError SbiStream::Read( ByteString& rBuf, sal_uInt16 n, bool bForceReadingPerBy
n = nLen;
if( !n )
return nError = SbERR_BAD_RECORD_LENGTH;
rtl::OStringBuffer aBuffer(read_uInt8s_ToOString(*pStrm, n));
rtl::OStringBuffer aBuffer(read_uInt8s_AsOString(*pStrm, n));
//Pad it out with ' ' to the requested length on short read
sal_Int32 nRequested = sal::static_int_cast<sal_Int32>(n);
comphelper::string::padToLength(aBuffer, nRequested, ' ');

View File

@ -2739,7 +2739,7 @@ sal_Bool ODbaseTable::ReadMemo(sal_uIntPtr nBlockNo, ORowSetValue& aVariable)
{
if ( bIsText )
{
rtl::OStringBuffer aBuffer(read_uInt8s_ToOString(*m_pMemoStream, nLength));
rtl::OStringBuffer aBuffer(read_uInt8s_AsOString(*m_pMemoStream, nLength));
//pad it out with ' ' to expected length on short read
sal_Int32 nRequested = sal::static_int_cast<sal_Int32>(nLength);
comphelper::string::padToLength(aBuffer, nRequested, ' ');

View File

@ -673,7 +673,7 @@ void ONDXNode::Read(SvStream &rStream, ODbaseIndex& rIndex)
else
{
sal_uInt16 nLen = rIndex.getHeader().db_keylen;
rtl::OString aBuf = read_uInt8s_ToOString(rStream, nLen);
rtl::OString aBuf = read_uInt8s_AsOString(rStream, nLen);
//get length minus trailing whitespace
sal_Int32 nContentLen = aBuf.getLength();
while (nContentLen && aBuf[nContentLen-1] == ' ')

View File

@ -1131,10 +1131,10 @@ void BinTextObject::StoreData( SvStream& rOStream ) const
// Convert CH_FEATURE to CH_FEATURE_OLD
aText.SearchAndReplaceAll( cFeatureConverted, CH_FEATURE_OLD );
write_lenPrefixed_uInt8s_FromOString(rOStream, aText);
rOStream.WriteByteString( aText );
// StyleName and Family...
write_lenPrefixed_uInt8s_FromOUString(rOStream, pC->GetStyle(), eEncoding);
rOStream.WriteByteString( rtl::OUStringToOString(pC->GetStyle(), eEncoding) );
rOStream << (sal_uInt16)pC->GetFamily();
// Paragraph attributes ...
@ -1226,8 +1226,9 @@ void BinTextObject::CreateData( SvStream& rIStream )
ContentInfo* pC = CreateAndInsertContent();
// The Text...
ByteString aByteString = read_lenPrefixed_uInt8s_ToOString(rIStream);
pC->GetText() = rtl::OStringToOUString(aByteString, eSrcEncoding);
ByteString aByteString;
rIStream.ReadByteString( aByteString );
pC->GetText() = String( aByteString, eSrcEncoding );
// StyleName and Family...
rIStream.ReadByteString( pC->GetStyle(), eSrcEncoding );

View File

@ -412,7 +412,7 @@ WString::Read( SvStream &rS )
nOffSet = rS.Tell();
sal_uInt8 nChars = 0;
rS >> nChars;
sString = read_LEuInt16s_ToOUString(rS, nChars);
sString = read_LEuInt16s_AsOUString(rS, nChars);
return true;
}

View File

@ -228,13 +228,13 @@ sal_Bool SvIdentifier::WriteSvIdl( SvStringHashEntry * pName,
SvStream& operator << (SvStream & rStm, const SvIdentifier & r )
{
write_lenPrefixed_uInt8s_FromOString(rStm, r);
rStm.WriteByteString( r );
return rStm;
}
SvStream& operator >> (SvStream & rStm, SvIdentifier & r )
{
r = read_lenPrefixed_uInt8s_ToOString(rStm);
rStm.ReadByteString( r );
return rStm;
}
@ -343,13 +343,13 @@ sal_Bool SvString::WriteSvIdl( SvStringHashEntry * pName, SvStream & rOutStm,
SvStream& operator << (SvStream & rStm, const SvString & r )
{
write_lenPrefixed_uInt8s_FromOString(rStm, r);
rStm.WriteByteString( r );
return rStm;
}
SvStream& operator >> (SvStream & rStm, SvString & r )
{
r = read_lenPrefixed_uInt8s_ToOString(rStm);
rStm.ReadByteString( r );
return rStm;
}

View File

@ -66,9 +66,9 @@ void SvMetaModule::Load( SvPersistStream & rStm )
rStm >> aAttrList;
// browser
rStm.ReadByteString( aIdlFileName );
aHelpFileName = read_lenPrefixed_uInt8s_ToOString(rStm);
aSlotIdFile = read_lenPrefixed_uInt8s_ToOString(rStm);
aModulePrefix = read_lenPrefixed_uInt8s_ToOString(rStm);
rStm.ReadByteString( aHelpFileName );
rStm.ReadByteString( aSlotIdFile );
rStm.ReadByteString( aModulePrefix );
// read compiler data
sal_uInt16 nCmpLen;
@ -91,9 +91,9 @@ void SvMetaModule::Save( SvPersistStream & rStm )
rStm << aAttrList;
// browser
rStm.WriteByteString( aIdlFileName );
write_lenPrefixed_uInt8s_FromOString(rStm, aHelpFileName);
write_lenPrefixed_uInt8s_FromOString(rStm, aSlotIdFile);
write_lenPrefixed_uInt8s_FromOString(rStm, aModulePrefix);
rStm.WriteByteString( aHelpFileName );
rStm.WriteByteString( aSlotIdFile );
rStm.WriteByteString( aModulePrefix );
// write compiler data
sal_uInt16 nCmpLen = 0;

View File

@ -55,7 +55,7 @@ void SvClassElement::Load( SvPersistStream & rStm )
return;
}
if( nMask & 0x01 ) rStm >> aAutomation;
if( nMask & 0x02 ) aPrefix = read_lenPrefixed_uInt8s_ToOString(rStm);
if( nMask & 0x02 ) rStm.ReadByteString( aPrefix );
if( nMask & 0x04 )
{
SvMetaClass * p;
@ -75,7 +75,7 @@ void SvClassElement::Save( SvPersistStream & rStm )
// write data
rStm << nMask;
if( nMask & 0x01 ) rStm << aAutomation;
if( nMask & 0x02 ) write_lenPrefixed_uInt8s_FromOString(rStm, aPrefix);
if( nMask & 0x02 ) rStm.WriteByteString( aPrefix );
if( nMask & 0x04 ) rStm << xClass;
}

View File

@ -1780,7 +1780,7 @@ void SvMetaEnumValue::Load( SvPersistStream & rStm )
OSL_FAIL( "wrong format" );
return;
}
if( nMask & 0x01 ) aEnumValue = read_lenPrefixed_uInt8s_ToOString(rStm);
if( nMask & 0x01 ) rStm.ReadByteString( aEnumValue );
}
void SvMetaEnumValue::Save( SvPersistStream & rStm )
@ -1793,7 +1793,7 @@ void SvMetaEnumValue::Save( SvPersistStream & rStm )
// write data
rStm << nMask;
if( nMask & 0x01 ) write_lenPrefixed_uInt8s_FromOString(rStm, aEnumValue);
if( nMask & 0x01 ) rStm.WriteByteString( aEnumValue );
}
sal_Bool SvMetaEnumValue::ReadSvIdl( SvIdlDataBase & rBase,
@ -1837,7 +1837,7 @@ void SvMetaTypeEnum::Load( SvPersistStream & rStm )
return;
}
if( nMask & 0x01 ) rStm >> aEnumValueList;
if( nMask & 0x02 ) aPrefix = read_lenPrefixed_uInt8s_ToOString(rStm);
if( nMask & 0x02 ) rStm.ReadByteString( aPrefix );
}
void SvMetaTypeEnum::Save( SvPersistStream & rStm )
@ -1852,7 +1852,7 @@ void SvMetaTypeEnum::Save( SvPersistStream & rStm )
// write data
rStm << nMask;
if( nMask & 0x01 ) rStm << aEnumValueList;
if( nMask & 0x02 ) write_lenPrefixed_uInt8s_FromOString(rStm, aPrefix);
if( nMask & 0x02 ) rStm.WriteByteString( aPrefix );
}
void SvMetaTypeEnum::ReadContextSvIdl( SvIdlDataBase & rBase,

View File

@ -276,9 +276,9 @@ ScStyleSheet& ScfTools::MakePageStyleSheet( ScStyleSheetPool& rPool, const Strin
// *** byte string import operations *** --------------------------------------
rtl::OString ScfTools::read_zeroTerminated_uInt8s_ToOString(SvStream& rStrm, sal_Int32& rnBytesLeft)
rtl::OString ScfTools::read_zeroTerminated_uInt8s_AsOString(SvStream& rStrm, sal_Int32& rnBytesLeft)
{
rtl::OString aRet(::read_zeroTerminated_uInt8s_ToOString(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;
@ -287,7 +287,7 @@ rtl::OString ScfTools::read_zeroTerminated_uInt8s_ToOString(SvStream& rStrm, sal
void ScfTools::AppendCString( SvStream& rStrm, String& rString, rtl_TextEncoding eTextEnc )
{
rString += ::read_zeroTerminated_uInt8s_ToOUString(rStrm, eTextEnc);
rString += ::read_zeroTerminated_uInt8s_AsOUString(rStrm, eTextEnc);
}
// *** HTML table names <-> named range names *** -----------------------------

View File

@ -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_ToOString(SvStream& rStrm, sal_Int32& rnBytesLeft);
static rtl::OString read_zeroTerminated_uInt8s_AsOString(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_ToOUString(SvStream& rStrm, sal_Int32& rnBytesLeft, rtl_TextEncoding eTextEnc)
inline static rtl::OUString read_zeroTerminated_uInt8s_AsOUString(SvStream& rStrm, sal_Int32& rnBytesLeft, rtl_TextEncoding eTextEnc)
{
return rtl::OStringToOUString(read_zeroTerminated_uInt8s_ToOString(rStrm, rnBytesLeft), eTextEnc);
return rtl::OStringToOUString(read_zeroTerminated_uInt8s_AsOString(rStrm, rnBytesLeft), eTextEnc);
}
/** Appends a zero terminated byte string. */

View File

@ -542,7 +542,7 @@ ConvErr LotusToSc::Convert( const ScTokenArray*& rpErg, sal_Int32& rRest,
break;
case FT_ConstString:
{
String aTmp(ScfTools::read_zeroTerminated_uInt8s_ToOUString(aIn, nBytesLeft, eSrcChar));
String aTmp(ScfTools::read_zeroTerminated_uInt8s_AsOUString(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_ToOUString(aIn, nBytesLeft, eSrcChar));
String aTmp(ScfTools::read_zeroTerminated_uInt8s_AsOUString(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_ToOUString(aIn, nBytesLeft, eSrcChar));
String aTmp(ScfTools::read_zeroTerminated_uInt8s_AsOUString(aIn, nBytesLeft, eSrcChar));
if( rRangeNameBufferWK3.FindAbs( aTmp, nRngIndex ) )
aStack << aPool.Store( nRngIndex );
else

View File

@ -249,7 +249,7 @@ ConvErr QProToSc::Convert( const ScTokenArray*& pArray, sal_uInt16 /*nLen*/, con
}
if( nFmla[ i ] == 0x06 )
{
String aTmp(::read_zeroTerminated_uInt8s_ToOUString(maIn, maIn.GetStreamCharSet()));
String aTmp(::read_zeroTerminated_uInt8s_AsOUString(maIn, maIn.GetStreamCharSet()));
sStringArray[ nStringCount ] = aTmp;
nStringCount++;
SAFEDEC_OR_RET(nRef, aTmp.Len() + 1, ConvErrCount);

View File

@ -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_ToOString(rStr, nTrySize);
ByteString aHeader = read_uInt8s_AsOString(rStr, nTrySize);
if ( HTMLParser::IsHTMLFormat( aHeader.GetBuffer() ) )
{

View File

@ -2605,7 +2605,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
*xCompObj >> nStringLen;
if ( ( nStringLen > 1 ) && ( ( xCompObj->Tell() + nStringLen ) < nStreamLen ) )
{ // i think that the OleIdentifier will follow
rtl::OString aTemp = read_uInt8s_ToOString(*xCompObj, nStringLen - 1);
rtl::OString aTemp = read_uInt8s_AsOString(*xCompObj, nStringLen - 1);
aOleIdentifier = rtl::OStringToOUString(aTemp, RTL_TEXTENCODING_MS_1252);
}
}

View File

@ -274,7 +274,7 @@ sal_Bool SfxHTMLParser::FinishFileDownload( String& rStr )
: STRING_MAXLEN;
aStream.Seek( 0 );
rtl::OString sBuffer = read_uInt8s_ToOString(aStream, nLen);
rtl::OString sBuffer = read_uInt8s_AsOString(aStream, nLen);
rStr = S2U(sBuffer);
}

View File

@ -3303,7 +3303,8 @@ String UCBStorage::GetLinkedFile( SvStream &rStream )
rStream >> nBytes;
if( nBytes == 0x04034b50 )
{
ByteString aTmp = read_lenPrefixed_uInt8s_ToOString(rStream);
ByteString aTmp;
rStream.ReadByteString( aTmp );
if ( aTmp.CompareTo( "ContentURL=", 11 ) == COMPARE_EQUAL )
{
aTmp.Erase( 0, 11 );

View File

@ -80,7 +80,8 @@ CntWallpaperItem::CntWallpaperItem( sal_uInt16 which, SvStream& rStream, sal_uIn
readUnicodeString(rStream, _aURL, false);
// "Read" SfxWallpaperItem's string member _aFilter.
read_lenPrefixed_uInt8s_ToOString(rStream);
ByteString aDummy;
rStream.ReadByteString(aDummy);
}
}

View File

@ -1768,7 +1768,8 @@ void SvNumberformat::ConvertLanguage( SvNumberFormatter& rConverter,
void SvNumberformat::LoadString( SvStream& rStream, String& rStr )
{
CharSet eStream = rStream.GetStreamCharSet();
ByteString aStr = read_lenPrefixed_uInt8s_ToOString(rStream);
ByteString aStr;
rStream.ReadByteString( aStr );
sal_Char cStream = NfCurrencyEntry::GetEuroSymbol( eStream );
if ( aStr.Search( cStream ) == STRING_NOTFOUND )
{ // simple conversion to unicode

View File

@ -257,8 +257,8 @@ sal_Bool GIFReader::ReadExtension()
// Appl.-Extension hat Laenge 11
if ( cSize == 0x0b )
{
rtl::OString aAppId = read_uInt8s_ToOString(rIStm, 8);
rtl::OString aAppCode = read_uInt8s_ToOString(rIStm, 3);
rtl::OString aAppId = read_uInt8s_AsOString(rIStm, 8);
rtl::OString aAppCode = read_uInt8s_AsOString(rIStm, 3);
rIStm >> cSize;
// NetScape-Extension

View File

@ -1125,6 +1125,7 @@ SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj )
VersionCompat aCompat( rIStm, STREAM_READ );
Graphic aGraphic;
GraphicAttr aAttr;
ByteString aLink;
sal_Bool bLink;
rIStm >> aGraphic >> aAttr >> bLink;
@ -1134,8 +1135,8 @@ SvStream& operator>>( SvStream& rIStm, GraphicObject& rGraphicObj )
if( bLink )
{
rtl::OUString aLink = read_lenPrefixed_uInt8s_ToOUString(rIStm, RTL_TEXTENCODING_UTF8);
rGraphicObj.SetLink(aLink);
rIStm.ReadByteString(aLink);
rGraphicObj.SetLink( UniString( aLink, RTL_TEXTENCODING_UTF8 ) );
}
else
rGraphicObj.SetLink();
@ -1153,7 +1154,7 @@ SvStream& operator<<( SvStream& rOStm, const GraphicObject& rGraphicObj )
rOStm << rGraphicObj.GetGraphic() << rGraphicObj.GetAttr() << bLink;
if( bLink )
write_lenPrefixed_uInt8s_FromOUString(rOStm, rGraphicObj.GetLink(), RTL_TEXTENCODING_UTF8);
rOStm.WriteByteString(rtl::OUStringToOString(rGraphicObj.GetLink(), RTL_TEXTENCODING_UTF8));
return rOStm;
}

View File

@ -104,16 +104,16 @@ void IMapObject::Write( SvStream& rOStm, const String& rBaseURL ) const
const rtl::OString aRelURL = rtl::OUStringToOString(
URIHelper::simpleNormalizedMakeRelative(rBaseURL, aURL), eEncoding);
write_lenPrefixed_uInt8s_FromOString(rOStm, aRelURL);
write_lenPrefixed_uInt8s_FromOUString(rOStm, aAltText, eEncoding);
rOStm.WriteByteString(aRelURL);
rOStm.WriteByteString(rtl::OUStringToOString(aAltText, eEncoding));
rOStm << bActive;
write_lenPrefixed_uInt8s_FromOUString(rOStm, aTarget, eEncoding);
rOStm.WriteByteString(rtl::OUStringToOString(aTarget, eEncoding));
pCompat = new IMapCompat( rOStm, STREAM_WRITE );
WriteIMapObject( rOStm );
aEventList.Write( rOStm ); // V4
write_lenPrefixed_uInt8s_FromOUString(rOStm, aName, eEncoding); // V5
aEventList.Write( rOStm ); // V4
rOStm.WriteByteString(rtl::OUStringToOString(aName, eEncoding)); // V5
delete pCompat;
}
@ -129,15 +129,16 @@ void IMapObject::Read( SvStream& rIStm, const String& rBaseURL )
{
IMapCompat* pCompat;
rtl_TextEncoding nTextEncoding;
ByteString aString;
// Typ und Version ueberlesen wir
rIStm.SeekRel( 2 );
rIStm >> nReadVersion;
rIStm >> nTextEncoding;
aURL = read_lenPrefixed_uInt8s_ToOUString(rIStm, nTextEncoding);
aAltText = read_lenPrefixed_uInt8s_ToOUString(rIStm, nTextEncoding);
rIStm.ReadByteString( aString ); aURL = String( aString.GetBuffer(), nTextEncoding );
rIStm.ReadByteString( aString ); aAltText = String( aString.GetBuffer(), nTextEncoding );
rIStm >> bActive;
aTarget = read_lenPrefixed_uInt8s_ToOUString(rIStm, nTextEncoding);
rIStm.ReadByteString( aString ); aTarget = String( aString.GetBuffer(), nTextEncoding );
// URL absolut machen
aURL = URIHelper::SmartRel2Abs( INetURLObject(rBaseURL), aURL, URIHelper::GetMaybeFileHdl(), true, false, INetURLObject::WAS_ENCODED, INetURLObject::DECODE_UNAMBIGUOUS );
@ -152,7 +153,9 @@ void IMapObject::Read( SvStream& rIStm, const String& rBaseURL )
// ab Version 5 kann ein Objektname vorhanden sein
if ( nReadVersion >= 0x0005 )
aName = read_lenPrefixed_uInt8s_ToOUString(rIStm, nTextEncoding);
{
rIStm.ReadByteString( aString ); aName = String( aString.GetBuffer(), nTextEncoding );
}
}
delete pCompat;
@ -1114,19 +1117,20 @@ void ImageMap::Write( SvStream& rOStm, const String& rBaseURL ) const
{
IMapCompat* pCompat;
String aImageName( GetName() );
String aDummy;
sal_uInt16 nOldFormat = rOStm.GetNumberFormatInt();
sal_uInt16 nCount = (sal_uInt16) GetIMapObjectCount();
const rtl_TextEncoding eEncoding = osl_getThreadTextEncoding(); //vomit!
const rtl_TextEncoding eEncoding = osl_getThreadTextEncoding();
rOStm.SetNumberFormatInt( NUMBERFORMAT_INT_LITTLEENDIAN );
// MagicCode schreiben
rOStm << IMAPMAGIC;
rOStm << GetVersion();
write_lenPrefixed_uInt8s_FromOUString(rOStm, aImageName, eEncoding);
write_lenPrefixed_uInt8s_FromOString(rOStm, rtl::OString()); //dummy
rOStm.WriteByteString(rtl::OUStringToOString(aImageName, eEncoding));
rOStm.WriteByteString(rtl::OUStringToOString(aDummy, eEncoding));
rOStm << nCount;
write_lenPrefixed_uInt8s_FromOUString(rOStm, aImageName, eEncoding);
rOStm.WriteByteString(rtl::OUStringToOString(aImageName, eEncoding));
pCompat = new IMapCompat( rOStm, STREAM_WRITE );
@ -1148,6 +1152,7 @@ void ImageMap::Write( SvStream& rOStm, const String& rBaseURL ) const
void ImageMap::Read( SvStream& rIStm, const String& rBaseURL )
{
ByteString aString;
char cMagic[6];
sal_uInt16 nOldFormat = rIStm.GetNumberFormatInt();
sal_uInt16 nCount;
@ -1165,10 +1170,10 @@ void ImageMap::Read( SvStream& rIStm, const String& rBaseURL )
// Version ueberlesen wir
rIStm.SeekRel( 2 );
aName = read_lenPrefixed_uInt8s_ToOUString(rIStm, osl_getThreadTextEncoding());
read_lenPrefixed_uInt8s_ToOString(rIStm); // Dummy
rIStm.ReadByteString( aString ); aName = String( aString, osl_getThreadTextEncoding() );
rIStm.ReadByteString( aString ); // Dummy
rIStm >> nCount;
read_lenPrefixed_uInt8s_ToOString(rIStm); // Dummy
rIStm.ReadByteString( aString ); // Dummy
pCompat = new IMapCompat( rIStm, STREAM_READ );

View File

@ -73,7 +73,7 @@ sal_Bool INetImage::Read( SvStream& rIStm, sal_uLong nFormat )
{
case SOT_FORMATSTR_ID_INET_IMAGE:
{
String sINetImg = read_zeroTerminated_uInt8s_ToOUString(rIStm, RTL_TEXTENCODING_UTF8);
String sINetImg = read_zeroTerminated_uInt8s_AsOUString(rIStm, RTL_TEXTENCODING_UTF8);
xub_StrLen nStart = 0;
aImageURL = sINetImg.GetToken( 0, TOKEN_SEPARATOR, nStart );
aTargetURL = sINetImg.GetToken( 0, TOKEN_SEPARATOR, nStart );
@ -119,11 +119,11 @@ sal_Bool INetImage::Read( SvStream& rIStm, sal_uLong nFormat )
// skip over iExtraHTML_Offset
rIStm.SeekRel( sizeof( int ) );
aImageURL = read_zeroTerminated_uInt8s_ToOUString(rIStm, eSysCSet);
aImageURL = read_zeroTerminated_uInt8s_AsOUString(rIStm, eSysCSet);
if( nAltOffset )
{
rIStm.Seek( nFilePos + nAltOffset );
aAlternateText = read_zeroTerminated_uInt8s_ToOUString(rIStm, eSysCSet);
aAlternateText = read_zeroTerminated_uInt8s_AsOUString(rIStm, eSysCSet);
}
else if( aAlternateText.Len() )
aAlternateText.Erase();
@ -131,7 +131,7 @@ sal_Bool INetImage::Read( SvStream& rIStm, sal_uLong nFormat )
if( nAnchorOffset )
{
rIStm.Seek( nFilePos + nAnchorOffset );
aTargetURL = read_zeroTerminated_uInt8s_ToOUString(rIStm, eSysCSet);
aTargetURL = read_zeroTerminated_uInt8s_AsOUString(rIStm, eSysCSet);
}
else if( aTargetURL.Len() )
aTargetURL.Erase();

View File

@ -47,16 +47,16 @@ class GalleryThemeEntry
{
private:
rtl::OUString aName;
String aName;
INetURLObject aThmURL;
INetURLObject aSdgURL;
INetURLObject aSdvURL;
sal_uInt32 nFileNumber;
sal_uInt32 nId;
sal_Bool bReadOnly;
sal_Bool bImported;
sal_Bool bModified;
sal_Bool bThemeNameFromResource;
sal_uInt32 nFileNumber;
sal_uInt32 nId;
sal_Bool bReadOnly;
sal_Bool bImported;
sal_Bool bModified;
sal_Bool bThemeNameFromResource;
GalleryThemeEntry();
INetURLObject ImplGetURLIgnoreCase( const INetURLObject& rURL ) const;
@ -68,26 +68,26 @@ public:
sal_Bool bNewFile, sal_uInt32 nId, sal_Bool bThemeNameFromResource );
~GalleryThemeEntry() {};
const rtl::OUString& GetThemeName() const { return aName; }
sal_uInt32 GetFileNumber() const { return nFileNumber; }
const String& GetThemeName() const { return aName; }
sal_uInt32 GetFileNumber() const { return nFileNumber; }
const INetURLObject& GetThmURL() const { return aThmURL; }
const INetURLObject& GetSdgURL() const { return aSdgURL; }
const INetURLObject& GetSdvURL() const { return aSdvURL; }
sal_Bool IsImported() const { return bImported; }
sal_Bool IsReadOnly() const { return bReadOnly; }
sal_Bool IsDefault() const;
sal_Bool IsImported() const { return bImported; }
sal_Bool IsReadOnly() const { return bReadOnly; }
sal_Bool IsDefault() const;
sal_Bool IsHidden() const { return aName.matchAsciiL(RTL_CONSTASCII_STRINGPARAM("private://gallery/hidden/")); }
sal_Bool IsHidden() const { return aName.SearchAscii( "private://gallery/hidden/" ) == 0; }
sal_Bool IsModified() const { return bModified; }
sal_Bool IsModified() const { return bModified; }
void SetModified( sal_Bool bSet ) { bModified = ( bSet && !IsImported() && !IsReadOnly() ); }
void SetName( const rtl::OUString& rNewName );
sal_Bool IsNameFromResource() const { return bThemeNameFromResource; }
void SetName( const String& rNewName );
sal_Bool IsNameFromResource() const { return bThemeNameFromResource; }
sal_uInt32 GetId() const { return nId; }
sal_uInt32 GetId() const { return nId; }
void SetId( sal_uInt32 nNewId, sal_Bool bResetThemeName );
};
@ -99,10 +99,10 @@ typedef ::std::vector< GalleryThemeEntry* > GalleryThemeList;
struct GalleryImportThemeEntry
{
rtl::OUString aThemeName;
rtl::OUString aUIName;
INetURLObject aURL;
rtl::OUString aImportName;
String aThemeName;
String aUIName;
INetURLObject aURL;
String aImportName;
};
typedef ::std::vector< GalleryImportThemeEntry* > GalleryImportThemeList;
@ -144,9 +144,9 @@ private:
void ImplLoadImports();
void ImplWriteImportList();
SVX_DLLPUBLIC GalleryThemeEntry* ImplGetThemeEntry( const rtl::OUString& rThemeName );
SVX_DLLPUBLIC GalleryThemeEntry* ImplGetThemeEntry( const String& rThemeName );
GalleryThemeEntry* ImplGetThemeEntry( sal_uIntPtr nThemeId );
GalleryImportThemeEntry* ImplGetImportThemeEntry( const rtl::OUString& rImportName );
GalleryImportThemeEntry* ImplGetImportThemeEntry( const String& rImportName );
GalleryTheme* ImplGetCachedTheme( const GalleryThemeEntry* pThemeEntry );
void ImplDeleteCachedTheme( GalleryTheme* pTheme );
@ -164,7 +164,7 @@ public:
const GalleryThemeEntry* GetThemeInfo( const String& rThemeName ) { return ImplGetThemeEntry( rThemeName ); }
SVX_DLLPUBLIC sal_Bool HasTheme( const String& rThemeName );
rtl::OUString GetThemeName( sal_uIntPtr nThemeId ) const;
String GetThemeName( sal_uIntPtr nThemeId ) const;
SVX_DLLPUBLIC sal_Bool CreateTheme( const String& rThemeName, sal_uInt32 nNumFrom = 0 );
sal_Bool RenameTheme( const String& rOldName, const String& rNewName );

View File

@ -245,8 +245,8 @@ class GalleryHint : public SfxHint
private:
sal_uIntPtr mnType;
rtl::OUString maThemeName;
rtl::OUString maStringData;
String maThemeName;
String maStringData;
sal_uIntPtr mnData1;
sal_uIntPtr mnData2;
@ -258,11 +258,11 @@ public:
GalleryHint( sal_uIntPtr nType, const String& rThemeName, const String& rStringData, sal_uIntPtr nData1 = 0UL, sal_uIntPtr nData2 = 0UL ) :
mnType( nType ), maThemeName( rThemeName ), maStringData( rStringData ), mnData1( nData1 ), mnData2( nData2 ) {}
sal_uIntPtr GetType() const { return mnType; }
const rtl::OUString& GetThemeName() const { return maThemeName; }
const rtl::OUString& GetStringData() const { return maStringData; }
sal_uIntPtr GetData1() const { return mnData1; }
sal_uIntPtr GetData2() const { return mnData2; }
sal_uIntPtr GetType() const { return mnType; }
const String& GetThemeName() const { return maThemeName; }
const String& GetStringData() const { return maStringData; }
sal_uIntPtr GetData1() const { return mnData1; }
sal_uIntPtr GetData2() const { return mnData2; }
};
#endif

View File

@ -70,10 +70,10 @@ class ListBox;
struct GalDragParams
{
Region aDragRegion;
sal_uIntPtr nDragObjPos;
rtl::OUString aThemeName;
rtl::OUString aFileName;
Region aDragRegion;
sal_uIntPtr nDragObjPos;
String aThemeName;
String aFileName;
SgaObjKind eObjKind;
};
@ -99,7 +99,7 @@ class GalleryTheme : public SfxBroadcaster
private:
GalleryObjectList aObjectList;
rtl::OUString aImportName;
String aImportName;
String m_aDestDir;
SotStorageRef aSvDrawStorageRef;
Gallery* pParent;
@ -147,10 +147,10 @@ public:
SVX_DLLPUBLIC bool RemoveObject( size_t nPos );
bool ChangeObjectPos( size_t nOldPos, size_t nNewPos );
SVX_DLLPUBLIC const rtl::OUString& GetName() const;
const rtl::OUString& GetRealName() const;
const rtl::OUString& GetImportName() const { return aImportName; }
void SetImportName(const rtl::OUString& rImportName) { aImportName = rImportName; }
SVX_DLLPUBLIC const String& GetName() const;
const String& GetRealName() const;
const String& GetImportName() const { return aImportName; }
void SetImportName(const String& rImportName) { aImportName = rImportName; }
const String& GetDestDir() const { return m_aDestDir; }
void SetDestDir(const String& rDestDir) { m_aDestDir = rDestDir; }

View File

@ -78,7 +78,7 @@ GalleryThemeEntry::GalleryThemeEntry( const INetURLObject& rBaseURL, const Strin
if( nId && bThemeNameFromResource )
aName = String( GAL_RESID( RID_GALLERYSTR_THEME_START + (sal_uInt16) nId ) );
if( !aName.getLength() )
if( !aName.Len() )
aName = rName;
}
@ -107,7 +107,7 @@ INetURLObject GalleryThemeEntry::ImplGetURLIgnoreCase( const INetURLObject& rURL
// -----------------------------------------------------------------------------
void GalleryThemeEntry::SetName( const rtl::OUString& rNewName )
void GalleryThemeEntry::SetName( const String& rNewName )
{
if( aName != rNewName )
{
@ -132,12 +132,16 @@ void GalleryThemeEntry::SetId( sal_uInt32 nNewId, sal_Bool bResetThemeName )
SvStream& operator<<( SvStream& rOut, const GalleryImportThemeEntry& rEntry )
{
write_lenPrefixed_uInt8s_FromOUString(rOut, rEntry.aThemeName, RTL_TEXTENCODING_UTF8);
write_lenPrefixed_uInt8s_FromOUString(rOut, rEntry.aUIName, RTL_TEXTENCODING_UTF8);
write_lenPrefixed_uInt8s_FromOUString(rOut, (rEntry.aURL.GetMainURL( INetURLObject::NO_DECODE )), RTL_TEXTENCODING_UTF8);
write_lenPrefixed_uInt8s_FromOUString(rOut, rEntry.aImportName, RTL_TEXTENCODING_UTF8);
rOut.WriteByteString(rtl::OUStringToOString(rEntry.aThemeName, RTL_TEXTENCODING_UTF8));
rOut.WriteByteString(rtl::OUStringToOString(rEntry.aUIName, RTL_TEXTENCODING_UTF8));
rOut.WriteByteString(rtl::OUStringToOString(String(rEntry.aURL.GetMainURL( INetURLObject::NO_DECODE )), RTL_TEXTENCODING_UTF8));
rOut.WriteByteString(rtl::OUStringToOString(rEntry.aImportName, RTL_TEXTENCODING_UTF8));
rOut.WriteByteString(rtl::OUString());
write_lenPrefixed_uInt8s_FromOString(rOut, rtl::OString());
return rOut;
}
@ -145,11 +149,22 @@ SvStream& operator<<( SvStream& rOut, const GalleryImportThemeEntry& rEntry )
SvStream& operator>>( SvStream& rIn, GalleryImportThemeEntry& rEntry )
{
rEntry.aThemeName = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8);
rEntry.aUIName = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8);
rEntry.aURL = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8);
rEntry.aImportName = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8);
read_lenPrefixed_uInt8s_ToOString(rIn);
ByteString aTmpStr;
rIn.ReadByteString(aTmpStr);
rEntry.aThemeName = String( aTmpStr, RTL_TEXTENCODING_UTF8 );
rIn.ReadByteString(aTmpStr);
rEntry.aUIName = String( aTmpStr, RTL_TEXTENCODING_UTF8 );
rIn.ReadByteString(aTmpStr);
rEntry.aURL = INetURLObject( String( aTmpStr, RTL_TEXTENCODING_UTF8 ) );
rIn.ReadByteString(aTmpStr);
rEntry.aImportName = String( aTmpStr, RTL_TEXTENCODING_UTF8 );
rIn.ReadByteString(aTmpStr);
return rIn;
}
@ -532,23 +547,21 @@ void Gallery::ImplWriteImportList()
// ------------------------------------------------------------------------
GalleryThemeEntry* Gallery::ImplGetThemeEntry( const rtl::OUString& rThemeName )
GalleryThemeEntry* Gallery::ImplGetThemeEntry( const String& rThemeName )
{
GalleryThemeEntry* pFound = NULL;
if( rThemeName.getLength() )
{
if( rThemeName.Len() )
for ( size_t i = 0, n = aThemeList.size(); i < n && !pFound; ++i )
if( rThemeName == aThemeList[ i ]->GetThemeName() )
pFound = aThemeList[ i ];
}
return pFound;
}
// ------------------------------------------------------------------------
GalleryImportThemeEntry* Gallery::ImplGetImportThemeEntry( const rtl::OUString& rImportName )
GalleryImportThemeEntry* Gallery::ImplGetImportThemeEntry( const String& rImportName )
{
for ( size_t i = 0, n = aImportList.size(); i < n; ++i )
if ( rImportName == aImportList[ i ]->aUIName )
@ -558,7 +571,7 @@ GalleryImportThemeEntry* Gallery::ImplGetImportThemeEntry( const rtl::OUString&
// ------------------------------------------------------------------------
rtl::OUString Gallery::GetThemeName( sal_uIntPtr nThemeId ) const
String Gallery::GetThemeName( sal_uIntPtr nThemeId ) const
{
GalleryThemeEntry* pFound = NULL;
@ -593,7 +606,7 @@ rtl::OUString Gallery::GetThemeName( sal_uIntPtr nThemeId ) const
pFound = ( (Gallery*) this )->ImplGetThemeEntry( String::CreateFromAscii( aFallback.GetBuffer() ) );
}
return( pFound ? pFound->GetThemeName() : rtl::OUString() );
return( pFound ? pFound->GetThemeName() : String() );
}
// ------------------------------------------------------------------------

View File

@ -168,7 +168,7 @@ void SgaObject::WriteData( SvStream& rOut, const String& rDestDir ) const
String aURLWithoutDestDir = String(aURL.GetMainURL( INetURLObject::NO_DECODE ));
aURLWithoutDestDir.SearchAndReplace(rDestDir, String());
write_lenPrefixed_uInt8s_FromOUString(rOut, aURLWithoutDestDir, RTL_TEXTENCODING_UTF8);
rOut.WriteByteString(rtl::OUStringToOString(aURLWithoutDestDir, RTL_TEXTENCODING_UTF8));
}
// ------------------------------------------------------------------------
@ -185,8 +185,9 @@ void SgaObject::ReadData(SvStream& rIn, sal_uInt16& rReadVersion )
else
rIn >> aThumbMtf;
rtl::OUString aTmpStr = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8);
aURL = INetURLObject(aTmpStr);
ByteString aTmpStr;
rIn.ReadByteString(aTmpStr);
aURL = INetURLObject(rtl::OStringToOUString(aTmpStr,RTL_TEXTENCODING_UTF8));
}
// ------------------------------------------------------------------------
@ -293,8 +294,9 @@ void SgaObjectBmp::WriteData( SvStream& rOut, const String& rDestDir ) const
SgaObject::WriteData( rOut, rDestDir );
char aDummy[ 10 ];
rOut.Write( aDummy, 10 );
write_lenPrefixed_uInt8s_FromOString(rOut, rtl::OString()); //dummy
write_lenPrefixed_uInt8s_FromOUString(rOut, aTitle, RTL_TEXTENCODING_UTF8);
String aDummyStr;
rOut.WriteByteString(rtl::OUStringToOString(aDummyStr, RTL_TEXTENCODING_UTF8));
rOut.WriteByteString(rtl::OUStringToOString(aTitle, RTL_TEXTENCODING_UTF8));
}
// ------------------------------------------------------------------------
@ -304,10 +306,14 @@ void SgaObjectBmp::ReadData( SvStream& rIn, sal_uInt16& rReadVersion )
SgaObject::ReadData( rIn, rReadVersion );
rIn.SeekRel( 10 ); // 16, 16, 32, 16
read_lenPrefixed_uInt8s_ToOString(rIn); //dummy
ByteString aTmpStr;
rIn.ReadByteString(aTmpStr); // dummy
if( rReadVersion >= 5 )
aTitle = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8);
{
rIn.ReadByteString(aTmpStr);
aTitle = rtl::OStringToOUString(aTmpStr, RTL_TEXTENCODING_UTF8);
}
}
// ------------------
@ -374,7 +380,7 @@ void SgaObjectSound::WriteData( SvStream& rOut, const String& rDestDir ) const
{
SgaObject::WriteData( rOut, rDestDir );
rOut << (sal_uInt16) eSoundType;
write_lenPrefixed_uInt8s_FromOUString(rOut, aTitle, RTL_TEXTENCODING_UTF8);
rOut.WriteByteString(rtl::OUStringToOString(aTitle, RTL_TEXTENCODING_UTF8));
}
// ------------------------------------------------------------------------
@ -390,7 +396,11 @@ void SgaObjectSound::ReadData( SvStream& rIn, sal_uInt16& rReadVersion )
rIn >> nTmp16; eSoundType = (GalSoundType) nTmp16;
if( rReadVersion >= 6 )
aTitle = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8);
{
ByteString aTmpStr;
rIn.ReadByteString(aTmpStr);
aTitle = rtl::OStringToOUString(aTmpStr, RTL_TEXTENCODING_UTF8);
}
}
}
@ -581,7 +591,7 @@ sal_Bool SgaObjectSvDraw::DrawCentered( OutputDevice* pOut, const FmFormModel& r
void SgaObjectSvDraw::WriteData( SvStream& rOut, const String& rDestDir ) const
{
SgaObject::WriteData( rOut, rDestDir );
write_lenPrefixed_uInt8s_FromOUString(rOut, aTitle, RTL_TEXTENCODING_UTF8);
rOut.WriteByteString(rtl::OUStringToOString(aTitle, RTL_TEXTENCODING_UTF8));
}
// ------------------------------------------------------------------------
@ -591,7 +601,11 @@ void SgaObjectSvDraw::ReadData( SvStream& rIn, sal_uInt16& rReadVersion )
SgaObject::ReadData( rIn, rReadVersion );
if( rReadVersion >= 5 )
aTitle = read_lenPrefixed_uInt8s_ToOUString(rIn, RTL_TEXTENCODING_UTF8);
{
ByteString aTmpStr;
rIn.ReadByteString(aTmpStr);
aTitle = rtl::OStringToOUString(aTmpStr, RTL_TEXTENCODING_UTF8);
}
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -733,7 +733,8 @@ GalleryThemeEntry* GalleryTheme::CreateThemeEntry( const INetURLObject& rURL, sa
{
sal_uInt32 nThemeId = 0;
rtl::OString aTmpStr = read_lenPrefixed_uInt8s_ToOString(*pIStm);
ByteString aTmpStr;
pIStm->ReadByteString(aTmpStr);
aThemeName = rtl::OStringToOUString(aTmpStr, RTL_TEXTENCODING_UTF8);
// Charakterkonvertierung durchfuehren
@ -1354,7 +1355,7 @@ SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const
sal_Bool bRel;
rOStm << (sal_uInt16) 0x0004;
write_lenPrefixed_uInt8s_FromOUString(rOStm, GetRealName(), RTL_TEXTENCODING_UTF8);
rOStm.WriteByteString(rtl::OUStringToOString(GetRealName(), RTL_TEXTENCODING_UTF8));
rOStm << nCount << (sal_uInt16) osl_getThreadTextEncoding();
for( sal_uInt32 i = 0; i < nCount; i++ )
@ -1394,7 +1395,7 @@ SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const
aPath.SearchAndReplace(m_aDestDir, String());
rOStm << bRel;
write_lenPrefixed_uInt8s_FromOUString(rOStm, aPath, RTL_TEXTENCODING_UTF8);
rOStm.WriteByteString(rtl::OUStringToOString(aPath, RTL_TEXTENCODING_UTF8));
rOStm << pObj->nOffset << (sal_uInt16) pObj->eObjKind;
}
@ -1432,9 +1433,10 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm )
String aThemeName;
rtl_TextEncoding nTextEncoding;
aImportName = rtl::OUString();
aImportName = String();
rIStm >> nVersion;
rtl::OString aTmpStr = read_lenPrefixed_uInt8s_ToOString(rIStm);
ByteString aTmpStr;
rIStm.ReadByteString(aTmpStr);
rIStm >> nCount;
if( nVersion >= 0x0004 )
@ -1469,12 +1471,13 @@ SvStream& GalleryTheme::ReadData( SvStream& rIStm )
{
pObj = new GalleryObject;
ByteString aTempFileName;
String aFileName;
String aPath;
sal_uInt16 nTemp;
rIStm >> bRel;
rtl::OString aTempFileName = read_lenPrefixed_uInt8s_ToOString(rIStm);
rIStm.ReadByteString(aTempFileName);
rIStm >> pObj->nOffset;
rIStm >> nTemp; pObj->eObjKind = (SgaObjKind) nTemp;
@ -1580,7 +1583,7 @@ SvStream& operator>>( SvStream& rIn, GalleryTheme& rTheme )
void GalleryTheme::ImplSetModified( sal_Bool bModified )
{ pThm->SetModified( bModified ); }
const rtl::OUString& GalleryTheme::GetRealName() const { return pThm->GetThemeName(); }
const String& GalleryTheme::GetRealName() const { return pThm->GetThemeName(); }
const INetURLObject& GalleryTheme::GetThmURL() const { return pThm->GetThmURL(); }
const INetURLObject& GalleryTheme::GetSdgURL() const { return pThm->GetSdgURL(); }
const INetURLObject& GalleryTheme::GetSdvURL() const { return pThm->GetSdvURL(); }
@ -1591,7 +1594,7 @@ sal_Bool GalleryTheme::IsImported() const { return pThm->IsImported(); }
sal_Bool GalleryTheme::IsReadOnly() const { return pThm->IsReadOnly(); }
sal_Bool GalleryTheme::IsDefault() const { return pThm->IsDefault(); }
sal_Bool GalleryTheme::IsModified() const { return pThm->IsModified(); }
const rtl::OUString& GalleryTheme::GetName() const { return IsImported() ? aImportName : pThm->GetThemeName(); }
const String& GalleryTheme::GetName() const { return IsImported() ? aImportName : pThm->GetThemeName(); }
void GalleryTheme::InsertAllThemes( ListBox& rListBox )
{

View File

@ -85,7 +85,7 @@ String Ww1PlainText::GetText( sal_uLong ulOffset, sal_uLong nLen ) const
bool bSeekOk = rFib.GetStream().Seek(nPos) == nPos;
rtl::OString a8BitStr = bSeekOk ?
read_uInt8s_ToOString(rFib.GetStream(), nLen) :
read_uInt8s_AsOString(rFib.GetStream(), nLen) :
rtl::OString();
return rtl::OStringToOUString(a8BitStr, RTL_TEXTENCODING_MS_1252);
}

View File

@ -281,7 +281,7 @@ bool Sttb::Read( SvStream& rS )
{
SBBItem aItem;
rS >> aItem.cchData;
aItem.data = read_LEuInt16s_ToOUString(rS, aItem.cchData);
aItem.data = read_LEuInt16s_AsOUString(rS, aItem.cchData);
dataItems.push_back( aItem );
}
}

View File

@ -4334,7 +4334,7 @@ void WW8RStyle::ImportOldFormatStyles()
}
else // user style
{
rtl::OString aTmp = read_uInt8s_ToOString(rSt, nCount);
rtl::OString aTmp = read_uInt8s_AsOString(rSt, nCount);
nByteCount += aTmp.getLength();
sName = rtl::OStringToOUString(aTmp, eStructChrSet);
}

View File

@ -1910,16 +1910,23 @@ Err:
return false;
}
String read_uInt8_PascalString(SvStream& rStrm, rtl_TextEncoding eEnc)
{
sal_uInt8 nLen(0);
rStrm >> nLen;
return rtl::OStringToOUString(read_uInt8s_AsOString(rStrm, nLen), eEnc);
}
String read_LEuInt16_PascalString(SvStream& rStrm)
{
sal_uInt16 nLen(0);
rStrm >> nLen;
return read_LEuInt16s_ToOUString(rStrm, nLen);
return read_LEuInt16s_AsOUString(rStrm, nLen);
}
String read_uInt8_BeltAndBracesString(SvStream& rStrm, rtl_TextEncoding eEnc)
{
rtl::OUString aRet = read_lenPrefixed_uInt8s_ToOUString<sal_uInt8>(rStrm, eEnc);
String aRet = read_uInt8_PascalString(rStrm, eEnc);
rStrm.SeekRel(sizeof(sal_uInt8)); // skip null-byte at end
return aRet;
}
@ -1961,11 +1968,11 @@ xub_StrLen WW8ScannerBase::WW8ReadString( SvStream& rStrm, String& rStr,
nLen = USHRT_MAX - 1;
if( bIsUnicode )
rStr.Append(String(read_LEuInt16s_ToOUString(rStrm, nLen)));
rStr.Append(String(read_LEuInt16s_AsOUString(rStrm, nLen)));
else
{
// Alloc method automatically sets Zero at the end
rtl::OString aByteStr = read_uInt8s_ToOString(rStrm, nLen);
rtl::OString aByteStr = read_uInt8s_AsOString(rStrm, nLen);
rStr.Append(String(rtl::OStringToOUString(aByteStr, eEnc)));
}
nTotalRead += nLen;
@ -3869,7 +3876,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen
{
sal_uInt8 nBChar(0);
rStrm >> nBChar;
rtl::OString aTmp = read_uInt8s_ToOString(rStrm, nBChar);
rtl::OString aTmp = read_uInt8s_AsOString(rStrm, nBChar);
rArray.push_back(rtl::OStringToOUString(aTmp, eCS));
}
@ -3902,7 +3909,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen
{
sal_uInt8 nBChar(0);
rStrm >> nBChar;
rtl::OString aTmp = read_uInt8s_ToOString(rStrm, nBChar);
rtl::OString aTmp = read_uInt8s_AsOString(rStrm, nBChar);
pValueArray->push_back(rtl::OStringToOUString(aTmp, eCS));
}
}
@ -3928,7 +3935,7 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen
++nRead;
if (nBChar)
{
rtl::OString aTmp = read_uInt8s_ToOString(rStrm, nBChar);
rtl::OString aTmp = read_uInt8s_AsOString(rStrm, nBChar);
nRead += aTmp.getLength();
rArray.push_back(rtl::OStringToOUString(aTmp, eCS));
}

View File

@ -136,10 +136,7 @@ public:
//Read a Pascal-style, i.e. single byte string length followed
//by string contents
inline String read_uInt8_PascalString(SvStream& rStrm, rtl_TextEncoding eEnc)
{
return read_lenPrefixed_uInt8s_ToOUString<sal_uInt8>(rStrm, eEnc);
}
String read_uInt8_PascalString(SvStream& rStrm, rtl_TextEncoding eEnc);
String read_LEuInt16_PascalString(SvStream& rStrm);
//Belt and Braces strings, i.e. Pascal-style strings followed by

View File

@ -1128,7 +1128,7 @@ bool TcgSttbfCore::Read( SvStream& rS )
for ( sal_Int32 index = 0; index < cData; ++index )
{
rS >> dataItems[ index ].cchData;
dataItems[ index ].data = read_LEuInt16s_ToOUString(rS, dataItems[index].cchData);
dataItems[ index ].data = read_LEuInt16s_AsOUString(rS, dataItems[index].cchData);
rS >> dataItems[ index ].extraData;
}
}

View File

@ -1993,9 +1993,9 @@ int SwTransferable::_PasteDDE( TransferableDataHelper& rData,
} // report useful error!!
rtl_TextEncoding eEncoding = DDE_TXT_ENCODING;
aApp = read_zeroTerminated_uInt8s_ToOUString(*xStrm, eEncoding);
aTopic = read_zeroTerminated_uInt8s_ToOUString(*xStrm, eEncoding);
aItem = read_zeroTerminated_uInt8s_ToOUString(*xStrm, eEncoding);
aApp = read_zeroTerminated_uInt8s_AsOUString(*xStrm, eEncoding);
aTopic = read_zeroTerminated_uInt8s_AsOUString(*xStrm, eEncoding);
aItem = read_zeroTerminated_uInt8s_AsOUString(*xStrm, eEncoding);
}
String aCmd;

View File

@ -51,7 +51,7 @@ class INetMessageHeader
ByteString m_aValue;
public:
INetMessageHeader()
INetMessageHeader (void)
{}
INetMessageHeader (
@ -64,7 +64,7 @@ public:
: m_aName (rHdr.m_aName), m_aValue (rHdr.m_aValue)
{}
~INetMessageHeader()
~INetMessageHeader (void)
{}
INetMessageHeader& operator= (const INetMessageHeader& rHdr)
@ -74,22 +74,22 @@ public:
return *this;
}
const ByteString& GetName() const { return m_aName; }
const ByteString& GetValue() const { return m_aValue; }
const ByteString& GetName (void) const { return m_aName; }
const ByteString& GetValue (void) const { return m_aValue; }
friend SvStream& operator<< (
SvStream& rStrm, const INetMessageHeader& rHdr)
{
write_lenPrefixed_uInt8s_FromOString(rStrm, rHdr.m_aName);
write_lenPrefixed_uInt8s_FromOString(rStrm, rHdr.m_aValue);
rStrm.WriteByteString (rHdr.m_aName);
rStrm.WriteByteString (rHdr.m_aValue);
return rStrm;
}
friend SvStream& operator>> (
SvStream& rStrm, INetMessageHeader& rHdr)
{
rHdr.m_aName = read_lenPrefixed_uInt8s_ToOString(rStrm);
rHdr.m_aValue = read_lenPrefixed_uInt8s_ToOString(rStrm);
rStrm.ReadByteString (rHdr.m_aName);
rStrm.ReadByteString (rHdr.m_aValue);
return rStrm;
}
};
@ -108,7 +108,7 @@ class INetMessage
UniString m_aDocName;
SvLockBytesRef m_xDocLB;
void ListCleanup_Impl();
void ListCleanup_Impl (void);
void ListCopy (const INetMessage& rMsg);
protected:
@ -158,8 +158,8 @@ protected:
virtual SvStream& operator>> (SvStream& rStrm);
public:
INetMessage() : m_nDocSize(0) {}
virtual ~INetMessage();
INetMessage (void) : m_nDocSize(0) {}
virtual ~INetMessage (void);
INetMessage (const INetMessage& rMsg)
: m_nDocSize (rMsg.m_nDocSize),
@ -178,7 +178,7 @@ public:
return *this;
}
sal_uIntPtr GetHeaderCount() const { return m_aHeaderList.size(); }
sal_uIntPtr GetHeaderCount (void) const { return m_aHeaderList.size(); }
UniString GetHeaderName (sal_uIntPtr nIndex) const
{
@ -204,13 +204,13 @@ public:
sal_uIntPtr nIndex = ((sal_uIntPtr)-1)
);
sal_uIntPtr GetDocumentSize() const { return m_nDocSize; }
sal_uIntPtr GetDocumentSize (void) const { return m_nDocSize; }
void SetDocumentSize (sal_uIntPtr nSize) { m_nDocSize = nSize; }
const UniString& GetDocumentName() const { return m_aDocName; }
const UniString& GetDocumentName (void) const { return m_aDocName; }
void SetDocumentName (const UniString& rName) { m_aDocName = rName; }
SvLockBytes* GetDocumentLB() const { return m_xDocLB; }
SvLockBytes* GetDocumentLB (void) const { return m_xDocLB; }
void SetDocumentLB (SvLockBytes *pDocLB) { m_xDocLB = pDocLB; }
friend SvStream& operator<< (
@ -260,9 +260,9 @@ protected:
virtual SvStream& operator>> (SvStream& rStrm);
public:
INetRFC822Message();
INetRFC822Message (void);
INetRFC822Message (const INetRFC822Message& rMsg);
virtual ~INetRFC822Message();
virtual ~INetRFC822Message (void);
INetRFC822Message& operator= (const INetRFC822Message& rMsg);
@ -277,105 +277,105 @@ public:
/** Header fields.
*/
UniString GetBCC() const
UniString GetBCC (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_BCC],
INetMIME::HEADER_FIELD_ADDRESS);
}
UniString GetCC() const
UniString GetCC (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_CC],
INetMIME::HEADER_FIELD_ADDRESS);
}
UniString GetComments() const
UniString GetComments (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_COMMENTS],
INetMIME::HEADER_FIELD_TEXT);
}
UniString GetDate() const
UniString GetDate (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_DATE],
INetMIME::HEADER_FIELD_STRUCTURED);
}
UniString GetFrom() const
UniString GetFrom (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_FROM],
INetMIME::HEADER_FIELD_ADDRESS);
}
UniString GetInReplyTo() const
UniString GetInReplyTo (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_IN_REPLY_TO],
INetMIME::HEADER_FIELD_ADDRESS); // ??? MESSAGE_ID ???
}
UniString GetKeywords() const
UniString GetKeywords (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_KEYWORDS],
INetMIME::HEADER_FIELD_PHRASE);
}
UniString GetMessageID() const
UniString GetMessageID (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_MESSAGE_ID],
INetMIME::HEADER_FIELD_MESSAGE_ID);
}
UniString GetReferences() const
UniString GetReferences (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_REFERENCES],
INetMIME::HEADER_FIELD_ADDRESS);
}
UniString GetReplyTo() const
UniString GetReplyTo (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_REPLY_TO],
INetMIME::HEADER_FIELD_ADDRESS);
}
UniString GetReturnPath() const
UniString GetReturnPath (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_RETURN_PATH],
INetMIME::HEADER_FIELD_ADDRESS);
}
UniString GetReturnReceiptTo() const
UniString GetReturnReceiptTo (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_RETURN_RECEIPT_TO],
INetMIME::HEADER_FIELD_ADDRESS);
}
UniString GetSender() const
UniString GetSender (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_SENDER],
INetMIME::HEADER_FIELD_ADDRESS);
}
UniString GetSubject() const
UniString GetSubject (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_SUBJECT],
INetMIME::HEADER_FIELD_TEXT);
}
UniString GetTo() const
UniString GetTo (void) const
{
return GetHeaderValue_Impl (
m_nIndex[INETMSG_RFC822_TO],
@ -430,15 +430,15 @@ class TOOLS_DLLPUBLIC INetMIMEMessage : public INetRFC822Message
INetMIMEMessage* pParent;
INetMIMEMessgeList_impl aChildren;
rtl::OString m_aBoundary;
ByteString m_aBoundary;
sal_Bool bHeaderParsed;
friend class INetMIMEMessageStream;
const rtl::OString& GetMultipartBoundary() const { return m_aBoundary; }
void SetMultipartBoundary (const rtl::OString& rBnd) { m_aBoundary = rBnd; }
const ByteString& GetMultipartBoundary (void) const { return m_aBoundary; }
void SetMultipartBoundary (const ByteString& rBnd) { m_aBoundary = rBnd; }
void CleanupImp();
void CleanupImp (void);
void CopyImp (const INetMIMEMessage& rMsg);
void SetHeaderParsed() { bHeaderParsed = sal_True; }
@ -447,9 +447,9 @@ protected:
virtual SvStream& operator>> (SvStream& rStrm);
public:
INetMIMEMessage();
INetMIMEMessage (void);
INetMIMEMessage (const INetMIMEMessage& rMsg);
virtual ~INetMIMEMessage();
virtual ~INetMIMEMessage (void);
INetMIMEMessage& operator= (const INetMIMEMessage& rMsg);
@ -467,35 +467,35 @@ public:
/** Header fields.
*/
void SetMIMEVersion (const UniString& rVersion);
UniString GetMIMEVersion() const
UniString GetMIMEVersion (void) const
{
return GetHeaderValue (m_nIndex[INETMSG_MIME_VERSION]);
}
UniString GetContentDescription() const
UniString GetContentDescription (void) const
{
return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_DESCRIPTION]);
}
void SetContentDisposition (const UniString& rDisposition);
UniString GetContentDisposition() const
UniString GetContentDisposition (void) const
{
return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_DISPOSITION]);
}
UniString GetContentID() const
UniString GetContentID (void) const
{
return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_ID]);
}
void SetContentType (const UniString& rType);
UniString GetContentType() const
UniString GetContentType (void) const
{
return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_TYPE]);
}
void SetContentTransferEncoding (const UniString& rEncoding);
UniString GetContentTransferEncoding() const
UniString GetContentTransferEncoding (void) const
{
return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_TRANSFER_ENCODING]);
}
@ -504,16 +504,16 @@ public:
/** Message container methods.
*/
sal_Bool IsContainer() const
sal_Bool IsContainer (void) const
{
return (IsMessage() || IsMultipart());
}
sal_Bool IsMessage() const
sal_Bool IsMessage (void) const
{
UniString aType (GetContentType());
return (aType.CompareIgnoreCaseToAscii("message/", 8) == 0);
}
sal_Bool IsMultipart() const
sal_Bool IsMultipart (void) const
{
UniString aType (GetContentType());
return (aType.CompareIgnoreCaseToAscii("multipart/", 10) == 0);
@ -523,7 +523,7 @@ public:
{
return ( nIndex < aChildren.size() ) ? aChildren[ nIndex ] : NULL;
}
INetMIMEMessage* GetParent() const { return pParent; }
INetMIMEMessage* GetParent (void) const { return pParent; }
sal_Bool EnableAttachChild (
INetMessageContainerType eType = INETMSG_MULTIPART_MIXED);

View File

@ -28,7 +28,6 @@
#ifndef _STREAM_HXX
#define _STREAM_HXX
#include <limits>
#include "tools/toolsdllapi.h"
#include <tools/solar.h>
#include <tools/string.hxx>
@ -365,8 +364,10 @@ public:
SvStream& ReadByteString( UniString& rStr, rtl_TextEncoding eSrcCharSet );
SvStream& ReadByteString( UniString& rStr ) { return ReadByteString( rStr, GetStreamCharSet() ); }
SvStream& ReadByteString( ByteString& rStr );
SvStream& WriteByteString( const UniString& rStr, rtl_TextEncoding eDestCharSet );
SvStream& WriteByteString( const UniString& rStr ) { return WriteByteString( rStr, GetStreamCharSet() ); }
SvStream& WriteByteString( const ByteString& rStr );
SvStream& WriteNumber( sal_uInt32 nUInt32 );
SvStream& WriteNumber( sal_Int32 nInt32 );
@ -545,70 +546,22 @@ TOOLS_DLLPUBLIC SvStream& endlub( SvStream& rStr );
//Attempt to read nLen 8bit units to an OString, returned rtl::OString's length
//is number of units successfully read
TOOLS_DLLPUBLIC rtl::OString read_uInt8s_ToOString(SvStream& rStrm, sal_Size nLen);
TOOLS_DLLPUBLIC rtl::OString read_uInt8s_AsOString(SvStream& rStr, sal_Size nLen);
//Attempt to read nLen little endian 16bit units to an OUString, returned
//rtl::OUString's length is number of units successfully read
TOOLS_DLLPUBLIC rtl::OUString read_LEuInt16s_ToOUString(SvStream& rStrm, sal_Size nLen);
TOOLS_DLLPUBLIC rtl::OUString read_LEuInt16s_AsOUString(SvStream& rStr, sal_Size nLen);
//Attempt to read 8bit units to an OString until a zero terminator is
//encountered, returned rtl::OString's length is number of units *definitely*
//successfully read, check SvStream::good() to see if null terminator was
//sucessfully read
TOOLS_DLLPUBLIC rtl::OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStrm);
TOOLS_DLLPUBLIC rtl::OString read_zeroTerminated_uInt8s_AsOString(SvStream& rStr);
//Attempt to read 8bit units assuming source encoding eEnc to an OUString until
//a zero terminator is encountered. Check SvStream::good() to see if null
//terminator was sucessfully read
TOOLS_DLLPUBLIC rtl::OUString read_zeroTerminated_uInt8s_ToOUString(SvStream& rStrm, rtl_TextEncoding eEnc);
//Attempt to read a pascal-style length (of type prefix) prefixed sequence of
//8bit units to an OString, returned rtl::OString's length is number of units
//successfully read.
template<typename prefix=sal_uInt16> rtl::OString read_lenPrefixed_uInt8s_ToOString(SvStream& rStrm)
{
prefix nLen = 0;
rStrm >> nLen;
return read_uInt8s_ToOString(rStrm, nLen);
}
//Attempt to read a pascal-style length (of type prefix) prefixed sequence of
//8bit units to an OUString
template<typename prefix=sal_uInt16> rtl::OUString read_lenPrefixed_uInt8s_ToOUString(SvStream& rStrm,
rtl_TextEncoding eEnc)
{
return rtl::OStringToOUString(read_lenPrefixed_uInt8s_ToOString<prefix>(rStrm), eEnc);
}
//Attempt to write a pascal-style length (of type prefix) prefixed sequence of
//8bit units from an OString, returned value is number of bytes written (including
//byte-count of prefix)
template<typename prefix=sal_uInt16> sal_Size write_lenPrefixed_uInt8s_FromOString(SvStream& rStrm,
const rtl::OString &rStr)
{
SAL_WARN_IF(rStr.getLength() > std::numeric_limits<prefix>::max(),
"tools.stream",
"string too long for prefix count to fit in output type");
sal_Size nWritten = 0;
prefix nLen = std::min<sal_Size>(rStr.getLength(), std::numeric_limits<prefix>::max());
rStrm << nLen;
if (rStrm.good())
{
nWritten += sizeof(prefix);
nWritten += rStrm.Write(rStr.getStr(), nLen);
}
return nWritten;
}
//Attempt to write a pascal-style length (of type prefix) prefixed sequence of
//8bit units from an OUString, returned value is number of bytes written (including
//byte-count of prefix)
template<typename prefix=sal_uInt16> sal_Size write_lenPrefixed_uInt8s_FromOUString(SvStream& rStrm,
const rtl::OUString &rStr, rtl_TextEncoding eEnc)
{
return write_lenPrefixed_uInt8s_FromOString<prefix>(rStrm, rtl::OUStringToOString(rStr, eEnc));
}
TOOLS_DLLPUBLIC rtl::OUString read_zeroTerminated_uInt8s_AsOUString(SvStream& rStr, rtl_TextEncoding eEnc);
// --------------
// - FileStream -

View File

@ -47,13 +47,11 @@ namespace
void test_stdstream();
void test_fastostring();
void test_read_cstring();
void test_read_pstring();
CPPUNIT_TEST_SUITE(Test);
CPPUNIT_TEST(test_stdstream);
CPPUNIT_TEST(test_fastostring);
CPPUNIT_TEST(test_read_cstring);
CPPUNIT_TEST(test_read_pstring);
CPPUNIT_TEST_SUITE_END();
};
@ -69,7 +67,7 @@ namespace
char tools_a(78);
aMemStream >> tools_a;
CPPUNIT_ASSERT(tools_a == 'f');
CPPUNIT_ASSERT(std_a == 'f');
iss.seekg(0, std::ios_base::end);
//seeking to end doesn't set eof, reading past eof does
@ -100,7 +98,7 @@ namespace
//a failed read doesn't change the data, it remains unchanged
CPPUNIT_ASSERT(tools_a == 78);
//nothing wrong with the stream, so not bad
CPPUNIT_ASSERT(!aMemStream.bad());
CPPUNIT_ASSERT(!aMemStream.GetError());
//yet, the read didn't succeed
CPPUNIT_ASSERT(!aMemStream.good());
@ -135,18 +133,18 @@ namespace
char foo[] = "foobar";
SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ);
rtl::OString aOne = read_uInt8s_ToOString(aMemStream, 3);
rtl::OString aOne = read_uInt8s_AsOString(aMemStream, 3);
CPPUNIT_ASSERT(aOne.equalsL(RTL_CONSTASCII_STRINGPARAM("foo")));
rtl::OString aTwo = read_uInt8s_ToOString(aMemStream, 3);
rtl::OString aTwo = read_uInt8s_AsOString(aMemStream, 3);
CPPUNIT_ASSERT(aTwo.equalsL(RTL_CONSTASCII_STRINGPARAM("bar")));
rtl::OString aThree = read_uInt8s_ToOString(aMemStream, 3);
rtl::OString aThree = read_uInt8s_AsOString(aMemStream, 3);
CPPUNIT_ASSERT(!aThree.getLength());
aMemStream.Seek(0);
rtl::OString aFour = read_uInt8s_ToOString(aMemStream, 100);
rtl::OString aFour = read_uInt8s_AsOString(aMemStream, 100);
CPPUNIT_ASSERT(aFour.equalsL(RTL_CONSTASCII_STRINGPARAM(foo)));
}
@ -155,7 +153,7 @@ namespace
char foo[] = "foobar";
SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ);
rtl::OString aOne = read_zeroTerminated_uInt8s_ToOString(aMemStream);
rtl::OString aOne = read_zeroTerminated_uInt8s_AsOString(aMemStream);
CPPUNIT_ASSERT(aOne.equalsL(RTL_CONSTASCII_STRINGPARAM("foobar")));
CPPUNIT_ASSERT(!aMemStream.good());
CPPUNIT_ASSERT(!aMemStream.bad());
@ -163,52 +161,11 @@ namespace
aMemStream.Seek(0);
foo[3] = 0;
rtl::OString aTwo = read_zeroTerminated_uInt8s_ToOString(aMemStream);
rtl::OString aTwo = read_zeroTerminated_uInt8s_AsOString(aMemStream);
CPPUNIT_ASSERT(aTwo.equalsL(RTL_CONSTASCII_STRINGPARAM("foo")));
CPPUNIT_ASSERT(aMemStream.good());
}
void Test::test_read_pstring()
{
char foo[] = "\3foobar";
SvMemoryStream aMemStream(RTL_CONSTASCII_STRINGPARAM(foo), STREAM_READ);
rtl::OString aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt8>(aMemStream);
CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("foo")));
CPPUNIT_ASSERT(aMemStream.good());
CPPUNIT_ASSERT(!aMemStream.bad());
CPPUNIT_ASSERT(!aMemStream.eof());
aMemStream.Seek(0);
foo[0] = 10;
aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt8>(aMemStream);
CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("foobar")));
CPPUNIT_ASSERT(!aMemStream.good());
CPPUNIT_ASSERT(!aMemStream.bad());
CPPUNIT_ASSERT(aMemStream.eof());
aMemStream.SetNumberFormatInt(NUMBERFORMAT_INT_BIGENDIAN);
aMemStream.Seek(0);
foo[0] = 0;
foo[1] = 3;
aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt16>(aMemStream);
CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("oob")));
CPPUNIT_ASSERT(aMemStream.good());
CPPUNIT_ASSERT(!aMemStream.bad());
CPPUNIT_ASSERT(!aMemStream.eof());
aMemStream.SetNumberFormatInt(NUMBERFORMAT_INT_LITTLEENDIAN);
aMemStream.Seek(0);
foo[0] = 3;
foo[1] = 0;
foo[2] = 0;
foo[3] = 0;
aFoo = read_lenPrefixed_uInt8s_ToOString<sal_uInt32>(aMemStream);
CPPUNIT_ASSERT(aFoo.equalsL(RTL_CONSTASCII_STRINGPARAM("bar")));
CPPUNIT_ASSERT(aMemStream.good());
CPPUNIT_ASSERT(!aMemStream.bad());
CPPUNIT_ASSERT(!aMemStream.eof());
}
CPPUNIT_TEST_SUITE_REGISTRATION(Test);
}

View File

@ -66,7 +66,7 @@ inline sal_Unicode ascii_toLowerCase( sal_Unicode ch )
/*
* ~INetMessage.
*/
INetMessage::~INetMessage()
INetMessage::~INetMessage (void)
{
ListCleanup_Impl();
}
@ -74,7 +74,7 @@ INetMessage::~INetMessage()
/*
* ListCleanup_Impl.
*/
void INetMessage::ListCleanup_Impl()
void INetMessage::ListCleanup_Impl (void)
{
// Cleanup.
sal_uIntPtr i, n = m_aHeaderList.size();
@ -243,7 +243,7 @@ enum _ImplINetRFC822MessageHeaderState
/*
* INetRFC822Message.
*/
INetRFC822Message::INetRFC822Message()
INetRFC822Message::INetRFC822Message (void)
: INetMessage()
{
for (sal_uInt16 i = 0; i < INETMSG_RFC822_NUMHDR; i++)
@ -275,7 +275,7 @@ INetRFC822Message& INetRFC822Message::operator= (const INetRFC822Message& rMsg)
/*
* ~INetRFC822Message.
*/
INetRFC822Message::~INetRFC822Message()
INetRFC822Message::~INetRFC822Message (void)
{
}
@ -753,7 +753,7 @@ enum _ImplINetMIMEMessageHeaderState
/*
* INetMIMEMessage.
*/
INetMIMEMessage::INetMIMEMessage()
INetMIMEMessage::INetMIMEMessage (void)
: INetRFC822Message (),
pParent (NULL),
bHeaderParsed (sal_False)
@ -792,7 +792,7 @@ INetMIMEMessage& INetMIMEMessage::operator= (
/*
* ~INetMIMEMessage.
*/
INetMIMEMessage::~INetMIMEMessage()
INetMIMEMessage::~INetMIMEMessage (void)
{
// Cleanup.
CleanupImp();
@ -801,7 +801,7 @@ INetMIMEMessage::~INetMIMEMessage()
/*
* CleanupImp.
*/
void INetMIMEMessage::CleanupImp()
void INetMIMEMessage::CleanupImp (void)
{
for( size_t i = 0, n = aChildren.size(); i < n; ++i ) {
delete aChildren[ i ];
@ -1161,7 +1161,7 @@ SvStream& INetMIMEMessage::operator<< (SvStream& rStrm) const
for (sal_uInt16 i = 0; i < INETMSG_MIME_NUMHDR; i++)
rStrm << static_cast<sal_uInt32>(m_nIndex[i]);
write_lenPrefixed_uInt8s_FromOString(rStrm, m_aBoundary);
rStrm.WriteByteString (m_aBoundary);
rStrm << static_cast<sal_uInt32>(aChildren.size());
return rStrm;
@ -1181,7 +1181,7 @@ SvStream& INetMIMEMessage::operator>> (SvStream& rStrm)
m_nIndex[i] = nTemp;
}
m_aBoundary = read_lenPrefixed_uInt8s_ToOString(rStrm);
rStrm.ReadByteString (m_aBoundary);
rStrm >> nTemp;

View File

@ -1608,7 +1608,7 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize)
// Multipart message body. Initialize multipart delimiters.
// Multipart message.
if (pMsg->GetMultipartBoundary().getLength() == 0)
if (pMsg->GetMultipartBoundary().Len() == 0)
{
// Determine boundary.
rtl::OString aType(rtl::OUStringToOString(

View File

@ -806,7 +806,7 @@ sal_Bool SvStream::ReadUniOrByteStringLine( String& rStr, rtl_TextEncoding eSrcC
return ReadByteStringLine( rStr, eSrcCharSet );
}
rtl::OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStream)
rtl::OString read_zeroTerminated_uInt8s_AsOString(SvStream& rStream)
{
rtl::OStringBuffer aOutput;
@ -839,10 +839,10 @@ rtl::OString read_zeroTerminated_uInt8s_ToOString(SvStream& rStream)
return aOutput.makeStringAndClear();
}
rtl::OUString read_zeroTerminated_uInt8s_ToOUString(SvStream& rStream, rtl_TextEncoding eEnc)
rtl::OUString read_zeroTerminated_uInt8s_AsOUString(SvStream& rStream, rtl_TextEncoding eEnc)
{
return rtl::OStringToOUString(
read_zeroTerminated_uInt8s_ToOString(rStream), eEnc);
read_zeroTerminated_uInt8s_AsOString(rStream), eEnc);
}
/*************************************************************************
@ -1517,7 +1517,19 @@ SvStream& SvStream::ReadByteString( UniString& rStr, rtl_TextEncoding eSrcCharSe
return *this;
}
rStr = read_lenPrefixed_uInt8s_ToOUString(*this, eSrcCharSet);
ByteString aStr;
ReadByteString( aStr );
rStr = UniString( aStr, eSrcCharSet );
return *this;
}
// -----------------------------------------------------------------------
SvStream& SvStream::ReadByteString( ByteString& rStr )
{
sal_uInt16 nLen = 0;
operator>>( nLen );
rStr = read_uInt8s_AsOString(*this, nLen);
return *this;
}
@ -1551,7 +1563,17 @@ SvStream& SvStream::WriteByteString( const UniString& rStr, rtl_TextEncoding eDe
return *this;
}
write_lenPrefixed_uInt8s_FromOUString(*this, rStr, eDestCharSet);
return WriteByteString(rtl::OUStringToOString(rStr, eDestCharSet));
}
// -----------------------------------------------------------------------
SvStream& SvStream::WriteByteString( const ByteString& rStr)
{
sal_uInt16 nLen = rStr.Len();
operator<< ( nLen );
if( nLen != 0 )
Write( rStr.GetBuffer(), nLen );
return *this;
}
@ -2432,7 +2454,7 @@ void SvDataCopyStream::Assign( const SvDataCopyStream& )
}
//Create a OString of nLen bytes from rStream
rtl::OString read_uInt8s_ToOString(SvStream& rStrm, sal_Size nLen)
rtl::OString read_uInt8s_AsOString(SvStream& rStrm, sal_Size nLen)
{
using comphelper::string::rtl_string_alloc;
@ -2459,7 +2481,7 @@ rtl::OString read_uInt8s_ToOString(SvStream& rStrm, sal_Size nLen)
}
//Create a OUString of nLen little endian sal_Unicodes from rStream
rtl::OUString read_LEuInt16s_ToOUString(SvStream& rStrm, sal_Size nLen)
rtl::OUString read_LEuInt16s_AsOUString(SvStream& rStrm, sal_Size nLen)
{
using comphelper::string::rtl_uString_alloc;

View File

@ -795,6 +795,7 @@ SvStream& operator<<( SvStream& rOStm, const Animation& rAnimation )
if( nCount )
{
const ByteString aDummyStr;
const sal_uInt32 nDummy32 = 0UL;
// Falls keine BitmapEx gesetzt wurde, schreiben wir
@ -824,7 +825,7 @@ SvStream& operator<<( SvStream& rOStm, const Animation& rAnimation )
rOStm << nDummy32; // unbenutzt
rOStm << nDummy32; // unbenutzt
rOStm << nDummy32; // unbenutzt
write_lenPrefixed_uInt8s_FromOString(rOStm, rtl::OString()); // dummy
rOStm.WriteByteString(aDummyStr); // unbenutzt
rOStm << nRest; // Anzahl der Strukturen, die noch _folgen_
}
}
@ -871,6 +872,7 @@ SvStream& operator>>( SvStream& rIStm, Animation& rAnimation )
{
AnimationBitmap aAnimBmp;
BitmapEx aBmpEx;
ByteString aDummyStr;
sal_uInt32 nTmp32;
sal_uInt16 nTmp16;
sal_uInt8 cTmp;
@ -888,7 +890,7 @@ SvStream& operator>>( SvStream& rIStm, Animation& rAnimation )
rIStm >> nTmp32; // unbenutzt
rIStm >> nTmp32; // unbenutzt
rIStm >> nTmp32; // unbenutzt
read_lenPrefixed_uInt8s_ToOString(rIStm); // unbenutzt
rIStm.ReadByteString(aDummyStr); // unbenutzt
rIStm >> nTmp16; // Rest zu lesen
rAnimation.Insert( aAnimBmp );

View File

@ -877,7 +877,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rIStm >> aPt >> nIndex >> nLen >> nTmp;
if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
{
rtl::OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
rtl::OString aByteStr = read_uInt8s_AsOString(rIStm, nTmp);
sal_uInt8 nTerminator = 0;
rIStm >> nTerminator;
DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
@ -899,7 +899,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rIStm >> aPt >> nIndex >> nLen >> nTmp >> nAryLen;
if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_UINT16 - 1 ) ) )
{
rtl::OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
rtl::OString aByteStr = read_uInt8s_AsOString(rIStm, nTmp);
sal_uInt8 nTerminator = 0;
rIStm >> nTerminator;
DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
@ -962,7 +962,7 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
rIStm >> aPt >> nIndex >> nLen >> nTmp >> nWidth;
if ( nTmp && ( static_cast< sal_uInt32 >( nTmp ) < ( SAL_MAX_INT16 - 1 ) ) )
{
rtl::OString aByteStr = read_uInt8s_ToOString(rIStm, nTmp);
rtl::OString aByteStr = read_uInt8s_AsOString(rIStm, nTmp);
sal_uInt8 nTerminator = 0;
rIStm >> nTerminator;
DBG_ASSERT( nTerminator == 0, "expected string to be NULL terminated" );
@ -1322,12 +1322,13 @@ void SVMConverter::ImplConvertFromSVM1( SvStream& rIStm, GDIMetaFile& rMtf )
case( GDI_COMMENT_COMMENT ):
{
ByteString aComment;
sal_Int32 nValue;
sal_uInt32 nDataSize;
sal_uInt8* pData;
sal_Int32 nFollowingActionCount;
rtl::OString aComment = read_lenPrefixed_uInt8s_ToOString(rIStm);
rIStm.ReadByteString(aComment);
rIStm >> nValue >> nDataSize;
if( nDataSize )
@ -2412,7 +2413,7 @@ sal_uLong SVMConverter::ImplWriteActions( SvStream& rOStm, GDIMetaFile& rMtf,
rOStm.SeekRel( 4 );
// write data
write_lenPrefixed_uInt8s_FromOString(rOStm, pA->GetComment());
rOStm.WriteByteString(pA->GetComment());
rOStm << pA->GetValue() << nDataSize;
if( nDataSize )

View File

@ -410,21 +410,13 @@ SvStream& operator<<( SvStream& rOStream, const JobSetup& rJobSetup )
rOStream.WriteByteString( it->first, RTL_TEXTENCODING_UTF8 );
rOStream.WriteByteString( it->second, RTL_TEXTENCODING_UTF8 );
}
write_lenPrefixed_uInt8s_FromOString(rOStream, "COMPAT_DUPLEX_MODE");
rOStream.WriteByteString( "COMPAT_DUPLEX_MODE" ) ;
switch( pJobData->meDuplexMode )
{
case DUPLEX_UNKNOWN:
write_lenPrefixed_uInt8s_FromOString(rOStream, "DUPLEX_UNKNOWN");
break;
case DUPLEX_OFF:
write_lenPrefixed_uInt8s_FromOString(rOStream, "DUPLEX_OFF");
break;
case DUPLEX_SHORTEDGE:
write_lenPrefixed_uInt8s_FromOString(rOStream, "DUPLEX_SHORTEDGE");
break;
case DUPLEX_LONGEDGE:
write_lenPrefixed_uInt8s_FromOString(rOStream, "DUPLEX_LONGEDGE");
break;
case DUPLEX_UNKNOWN: rOStream.WriteByteString( "DUPLEX_UNKNOWN" );break;
case DUPLEX_OFF: rOStream.WriteByteString( "DUPLEX_OFF" );break;
case DUPLEX_SHORTEDGE: rOStream.WriteByteString( "DUPLEX_SHORTEDGE" );break;
case DUPLEX_LONGEDGE: rOStream.WriteByteString( "DUPLEX_LONGEDGE" );break;
}
nLen = sal::static_int_cast<sal_uInt16>(rOStream.Tell() - nPos);
rOStream.Seek( nPos );

View File

@ -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 );
write_lenPrefixed_uInt8s_FromOString(rOStm, maComment);
rOStm.WriteByteString(maComment);
rOStm << mnValue << mnDataSize;
if ( mnDataSize )
@ -4210,10 +4210,13 @@ void MetaCommentAction::Write( SvStream& rOStm, ImplMetaWriteData* pData )
void MetaCommentAction::Read( SvStream& rIStm, ImplMetaReadData* )
{
COMPAT( rIStm );
maComment = read_lenPrefixed_uInt8s_ToOString(rIStm);
ByteString sTmp;
rIStm.ReadByteString(sTmp);
maComment = sTmp;
rIStm >> mnValue >> mnDataSize;
delete[] mpData;
if( mpData )
delete[] mpData;
if( mnDataSize )
{