diff --git a/simgear/debug/logtest.cxx b/simgear/debug/logtest.cxx index afa5ddcc..07a6501a 100644 --- a/simgear/debug/logtest.cxx +++ b/simgear/debug/logtest.cxx @@ -1,5 +1,5 @@ #include -#include "Debug/logstream.hxx" +#include class Test { diff --git a/simgear/io/tcp_server.cxx b/simgear/io/tcp_server.cxx index 01c949da..672e6d96 100644 --- a/simgear/io/tcp_server.cxx +++ b/simgear/io/tcp_server.cxx @@ -12,6 +12,7 @@ class TcpServer { public: TcpServer(); + ~TcpServer(); bool open(); bool process(); bool close(); @@ -25,6 +26,11 @@ TcpServer::TcpServer() channel = new SGSocket( "", "5500", "tcp" ); } +TcpServer::~TcpServer() +{ + delete channel; +} + bool TcpServer::open() { diff --git a/simgear/math/interpolater.hxx b/simgear/math/interpolater.hxx index 0df566a9..393e39ff 100644 --- a/simgear/math/interpolater.hxx +++ b/simgear/math/interpolater.hxx @@ -35,7 +35,7 @@ #include -#include "simgear/structure/SGReferenced.hxx" +#include #include diff --git a/simgear/misc/tabbed_values.cxx b/simgear/misc/tabbed_values.cxx index dc4d34bc..07ed2063 100644 --- a/simgear/misc/tabbed_values.cxx +++ b/simgear/misc/tabbed_values.cxx @@ -21,10 +21,10 @@ // $Id$ #include +#include #include "tabbed_values.hxx" -#include "assert.h" SGTabbedValues::SGTabbedValues(const char *line) : _line(line) diff --git a/simgear/scene/model/SGPagedLOD.cxx b/simgear/scene/model/SGPagedLOD.cxx index fee5dee4..b45af204 100644 --- a/simgear/scene/model/SGPagedLOD.cxx +++ b/simgear/scene/model/SGPagedLOD.cxx @@ -75,9 +75,7 @@ void SGPagedLOD::forceLoad(osgDB::DatabasePager *dbp) setTimeStamp(childNum, 0); double priority=1.0; dbp->requestNodeFile(getFileName(childNum),this,priority,0, -#if SG_OSG_VERSION >= 25001 getDatabaseRequest(childNum), -#endif _readerWriterOptions.get()); } diff --git a/simgear/scene/model/SGPagedLOD.hxx b/simgear/scene/model/SGPagedLOD.hxx index 40e59ae7..7bf54266 100644 --- a/simgear/scene/model/SGPagedLOD.hxx +++ b/simgear/scene/model/SGPagedLOD.hxx @@ -17,7 +17,11 @@ #ifndef SGPAGEDLOD_HXX #define SGPAGEDLOD_HXX 1 +#include #include +#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5) +#include +#endif #include #include @@ -44,19 +48,21 @@ public: // reimplemented to notify the loading through ModelData bool addChild(osg::Node *child); - void setReaderWriterOptions(osgDB::ReaderWriter::Options *o) { - _readerWriterOptions=o; - _readerWriterOptions->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE); + void setReaderWriterOptions(osgDB::ReaderWriter::Options *options) { + _readerWriterOptions = options; + options->setObjectCacheHint(osgDB::ReaderWriter::Options::CACHE_NONE); +#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5) + setDatabaseOptions(options); +#endif } - osgDB::ReaderWriter::Options * getReaderWriterOptions() { + osgDB::ReaderWriter::Options* getReaderWriterOptions() { return _readerWriterOptions.get(); } protected: virtual ~SGPagedLOD(); osg::ref_ptr _readerWriterOptions; - SGPropertyNode_ptr _props; }; } #endif diff --git a/simgear/scene/sky/cloud.cxx b/simgear/scene/sky/cloud.cxx index da61f7fc..0addf208 100644 --- a/simgear/scene/sky/cloud.cxx +++ b/simgear/scene/sky/cloud.cxx @@ -30,6 +30,7 @@ #include +#include #include #include #include @@ -43,6 +44,9 @@ #include #include #include +#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5) +#include +#endif #include #include diff --git a/simgear/scene/sky/moon.cxx b/simgear/scene/sky/moon.cxx index 73cc8e8b..a5366c71 100644 --- a/simgear/scene/sky/moon.cxx +++ b/simgear/scene/sky/moon.cxx @@ -32,6 +32,7 @@ #include #include +#include #include #include #include @@ -42,6 +43,9 @@ #include #include #include +#if SG_OSG_MIN_VERSION_REQUIRED(2,9,5) +#include +#endif #include #include diff --git a/simgear/screen/screen-dump.cxx b/simgear/screen/screen-dump.cxx index b74f06c0..dc5ba7bd 100644 --- a/simgear/screen/screen-dump.cxx +++ b/simgear/screen/screen-dump.cxx @@ -55,6 +55,7 @@ bool sg_glWritePPMFile(const char *filename, GLubyte *buffer, int win_width, int ibuffer = (unsigned char *) malloc(win_width*win_height*RGB3); if ( (fp = fopen(filename, "wb")) == NULL ) { + free(ibuffer); printf("Warning: cannot open %s\n", filename); return false; } diff --git a/simgear/structure/OSGVersion.hxx b/simgear/structure/OSGVersion.hxx index e8dd8e26..46d0187e 100644 --- a/simgear/structure/OSGVersion.hxx +++ b/simgear/structure/OSGVersion.hxx @@ -23,4 +23,28 @@ #define SG_OSG_VERSION \ ((OPENSCENEGRAPH_MAJOR_VERSION*10000)\ + (OPENSCENEGRAPH_MINOR_VERSION*1000) + OPENSCENEGRAPH_PATCH_VERSION) + +#define SG_OSG_VERSION_GREATER_EQUAL(MAJOR, MINOR, PATCH) \ + ((OPENSCENEGRAPH_MAJOR_VERSION > (MAJOR)) || \ + (OPENSCENEGRAPH_MAJOR_VERSION == (MAJOR) && \ + (OPENSCENEGRAPH_MINOR_VERSION > (MINOR) || \ + (OPENSCENEGRAPH_MINOR_VERSION == (MINOR) && \ + OPENSCENEGRAPH_PATCH_VERSION >= (PATCH))))) + +#define SG_OSG_VERSION_GREATER_THAN(MAJOR, MINOR, PATCH) \ + ((OPENSCENEGRAPH_MAJOR_VERSION > (MAJOR)) || \ + (OPENSCENEGRAPH_MAJOR_VERSION == (MAJOR) && \ + (OPENSCENEGRAPH_MINOR_VERSION > (MINOR) || \ + (OPENSCENEGRAPH_MINOR_VERSION == (MINOR) && \ + OPENSCENEGRAPH_PATCH_VERSION > (PATCH))))) + +#define SG_OSG_VERSION_LESS_THAN(MAJOR, MINOR, PATCH) \ + (!SG_OSG_VERSION_GREATER_EQUAL(MAJOR, MINOR, PATCH)) + +#define SG_OSG_VERSION_LESS_EQUAL(MAJOR, MINOR, PATCH) \ + (!SG_OSG_VERSION_GREATER_THAN(MAJOR, MINOR, PATCH)) + +#define SG_OSG_MIN_VERSION_REQUIRED(MAJOR, MINOR, PATCH) \ + SG_OSG_VERSION_GREATER_EQUAL(MAJOR, MINOR, PATCH) + #endif diff --git a/simgear/threads/SGThread.cxx b/simgear/threads/SGThread.cxx index d786c24a..c7a841b0 100644 --- a/simgear/threads/SGThread.cxx +++ b/simgear/threads/SGThread.cxx @@ -11,7 +11,7 @@ # include #endif #if _MSC_VER >= 1300 -# include "winsock2.h" +# include #endif #include "SGThread.hxx" diff --git a/simgear/timing/sg_time.cxx b/simgear/timing/sg_time.cxx index 66f4b16e..45fd41c1 100644 --- a/simgear/timing/sg_time.cxx +++ b/simgear/timing/sg_time.cxx @@ -122,11 +122,7 @@ SGTime::SGTime() { SGTime::~SGTime() { - if ( tzContainer != NULL ) { - SGTimeZoneContainer *tmp = tzContainer; - tzContainer = NULL; - delete tmp; - } + delete tzContainer; } diff --git a/simgear/xml/xmldef.h b/simgear/xml/xmldef.h index 49ce9ed6..81de339b 100644 --- a/simgear/xml/xmldef.h +++ b/simgear/xml/xmldef.h @@ -53,7 +53,7 @@ particular environments. */ #ifdef MOZILLA -#include "nspr.h" +#include #define malloc(x) PR_Malloc(x) #define realloc(x, y) PR_Realloc((x), (y)) #define calloc(x, y) PR_Calloc((x),(y))