Kaydet (Commit) b1f74de0 authored tarafından Caolán McNamara's avatar Caolán McNamara

ByteString->rtl::OString

üst d3c0bf6c
...@@ -647,7 +647,9 @@ SbError SbiStream::Read( ByteString& rBuf, sal_uInt16 n, bool bForceReadingPerBy ...@@ -647,7 +647,9 @@ SbError SbiStream::Read( ByteString& rBuf, sal_uInt16 n, bool bForceReadingPerBy
nExpandOnWriteTo = 0; nExpandOnWriteTo = 0;
if( !bForceReadingPerByte && IsText() ) if( !bForceReadingPerByte && IsText() )
{ {
pStrm->ReadLine( rBuf ); rtl::OString aBuffer;
pStrm->ReadLine(aBuffer);
rBuf = aBuffer;
nLine++; nLine++;
} }
else else
......
...@@ -1046,12 +1046,12 @@ int _cdecl main( int argc, char *argv[] ) ...@@ -1046,12 +1046,12 @@ int _cdecl main( int argc, char *argv[] )
} }
ByteString sReferenceLine; rtl::OString sReferenceLine;
GSILine* pReferenceLine = NULL; GSILine* pReferenceLine = NULL;
ByteString aOldReferenceId("No Valid ID"); // just set to something which can never be an ID ByteString aOldReferenceId("No Valid ID"); // just set to something which can never be an ID
sal_uLong nReferenceLine = 0; sal_uLong nReferenceLine = 0;
ByteString sGSILine; rtl::OString sGSILine;
GSILine* pGSILine = NULL; GSILine* pGSILine = NULL;
ByteString aOldId("No Valid ID"); // just set to something which can never be an ID ByteString aOldId("No Valid ID"); // just set to something which can never be an ID
GSIBlock *pBlock = NULL; GSIBlock *pBlock = NULL;
......
...@@ -371,12 +371,12 @@ void SourceTreeLocalizer::WorkOnFile( ...@@ -371,12 +371,12 @@ void SourceTreeLocalizer::WorkOnFile(
nFileCnt++; nFileCnt++;
SvFileStream aSDFIn( aTemp.GetFull(), STREAM_READ ); SvFileStream aSDFIn( aTemp.GetFull(), STREAM_READ );
ByteString sLine; rtl::OString sLine;
while ( aSDFIn.IsOpen() && !aSDFIn.IsEof()) { while ( aSDFIn.IsOpen() && !aSDFIn.IsEof())
{
aSDFIn.ReadLine( sLine ); aSDFIn.ReadLine( sLine );
if ( sLine.Len()) { if (!sLine.isEmpty())
aSDF.WriteLine( sLine ); aSDF.WriteLine( sLine );
}
} }
aSDFIn.Close(); aSDFIn.Close();
......
...@@ -187,7 +187,7 @@ MergeDataFile::MergeDataFile( ...@@ -187,7 +187,7 @@ MergeDataFile::MergeDataFile(
{ {
SvFileStream aInputStream( String( rFileName, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_READ ); SvFileStream aInputStream( String( rFileName, RTL_TEXTENCODING_ASCII_US ), STREAM_STD_READ );
aInputStream.SetStreamCharSet( RTL_TEXTENCODING_MS_1252 ); aInputStream.SetStreamCharSet( RTL_TEXTENCODING_MS_1252 );
ByteString sLine; rtl::OString sLine;
const ByteString sHACK("HACK"); const ByteString sHACK("HACK");
const ::rtl::OString sFileNormalized(lcl_NormalizeFilename(sFile)); const ::rtl::OString sFileNormalized(lcl_NormalizeFilename(sFile));
const bool isFileEmpty = !sFileNormalized.isEmpty(); const bool isFileEmpty = !sFileNormalized.isEmpty();
...@@ -208,17 +208,17 @@ MergeDataFile::MergeDataFile( ...@@ -208,17 +208,17 @@ MergeDataFile::MergeDataFile(
const ::rtl::OString filename = lcl_NormalizeFilename(getToken(sLine, 1 , '\t')); const ::rtl::OString filename = lcl_NormalizeFilename(getToken(sLine, 1 , '\t'));
if(isFileEmpty || sFileNormalized.equals("") || (!isFileEmpty && filename.equals(sFileNormalized)) ) if(isFileEmpty || sFileNormalized.equals("") || (!isFileEmpty && filename.equals(sFileNormalized)) )
{ {
xub_StrLen rIdx = 0; sal_Int32 rIdx = 0;
const ByteString sTYP = sLine.GetToken( 3, '\t', rIdx ); const ByteString sTYP = sLine.getToken( 3, '\t', rIdx );
const ByteString sGID = sLine.GetToken( 0, '\t', rIdx ); // 4 const ByteString sGID = sLine.getToken( 0, '\t', rIdx ); // 4
const ByteString sLID = sLine.GetToken( 0, '\t', rIdx ); // 5 const ByteString sLID = sLine.getToken( 0, '\t', rIdx ); // 5
ByteString sPFO = sLine.GetToken( 1, '\t', rIdx ); // 7 ByteString sPFO = sLine.getToken( 1, '\t', rIdx ); // 7
sPFO = sHACK; sPFO = sHACK;
ByteString nLANG = sLine.GetToken( 1, '\t', rIdx ); // 9 ByteString nLANG = sLine.getToken( 1, '\t', rIdx ); // 9
nLANG = comphelper::string::strip(nLANG, ' '); nLANG = comphelper::string::strip(nLANG, ' ');
const ByteString sTEXT = sLine.GetToken( 0, '\t', rIdx ); // 10 const ByteString sTEXT = sLine.getToken( 0, '\t', rIdx ); // 10
const ByteString sQHTEXT = sLine.GetToken( 1, '\t', rIdx ); // 12 const ByteString sQHTEXT = sLine.getToken( 1, '\t', rIdx ); // 12
const ByteString sTITLE = sLine.GetToken( 0, '\t', rIdx ); // 13 const ByteString sTITLE = sLine.getToken( 0, '\t', rIdx ); // 13
if( !nLANG.EqualsIgnoreCaseAscii("en-US") ) if( !nLANG.EqualsIgnoreCaseAscii("en-US") )
......
...@@ -80,15 +80,16 @@ static const sal_Int16 DIC_VERSION_5 = 5; ...@@ -80,15 +80,16 @@ static const sal_Int16 DIC_VERSION_5 = 5;
static const sal_Int16 DIC_VERSION_6 = 6; static const sal_Int16 DIC_VERSION_6 = 6;
static const sal_Int16 DIC_VERSION_7 = 7; static const sal_Int16 DIC_VERSION_7 = 7;
static sal_Bool getTag(const ByteString &rLine, static bool getTag(const rtl::OString &rLine, const sal_Char *pTagName,
const sal_Char *pTagName, ByteString &rTagValue) rtl::OString &rTagValue)
{ {
xub_StrLen nPos = rLine.Search( pTagName ); sal_Int32 nPos = rLine.indexOf(pTagName);
if (nPos == STRING_NOTFOUND) if (nPos == -1)
return sal_False; return false;
rTagValue = comphelper::string::strip(rLine.Copy(nPos + sal::static_int_cast< xub_StrLen >(strlen( pTagName ))), ' '); rTagValue = comphelper::string::strip(rLine.copy(nPos + rtl_str_getLength(pTagName)),
return sal_True; ' ');
return true;
} }
...@@ -111,7 +112,7 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNe ...@@ -111,7 +112,7 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNe
!strcmp(pMagicHeader, pVerOOo7)) !strcmp(pMagicHeader, pVerOOo7))
{ {
sal_Bool bSuccess; sal_Bool bSuccess;
ByteString aLine; rtl::OString aLine;
nDicVersion = DIC_VERSION_7; nDicVersion = DIC_VERSION_7;
...@@ -121,31 +122,31 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNe ...@@ -121,31 +122,31 @@ sal_Int16 ReadDicVersion( SvStreamPtr &rpStream, sal_uInt16 &nLng, sal_Bool &bNe
// 2nd line: language all | en-US | pt-BR ... // 2nd line: language all | en-US | pt-BR ...
while (sal_True == (bSuccess = rpStream->ReadLine(aLine))) while (sal_True == (bSuccess = rpStream->ReadLine(aLine)))
{ {
ByteString aTagValue; rtl::OString aTagValue;
if (aLine.GetChar(0) == '#') // skip comments if (aLine[0] == '#') // skip comments
continue; continue;
// lang: field // lang: field
if (getTag(aLine, "lang: ", aTagValue)) if (getTag(aLine, "lang: ", aTagValue))
{ {
if (aTagValue == "<none>") if (aTagValue.equalsL(RTL_CONSTASCII_STRINGPARAM("<none>")))
nLng = LANGUAGE_NONE; nLng = LANGUAGE_NONE;
else else
nLng = MsLangId::convertIsoStringToLanguage(OUString(aTagValue.GetBuffer(), nLng = MsLangId::convertIsoStringToLanguage(rtl::OStringToOUString(
aTagValue.Len(), RTL_TEXTENCODING_ASCII_US)); aTagValue, RTL_TEXTENCODING_ASCII_US));
} }
// type: negative / positive // type: negative / positive
if (getTag(aLine, "type: ", aTagValue)) if (getTag(aLine, "type: ", aTagValue))
{ {
if (aTagValue == "negative") if (aTagValue.equalsL(RTL_CONSTASCII_STRINGPARAM("negative")))
bNeg = sal_True; bNeg = sal_True;
else else
bNeg = sal_False; bNeg = sal_False;
} }
if (aLine.Search ("---") != STRING_NOTFOUND) // end of header if (comphelper::string::indexOfL(aLine, RTL_CONSTASCII_STRINGPARAM("---")) != -1) // end of header
break; break;
} }
if (!bSuccess) if (!bSuccess)
...@@ -369,14 +370,14 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL) ...@@ -369,14 +370,14 @@ sal_uLong DictionaryNeo::loadEntries(const OUString &rMainURL)
else if (DIC_VERSION_7 == nDicVersion) else if (DIC_VERSION_7 == nDicVersion)
{ {
sal_Bool bSuccess; sal_Bool bSuccess;
ByteString aLine; rtl::OString aLine;
// remaining lines - stock strings (a [==] b) // remaining lines - stock strings (a [==] b)
while (sal_True == (bSuccess = pStream->ReadLine(aLine))) while (sal_True == (bSuccess = pStream->ReadLine(aLine)))
{ {
if (aLine.GetChar(0) == '#') // skip comments if (aLine[0] == '#') // skip comments
continue; continue;
rtl::OUString aText = rtl::OStringToOUString (aLine, RTL_TEXTENCODING_UTF8); rtl::OUString aText = rtl::OStringToOUString(aLine, RTL_TEXTENCODING_UTF8);
uno::Reference< XDictionaryEntry > xEntry = uno::Reference< XDictionaryEntry > xEntry =
new DicEntry( aText, eDicType == DictionaryType_NEGATIVE ); new DicEntry( aText, eDicType == DictionaryType_NEGATIVE );
addEntry_Impl( xEntry , sal_True ); //! don't launch events here addEntry_Impl( xEntry , sal_True ); //! don't launch events here
......
...@@ -75,6 +75,7 @@ using ::rtl::OStringBuffer; ...@@ -75,6 +75,7 @@ using ::rtl::OStringBuffer;
using ::rtl::OStringToOUString; using ::rtl::OStringToOUString;
using comphelper::string::getToken; using comphelper::string::getToken;
using comphelper::string::getTokenCount; using comphelper::string::getTokenCount;
using comphelper::string::indexOfL;
/*************** F o r w a r d s *****************************************/ /*************** F o r w a r d s *****************************************/
/*************** G l o b a l e V a r i a b l e n **********************/ /*************** G l o b a l e V a r i a b l e n **********************/
...@@ -1149,7 +1150,7 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, ...@@ -1149,7 +1150,7 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
if( !aIStm.GetError() && !aOStm.GetError() ) if( !aIStm.GetError() && !aOStm.GetError() )
{ {
ByteString aLine; rtl::OString aLine;
rtl::OString aFilePath; rtl::OString aFilePath;
while( aIStm.ReadLine( aLine ) ) while( aIStm.ReadLine( aLine ) )
...@@ -1160,43 +1161,47 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, ...@@ -1160,43 +1161,47 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
rtl::OString aBaseFileName( getToken(getToken(aLine, 1, '"'), 0, '.') ); rtl::OString aBaseFileName( getToken(getToken(aLine, 1, '"'), 0, '.') );
if( GetImageFilePath( rOutputFile, rContext, aBaseFileName, aFilePath, pSysListFile ) ) if( GetImageFilePath( rOutputFile, rContext, aBaseFileName, aFilePath, pSysListFile ) )
( ( aLine = "File = \"" ) += aFilePath ) += "\";"; {
aLine = rtl::OStringBuffer(RTL_CONSTASCII_STRINGPARAM("File = \"")).
append(aFilePath).append(RTL_CONSTASCII_STRINGPARAM("\";")).
makeStringAndClear();
}
else else
aMissingImages.push_back( aBaseFileName ); aMissingImages.push_back( aBaseFileName );
aOStm.WriteLine( aLine ); aOStm.WriteLine(aLine);
} }
else if( aLine.Search( "ImageList" ) != STRING_NOTFOUND ) else if (indexOfL(aLine, RTL_CONSTASCII_STRINGPARAM("ImageList")) != -1)
{ {
::std::vector< ::std::pair< rtl::OString, sal_Int32 > > aEntryVector; ::std::vector< ::std::pair< rtl::OString, sal_Int32 > > aEntryVector;
aOStm.WriteLine( aLine ); aOStm.WriteLine(aLine);
if( aLine.Search( ';' ) == STRING_NOTFOUND ) if (aLine.indexOf(';') == -1)
{ {
const sal_uInt32 nImgListStartPos = aIStm.Tell(); const sal_uInt32 nImgListStartPos = aIStm.Tell();
do do
{ {
if( !aIStm.ReadLine( aLine ) ) if( !aIStm.ReadLine(aLine) )
break; break;
} }
while( aLine.Search( "Prefix" ) == STRING_NOTFOUND ); while (indexOfL(aLine, RTL_CONSTASCII_STRINGPARAM("Prefix")) == -1);
const rtl::OString aPrefix( getToken(aLine, 1, '"') ); const rtl::OString aPrefix( getToken(aLine, 1, '"') );
aIStm.Seek( nImgListStartPos ); aIStm.Seek( nImgListStartPos );
do do
{ {
if (!aIStm.ReadLine( aLine ) ) if (!aIStm.ReadLine(aLine) )
break; break;
} }
while( aLine.Search( "IdList" ) == STRING_NOTFOUND ); while (indexOfL(aLine, RTL_CONSTASCII_STRINGPARAM("IdList")) == -1);
// scan all ids and collect images // scan all ids and collect images
while( aLine.Search( '}' ) == STRING_NOTFOUND ) while (aLine.indexOf('}') == -1)
{ {
if( !aIStm.ReadLine( aLine ) ) if( !aIStm.ReadLine(aLine) )
break; break;
aLine = comphelper::string::stripStart(aLine, ' '); aLine = comphelper::string::stripStart(aLine, ' ');
...@@ -1205,7 +1210,7 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, ...@@ -1205,7 +1210,7 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
if (comphelper::string::isdigitAsciiString(aLine)) if (comphelper::string::isdigitAsciiString(aLine))
{ {
sal_Int32 nNumber = atoi( aLine.GetBuffer() ); sal_Int32 nNumber = atoi(aLine.getStr());
rtl::OStringBuffer aBuf(aPrefix); rtl::OStringBuffer aBuf(aPrefix);
if( nNumber < 10000 ) if( nNumber < 10000 )
...@@ -1226,13 +1231,13 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, ...@@ -1226,13 +1231,13 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
{ {
aIStm.ReadLine( aLine ); aIStm.ReadLine( aLine );
if( aLine.Search( "IdList" ) != STRING_NOTFOUND ) if (indexOfL(aLine, RTL_CONSTASCII_STRINGPARAM("IdList")) != -1)
{ {
while( aLine.Search( '}' ) == STRING_NOTFOUND ) while (aLine.indexOf('}') == -1)
aIStm.ReadLine( aLine ); aIStm.ReadLine(aLine);
} }
else else
aOStm.WriteLine( aLine ); aOStm.WriteLine(aLine);
} }
aOStm.WriteLine(rtl::OString(RTL_CONSTASCII_STRINGPARAM("FileList = {"))); aOStm.WriteLine(rtl::OString(RTL_CONSTASCII_STRINGPARAM("FileList = {")));
...@@ -1253,10 +1258,10 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile, ...@@ -1253,10 +1258,10 @@ void RscCompiler::PreprocessSrsFile( const RscCmdLine::OutputFile& rOutputFile,
aOStm.WriteLine(rtl::OString(RTL_CONSTASCII_STRINGPARAM("};"))); aOStm.WriteLine(rtl::OString(RTL_CONSTASCII_STRINGPARAM("};")));
} }
else else
aOStm.WriteLine( aLine ); aOStm.WriteLine(aLine);
} }
else else
aOStm.WriteLine( aLine ); aOStm.WriteLine(aLine);
} }
} }
......
...@@ -93,7 +93,7 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs, ...@@ -93,7 +93,7 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs,
if( !rInDirs.empty() ) if( !rInDirs.empty() )
{ {
ByteString aLine; rtl::OString aLine;
String aInfo, aPrefix, aName( rName ), aString; String aInfo, aPrefix, aName( rName ), aString;
SvFileStream aOutStream; SvFileStream aOutStream;
BitmapEx aTotalBmpEx; BitmapEx aTotalBmpEx;
...@@ -123,7 +123,7 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs, ...@@ -123,7 +123,7 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs,
aOutFile += DirEntry( aName ); aOutFile += DirEntry( aName );
// get number of bitmaps // get number of bitmaps
while( aLine.Search( '}' ) == STRING_NOTFOUND ) while( aLine.indexOf('}') == -1 )
{ {
if( !pSRS->ReadLine( aLine ) ) if( !pSRS->ReadLine( aLine ) )
break; break;
...@@ -136,11 +136,11 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs, ...@@ -136,11 +136,11 @@ void BmpCreator::ImplCreate( const ::std::vector< DirEntry >& rInDirs,
{ {
aString = aPrefix; aString = aPrefix;
if( atoi( aLine.GetBuffer() ) < 10000 ) if( atoi( aLine.getStr() ) < 10000 )
aString += String::CreateFromInt32( 0 ); aString += String::CreateFromInt32( 0 );
// search for pngs by default // search for pngs by default
String aPngString( aString += String( aLine.GetBuffer(), RTL_TEXTENCODING_UTF8 ) ); String aPngString( aString += rtl::OStringToOUString(aLine, RTL_TEXTENCODING_UTF8) );
aNameVector.push_back( aPngString += String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) ) ); aNameVector.push_back( aPngString += String( RTL_CONSTASCII_USTRINGPARAM( ".png" ) ) );
} }
} }
...@@ -361,9 +361,11 @@ void BmpCreator::Create( const String& rSRSName, ...@@ -361,9 +361,11 @@ void BmpCreator::Create( const String& rSRSName,
else else
{ {
String aText; String aText;
ByteString aByteText; rtl::OString aByteText;
sal_Bool bLangDep = sal_False; sal_Bool bLangDep = sal_False;
using comphelper::string::indexOfL;
do do
{ {
do do
...@@ -371,24 +373,24 @@ void BmpCreator::Create( const String& rSRSName, ...@@ -371,24 +373,24 @@ void BmpCreator::Create( const String& rSRSName,
if (!pSRS->ReadLine(aByteText)) if (!pSRS->ReadLine(aByteText))
break; break;
} }
while ( aByteText.Search( "ImageList" ) == STRING_NOTFOUND ); while ( indexOfL(aByteText, RTL_CONSTASCII_STRINGPARAM("ImageList")) == -1 );
do do
{ {
if (!pSRS->ReadLine( aByteText ) ) if (!pSRS->ReadLine( aByteText ) )
break; break;
} }
while ( aByteText.Search( "File" ) == STRING_NOTFOUND ); while ( indexOfL(aByteText, RTL_CONSTASCII_STRINGPARAM("File")) == -1 );
aText = String::CreateFromAscii( aByteText.GetBuffer() ); aText = rtl::OStringToOUString(aByteText, RTL_TEXTENCODING_ASCII_US);
const String aName( aText.GetToken( 1, '"' ) ); const String aName( aText.GetToken( 1, '"' ) );
do do
{ {
if( !bLangDep && if( !bLangDep &&
aByteText.Search( "File" ) != STRING_NOTFOUND && indexOfL(aByteText, RTL_CONSTASCII_STRINGPARAM("File")) != -1 &&
aByteText.Search( '[' ) != STRING_NOTFOUND && aByteText.indexOf('[') != -1 &&
aByteText.Search( ']' ) != STRING_NOTFOUND ) aByteText.indexOf(']') != -1 )
{ {
bLangDep = sal_True; bLangDep = sal_True;
} }
...@@ -396,8 +398,8 @@ void BmpCreator::Create( const String& rSRSName, ...@@ -396,8 +398,8 @@ void BmpCreator::Create( const String& rSRSName,
if (!pSRS->ReadLine(aByteText)) if (!pSRS->ReadLine(aByteText))
break; break;
} }
while (aByteText.Search( "IdList" ) == STRING_NOTFOUND ); while (indexOfL(aByteText, RTL_CONSTASCII_STRINGPARAM("IdList")) == -1);
aText = String::CreateFromAscii( aByteText.GetBuffer() ); aText = rtl::OStringToOUString(aByteText, RTL_TEXTENCODING_ASCII_US);
// if image list is not language dependent, don't do anything for languages except german // if image list is not language dependent, don't do anything for languages except german
if( aText.Len() ) if( aText.Len() )
......
...@@ -297,15 +297,15 @@ void BmpSum::ProcessFileList( const String& rInFileList, ...@@ -297,15 +297,15 @@ void BmpSum::ProcessFileList( const String& rInFileList,
if( aIStm.IsOpen() && aOStm.IsOpen() ) if( aIStm.IsOpen() && aOStm.IsOpen() )
{ {
ByteString aReadLine; rtl::OString aReadLine;
::std::set< ByteString > aFileNameSet; ::std::set< ByteString > aFileNameSet;
while( aIStm.ReadLine( aReadLine ) ) while( aIStm.ReadLine( aReadLine ) )
{ {
if( aReadLine.Len() ) if( !aReadLine.isEmpty() )
aFileNameSet.insert( aReadLine ); aFileNameSet.insert( aReadLine );
if( aReadLine.Search( "enus" ) != STRING_NOTFOUND ) if( comphelper::string::indexOfL(aReadLine, RTL_CONSTASCII_STRINGPARAM("enus") ) != -1 )
{ {
static const char* aLanguages[] = static const char* aLanguages[] =
{ {
...@@ -340,7 +340,7 @@ void BmpSum::ProcessFileList( const String& rInFileList, ...@@ -340,7 +340,7 @@ void BmpSum::ProcessFileList( const String& rInFileList,
} }
} }
aReadLine.Erase(); aReadLine = rtl::OString();
} }
aIStm.Close(); aIStm.Close();
......
...@@ -101,13 +101,11 @@ void XBMReader::InitTable() ...@@ -101,13 +101,11 @@ void XBMReader::InitTable()
// ------------------------------------------------------------------------ // ------------------------------------------------------------------------
ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1, rtl::OString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1,
const char* pTok2, const char* pTok3 ) const char* pTok2, const char* pTok3 )
{ {
ByteString aRet; rtl::OString aRet;
long nPos1; sal_Int32 nPos1, nPos2, nPos3;
long nPos2;
long nPos3;
bStatus = sal_False; bStatus = sal_False;
...@@ -118,7 +116,7 @@ ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1, ...@@ -118,7 +116,7 @@ ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1,
if( pTok1 ) if( pTok1 )
{ {
if( ( nPos1 = aRet.Search( pTok1 ) ) != STRING_NOTFOUND ) if( ( nPos1 = aRet.indexOf( pTok1 ) ) != -1 )
{ {
bStatus = sal_True; bStatus = sal_True;
...@@ -126,7 +124,7 @@ ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1, ...@@ -126,7 +124,7 @@ ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1,
{ {
bStatus = sal_False; bStatus = sal_False;
if( ( ( nPos2 = aRet.Search( pTok2 ) ) != STRING_NOTFOUND ) && if( ( ( nPos2 = aRet.indexOf( pTok2 ) ) != -1 ) &&
( nPos2 > nPos1 ) ) ( nPos2 > nPos1 ) )
{ {
bStatus = sal_True; bStatus = sal_True;
...@@ -135,7 +133,7 @@ ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1, ...@@ -135,7 +133,7 @@ ByteString XBMReader::FindTokenLine( SvStream* pInStm, const char* pTok1,
{ {
bStatus = sal_False; bStatus = sal_False;
if( ( ( nPos3 = aRet.Search( pTok3 ) ) != STRING_NOTFOUND ) && ( nPos3 > nPos2 ) ) if( ( ( nPos3 = aRet.indexOf( pTok3 ) ) != -1 ) && ( nPos3 > nPos2 ) )
bStatus = sal_True; bStatus = sal_True;
} }
} }
...@@ -201,7 +199,7 @@ long XBMReader::ParseDefine( const sal_Char* pDefine ) ...@@ -201,7 +199,7 @@ long XBMReader::ParseDefine( const sal_Char* pDefine )
sal_Bool XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat ) sal_Bool XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat )
{ {
ByteString aLine; rtl::OString aLine;
long nRow = 0; long nRow = 0;
long nCol = 0; long nCol = 0;
long nBits = ( eFormat == XBM10 ) ? 16 : 8; long nBits = ( eFormat == XBM10 ) ? 16 : 8;
...@@ -214,18 +212,18 @@ sal_Bool XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XB ...@@ -214,18 +212,18 @@ sal_Bool XBMReader::ParseData( SvStream* pInStm, const ByteString& aLastLine, XB
{ {
if( bFirstLine ) if( bFirstLine )
{ {
xub_StrLen nPos; sal_Int32 nPos;
// einfuehrende geschweifte Klammer loeschen // einfuehrende geschweifte Klammer loeschen
if( (nPos = ( aLine = aLastLine ).Search( '{' ) ) != STRING_NOTFOUND ) if( (nPos = ( aLine = aLastLine ).indexOf('{') ) != -1 )
aLine.Erase( 0, nPos + 1 ); aLine = aLine.copy(nPos + 1);
bFirstLine = sal_False; bFirstLine = sal_False;
} }
else if( !pInStm->ReadLine( aLine ) ) else if( !pInStm->ReadLine( aLine ) )
break; break;
if( aLine.Len() ) if (!aLine.isEmpty())
{ {
const sal_Int32 nCount = comphelper::string::getTokenCount(aLine, ','); const sal_Int32 nCount = comphelper::string::getTokenCount(aLine, ',');
......
...@@ -69,7 +69,7 @@ class XBMReader : public GraphicReader ...@@ -69,7 +69,7 @@ class XBMReader : public GraphicReader
sal_Bool bStatus; sal_Bool bStatus;
void InitTable(); void InitTable();
ByteString FindTokenLine( SvStream* pInStm, const char* pTok1, rtl::OString FindTokenLine( SvStream* pInStm, const char* pTok1,
const char* pTok2 = NULL, const char* pTok3 = NULL ); const char* pTok2 = NULL, const char* pTok3 = NULL );
long ParseDefine( const sal_Char* pDefine ); long ParseDefine( const sal_Char* pDefine );
sal_Bool ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat ); sal_Bool ParseData( SvStream* pInStm, const ByteString& aLastLine, XBMFormat eFormat );
......
...@@ -654,7 +654,7 @@ sal_Bool SvStream::ReadByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSe ...@@ -654,7 +654,7 @@ sal_Bool SvStream::ReadByteStringLine( String& rStr, rtl_TextEncoding eSrcCharSe
return bRet; return bRet;
} }
sal_Bool SvStream::ReadLine( ByteString& rStr ) sal_Bool SvStream::ReadLine(rtl::OString& rStr)
{ {
sal_Char buf[256+1]; sal_Char buf[256+1];
sal_Bool bEnd = sal_False; sal_Bool bEnd = sal_False;
...@@ -722,9 +722,9 @@ sal_Bool SvStream::ReadLine( ByteString& rStr ) ...@@ -722,9 +722,9 @@ sal_Bool SvStream::ReadLine( ByteString& rStr )
return bEnd; return bEnd;
} }
sal_Bool SvStream::ReadLine( rtl::OString& rStr ) sal_Bool SvStream::ReadLine( ByteString& rStr )
{ {
ByteString aFoo; rtl::OString aFoo;
sal_Bool ret = ReadLine(aFoo); sal_Bool ret = ReadLine(aFoo);
rStr = aFoo; rStr = aFoo;
return ret; return ret;
......
...@@ -296,7 +296,7 @@ class PPDDecompressStream ...@@ -296,7 +296,7 @@ class PPDDecompressStream
bool IsOpen() const; bool IsOpen() const;
bool IsEof() const; bool IsEof() const;
void ReadLine( ByteString& o_rLine); rtl::OString ReadLine();
void Open( const rtl::OUString& i_rFile ); void Open( const rtl::OUString& i_rFile );
void Close(); void Close();
const rtl::OUString& GetFileName() const { return maFileName; } const rtl::OUString& GetFileName() const { return maFileName; }
...@@ -378,12 +378,14 @@ bool PPDDecompressStream::IsEof() const ...@@ -378,12 +378,14 @@ bool PPDDecompressStream::IsEof() const
return ( mpMemStream ? mpMemStream->IsEof() : ( mpFileStream ? mpFileStream->IsEof() : true ) ); return ( mpMemStream ? mpMemStream->IsEof() : ( mpFileStream ? mpFileStream->IsEof() : true ) );
} }
void PPDDecompressStream::ReadLine( ByteString& o_rLine ) rtl::OString PPDDecompressStream::ReadLine()
{ {
rtl::OString o_rLine;
if( mpMemStream ) if( mpMemStream )
mpMemStream->ReadLine( o_rLine ); mpMemStream->ReadLine( o_rLine );
else if( mpFileStream ) else if( mpFileStream )
mpFileStream->ReadLine( o_rLine ); mpFileStream->ReadLine( o_rLine );
return o_rLine;
} }
static osl::FileBase::RC resolveLink( const rtl::OUString& i_rURL, rtl::OUString& o_rResolvedURL, rtl::OUString& o_rBaseName, osl::FileStatus::Type& o_rType, int nLinkLevel = 10 ) static osl::FileBase::RC resolveLink( const rtl::OUString& i_rURL, rtl::OUString& o_rResolvedURL, rtl::OUString& o_rBaseName, osl::FileStatus::Type& o_rType, int nLinkLevel = 10 )
...@@ -565,8 +567,7 @@ String PPDParser::getPPDFile( const String& rFile ) ...@@ -565,8 +567,7 @@ String PPDParser::getPPDFile( const String& rFile )
String aRet; String aRet;
if( aStream.IsOpen() ) if( aStream.IsOpen() )
{ {
ByteString aLine; ByteString aLine = aStream.ReadLine();
aStream.ReadLine( aLine );
if( aLine.Search( "*PPD-Adobe" ) == 0 ) if( aLine.Search( "*PPD-Adobe" ) == 0 )
aRet = aStream.GetFileName(); aRet = aStream.GetFileName();
else else
...@@ -575,7 +576,7 @@ String PPDParser::getPPDFile( const String& rFile ) ...@@ -575,7 +576,7 @@ String PPDParser::getPPDFile( const String& rFile )
// with *PPD-Adobe, so try some lines for *Include // with *PPD-Adobe, so try some lines for *Include
int nLines = 10; int nLines = 10;
while( aLine.Search( "*Include" ) != 0 && --nLines ) while( aLine.Search( "*Include" ) != 0 && --nLines )
aStream.ReadLine( aLine ); aLine = aStream.ReadLine();
if( nLines ) if( nLines )
aRet = aStream.GetFileName(); aRet = aStream.GetFileName();
} }
...@@ -596,9 +597,8 @@ String PPDParser::getPPDPrinterName( const String& rFile ) ...@@ -596,9 +597,8 @@ String PPDParser::getPPDPrinterName( const String& rFile )
String aCurLine; String aCurLine;
while( ! aStream.IsEof() && aStream.IsOpen() ) while( ! aStream.IsEof() && aStream.IsOpen() )
{ {
ByteString aByteLine; rtl::OString aByteLine = aStream.ReadLine();
aStream.ReadLine( aByteLine ); aCurLine = rtl::OStringToOUString(aByteLine, RTL_TEXTENCODING_MS_1252);
aCurLine = String( aByteLine, RTL_TEXTENCODING_MS_1252 );
if( aCurLine.CompareIgnoreCaseToAscii( "*include:", 9 ) == COMPARE_EQUAL ) if( aCurLine.CompareIgnoreCaseToAscii( "*include:", 9 ) == COMPARE_EQUAL )
{ {
aCurLine.Erase( 0, 9 ); aCurLine.Erase( 0, 9 );
...@@ -694,10 +694,9 @@ PPDParser::PPDParser( const String& rFile ) : ...@@ -694,10 +694,9 @@ PPDParser::PPDParser( const String& rFile ) :
bool bLanguageEncoding = false; bool bLanguageEncoding = false;
if( aStream.IsOpen() ) if( aStream.IsOpen() )
{ {
ByteString aCurLine;
while( ! aStream.IsEof() ) while( ! aStream.IsEof() )
{ {
aStream.ReadLine( aCurLine ); ByteString aCurLine = aStream.ReadLine();
if( aCurLine.GetChar( 0 ) == '*' ) if( aCurLine.GetChar( 0 ) == '*' )
{ {
if( aCurLine.CompareIgnoreCaseToAscii( "*include:", 9 ) == COMPARE_EQUAL ) if( aCurLine.CompareIgnoreCaseToAscii( "*include:", 9 ) == COMPARE_EQUAL )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment