From addca63bba3ddaf212e44cdf16e95038b0a5bf3e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Sat, 20 Oct 2007 17:59:32 +0000 Subject: Just marked Bu::FString::c_str as deprecated, don't use it, it'll go away later. --- src/fstring.h | 12 ++++++++++++ src/paramproc.cpp | 2 +- src/tests/fstratsptr.cpp | 4 ++-- src/tests/fstring.cpp | 9 +++++---- src/unit/taf.cpp | 6 +++--- 5 files changed, 23 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/fstring.h b/src/fstring.h index 97959d3..c324e4a 100644 --- a/src/fstring.h +++ b/src/fstring.h @@ -11,6 +11,16 @@ #define min( a, b ) ((a 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)) +#define DEPRECATED __attribute__((__deprecated__)) +#else +#define DEPRECATED +#endif /* __GNUC__ */ + + namespace Bu { template< typename chr > @@ -286,6 +296,7 @@ namespace Bu * (std::string compatability) Get a pointer to the string array. *@returns (chr *) The string data. */ + DEPRECATED chr *c_str() { if( pFirst == NULL ) @@ -300,6 +311,7 @@ namespace Bu * (std::string compatability) Get a const pointer to the string array. *@returns (const chr *) The string data. */ + DEPRECATED const chr *c_str() const { if( pFirst == NULL ) diff --git a/src/paramproc.cpp b/src/paramproc.cpp index 67ef44b..c197e9c 100644 --- a/src/paramproc.cpp +++ b/src/paramproc.cpp @@ -484,7 +484,7 @@ int Bu::ParamProc::help( int argc, char *argv[] ) Bu::FString sTmp = (*i)->sWord.getStr(); if( (*i)->sExtra.getStr() ) sTmp += (*i)->sExtra.getStr(); - printf( fmt, sTmp.c_str() ); + printf( fmt, sTmp.getStr() ); } else { diff --git a/src/tests/fstratsptr.cpp b/src/tests/fstratsptr.cpp index 343f682..61c20bd 100644 --- a/src/tests/fstratsptr.cpp +++ b/src/tests/fstratsptr.cpp @@ -22,8 +22,8 @@ void Swap(PersonPtr one, PersonPtr two) printf( "%s %s\n", - three->sFirstName->c_str(), - three->sLastName->c_str() ); + three->sFirstName->getStr(), + three->sLastName->getStr() ); } int main() diff --git a/src/tests/fstring.cpp b/src/tests/fstring.cpp index 11f147d..d20309a 100644 --- a/src/tests/fstring.cpp +++ b/src/tests/fstring.cpp @@ -27,13 +27,14 @@ Bu::FString genThing() bob += "cd "; bob += "efg"; - printf("---bob------\n%08X: %s\n", (unsigned int)bob.c_str(), bob.c_str() ); + printf("---bob------\n%08X: %s\n", (unsigned int)bob.getStr(), + bob.getStr() ); return bob; } void thing( Bu::FString str ) { - printf("Hey: %s\n", str.c_str() ); + printf("Hey: %s\n", str.getStr() ); } void copyfunc( std::string temp ) @@ -107,7 +108,7 @@ void doTimings() delete[] buf; } -#define pem printf("---------\n%08X: %s\n%08X: %s\n", (unsigned int)str.c_str(), str.c_str(), (unsigned int)str2.c_str(), str2.c_str() ); +#define pem printf("---------\n%08X: %s\n%08X: %s\n", (unsigned int)str.getStr(), str.getStr(), (unsigned int)str2.getStr(), str2.getStr() ); int main( int argc, char *argv ) { Bu::FString fs1; @@ -137,7 +138,7 @@ int main( int argc, char *argv ) thing( str2 ); thing("test."); - printf("%d == %d\n", Bu::__calcHashCode( str ), Bu::__calcHashCode( str.c_str() ) ); + printf("%d == %d\n", Bu::__calcHashCode( str ), Bu::__calcHashCode( str.getStr() ) ); doTimings(); } diff --git a/src/unit/taf.cpp b/src/unit/taf.cpp index 5e0e914..94b4613 100644 --- a/src/unit/taf.cpp +++ b/src/unit/taf.cpp @@ -29,14 +29,14 @@ public: fOut.write(data,strlen(data)); fOut.close(); - Bu::File fIn(sFnTmp.c_str(), "rb"); + Bu::File fIn(sFnTmp.getStr(), "rb"); Bu::TafReader tr(fIn); Bu::TafGroup *tn = tr.readGroup(); - unitTest( !strcmp("Bob", tn->getProperty("name").c_str()) ); + unitTest( !strcmp("Bob", tn->getProperty("name").getStr()) ); delete tn; - unlink(sFnTmp.c_str()); + unlink(sFnTmp.getStr()); #undef FN_TMP } }; -- cgit v1.2.3