]> de.git.xonotic.org Git - xonotic/netradiant.git/commitdiff
clang: fix build. Still doesn't work right TimePath/clang
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 6 May 2018 08:00:42 +0000 (18:00 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 6 May 2018 08:00:42 +0000 (18:00 +1000)
35 files changed:
contrib/bobtoolz/visfind.cpp
contrib/ufoaiplug/ufoai_filters.cpp
libs/container/hashfunc.h
libs/generic/callback.cpp
libs/generic/callback.h
libs/l_net/l_net_berkley.c
libs/mathlib/bbox.c
libs/mathlib/m4x4.c
libs/picomodel/pm_fm.c
libs/picomodel/pm_md2.c
libs/picomodel/pm_ms3d.c
libs/property.h
libs/selectionlib.h
libs/uilib/uilib.cpp
libs/uilib/uilib.h
libs/xml/xmltextags.h
plugins/mapxml/xmlparse.cpp
plugins/md3model/model.h
plugins/model/model.cpp
plugins/vfspk3/vfs.cpp
radiant/brush.h
radiant/dialog.cpp
radiant/eclass_xml.cpp
radiant/referencecache.cpp
radiant/scenegraph.h
radiant/watchbsp.cpp
tools/quake3/q3data/md3lib.c
tools/quake3/q3map2/convert_map.c
tools/quake3/q3map2/exportents.c
tools/quake3/q3map2/light_bounce.c
tools/quake3/q3map2/light_ydnar.c
tools/quake3/q3map2/portals.c
tools/quake3/q3map2/q3map2.h
tools/quake3/q3map2/shaders.c
tools/quake3/q3map2/surface_meta.c

index 2e49da3e33bc8a0c082c26988a3be820ab4c9a60..6c2eb2af1b3193fd0c0523bed9fbf94fe978e077 100644 (file)
@@ -214,7 +214,7 @@ std::list<DWinding *> *CreateTrace(dleaf_t *leaf, int c, vis_header *header, byt
         }
     }
 
-    delete repeatlist;
+    delete[] repeatlist;
 
     return pointlist;
 }
