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

ditch some ByteStrings

üst 66a8b58a
...@@ -67,17 +67,17 @@ sal_Bool CppDep::AddSource( const char* pSource ) ...@@ -67,17 +67,17 @@ sal_Bool CppDep::AddSource( const char* pSource )
return sal_False; return sal_False;
} }
sal_Bool CppDep::Search( ByteString aFileName ) sal_Bool CppDep::Search(const rtl::OString &rFileName)
{ {
#ifdef DEBUG_VERBOSE #ifdef DEBUG_VERBOSE
fprintf( stderr, "SEARCH : %s\n", aFileName.GetBuffer()); fprintf( stderr, "SEARCH : %s\n", rFileName.getStr());
#endif #endif
sal_Bool bRet = sal_False; sal_Bool bRet = sal_False;
SvFileStream aFile; SvFileStream aFile;
rtl::OString aReadLine; rtl::OString aReadLine;
UniString suFileName(aFileName, osl_getThreadTextEncoding()); UniString suFileName(rtl::OStringToOUString(rFileName, osl_getThreadTextEncoding()));
aFile.Open( suFileName, STREAM_READ ); aFile.Open( suFileName, STREAM_READ );
while ( aFile.ReadLine( aReadLine )) while ( aFile.ReadLine( aReadLine ))
...@@ -90,13 +90,13 @@ sal_Bool CppDep::Search( ByteString aFileName ) ...@@ -90,13 +90,13 @@ sal_Bool CppDep::Search( ByteString aFileName )
#ifdef DEBUG_VERBOSE #ifdef DEBUG_VERBOSE
fprintf( stderr, "found : %d %s\n", nPos, aReadLine.getStr() ); fprintf( stderr, "found : %d %s\n", nPos, aReadLine.getStr() );
#endif #endif
ByteString aResult = IsIncludeStatement( aReadLine ); rtl::OString aResult = IsIncludeStatement( aReadLine );
#ifdef DEBUG_VERBOSE #ifdef DEBUG_VERBOSE
fprintf( stderr, "Result : %s\n", aResult.GetBuffer() ); fprintf( stderr, "Result : %s\n", aResult.getStr() );
#endif #endif
rtl::OString aNewFile; rtl::OString aNewFile;
if ( aResult !="") if (!aResult.isEmpty())
if ( (aNewFile = Exists( aResult )).getLength() ) if ( (aNewFile = Exists( aResult )).getLength() )
{ {
sal_Bool bFound = sal_False; sal_Bool bFound = sal_False;
...@@ -126,12 +126,12 @@ sal_Bool CppDep::Search( ByteString aFileName ) ...@@ -126,12 +126,12 @@ sal_Bool CppDep::Search( ByteString aFileName )
return bRet; return bRet;
} }
rtl::OString CppDep::Exists( rtl::OString aFileName ) rtl::OString CppDep::Exists(const rtl::OString &rFileName)
{ {
char pFullName[1023]; char pFullName[1023];
#ifdef DEBUG_VERBOSE #ifdef DEBUG_VERBOSE
fprintf( stderr, "Searching %s \n", aFileName.getStr() ); fprintf( stderr, "Searching %s \n", rFileName.getStr() );
#endif #endif
size_t nCount = m_aSearchPath.size(); size_t nCount = m_aSearchPath.size();
...@@ -142,7 +142,7 @@ rtl::OString CppDep::Exists( rtl::OString aFileName ) ...@@ -142,7 +142,7 @@ rtl::OString CppDep::Exists( rtl::OString aFileName )
strcpy( pFullName, rPathName.getStr()); strcpy( pFullName, rPathName.getStr());
strcat( pFullName, DIR_SEP ); strcat( pFullName, DIR_SEP );
strcat( pFullName, aFileName.getStr()); strcat( pFullName, rFileName.getStr());
#ifdef DEBUG_VERBOSE #ifdef DEBUG_VERBOSE
fprintf( stderr, "looking for %s\t ", pFullName ); fprintf( stderr, "looking for %s\t ", pFullName );
......
...@@ -39,8 +39,8 @@ protected: ...@@ -39,8 +39,8 @@ protected:
std::vector<rtl::OString> m_aFileList; std::vector<rtl::OString> m_aFileList;
std::vector<rtl::OString> m_aSources; std::vector<rtl::OString> m_aSources;
sal_Bool Search( ByteString aFileName ); sal_Bool Search(const rtl::OString& rFileName);
rtl::OString Exists( rtl::OString aFileName ); rtl::OString Exists(const rtl::OString& rFileName);
rtl::OString IsIncludeStatement(rtl::OString aLine); rtl::OString IsIncludeStatement(rtl::OString aLine);
public: public:
......
...@@ -38,26 +38,26 @@ protected: ...@@ -38,26 +38,26 @@ protected:
FILE *pIn, *pOut; FILE *pIn, *pOut;
virtual void Filter(); virtual void Filter();
public: public:
TextFilter( ByteString aInFile = "stdin", TextFilter( rtl::OString aInFile = "stdin",
ByteString aOutFile = "stdout" ); rtl::OString aOutFile = "stdout" );
virtual ~TextFilter(); virtual ~TextFilter();
virtual void Execute(); virtual void Execute();
}; };
TextFilter::TextFilter( ByteString aInFile, ByteString aOutFile ) TextFilter::TextFilter( rtl::OString aInFile, rtl::OString aOutFile )
{ {
if ( aInFile == "stdin" ) if ( aInFile == "stdin" )
pIn = stdin; pIn = stdin;
else else
if (( pIn = fopen( aInFile.GetBuffer(), "r" )) == NULL ) if (( pIn = fopen( aInFile.getStr(), "r" )) == NULL )
printf( "Can't read %s\n", aInFile.GetBuffer() ); printf( "Can't read %s\n", aInFile.getStr() );
if ( aOutFile == "stdout" ) if ( aOutFile == "stdout" )
pOut = stdout; pOut = stdout;
else else
if (( pOut = fopen( aOutFile.GetBuffer(), "w" )) == NULL ) if (( pOut = fopen( aOutFile.getStr(), "w" )) == NULL )
printf( "Can't write %s\n", aOutFile.GetBuffer() ); printf( "Can't write %s\n", aOutFile.getStr() );
} }
TextFilter::~TextFilter() TextFilter::~TextFilter()
...@@ -110,11 +110,11 @@ class MkFilter : public TextFilter ...@@ -110,11 +110,11 @@ class MkFilter : public TextFilter
protected: protected:
virtual void Filter(); virtual void Filter();
public: public:
MkFilter( ByteString aInFile = "stdin", ByteString aOutFile = "stdout"); MkFilter( rtl::OString aInFile = "stdin", rtl::OString aOutFile = "stdout");
~MkFilter(); ~MkFilter();
}; };
MkFilter::MkFilter( ByteString aInFile, ByteString aOutFile ) : MkFilter::MkFilter( rtl::OString aInFile, rtl::OString aOutFile ) :
TextFilter( aInFile, aOutFile ) TextFilter( aInFile, aOutFile )
{ {
pLst = new ByteStringList; pLst = new ByteStringList;
......
...@@ -85,7 +85,7 @@ int main( int argc, char** argv ) ...@@ -85,7 +85,7 @@ int main( int argc, char** argv )
char pSrsFileName[255]; char pSrsFileName[255];
String aSrsBaseName; String aSrsBaseName;
sal_Bool bSource = sal_False; sal_Bool bSource = sal_False;
ByteString aRespArg; rtl::OStringBuffer aRespArg;
// who needs anything but '/' ? // who needs anything but '/' ?
sal_Char cDelim = '/'; sal_Char cDelim = '/';
...@@ -155,8 +155,7 @@ int main( int argc, char** argv ) ...@@ -155,8 +155,7 @@ int main( int argc, char** argv )
if (( aBuf2[0] != '-' ) && ( aBuf2[0] != '@' )) if (( aBuf2[0] != '-' ) && ( aBuf2[0] != '@' ))
{ {
pDep->AddSource( &aBuf2[0] ); pDep->AddSource( &aBuf2[0] );
aRespArg += " "; aRespArg.append(' ').append(&aBuf2[0]);
aRespArg += &aBuf2[0];
bSource = sal_True; bSource = sal_True;
} }
} }
...@@ -239,7 +238,7 @@ int main( int argc, char** argv ) ...@@ -239,7 +238,7 @@ int main( int argc, char** argv )
} }
} }
} }
aString.append(aRespArg); aString.append(aRespArg.makeStringAndClear());
pDep->Execute(); pDep->Execute();
std::vector<rtl::OString>& rLst = pDep->GetDepList(); std::vector<rtl::OString>& rLst = pDep->GetDepList();
size_t nCount = rLst.size(); size_t nCount = rLst.size();
......
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