From dec6e86f6ed39bf66678c9061e50a04c5ea068bf Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 7 Aug 1999 18:24:49 +0000 Subject: [PATCH] Mac portability tweaks. --- src/Objects/materialmgr.cxx | 8 +++++++- src/Objects/obj.cxx | 12 +++++++++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/src/Objects/materialmgr.cxx b/src/Objects/materialmgr.cxx index ece3f4d65..c6e30d558 100644 --- a/src/Objects/materialmgr.cxx +++ b/src/Objects/materialmgr.cxx @@ -135,12 +135,18 @@ fgMATERIAL_MGR::load_lib ( void ) mpath.append( "materials" ); fg_gzifstream in( mpath.str() ); - if ( ! in ) { + if ( ! in.is_open() ) { FG_LOG( FG_GENERAL, FG_ALERT, "Cannot open file: " << mpath.str() ); exit(-1); } +#ifndef __MWERKS__ while ( ! in.eof() ) { +#else + char c = '\0'; + while ( in.get(c) && c != '\0' ) { + in.putback(c); +#endif // printf("%s", line); // strip leading white space and comments diff --git a/src/Objects/obj.cxx b/src/Objects/obj.cxx index 6c000a533..eb400bb78 100644 --- a/src/Objects/obj.cxx +++ b/src/Objects/obj.cxx @@ -182,11 +182,17 @@ ssgBranch *fgObjLoad( const string& path, FGTileEntry *t) { // ignore initial comments and blank lines. (priming the pump) // in >> skipcomment; - string line; + // string line; + string token; + char c; + +#ifdef __MWERKS__ + while ( in.get(c) && c != '\0' ) { + in.putback(c); +#else while ( ! in.eof() ) { - string token; - char c; +#endif #if defined( MACOS ) in >> ::skipws;