adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Adonthell-devel] [PATCH] Fixed swig warnings


From: Chris Frey
Subject: [Adonthell-devel] [PATCH] Fixed swig warnings
Date: Sat, 4 Oct 2008 18:04:59 -0400
User-agent: Mutt/1.4.1i

There are three warnings fixed in this patch.  First, it seemed that swig
was confused by the "using std::map" statements in surface_cacher.h.
It appeared that this using statement was not strictly needed, so I removed
it in favour of explicit std:: declarations in the class.

Second was the bare extern pointer in surface_cacher.h: surfaces.
I could not see any use of this pointer in the python code, based on
grep searches, so I disabled SWIG for that pointer.

Lastly, in vector3.h, there were many redundant uses of vector3<T> which
are not needed with modern compilers.  I renamed vector3<T> to simply
vector3, which fixed SWIG template warnings about some odd specialization.
---
 src/gfx/surface_cacher.h |    9 ++++-----
 src/world/vector3.h      |   18 +++++++++---------
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/src/gfx/surface_cacher.h b/src/gfx/surface_cacher.h
index c876934..bb7cab3 100644
--- a/src/gfx/surface_cacher.h
+++ b/src/gfx/surface_cacher.h
@@ -37,9 +37,6 @@
 #include <string>
 #include <map>
 
-using std::map;
-using std::string;
-
 #define DEFAULT_CACHE_SIZE 10000000
 
 namespace gfx
@@ -196,9 +193,9 @@ namespace gfx
         
     private:
         /// list of surfaces by name
-        map<string, surface_ref> Cache;
+        std::map<string, surface_ref> Cache;
         /// mapping of surface to name
-               map<const surface*, string> SurfToString;
+               std::map<const surface*, string> SurfToString;
         /// memory used by cache
                u_int32 MemUsed;
         /// memory allowed to use
@@ -215,7 +212,9 @@ namespace gfx
        /**
         * A singleton surface_cacher
         */
+#ifndef SWIG
        extern surface_cacher* surfaces;
+#endif
 }
 
 #endif
diff --git a/src/world/vector3.h b/src/world/vector3.h
index 82e00f4..946c826 100644
--- a/src/world/vector3.h
+++ b/src/world/vector3.h
@@ -46,7 +46,7 @@ public:
     /**
      * Create a 3D vector located at the origin
      */
-    vector3<T> () : X (0), Y (0), Z (0)
+    vector3 () : X (0), Y (0), Z (0)
     {
     }
 
@@ -56,7 +56,7 @@ public:
         * @param y y coordinate
         * @param z z coordinate
         */
-       vector3<T> (const T & x, const T & y, const T & z) : X (x), Y (y), Z (z)
+       vector3 (const T & x, const T & y, const T & z) : X (x), Y (y), Z (z)
        {
        }
 
@@ -64,7 +64,7 @@ public:
      * Create a new 3D vector as copy of existing vector
      * @param v the vector to copy
      */
-    vector3<T> (const vector3<T> & v) : X (v.X), Y (v.Y), Z (v.Z)
+    vector3 (const vector3 & v) : X (v.X), Y (v.Y), Z (v.Z)
     {
     }
     
@@ -73,7 +73,7 @@ public:
      * @param v the vector to copy
      */
     template<class P>
-    vector3<T> (const vector3<P> & v) : X (v.x()), Y (v.y()), Z (v.z())
+    vector3 (const vector3<P> & v) : X (v.x()), Y (v.y()), Z (v.z())
     {
     }
     
@@ -150,7 +150,7 @@ public:
         * @param v vector to compare with this.
         * @return true if all members are equal, false otherwise.
         */
-       bool operator == (const vector3<T> & v) const
+       bool operator == (const vector3 & v) const
        {
                return (X == v.X && Y == v.Y && Z == v.Z);
        }
@@ -160,7 +160,7 @@ public:
         * @param v vector to compare with this.
         * @return true if at least one members differs, false otherwise.
         */
-       bool operator != (const vector3<T> & v) const
+       bool operator != (const vector3 & v) const
        {
                return (X != v.X || Y != v.Y || Z != v.Z);
        }
@@ -175,7 +175,7 @@ public:
         * @return new vector
         */
     template<class PT>
-       vector3<T> operator - (const vector3<PT> & v) const
+       vector3 operator - (const vector3<PT> & v) const
        {
                return vector3 (X - v.x(), Y - v.y(), Z - v.z());
        }
@@ -184,7 +184,7 @@ public:
         * Return a vector that is the sum of the two given vectors.
         * @return new vector.
         */
-       vector3<T> operator + (const vector3<T> & v) const
+       vector3 operator + (const vector3 & v) const
        {
                return vector3 (X + v.X, Y + v.Y, Z + v.Z);
        }
@@ -193,7 +193,7 @@ public:
         * Calculate the cross product of two given vectors.
         * @return vector representing the cross product of two vectors.
         */
-       vector3<T> operator * (const vector3<T> & v) const
+       vector3 operator * (const vector3 & v) const
        {
                return vector3 (Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - 
Y * v.X);
        }
-- 
1.6.0.2





reply via email to

[Prev in Thread] Current Thread [Next in Thread]