]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
AllocWinding: fix handling of compiler enforced alignment of double
authorRudolf Polzer <divverent@xonotic.org>
Thu, 8 Dec 2011 11:20:56 +0000 (12:20 +0100)
committerRudolf Polzer <divverent@xonotic.org>
Thu, 8 Dec 2011 11:20:56 +0000 (12:20 +0100)
tools/quake3/common/polylib.c
tools/quake3/common/polylib.h

index af4b98e4a113b1bfb318ceaf88cb0692d8e7ba6e..1d59dd4b3d57cef56cb8f31bdb8899dba53b7369 100644 (file)
@@ -67,7 +67,7 @@ winding_t     *AllocWinding (int points)
                if (c_active_windings > c_peak_windings)
                        c_peak_windings = c_active_windings;
        }
-       s = sizeof(vec_t)*3*points + sizeof(int);
+       s = sizeof(*w) + (points ? sizeof(w->p[0])*(points-1) : 0);
        w = safe_malloc (s);
        memset (w, 0, s); 
        return w;
@@ -95,7 +95,7 @@ winding_accu_t *AllocWindingAccu(int points)
                if (c_active_windings > c_peak_windings)
                        c_peak_windings = c_active_windings;
        }
-       s = sizeof(vec_accu_t) * 3 * points + sizeof(int);
+       s = sizeof(*w) + (points ? sizeof(w->p[0])*(points-1) : 0);
        w = safe_malloc(s);
        memset(w, 0, s); 
        return w;
index 9750180ed325c51d52710e7032084c36c546a24f..07e37839ef055e683cd32f4117cc16e84877806e 100644 (file)
@@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 typedef struct
 {
        int             numpoints;
-       vec3_t  p[4];           // variable sized
+       vec3_t  p[1];           // variable sized
 } winding_t;
 
 #define        MAX_POINTS_ON_WINDING   512
@@ -67,7 +67,7 @@ void pw(winding_t *w);
 typedef struct
 {
        int             numpoints;
-       vec3_accu_t     p[4]; // variable sized
+       vec3_accu_t     p[1]; // variable sized
 } winding_accu_t;
 
 winding_accu_t *BaseWindingForPlaneAccu(vec3_t normal, vec_t dist);