index de30083a0ce82c9c6bf9cdb5056e28c2c4aec3e6..d9af4fb7b4dc778c97b9aa632766595f191e98b4 100644 (file)
@@ -90,13 +90,11 @@ public:
 };
 
 class ForEachFace : public BrushVisitor {
-    Brush &m_brush;
 public:
     mutable int m_contentFlagsVis;
     mutable int m_surfaceFlagsVis;
 
-    ForEachFace(Brush &brush)
-            : m_brush(brush)
+    ForEachFace()
     {
         m_contentFlagsVis = -1;
         m_surfaceFlagsVis = -1;
@@ -140,7 +138,7 @@ public:
     {
         Brush *brush = Node_getBrush(path.top());
         if (brush != 0) {
-            ForEachFace faces(*brush);
+            ForEachFace faces{};
             brush->forEachFace(faces);
             // contentflags?
             if (m_content) {
index 305202d0c9f00435bdcdab0c0798363abf5a8ef2..ef81fadc1c50667c70937d17a67e69de8a450656 100644 (file)
@@ -182,7 +182,7 @@ inline ub4 hash(
        const UB1Traits& ub1traits,
        const UB4x1Traits& ub4x1traits
        ){
-       register ub4 a,b,c,len;
+       ub4 a,b,c,len;
 
        /* Set up the internal state */
        len = length;
@@ -203,17 +203,17 @@ inline ub4 hash(
        c += length;
        switch ( len )          /* all the case statements fall through */
        {
-       case 11: c += ( ( ub4 ) UB1Traits::as_ub1( k[10] ) << 24 ); __attribute((fallthrough));
-       case 10: c += ( ( ub4 ) UB1Traits::as_ub1( k[9] ) << 16 ); __attribute((fallthrough));
-       case 9: c += ( ( ub4 ) UB1Traits::as_ub1( k[8] ) << 8 ); __attribute((fallthrough));
+       case 11: c += ( ( ub4 ) UB1Traits::as_ub1( k[10] ) << 24 ); [[clang::fallthrough]];
+       case 10: c += ( ( ub4 ) UB1Traits::as_ub1( k[9] ) << 16 ); [[clang::fallthrough]];
+       case 9: c += ( ( ub4 ) UB1Traits::as_ub1( k[8] ) << 8 ); [[clang::fallthrough]];
        /* the first byte of c is reserved for the length */
-       case 8: b += ( ( ub4 ) UB1Traits::as_ub1( k[7] ) << 24 ); __attribute((fallthrough));
-       case 7: b += ( ( ub4 ) UB1Traits::as_ub1( k[6] ) << 16 ); __attribute((fallthrough));
-       case 6: b += ( ( ub4 ) UB1Traits::as_ub1( k[5] ) << 8 ); __attribute((fallthrough));
-       case 5: b += UB1Traits::as_ub1( k[4] );  __attribute((fallthrough));
-       case 4: a += ( ( ub4 ) UB1Traits::as_ub1( k[3] ) << 24 ); __attribute((fallthrough));
-       case 3: a += ( ( ub4 ) UB1Traits::as_ub1( k[2] ) << 16 ); __attribute((fallthrough));
-       case 2: a += ( ( ub4 ) UB1Traits::as_ub1( k[1] ) << 8 ); __attribute((fallthrough));
+       case 8: b += ( ( ub4 ) UB1Traits::as_ub1( k[7] ) << 24 ); [[clang::fallthrough]];
+       case 7: b += ( ( ub4 ) UB1Traits::as_ub1( k[6] ) << 16 ); [[clang::fallthrough]];
+       case 6: b += ( ( ub4 ) UB1Traits::as_ub1( k[5] ) << 8 ); [[clang::fallthrough]];
+       case 5: b += UB1Traits::as_ub1( k[4] );  [[clang::fallthrough]];
+       case 4: a += ( ( ub4 ) UB1Traits::as_ub1( k[3] ) << 24 ); [[clang::fallthrough]];
+       case 3: a += ( ( ub4 ) UB1Traits::as_ub1( k[2] ) << 16 ); [[clang::fallthrough]];
+       case 2: a += ( ( ub4 ) UB1Traits::as_ub1( k[1] ) << 8 ); [[clang::fallthrough]];
        case 1: a += UB1Traits::as_ub1( k[0] );
                /* case 0: nothing left to add */
        }
@@ -240,7 +240,7 @@ inline ub4 hash2(
        ub4 initval, /* the previous hash, or an arbitrary value */
        const UB4Traits& ub4traits
        ){
-       register ub4 a,b,c,len;
+       ub4 a,b,c,len;
 
        /* Set up the internal state */
        len = length;
index 7022e8cf65900a89e11917cbefd46561e27a08bf..22683b67def774aba3a92c22d28ecd70f7067772 100644 (file)
@@ -207,7 +207,7 @@ void instantiate(){
        Test test;
        const Test& testconst = test;
        {
-               Callback<void()> a = makeCallbackF(&test0free);
+               Callback<void()> a = makeCallbackF(test0free);
                Callback<void()> b = Test::Test0Caller( test );
                b = makeCallback( Test::Test0(), test );
                Callback<void()> c = Test::Test0ConstCaller( testconst );
@@ -221,7 +221,7 @@ void instantiate(){
        }
        {
                typedef Callback<void(A1)> TestCallback1;
-               TestCallback1 a = makeCallbackF(&test1free);
+               TestCallback1 a = makeCallbackF(test1free);
                TestCallback1 b = Test::Test1Caller( test );
                b = makeCallback( Test::Test1(), test );
                TestCallback1 c = Test::Test1ConstCaller( testconst );
index 577dd9d958bd337082f9c2479c5c1803e664c1a3..c1eb39af4ce536088401a6af8d23dbac89a8a0bf 100644 (file)
@@ -70,54 +70,36 @@ namespace detail {
 namespace detail {
 
        template<class Type>
-       struct ConvertFromOpaque {
+       struct ConvertToOpaque {
        };
 
-       // reference
+       template<class Type>
+       struct ConvertFromOpaque {
+       };
 
-       template<class T>
-       inline const void *convertToOpaque(const T &t) {
-               return &t;
-       }
+       // pointer
 
        template<class T>
-       struct ConvertFromOpaque<const T &> {
-               static T const &apply(void *p) {
-                       return *static_cast<const T *>(p);
+       struct ConvertToOpaque<T const *> {
+               static void const *apply(const T *t) {
+                       return t;
                }
        };
 
        template<class T>
-       inline void *convertToOpaque(T &t) {
-               return &t;
-       }
-
-       template<class T>
-       struct ConvertFromOpaque<T &> {
-               static T &apply(void *p) {
-                       return *static_cast<T *>( p );
+       struct ConvertFromOpaque<T const *> {
+               static T const *apply(void const *p) {
+                       return static_cast<T const *>(p);
                }
        };
 
-       // pointer
-
        template<class T>
-       inline const void *convertToOpaque(const T *t) {
-               return t;
-       }
-
-       template<class T>
-       struct ConvertFromOpaque<const T *> {
-               static const T *apply(void *p) {
-                       return static_cast<const T *>(p);
+       struct ConvertToOpaque<T *> {
+               static void *apply(T *t) {
+                       return t;
                }
        };
 
-       template<class T>
-       inline void *convertToOpaque(T *t) {
-               return t;
-       }
-
        template<class T>
        struct ConvertFromOpaque<T *> {
                static T *apply(void *p) {
@@ -125,35 +107,35 @@ namespace detail {
                }
        };
 
-       // function pointer
-
-       template<class R, class... Ts>
-       inline const void *convertToOpaque(R(*const &t)(Ts...)) {
-               return &t;
-       }
-
-       template<class R, class... Ts>
-       struct ConvertFromOpaque<R(*const &)(Ts...)> {
-               using Type = R(*)(Ts...);
+       // reference
 
-               static Type const &apply(void *p) {
-                       return *static_cast<Type *>(p);
+       template<class T>
+       struct ConvertToOpaque<T const &> {
+               static void const *apply(T const &t) {
+                       return &t;
                }
        };
 
-    template<class R, class... Ts>
-    inline void *convertToOpaque(R(*&t)(Ts...)) {
-        return &t;
-    }
+       template<class T>
+       struct ConvertFromOpaque<T const &> {
+               static T const &apply(void const *p) {
+                       return *static_cast<T const *>(p);
+               }
+       };
 
-    template<class R, class... Ts>
-    struct ConvertFromOpaque<R(*&)(Ts...)> {
-        using Type = R(*)(Ts...);
+       template<class T>
+       struct ConvertToOpaque<T &> {
+               static void *apply(T &t) {
+                       return &t;
+               }
+       };
 
-        static Type &apply(void *p) {
-            return *static_cast<Type *>(p);
-        }
-    };
+       template<class T>
+       struct ConvertFromOpaque<T &> {
+               static T &apply(void *p) {
+                       return *static_cast<T *>( p );
+               }
+       };
 
        template<class Caller, class F>
        class BindFirstOpaqueN;
@@ -182,7 +164,7 @@ namespace detail {
                }
 
                void *getEnvironment() const {
-                       return const_cast<void *>(detail::convertToOpaque(firstBound));
+                       return const_cast<void *>(detail::ConvertToOpaque<FirstBound>::apply(firstBound));
                }
        };
 
index f53f37e82bcd30c05c2c17ea31abb5f361c0dbc6..782a4435c2be503c9883707c045c2ceea0cf9dff 100644 (file)
@@ -79,7 +79,7 @@ static char my_tcpip_address[NET_NAMELEN];
 
 const int DEFAULTnet_hostport = 26000;
 
-const int MAXHOSTNAMELEN = 256;
+#define MAXHOSTNAMELEN 256
 
 static int net_acceptsocket = -1;       // socket for fielding new connections
 static int net_controlsocket;
index fe5646d9327e683c2285d0e9f2541a6b436b68dc..c8924646faa551c097b85c236a8a5880d3cb21fc 100644 (file)
@@ -166,7 +166,7 @@ int aabb_test_plane( const aabb_t *aabb, const float *plane ){
    from "Graphics Gems", Academic Press, 1990
  */
 
-const int NUMDIM  = 3;
+#define NUMDIM 3
 const int RIGHT   = 0;
 const int LEFT    = 1;
 const int MIDDLE  = 2;
index 45e421f4d60eb5cc8748fc956f0cb4620eb8739b..b6f7368fc8897b8b3716a5df8bfa03794523867a 100644 (file)
@@ -1738,7 +1738,7 @@ void m4x4_solve_ge( m4x4_t matrix, vec4_t x ){
 #endif
 
 int matrix_solve_ge( vec_t* matrix, vec_t* aug, vec3_t x ){
-       const int N = 3;
+       #define N 3
        int indx[N];
        int c,r;
        int i;
index c4086184c317cf15547c4f42637dff9f9d32b85b..4c8cd28c8cbf48471fecf260628aec580c1adfe8 100644 (file)
@@ -444,7 +444,7 @@ static picoModel_t *_fm_load( PM_PARAMS_LOAD ){
 #endif
                                continue;
                        }
-                       else if ( ( p_index_LUT[triangle->index_xyz[j]].next == NULL ) ) { // Not equal to Main entry, and no LL entry
+                       else if ( p_index_LUT[triangle->index_xyz[j]].next == NULL ) { // Not equal to Main entry, and no LL entry
                                // Add first entry of LL from Main
                                p_index_LUT2 = (index_LUT_t *)_pico_alloc( sizeof( index_LUT_t ) );
                                if ( p_index_LUT2 == NULL ) {
index 37b5466c56f712e3c36c39dd6d72aaf4dc10d667..2df1a9e5d3f1d06dbfb8428c69c625b3403ebf04 100644 (file)
@@ -50,7 +50,7 @@ const int MD2_MAX_TRIANGLES       = 4096;
 const int MD2_MAX_VERTS           = 2048;
 const int MD2_MAX_FRAMES          = 512;
 const int MD2_MAX_MD2SKINS        = 32;
-const int MD2_MAX_SKINNAME        = 64;
+#define MD2_MAX_SKINNAME 64
 
 typedef struct index_LUT_s
 {
@@ -491,7 +491,7 @@ static picoModel_t *_md2_load( PM_PARAMS_LOAD ){
                                continue;
                        }
 
-                       else if ( ( p_index_LUT[p_md2Triangle->index_xyz[j]].next == NULL ) ) { // Not equal to Main entry, and no LL entry
+                       else if ( p_index_LUT[p_md2Triangle->index_xyz[j]].next == NULL ) { // Not equal to Main entry, and no LL entry
                                // Add first entry of LL from Main
                                p_index_LUT2 = (index_LUT_t *)_pico_alloc( sizeof( index_LUT_t ) );
                                if ( p_index_LUT2 == NULL ) {
index 378265f30a5504d59206c95b08d6f43fb103bce7..2ed5faf39ef30cbadea576e6ed494ffd65a5bb5a 100644 (file)
@@ -57,7 +57,7 @@ static picoColor_t white = { 255,255,255,255 };
 /* ms3d limits */
 const int MS3D_MAX_VERTS      = 8192;
 const int MS3D_MAX_TRIS       = 16384;
-const int MS3D_MAX_GROUPS     = 128;
+#define MS3D_MAX_GROUPS 128
 const int MS3D_MAX_MATERIALS  = 128;
 const int MS3D_MAX_JOINTS     = 128;
 const int MS3D_MAX_KEYFRAMES  = 216;
index abdb32f4d4a945b84120d449c1c640c67c3ecc6e..35732f5f72b160525c194a658190bcd1305fbdec 100644 (file)
@@ -102,53 +102,55 @@ Property<T> make_property(Self &self) {
 
 // chain
 
+template <class DST, class SRC, class X, class A>
+struct PropertyChainImpl {
+    static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
+        PropertyImpl<SRC, DST>::Export(value, self);
+    }
+
+    static void Export(const X &self, const Callback<void(DST)> &returnz) {
+        A::Get::thunk_(self, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
+    }
+
+    static void Import(X &self, DST value) {
+        SRC out;
+        PropertyImpl<SRC, DST>::Import(out, value);
+        A::Set::thunk_(self, out);
+    }
+};
+
 template<class I_Outer, class I_Inner>
 Property<detail::propertyimpl_other<I_Outer>> make_property_chain(detail::propertyimpl_self<I_Inner> &it) {
     using DST = detail::propertyimpl_other<I_Outer>;
     using SRC = detail::propertyimpl_self<I_Outer>;
     using X = detail::propertyimpl_self<I_Inner>;
-
     using A = property_impl<I_Inner>;
-    struct I {
-        static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
-            PropertyImpl<SRC, DST>::Export(value, self);
-        }
-
-        static void Export(const X &self, const Callback<void(DST)> &returnz) {
-            A::Get::thunk_(self, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
-        }
-
-        static void Import(X &self, DST value) {
-            SRC out;
-            PropertyImpl<SRC, DST>::Import(out, value);
-            A::Set::thunk_(self, out);
-        }
-    };
-    return make_property<PropertyAdaptor<X, DST, I>>(it);
+    return make_property<PropertyAdaptor<X, DST, PropertyChainImpl<DST, SRC, X, A>>>(it);
 }
 
+template <class DST, class SRC, class A>
+struct PropertyChainImpl_free {
+    static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
+        PropertyImpl<SRC, DST>::Export(value, self);
+    }
+
+    static void Export(const Callback<void(DST)> &returnz) {
+        A::Get::thunk_(nullptr, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
+    }
+
+    static void Import(DST value) {
+        SRC out;
+        PropertyImpl<SRC, DST>::Import(out, value);
+        A::Set::thunk_(nullptr, out);
+    }
+};
+
 template<class I_Outer, class I_Inner>
 Property<detail::propertyimpl_other<I_Outer>> make_property_chain() {
     using DST = detail::propertyimpl_other<I_Outer>;
     using SRC = detail::propertyimpl_self<I_Outer>;
-
     using A = property_impl_free<I_Inner>;
-    struct I {
-        static void ExportThunk(const Callback<void(DST)> &self, SRC value) {
-            PropertyImpl<SRC, DST>::Export(value, self);
-        }
-
-        static void Export(const Callback<void(DST)> &returnz) {
-            A::Get::thunk_(nullptr, ConstReferenceCaller<Callback<void(DST)>, void(SRC), ExportThunk>(returnz));
-        }
-
-        static void Import(DST value) {
-            SRC out;
-            PropertyImpl<SRC, DST>::Import(out, value);
-            A::Set::thunk_(nullptr, out);
-        }
-    };
-    return make_property<PropertyAdaptorFree<DST, I>>();
+    return make_property<PropertyAdaptorFree<DST, PropertyChainImpl_free<DST, SRC, A>>>();
 }
 
 // specializations
index 06a905c74a2440c071e4eaf2da00e79010e5e19f..d6b1d8387026ed5ddf50bc9e700b7086f280abcc 100644 (file)
@@ -43,7 +43,7 @@ bool isSelected() const {
 }
 };
 
-class ObservedSelectable : public Selectable
+class ObservedSelectable final : public Selectable
 {
 SelectionChangeCallback m_onchanged;
 bool m_selected;
index 1f4acb1fc7fec334f8501cd33d285bea319d40e3..93e6e604c7d8844eb431ab11c8208a812514f7c2 100644 (file)
@@ -51,7 +51,10 @@ namespace ui {
             >::type
     >;
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wkeyword-macro"
 #define this (verify<self>::test(*static_cast<self>(const_cast<pointer_remove_const<decltype(this)>::type>(this))))
+#pragma clang diagnostic pop
 
     IMPL(Editable, GTK_EDITABLE);
 
index d795b75834659eff96b1e79d1514837f152b3d32..96e0d54a6b3f842fc8a95ce608a17c288e2b1c91 100644 (file)
@@ -599,7 +599,10 @@ namespace ui {
         }
     }
 
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wkeyword-macro"
 #define this (*static_cast<self>(this))
+#pragma clang diagnostic pop
 
     template<class Lambda>
     gulong Object::connect(char const *detailed_signal, Lambda &&c_handler, void *data)
index 7a1bae6db1ff3236ee964f8b3c947ba3cf80f20b..82424299a18f8e943444c5bda49f395bda327f68 100644 (file)
@@ -55,7 +55,6 @@ private:
 CopiedString m_savefilename;
 xmlDocPtr doc;
 xmlXPathContextPtr context;
-xmlNodeSetPtr nodePtr;
 
 xmlXPathObjectPtr XpathEval( const char* queryString ){
        xmlChar* expression = (xmlChar*)queryString;
index b26c57661128757829550f14fbcd1f849f436a7f..bed19bd1d4cc13964b90823f4419dedfac81f240 100644 (file)
@@ -66,7 +66,7 @@ public:
     virtual TreeXMLImporter &child() = 0;
 };
 
-class SubPrimitiveImporter : public TreeXMLImporter {
+class SubPrimitiveImporter final : public TreeXMLImporter {
     XMLImporter *m_importer;
 public:
     SubPrimitiveImporter(XMLImporter *importer) : m_importer(importer)
@@ -94,7 +94,7 @@ public:
     }
 };
 
-class PrimitiveImporter : public TreeXMLImporter {
+class PrimitiveImporter final : public TreeXMLImporter {
     scene::Node &m_parent;
     XMLImporter *m_importer;
     char m_child[sizeof(SubPrimitiveImporter)];
@@ -149,7 +149,7 @@ public:
     }
 };
 
-class EntityImporter : public TreeXMLImporter {
+class EntityImporter final : public TreeXMLImporter {
     scene::Node &m_parent;
     char m_node[sizeof(NodeSmartReference)];
     char m_child[sizeof(PrimitiveImporter)];
index ea4f049237633c18244b4c6676ff0faa03c8131b..5bcd535b0abb340f4426ec6b18a93cf19e08e0ae 100644 (file)
@@ -39,7 +39,7 @@
 #include "traverselib.h"
 #include "render.h"
 
-class VectorLightList : public LightList {
+class VectorLightList final : public LightList {
     typedef std::vector<const RendererLight *> Lights;
     Lights m_lights;
 public:
index 1234c7bdca9d97fafe3571074c538a35590eaee8..c628b95854f85919af4f0c4d1a00869a4cc5b681 100644 (file)
@@ -43,7 +43,7 @@
 #include "traverselib.h"
 #include "render.h"
 
-class VectorLightList : public LightList {
+class VectorLightList final : public LightList {
     typedef std::vector<const RendererLight *> Lights;
     Lights m_lights;
 public:
index 0829073f78b1be186fb2c90e8dd1aa7a162fc099..171b2310707fe142a326ecd75fe612e0283e7a31 100644 (file)
@@ -558,7 +558,7 @@ void InitDirectory(const char *directory, ArchiveModules &archiveModules)
                 }
 
                 const char *ext = strrchr(name, '.');
-                char tmppath[PATH_MAX];
+                char tmppath[PATH_MAX + 1];
 
                 if (is_dpk_vfs) {
                     if (!!ext && !string_compare_nocase_upper(ext, ".dpkdir")) {
index 6114d59af9ec5f3e80e1b532e72e47fc4bfaaf85..9955bfbadf1caaa920da178adc553b1e1a40bf2d 100644 (file)
@@ -2633,7 +2633,7 @@ triangles_same_winding(const BasicVector3<Element> &x1, const BasicVector3<Eleme
 typedef const Plane3 *PlanePointer;
 typedef PlanePointer *PlanesIterator;
 
-class VectorLightList : public LightList {
+class VectorLightList final : public LightList {
     typedef std::vector<const RendererLight *> Lights;
     Lights m_lights;
 public:
index 3b59f6aba4740d2a6e53ba24490e42c1edcdf398..df7daa05ab5919e289a4f24c94d38546bda1e50c 100644 (file)
@@ -284,29 +284,31 @@ public:
     }
 };
 
+template <class Widget, class Self, class T, class native>
+struct AddDataCustomWrapper {
+    static void Export(const native &self, const Callback<void(T)> &returnz)
+    {
+        native *p = &const_cast<native &>(self);
+        auto widget = Self::from(p);
+        Widget::Get::thunk_(widget, returnz);
+    }
+
+    static void Import(native &self, T value)
+    {
+        native *p = &self;
+        auto widget = Self::from(p);
+        Widget::Set::thunk_(widget, value);
+    }
+};
+
 template<class Widget>
 void AddDataCustom(DialogDataList &self, typename Widget::Type widget, Property<typename Widget::Other> const &property)
 {
     using Self = typename Widget::Type;
     using T = typename Widget::Other;
     using native = typename std::remove_pointer<typename Self::native>::type;
-    struct Wrapper {
-        static void Export(const native &self, const Callback<void(T)> &returnz)
-        {
-            native *p = &const_cast<native &>(self);
-            auto widget = Self::from(p);
-            Widget::Get::thunk_(widget, returnz);
-        }
-
-        static void Import(native &self, T value)
-        {
-            native *p = &self;
-            auto widget = Self::from(p);
-            Widget::Set::thunk_(widget, value);
-        }
-    };
-    self.push_back(new CallbackDialogData<typename Widget::Other>(
-            make_property<PropertyAdaptor<native, T, Wrapper>>(*static_cast<native *>(widget)),
+    self.push_back(new CallbackDialogData<T>(
+            make_property<PropertyAdaptor<native, T, AddDataCustomWrapper<Widget, Self, T, native>>>(*static_cast<native *>(widget)),
             property
     ));
 }
index 5d9d317c6da192b8e4b6f5a71524aec8a4ac0c38..e3b053e71f3f57b34f7c5f754994d00f42c2c938 100644 (file)
@@ -198,7 +198,7 @@ namespace {
         }
     };
 
-    class AttributeImporter : public TreeXMLImporter {
+    class AttributeImporter final : public TreeXMLImporter {
         StringOutputStream &m_comment;
 
     public:
@@ -278,7 +278,7 @@ namespace {
     }
 
 
-    class ClassImporter : public TreeXMLImporter {
+    class ClassImporter final : public TreeXMLImporter {
         EntityClassCollector &m_collector;
         EntityClass *m_eclass;
         StringOutputStream m_comment;
@@ -358,7 +358,7 @@ namespace {
         }
     };
 
-    class ItemImporter : public TreeXMLImporter {
+    class ItemImporter final : public TreeXMLImporter {
     public:
         ItemImporter(ListAttributeType &list, const XMLElement &element)
         {
@@ -389,7 +389,7 @@ namespace {
         return string_equal(name, "item");
     }
 
-    class ListAttributeImporter : public TreeXMLImporter {
+    class ListAttributeImporter final : public TreeXMLImporter {
         ListAttributeType *m_listType;
         Storage<ItemImporter> m_item;
     public:
@@ -436,7 +436,7 @@ namespace {
         return string_equal(name, "list");
     }
 
-    class ClassesImporter : public TreeXMLImporter {
+    class ClassesImporter final : public TreeXMLImporter {
         EntityClassCollector &m_collector;
         Storage<ClassImporter> m_class;
         Storage<ListAttributeImporter> m_list;
index 448cd913c7054eef66e4dbf08124b9692ffd4c85..8db271c6a4fa1b98ff5da876ebbf8ae31a26dad4 100644 (file)
@@ -325,7 +325,7 @@ namespace {
     }
 }
 
-struct ModelResource : public Resource {
+struct ModelResource final : public Resource {
     NodeSmartReference m_model;
     const CopiedString m_originalName;
     CopiedString m_path;
index 48fb08b31caac7d6676c2e2c434ff812005bf363..759c34c08db1285d1b67cd4a16784543d88ac1bf 100644 (file)
@@ -19,7 +19,7 @@
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#if !defined( INCLUDEDE_SCENEGRAPH_H )
+#if !defined( INCLUDED_SCENEGRAPH_H )
 #define INCLUDED_SCENEGRAPH_H
 
 #endif
index 2803ce944ab1d434fb44f56756d2b6f1b51a42fb..7ae548795951fd4b851020a29cfeeacf81a9feef 100644 (file)
@@ -104,7 +104,6 @@ private:
     char *m_sBSPName;
     // buffer we use in push mode to receive data directly from the network
     xmlParserInputBufferPtr m_xmlInputBuffer;
-    xmlParserInputPtr m_xmlInput;
     xmlParserCtxtPtr m_xmlParserCtxt;
 
     // call this to switch the set listening mode
index 93b1dfe0028787d2a015149839f62ca7788c54df..68085f5c2349c14beedc98c0b3a300096689dce2 100644 (file)
@@ -85,6 +85,9 @@ void MD3_ComputeTagFromTri( md3Tag_t *pTag, float pTri[3][3] ){
                hypotSide = 2;
                origin = 1;
        }
+       else {
+               assert(0);
+       }
        len[hypotSide] = -1;
 
        if ( len[0] > len[1] && len[0] > len[2] ) {
@@ -96,6 +99,9 @@ void MD3_ComputeTagFromTri( md3Tag_t *pTag, float pTri[3][3] ){
        else if ( len[2] > len[0] && len[2] > len[1] ) {
                longestSide = 2;
        }
+       else {
+               assert(0);
+       }
        len[longestSide] = -1;
 
        if ( len[0] > len[1] && len[0] > len[2] ) {
@@ -107,6 +113,9 @@ void MD3_ComputeTagFromTri( md3Tag_t *pTag, float pTri[3][3] ){
        else if ( len[2] > len[0] && len[2] > len[1] ) {
                shortestSide = 2;
        }
+       else {
+               assert(0);
+       }
        len[shortestSide] = -1;
 
 
index 04c4a4d0872f0a7047a33205ecb5507304fcadfa..9db846657ef1d1e7bcd27d21dc5afcfcadab18ec 100644 (file)
@@ -110,13 +110,13 @@ void GetBestSurfaceTriangleMatchForBrushside( side_t *buildSide, bspDrawVert_t *
                                        continue;
                                }
                        }
-                       if ( abs( DotProduct( vert[0]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
+                       if ( fabsf( DotProduct( vert[0]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
                                continue;
                        }
-                       if ( abs( DotProduct( vert[1]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
+                       if ( fabsf( DotProduct( vert[1]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
                                continue;
                        }
-                       if ( abs( DotProduct( vert[2]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
+                       if ( fabsf( DotProduct( vert[2]->xyz, buildPlane->normal ) - buildPlane->dist ) >= distanceEpsilon ) {
                                continue;
                        }
                        // Okay. Correct surface type, correct shader, correct plane. Let's start with the business...
index b123660843acfc4cdfc7a962bf5d96c6bdae2cbc..a0e5d6b6c11d5e036add41268cd962935f3707c6 100644 (file)
@@ -109,4 +109,4 @@ int ExportEntitiesMain( int argc, char **argv ){
                
         /* return to sender */
         return 0;
-}
\ No newline at end of file
+}
index 9fe00ef68c57dd7d7f5876739be47d86fd0eeffa..bf2b63e5293e24cec76eb25dc635e253f786fd5c 100644 (file)
@@ -288,7 +288,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
                        /* multiply by texture color */
                        if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, rw->verts[ samples ].st, textureColor ) ) {
                                VectorCopy( si->averageColor, textureColor );
-                               textureColor[ 4 ] = 255.0f;
+                               textureColor[ 3 ] = 255.0f;
                        }
                        for ( i = 0; i < 3; i++ )
                                color[ i ] = ( textureColor[ i ] / 255 ) * ( rw->verts[ samples ].color[ lightmapNum ][ i ] / 255.0f );
@@ -372,7 +372,7 @@ static void RadSample( int lightmapNum, bspDrawSurface_t *ds, rawLightmap_t *lm,
                                                /* multiply by texture color */
                                                if ( !RadSampleImage( si->lightImage->pixels, si->lightImage->width, si->lightImage->height, st, textureColor ) ) {
                                                        VectorCopy( si->averageColor, textureColor );
-                                                       textureColor[ 4 ] = 255;
+                                                       textureColor[ 3 ] = 255;
                                                }
                                                for ( i = 0; i < 3; i++ )
                                                        color[ i ] = ( textureColor[ i ] / 255 ) * ( radLuxel[ i ] / 255 );
index c75dac2e55f5705029df32059d2eec071a09031d..b173b6641806ae2b707f1a72d6cde9dda897a1a7 100644 (file)
@@ -1719,7 +1719,7 @@ void DirtyRawLightmap( int rawLightmapNum ){
 
 static qboolean SubmapRawLuxel( rawLightmap_t *lm, int x, int y, float bx, float by, int *sampleCluster, vec3_t sampleOrigin, vec3_t sampleNormal ){
        int i, *cluster, *cluster2;
-       float       *origin, *origin2, *normal; //%     , *normal2;
+       float       *origin = NULL, *origin2 = NULL, *normal; //%       , *normal2;
        vec3_t originVecs[ 2 ];                 //%     , normalVecs[ 2 ];
 
 
@@ -1744,9 +1744,13 @@ static qboolean SubmapRawLuxel( rawLightmap_t *lm, int x, int y, float bx, float
                Sys_FPrintf( SYS_WRN, "WARNING: Spurious lightmap S vector\n" );
        }
 
-       VectorSubtract( origin2, origin, originVecs[ 0 ] );
+       if (origin && origin2) {
+               VectorSubtract(origin2, origin, originVecs[0]);
+       }
        //%     VectorSubtract( normal2, normal, normalVecs[ 0 ] );
 
+       origin = origin2 = NULL;
+
        /* calulate y vector */
        if ( ( y < ( lm->sh - 1 ) && bx >= 0.0f ) || ( y == 0 && bx <= 0.0f ) ) {
                cluster = SUPER_CLUSTER( x, y );
@@ -1768,7 +1772,9 @@ static qboolean SubmapRawLuxel( rawLightmap_t *lm, int x, int y, float bx, float
                Sys_FPrintf( SYS_WRN, "WARNING: Spurious lightmap T vector\n" );
        }
 
-       VectorSubtract( origin2, origin, originVecs[ 1 ] );
+       if (origin && origin2) {
+               VectorSubtract(origin2, origin, originVecs[1]);
+       }
 
        /* calculate new origin */
        for ( i = 0; i < 3; i++ )
index 676fa31599df4754276c9580b5e532edd709912c..c291520ffa33a3f3014e351ba27245b0a76f8c84 100644 (file)
@@ -677,7 +677,7 @@ int FloodEntities( tree_t *tree ){
        inside = qfalse;
        tree->outside_node.occupied = 0;
 
-       tripped = qfalse;
+       tripped = NULL;
        c_floodedleafs = 0;
        for ( i = 1; i < numEntities; i++ )
        {
index 46fec5eef2bed378f918ff73fe8b8a609ec34ee2..655b9f07b3aa2208848300a133e0165efa3390cb 100644 (file)
@@ -627,7 +627,7 @@ typedef struct foliage_s
        struct foliage_s    *next;
        char model[ MAX_QPATH ];
        float scale, density, odds;
-       qboolean inverseAlpha;
+       int inverseAlpha;
 }
 foliage_t;
 
index 166319aa930862279da2abee60d3f9c0d9176969..d1f8be17f72018d3978aea86949012f552614e2c 100644 (file)
@@ -719,7 +719,7 @@ void FinishShader( shaderInfo_t *si ){
 
                        /* determine error squared */
                        VectorSubtract( color, si->averageColor, delta );
-                       delta[ 3 ] = color[ 3 ] - si->averageColor[ 3 ];
+                       delta[ 3 ] = color[ 3 ] - 255;
                        dist = delta[ 0 ] * delta[ 0 ] + delta[ 1 ] * delta[ 1 ] + delta[ 2 ] * delta[ 2 ] + delta[ 3 ] * delta[ 3 ];
                        if ( dist < bestDist ) {
                                si->stFlat[ 0 ] = st[ 0 ];
@@ -1272,7 +1272,7 @@ static void ParseShaderFile( const char *filename ){
                        else if ( !Q_stricmp( token, "sun" ) /* sof2 */ || !Q_stricmp( token, "q3map_sun" ) || !Q_stricmp( token, "q3map_sunExt" ) ) {
                                float a, b;
                                sun_t       *sun;
-                               qboolean ext;
+                               qboolean ext = qfalse;
 
 
                                /* ydnar: extended sun directive? */
index 145e1961cc7ee683fcd89814fdddcbc6e61ec6ad..4fff8a7403b836970afee3e16cb33bc732e7647e 100644 (file)
@@ -987,8 +987,7 @@ void CreateEdge( vec4_t plane, vec3_t a, vec3_t b, edge_t *edge ){
        edge->kingpinLength = edge->edge[ edge->kingpin ];
 
        VectorNormalize( edge->edge, edge->edge );
-       edge->edge[ 3 ] = DotProduct( a, edge->edge );
-       edge->length = DotProduct( b, edge->edge ) - edge->edge[ 3 ];
+       edge->length = DotProduct( b, edge->edge ) - DotProduct( a, edge->edge );
 
        /* create perpendicular plane that edge lies in */
        CrossProduct( plane, edge->edge, edge->plane );