From a06492465223d42fb8905c4770c9f1ec4b80af36 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 6 Dec 2011 23:32:42 +0000 Subject: ditch some ByteStrings --- tools/bootstrp/cppdep.cxx | 18 +++++++++--------- tools/bootstrp/cppdep.hxx | 4 ++-- tools/bootstrp/mkunroll/mkunroll.cxx | 18 +++++++++--------- tools/bootstrp/rscdep.cxx | 7 +++---- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/tools/bootstrp/cppdep.cxx b/tools/bootstrp/cppdep.cxx index ea9179d2a071..c03a6a456bc0 100644 --- a/tools/bootstrp/cppdep.cxx +++ b/tools/bootstrp/cppdep.cxx @@ -67,17 +67,17 @@ sal_Bool CppDep::AddSource( const char* pSource ) return sal_False; } -sal_Bool CppDep::Search( ByteString aFileName ) +sal_Bool CppDep::Search(const rtl::OString &rFileName) { #ifdef DEBUG_VERBOSE - fprintf( stderr, "SEARCH : %s\n", aFileName.GetBuffer()); + fprintf( stderr, "SEARCH : %s\n", rFileName.getStr()); #endif sal_Bool bRet = sal_False; SvFileStream aFile; rtl::OString aReadLine; - UniString suFileName(aFileName, osl_getThreadTextEncoding()); + UniString suFileName(rtl::OStringToOUString(rFileName, osl_getThreadTextEncoding())); aFile.Open( suFileName, STREAM_READ ); while ( aFile.ReadLine( aReadLine )) @@ -90,13 +90,13 @@ sal_Bool CppDep::Search( ByteString aFileName ) #ifdef DEBUG_VERBOSE fprintf( stderr, "found : %d %s\n", nPos, aReadLine.getStr() ); #endif - ByteString aResult = IsIncludeStatement( aReadLine ); + rtl::OString aResult = IsIncludeStatement( aReadLine ); #ifdef DEBUG_VERBOSE - fprintf( stderr, "Result : %s\n", aResult.GetBuffer() ); + fprintf( stderr, "Result : %s\n", aResult.getStr() ); #endif rtl::OString aNewFile; - if ( aResult !="") + if (!aResult.isEmpty()) if ( (aNewFile = Exists( aResult )).getLength() ) { sal_Bool bFound = sal_False; @@ -126,12 +126,12 @@ sal_Bool CppDep::Search( ByteString aFileName ) return bRet; } -rtl::OString CppDep::Exists( rtl::OString aFileName ) +rtl::OString CppDep::Exists(const rtl::OString &rFileName) { char pFullName[1023]; #ifdef DEBUG_VERBOSE - fprintf( stderr, "Searching %s \n", aFileName.getStr() ); + fprintf( stderr, "Searching %s \n", rFileName.getStr() ); #endif size_t nCount = m_aSearchPath.size(); @@ -142,7 +142,7 @@ rtl::OString CppDep::Exists( rtl::OString aFileName ) strcpy( pFullName, rPathName.getStr()); strcat( pFullName, DIR_SEP ); - strcat( pFullName, aFileName.getStr()); + strcat( pFullName, rFileName.getStr()); #ifdef DEBUG_VERBOSE fprintf( stderr, "looking for %s\t ", pFullName ); diff --git a/tools/bootstrp/cppdep.hxx b/tools/bootstrp/cppdep.hxx index b60242790890..3ed2942d5e84 100644 --- a/tools/bootstrp/cppdep.hxx +++ b/tools/bootstrp/cppdep.hxx @@ -39,8 +39,8 @@ protected: std::vector m_aFileList; std::vector m_aSources; - sal_Bool Search( ByteString aFileName ); - rtl::OString Exists( rtl::OString aFileName ); + sal_Bool Search(const rtl::OString& rFileName); + rtl::OString Exists(const rtl::OString& rFileName); rtl::OString IsIncludeStatement(rtl::OString aLine); public: diff --git a/tools/bootstrp/mkunroll/mkunroll.cxx b/tools/bootstrp/mkunroll/mkunroll.cxx index 694645745658..d315af5b6305 100644 --- a/tools/bootstrp/mkunroll/mkunroll.cxx +++ b/tools/bootstrp/mkunroll/mkunroll.cxx @@ -38,26 +38,26 @@ protected: FILE *pIn, *pOut; virtual void Filter(); public: - TextFilter( ByteString aInFile = "stdin", - ByteString aOutFile = "stdout" ); + TextFilter( rtl::OString aInFile = "stdin", + rtl::OString aOutFile = "stdout" ); virtual ~TextFilter(); virtual void Execute(); }; -TextFilter::TextFilter( ByteString aInFile, ByteString aOutFile ) +TextFilter::TextFilter( rtl::OString aInFile, rtl::OString aOutFile ) { if ( aInFile == "stdin" ) pIn = stdin; else - if (( pIn = fopen( aInFile.GetBuffer(), "r" )) == NULL ) - printf( "Can't read %s\n", aInFile.GetBuffer() ); + if (( pIn = fopen( aInFile.getStr(), "r" )) == NULL ) + printf( "Can't read %s\n", aInFile.getStr() ); if ( aOutFile == "stdout" ) pOut = stdout; else - if (( pOut = fopen( aOutFile.GetBuffer(), "w" )) == NULL ) - printf( "Can't write %s\n", aOutFile.GetBuffer() ); + if (( pOut = fopen( aOutFile.getStr(), "w" )) == NULL ) + printf( "Can't write %s\n", aOutFile.getStr() ); } TextFilter::~TextFilter() @@ -110,11 +110,11 @@ class MkFilter : public TextFilter protected: virtual void Filter(); public: - MkFilter( ByteString aInFile = "stdin", ByteString aOutFile = "stdout"); + MkFilter( rtl::OString aInFile = "stdin", rtl::OString aOutFile = "stdout"); ~MkFilter(); }; -MkFilter::MkFilter( ByteString aInFile, ByteString aOutFile ) : +MkFilter::MkFilter( rtl::OString aInFile, rtl::OString aOutFile ) : TextFilter( aInFile, aOutFile ) { pLst = new ByteStringList; diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx index eb6993e8498d..4afde22fae14 100644 --- a/tools/bootstrp/rscdep.cxx +++ b/tools/bootstrp/rscdep.cxx @@ -85,7 +85,7 @@ int main( int argc, char** argv ) char pSrsFileName[255]; String aSrsBaseName; sal_Bool bSource = sal_False; - ByteString aRespArg; + rtl::OStringBuffer aRespArg; // who needs anything but '/' ? sal_Char cDelim = '/'; @@ -155,8 +155,7 @@ int main( int argc, char** argv ) if (( aBuf2[0] != '-' ) && ( aBuf2[0] != '@' )) { pDep->AddSource( &aBuf2[0] ); - aRespArg += " "; - aRespArg += &aBuf2[0]; + aRespArg.append(' ').append(&aBuf2[0]); bSource = sal_True; } } @@ -239,7 +238,7 @@ int main( int argc, char** argv ) } } } - aString.append(aRespArg); + aString.append(aRespArg.makeStringAndClear()); pDep->Execute(); std::vector& rLst = pDep->GetDepList(); size_t nCount = rLst.size(); -- cgit