From d219c5c4c613e4f36d8ff1ce8af674fc96dcb543 Mon Sep 17 00:00:00 2001 From: timoore Date: Mon, 2 Jun 2008 20:21:27 +0000 Subject: [PATCH] Don't include and "using" declarations in header files sucks in expensive initialization of the standard streams and isn't appropriate in a header file. Use and instead. using declarations should never appear at global scope in a header file; source files get to decide what they want to use in their namespace. --- simgear/bucket/newbucket.hxx | 44 ++++++++------------------ simgear/debug/logstream.cxx | 23 +++++++++++++- simgear/debug/logstream.hxx | 49 +++++++++++------------------ simgear/io/sg_binobj.cxx | 3 ++ simgear/io/tcp_client.cxx | 6 ++-- simgear/math/point3d.hxx | 40 +++++++---------------- simgear/misc/sgstream.cxx | 3 ++ simgear/misc/sgstream.hxx | 16 ++++------ simgear/misc/zfstream.cxx | 8 ++--- simgear/misc/zfstream.hxx | 27 +++++++--------- simgear/props/props.cxx | 23 ++++++-------- simgear/props/props.hxx | 48 ++++++++++------------------ simgear/props/props_io.cxx | 2 ++ simgear/props/props_io.hxx | 20 +++++------- simgear/props/props_test.cxx | 4 +-- simgear/scene/material/matmodel.hxx | 9 +++--- simgear/scene/model/shadanim.cxx | 2 +- simgear/scene/tgdb/TileEntry.cxx | 4 ++- simgear/sound/xmlsound.cxx | 2 +- simgear/sound/xmlsound.hxx | 6 ++-- simgear/structure/SGSmplhist.hxx | 6 ++-- 21 files changed, 150 insertions(+), 195 deletions(-) diff --git a/simgear/bucket/newbucket.hxx b/simgear/bucket/newbucket.hxx index 9609138c..6e9bdd24 100644 --- a/simgear/bucket/newbucket.hxx +++ b/simgear/bucket/newbucket.hxx @@ -33,29 +33,10 @@ #include #include -#ifdef SG_HAVE_STD_INCLUDES -# include -# include // sprintf() -#else -# include -# include // sprintf() -#endif - -#include STL_IOSTREAM - -// I don't understand ... or should be included -// already depending on how you defined SG_HAVE_STD_INCLUDES, but I -// can go ahead and add this -- CLO -#ifdef __MWERKS__ -SG_USING_STD(sprintf); -SG_USING_STD(fabs); -#endif - -#include STL_STRING - -SG_USING_STD(string); -SG_USING_STD(ostream); - +#include +#include // sprintf() +#include +#include /** * standard size of a bucket in degrees (1/8 of a degree) @@ -210,18 +191,19 @@ public: * string form. * @return tile index in string form */ - inline string gen_index_str() const { + inline std::string gen_index_str() const { char tmp[20]; - sprintf(tmp, "%ld", - (((long)lon + 180) << 14) + ((lat + 90) << 6) + (y << 3) + x); - return (string)tmp; + std::sprintf(tmp, "%ld", + (((long)lon + 180) << 14) + ((lat + 90) << 6) + + (y << 3) + x); + return (std::string)tmp; } /** * Build the base path name for this bucket. * @return base path in string form */ - string gen_base_path() const; + std::string gen_base_path() const; /** * @return the center lon of a tile. @@ -306,7 +288,7 @@ public: // friends - friend ostream& operator<< ( ostream&, const SGBucket& ); + friend std::ostream& operator<< ( std::ostream&, const SGBucket& ); friend bool operator== ( const SGBucket&, const SGBucket& ); }; @@ -345,8 +327,8 @@ void sgBucketDiff( const SGBucket& b1, const SGBucket& b2, int *dx, int *dy ); * @param out output stream * @param b bucket */ -inline ostream& -operator<< ( ostream& out, const SGBucket& b ) +inline std::ostream& +operator<< ( std::ostream& out, const SGBucket& b ) { return out << b.lon << ":" << b.x << ", " << b.lat << ":" << b.y; } diff --git a/simgear/debug/logstream.cxx b/simgear/debug/logstream.cxx index 0a360941..28afbd26 100644 --- a/simgear/debug/logstream.cxx +++ b/simgear/debug/logstream.cxx @@ -20,9 +20,11 @@ // // $Id$ +#include + #include "logstream.hxx" -logstream *global_logstream = NULL; +logstream *logstream::global_logstream = 0; bool logbuf::logging_enabled = true; #ifdef _MSC_VER @@ -90,3 +92,22 @@ logstream::setLogLevels( sgDebugClass c, sgDebugPriority p ) logbuf::set_log_level( c, p ); } +void +logstream::initGlobalLogstream() +{ + // Force initialization of cerr. + static std::ios_base::Init initializer; + // XXX Is the following still necessary? +#ifdef __APPLE__ + /** + * There appears to be a bug in the C++ runtime in Mac OS X that + * will crash if certain funtions are called (in this case + * cerr.rdbuf()) during static initialization of a class. This + * print statement is hack to kick the library in the pants so it + * won't crash when cerr.rdbuf() is first called -DW + **/ + std::cout << "Using Mac OS X hack for initializing C++ stdio..." + << std::endl; +#endif + global_logstream = new logstream(std::cerr); +} diff --git a/simgear/debug/logstream.hxx b/simgear/debug/logstream.hxx index c4ea7834..a9dafa6d 100644 --- a/simgear/debug/logstream.hxx +++ b/simgear/debug/logstream.hxx @@ -33,7 +33,7 @@ #ifdef SG_HAVE_STD_INCLUDES # include -# include +# include #else # include # include @@ -43,9 +43,6 @@ SG_USING_STD(streambuf); SG_USING_STD(ostream); -SG_USING_STD(cout); -SG_USING_STD(cerr); -SG_USING_STD(endl); #ifdef __MWERKS__ SG_USING_STD(iostream); @@ -67,7 +64,7 @@ SG_USING_STD(iostream); #ifdef SG_NEED_STREAMBUF_HACK class logbuf : public __streambuf #else -class logbuf : public streambuf +class logbuf : public std::streambuf #endif { public: @@ -137,7 +134,7 @@ public: * Set the stream buffer * @param sb stream buffer */ - void set_sb( streambuf* sb ); + void set_sb( std::streambuf* sb ); #ifdef _MSC_VER static void has_no_console() { has_console = false; } @@ -155,7 +152,7 @@ protected: private: // The streambuf used for actual output. Defaults to cerr.rdbuf(). - static streambuf* sbuf; + static std::streambuf* sbuf; static bool logging_enabled; #ifdef _MSC_VER @@ -238,23 +235,23 @@ struct logstream_base /** * Class to manage the debug logging stream. */ -class logstream : private logstream_base, public ostream +class logstream : private logstream_base, public std::ostream { public: /** * The default is to send messages to cerr. * @param out output stream */ - logstream( ostream& out ) + logstream( std::ostream& out ) // : logstream_base(out.rdbuf()), : logstream_base(), - ostream(&lbuf) { lbuf.set_sb(out.rdbuf());} + std::ostream(&lbuf) { lbuf.set_sb(out.rdbuf());} /** * Set the output stream * @param out output stream */ - void set_output( ostream& out ) { lbuf.set_sb( out.rdbuf() ); } + void set_output( std::ostream& out ) { lbuf.set_sb( out.rdbuf() ); } /** * Set the global log class and priority level. @@ -267,18 +264,20 @@ public: * Output operator to capture the debug level and priority of a message. * @param l log level */ - inline ostream& operator<< ( const loglevel& l ); + inline std::ostream& operator<< ( const loglevel& l ); + friend logstream& sglog(); +protected: + static logstream *global_logstream; + static void initGlobalLogstream(); }; -inline ostream& +inline std::ostream& logstream::operator<< ( const loglevel& l ) { lbuf.set_log_state( l.logClass, l.logPriority ); return *this; } -extern logstream *global_logstream; - /** * \relates logstream * Return the one and only logstream instance. @@ -289,22 +288,10 @@ extern logstream *global_logstream; inline logstream& sglog() { - if (global_logstream == NULL) { - -#ifdef __APPLE__ - /** - * There appears to be a bug in the C++ runtime in Mac OS X that - * will crash if certain funtions are called (in this case - * cerr.rdbuf()) during static initialization of a class. This - * print statement is hack to kick the library in the pants so it - * won't crash when cerr.rdbuf() is first called -DW - **/ - cout << "Using Mac OS X hack for initializing C++ stdio..." << endl; -#endif - global_logstream = new logstream (cerr); + if (logstream::global_logstream == NULL) { + logstream::initGlobalLogstream(); } - - return *global_logstream; + return *logstream::global_logstream; } @@ -319,7 +306,7 @@ sglog() #elif defined( __MWERKS__ ) # define SG_LOG(C,P,M) ::sglog() << ::loglevel(C,P) << M << std::endl #else -# define SG_LOG(C,P,M) sglog() << loglevel(C,P) << M << endl +# define SG_LOG(C,P,M) sglog() << loglevel(C,P) << M << std::endl #endif #define SG_STRINGIFY(x) #x diff --git a/simgear/io/sg_binobj.cxx b/simgear/io/sg_binobj.cxx index f0af93b8..62e3fbe1 100644 --- a/simgear/io/sg_binobj.cxx +++ b/simgear/io/sg_binobj.cxx @@ -34,6 +34,7 @@ #include #include STL_STRING +#include #include #include @@ -45,6 +46,8 @@ SG_USING_STD( string ); SG_USING_STD( vector ); +using std::cout; +using std::endl; enum sgObjectTypes { SG_BOUNDING_SPHERE = 0, diff --git a/simgear/io/tcp_client.cxx b/simgear/io/tcp_client.cxx index d1d7f8c7..dc9b171e 100644 --- a/simgear/io/tcp_client.cxx +++ b/simgear/io/tcp_client.cxx @@ -7,6 +7,8 @@ #include #endif +#include + #include #include "sg_socket.hxx" @@ -49,7 +51,7 @@ TcpClient::process() sprintf( wbuf, "hello world\n" ); int length = channel->writestring( wbuf ); - cout << "writestring returned " << length << "\n"; + std::cout << "writestring returned " << length << "\n"; return true; } @@ -67,7 +69,7 @@ main() TcpClient client( "localhost", "5500" ); if (!client.open()) { - cout << "client open failed\n"; + std::cout << "client open failed\n"; return 0; } diff --git a/simgear/math/point3d.hxx b/simgear/math/point3d.hxx index 79ce8303..48f6e9ad 100644 --- a/simgear/math/point3d.hxx +++ b/simgear/math/point3d.hxx @@ -41,37 +41,21 @@ # define exception c_exception #endif -#ifdef SG_HAVE_STD_INCLUDES -# include -# include -# include -#else -# include -# include -# include -#endif +#include +#include +#include +#include #include "SGMath.hxx" -// I don't understand ... or should be included -// already depending on how you defined SG_HAVE_STD_INCLUDES, but I -// can go ahead and add this -- CLO -#ifdef __MWERKS__ -SG_USING_NAMESPACE(std); -#endif - -SG_USING_STD(ostream); -SG_USING_STD(istream); - - const double fgPoint3_Epsilon = 0.0000001; enum {PX, PY, PZ}; // axes // Kludge for msvc++ 6.0 - requires forward decls of friend functions. class Point3D; -istream& operator>> ( istream&, Point3D& ); -ostream& operator<< ( ostream&, const Point3D& ); +std::istream& operator>> ( std::istream&, Point3D& ); +std::ostream& operator<< ( std::ostream&, const Point3D& ); Point3D operator- (const Point3D& p); // -p1 bool operator== (const Point3D& a, const Point3D& b); // p1 == p2? @@ -141,8 +125,8 @@ public: // friends friend Point3D operator - (const Point3D& p); // -p1 friend bool operator == (const Point3D& a, const Point3D& b); // p1 == p2? - friend istream& operator>> ( istream&, Point3D& ); - friend ostream& operator<< ( ostream&, const Point3D& ); + friend std::istream& operator>> ( std::istream&, Point3D& ); + friend std::ostream& operator<< ( std::ostream&, const Point3D& ); // Special functions double distance3D(const Point3D& a) const; // distance between @@ -151,8 +135,8 @@ public: // input from stream -inline istream& -operator >> ( istream& in, Point3D& p) +inline std::istream& +operator >> ( std::istream& in, Point3D& p) { char c; @@ -183,8 +167,8 @@ operator >> ( istream& in, Point3D& p) return in; } -inline ostream& -operator<< ( ostream& out, const Point3D& p ) +inline std::ostream& +operator<< ( std::ostream& out, const Point3D& p ) { return out << p.n[PX] << ", " << p.n[PY] << ", " << p.n[PZ]; } diff --git a/simgear/misc/sgstream.cxx b/simgear/misc/sgstream.cxx index 4a1e0322..484dce73 100644 --- a/simgear/misc/sgstream.cxx +++ b/simgear/misc/sgstream.cxx @@ -33,6 +33,9 @@ #include "sgstream.hxx" +using std::string; +using std::istream; + sg_gzifstream::sg_gzifstream() : istream(&gzbuf) { diff --git a/simgear/misc/sgstream.hxx b/simgear/misc/sgstream.hxx index b56d8cb2..aa680d01 100644 --- a/simgear/misc/sgstream.hxx +++ b/simgear/misc/sgstream.hxx @@ -45,14 +45,10 @@ #include -SG_USING_STD(string); -SG_USING_STD(istream); - - /** * An envelope class for gzifstream. */ -class sg_gzifstream : private gzifstream_base, public istream +class sg_gzifstream : private gzifstream_base, public std::istream { public: /** Default constructor */ @@ -64,7 +60,7 @@ public: * @param name name of file * @param io_mode file open mode(s) "or'd" together */ - sg_gzifstream( const string& name, + sg_gzifstream( const std::string& name, ios_openmode io_mode = ios_in | ios_binary ); /** @@ -79,7 +75,7 @@ public: * @param name name of file * @param io_mode file open mode(s) "or'd" together */ - void open( const string& name, + void open( const std::string& name, ios_openmode io_mode = ios_in|ios_binary ); /** @@ -108,14 +104,14 @@ private: * An istream manipulator that skips to end of line. * @param in input stream */ -istream& skipeol( istream& in ); +std::istream& skipeol( std::istream& in ); /** * \relates sg_gzifstream * An istream manipulator that skips over white space. * @param in input stream */ -istream& skipws( istream& in ); +std::istream& skipws( std::istream& in ); /** * \relates sg_gzifstream @@ -123,7 +119,7 @@ istream& skipws( istream& in ); * Ignores comments that start with '#'. * @param in input stream */ -istream& skipcomment( istream& in ); +std::istream& skipcomment( std::istream& in ); #endif /* _SGSTREAM_HXX */ diff --git a/simgear/misc/zfstream.cxx b/simgear/misc/zfstream.cxx index 97865bc8..1d02b4e0 100644 --- a/simgear/misc/zfstream.cxx +++ b/simgear/misc/zfstream.cxx @@ -38,7 +38,7 @@ // Allocate memory for 'get' buffer and zero all buffer pointers. // gzfilebuf::gzfilebuf() - : streambuf(), + : std::streambuf(), file(NULL), #if defined( __MWERKS__ ) || __GNUC__ > 2 mode(ios_openmode(0)), @@ -174,10 +174,10 @@ gzfilebuf::close() // } -streampos -gzfilebuf::seekoff( streamoff, ios_seekdir, int ) +std::streampos +gzfilebuf::seekoff( std::streamoff, ios_seekdir, int ) { - return streampos(EOF); + return std::streampos(EOF); } gzfilebuf::int_type diff --git a/simgear/misc/zfstream.hxx b/simgear/misc/zfstream.hxx index 8e1c16c7..e4c1ff1f 100644 --- a/simgear/misc/zfstream.hxx +++ b/simgear/misc/zfstream.hxx @@ -36,21 +36,16 @@ # include # include -# define ios_openmode ios_base::openmode -# define ios_in ios_base::in -# define ios_out ios_base::out -# define ios_app ios_base::app -# define ios_binary ios_base::binary +# define ios_openmode std::ios_base::openmode +# define ios_in std::ios_base::in +# define ios_out std::ios_base::out +# define ios_app std::ios_base::app +# define ios_binary std::ios_base::binary -# define ios_seekdir ios_base::seekdir +# define ios_seekdir std::ios_base::seekdir -# define ios_badbit ios_base::badbit -# define ios_failbit ios_base::failbit - -SG_USING_STD(streambuf); -SG_USING_STD(ios_base); -SG_USING_STD(streampos); -SG_USING_STD(streamoff); +# define ios_badbit std::ios_base::badbit +# define ios_failbit std::ios_base::failbit #else @@ -88,7 +83,7 @@ SG_USING_STD(streamoff); #ifdef SG_NEED_STREAMBUF_HACK class gzfilebuf : public __streambuf #else -class gzfilebuf : public streambuf +class gzfilebuf : public std::streambuf #endif { public: @@ -132,7 +127,7 @@ public: bool is_open() const { return (file != NULL); } /** @return stream position */ - virtual streampos seekoff( streamoff off, ios_seekdir way, int which ); + virtual std::streampos seekoff( std::streamoff off, ios_seekdir way, int which ); /** sync the stream */ virtual int sync(); @@ -143,7 +138,7 @@ protected: #ifndef SG_HAVE_STD_INCLUDES virtual int_type overflow( int_type c = traits_type::eof() ); #else - virtual int_type overflow( int_type c = streambuf::traits_type::eof() ); + virtual int_type overflow( int_type c = std::streambuf::traits_type::eof() ); #endif private: diff --git a/simgear/props/props.cxx b/simgear/props/props.cxx index aa37f1db..2d19c1eb 100644 --- a/simgear/props/props.cxx +++ b/simgear/props/props.cxx @@ -9,38 +9,35 @@ #include "props.hxx" #include + #include #include #include #if PROPS_STANDALONE - #include -using std::cerr; -using std::endl; -using std::find; -using std::sort; -using std::vector; -using std::stringstream; - #else #include #include -SG_USING_STD(sort); -SG_USING_STD(find); -SG_USING_STD(vector); -SG_USING_STD(stringstream); - #if ( _MSC_VER == 1200 ) // MSVC 6 is buggy, and needs something strange here SG_USING_STD(vector); SG_USING_STD(vector); SG_USING_STD(vector); #endif +#endif +#if PROPS_STANDALONE +using std::cerr; #endif +using std::endl; +using std::find; +using std::sort; +using std::string; +using std::vector; +using std::stringstream; diff --git a/simgear/props/props.hxx b/simgear/props/props.hxx index ce58e00c..f9b469fe 100644 --- a/simgear/props/props.hxx +++ b/simgear/props/props.hxx @@ -17,30 +17,16 @@ #endif #include - -#if PROPS_STANDALONE - #include -#include - -using std::string; -using std::vector; -using std::istream; -using std::ostream; +#if PROPS_STANDALONE #else - #include #include -#include STL_STRING -#include STL_IOSTREAM -SG_USING_STD(string); -SG_USING_STD(vector); -SG_USING_STD(istream); -SG_USING_STD(ostream); - #endif + + #include #include @@ -479,7 +465,7 @@ protected: virtual void unregister_property (SGPropertyNode * node); private: - vector _properties; + std::vector _properties; }; @@ -666,12 +652,12 @@ public: /** * Get a vector of all children with the specified name. */ - vector getChildren (const char * name) const; + std::vector getChildren (const char * name) const; /** * Get a vector of all children with the specified name. */ - vector getChildren (const std::string& name) const + std::vector getChildren (const std::string& name) const { return getChildren(name.c_str()); } /** @@ -696,14 +682,14 @@ public: /** * Remove all children with the specified name. */ - vector removeChildren (const char * name, + std::vector removeChildren (const char * name, bool keep = true); /** * Remove all children with the specified name. */ - vector removeChildren (const std::string& name, + std::vector removeChildren (const std::string& name, bool keep = true) { return removeChildren(name.c_str(), keep); } @@ -1422,16 +1408,16 @@ private: class hash_table; int _index; - string _name; - mutable string _display_name; + std::string _name; + mutable std::string _display_name; /// To avoid cyclic reference counting loops this shall not be a reference /// counted pointer SGPropertyNode * _parent; - vector _children; - vector _removedChildren; - vector _linkedNodes; - mutable string _path; - mutable string _buffer; + std::vector _children; + std::vector _removedChildren; + std::vector _linkedNodes; + mutable std::string _path; + mutable std::string _buffer; hash_table * _path_cache; Type _type; bool _tied; @@ -1457,7 +1443,7 @@ private: char * string_val; } _local_val; - vector * _listeners; + std::vector * _listeners; /** @@ -1486,7 +1472,7 @@ private: SGPropertyNode * get_value () { return _value; } void set_value (SGPropertyNode * value); private: - string _key; + std::string _key; SGSharedPtr _value; }; diff --git a/simgear/props/props_io.cxx b/simgear/props/props_io.cxx index 187f5660..d6612237 100644 --- a/simgear/props/props_io.cxx +++ b/simgear/props/props_io.cxx @@ -38,6 +38,8 @@ SG_USING_STD(string); SG_USING_STD(vector); SG_USING_STD(map); +using std::endl; + #define DEFAULT_MODE (SGPropertyNode::READ|SGPropertyNode::WRITE) diff --git a/simgear/props/props_io.hxx b/simgear/props/props_io.hxx index abcefe49..34fe33a3 100644 --- a/simgear/props/props_io.hxx +++ b/simgear/props/props_io.hxx @@ -20,25 +20,20 @@ #include STL_STRING #include #include -#include STL_IOSTREAM - -SG_USING_STD(string); -SG_USING_STD(vector); -SG_USING_STD(map); -SG_USING_STD(istream); -SG_USING_STD(ostream); +#include +#include /** * Read properties from an XML input stream. */ -void readProperties (istream &input, SGPropertyNode * start_node, - const string &base = "", int default_mode = 0); +void readProperties (std::istream &input, SGPropertyNode * start_node, + const std::string &base = "", int default_mode = 0); /** * Read properties from an XML file. */ -void readProperties (const string &file, SGPropertyNode * start_node, +void readProperties (const std::string &file, SGPropertyNode * start_node, int default_mode = 0); @@ -52,7 +47,7 @@ void readProperties (const char *buf, const int size, /** * Write properties to an XML output stream. */ -void writeProperties (ostream &output, const SGPropertyNode * start_node, +void writeProperties (std::ostream &output, const SGPropertyNode * start_node, bool write_all = false, SGPropertyNode::Attribute archive_flag = SGPropertyNode::ARCHIVE); @@ -60,7 +55,8 @@ void writeProperties (ostream &output, const SGPropertyNode * start_node, /** * Write properties to an XML file. */ -void writeProperties (const string &file, const SGPropertyNode * start_node, +void writeProperties (const std::string &file, + const SGPropertyNode * start_node, bool write_all = false, SGPropertyNode::Attribute archive_flag = SGPropertyNode::ARCHIVE); diff --git a/simgear/props/props_test.cxx b/simgear/props/props_test.cxx index ab29deee..c525e0b8 100644 --- a/simgear/props/props_test.cxx +++ b/simgear/props/props_test.cxx @@ -311,7 +311,7 @@ test_property_nodes () cout << endl; cout << "Looking for all /hack[0]/bar children" << endl; - vector bar = child->getChildren("bar"); + std::vector bar = child->getChildren("bar"); cout << "There are " << bar.size() << " matches" << endl; for (int i = 0; i < (int)bar.size(); i++) cout << bar[i]->getName() << '[' << bar[i]->getIndex() << ']' << endl; @@ -337,7 +337,7 @@ int main (int ac, char ** av) readProperties(av[i], &root); writeProperties(cout, &root, true); cout << endl; - } catch (string &message) { + } catch (std::string &message) { cout << "Aborted with " << message << endl; } } diff --git a/simgear/scene/material/matmodel.hxx b/simgear/scene/material/matmodel.hxx index 12ff23dd..363efec2 100644 --- a/simgear/scene/material/matmodel.hxx +++ b/simgear/scene/material/matmodel.hxx @@ -31,6 +31,7 @@ #include #include STL_STRING // Standard C++ string library +#include #include #include @@ -42,8 +43,6 @@ #include #include -SG_USING_STD(string); - class SGMatModelGroup; @@ -142,8 +141,8 @@ private: */ void load_models( SGPropertyNode *prop_root ); - vector _paths; - mutable vector > _models; + std::vector _paths; + mutable std::vector > _models; mutable bool _models_loaded; double _coverage_m2; double _range_m; @@ -199,7 +198,7 @@ protected: private: double _range_m; - vector > _objects; + std::vector > _objects; }; #endif // _SG_MAT_MODEL_HXX diff --git a/simgear/scene/model/shadanim.cxx b/simgear/scene/model/shadanim.cxx index f9b747e1..1eae56de 100644 --- a/simgear/scene/model/shadanim.cxx +++ b/simgear/scene/model/shadanim.cxx @@ -208,7 +208,7 @@ public: } }; -typedef map, osg::ref_ptr > +typedef std::map, osg::ref_ptr > StateSetMap; } diff --git a/simgear/scene/tgdb/TileEntry.cxx b/simgear/scene/tgdb/TileEntry.cxx index ea0c73e4..2eb63a11 100644 --- a/simgear/scene/tgdb/TileEntry.cxx +++ b/simgear/scene/tgdb/TileEntry.cxx @@ -27,6 +27,7 @@ #include STL_STRING #include +#include #include #include @@ -252,7 +253,8 @@ typedef enum { // storage class for deferred object processing in TileEntry::load() struct Object { - Object(object_type t, const string& token, const SGPath& p, istream& in) + Object(object_type t, const string& token, const SGPath& p, + std::istream& in) : type(t), path(p) { in >> name; diff --git a/simgear/sound/xmlsound.cxx b/simgear/sound/xmlsound.cxx index 7a39d234..18850f84 100644 --- a/simgear/sound/xmlsound.cxx +++ b/simgear/sound/xmlsound.cxx @@ -128,7 +128,7 @@ SGXmlSound::init(SGPropertyNode *root, SGPropertyNode *node, SGSoundMgr *sndmgr, // unsigned int i; float v = 0.0; - vector kids = node->getChildren("volume"); + std::vector kids = node->getChildren("volume"); for (i = 0; (i < kids.size()) && (i < SGXmlSound::MAXPROP); i++) { _snd_prop volume = {NULL, NULL, NULL, 1.0, 0.0, 0.0, 0.0, false}; diff --git a/simgear/sound/xmlsound.hxx b/simgear/sound/xmlsound.hxx index de1be7b6..22dc5c2e 100644 --- a/simgear/sound/xmlsound.hxx +++ b/simgear/sound/xmlsound.hxx @@ -33,6 +33,8 @@ # error This library requires C++ #endif +#include + #include #include @@ -149,8 +151,8 @@ private: double _stopping; // time after the sound should have stopped. // This is usefull for lost packets in in-trasit mode. - vector<_snd_prop> _volume; - vector<_snd_prop> _pitch; + std::vector<_snd_prop> _volume; + std::vector<_snd_prop> _pitch; }; diff --git a/simgear/structure/SGSmplhist.hxx b/simgear/structure/SGSmplhist.hxx index d56d6693..7d9f05d3 100644 --- a/simgear/structure/SGSmplhist.hxx +++ b/simgear/structure/SGSmplhist.hxx @@ -25,12 +25,10 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #endif #define SampleHistogram_h 1 -#include +#include #include #include "SGSmplstat.hxx" -using namespace std; - extern const int SampleHistogramMinimum; extern const int SampleHistogramMaximum; @@ -56,7 +54,7 @@ public: double bucketThreshold (int i); int inBucket (int i); - void printBuckets (ostream &); + void printBuckets (std::ostream &); }; -- 2.39.5