Re: [AD] 4.3.0 progress

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


On Sat, 2006-07-22 at 15:31 -0700, Chris wrote:
> On Saturday 22 July 2006 06:50, Peter Wang wrote:
> > I would be nice if some other people tested it as well before then.
> 
> It won't compile with --enable-strictwarn on my Linux machine, using GCC 4.1. 
> It complains about possibly using an uninitialized struct in 
> src/compat/cotimer.c (even though it really can't). The attached patch fixes 
> that. It then complains about type-punning in grabber.c, but this isn't 
> easilly fixable with how the code is all structured.
> 

Here's a patch to silence those.

-- 
Elias Pschernig
Index: tools/grabber.c
===================================================================
--- tools/grabber.c	(revision 7375)
+++ tools/grabber.c	(working copy)
@@ -512,8 +512,10 @@
    }
    else {
       *dat = data[SELECTED_ITEM].dat;
-      if ((*dat)->type == DAT_FILE)
-	 *parent = (DATAFILE **)&(*dat)->dat;
+      if ((*dat)->type == DAT_FILE) {
+         void *ptr = &(*dat)->dat;
+         *parent = (DATAFILE **)ptr;
+      }
       else
 	 *parent = data[SELECTED_ITEM].parent;
    }
@@ -1738,9 +1740,11 @@
       add_to_list(d, dat, i, tmp, clear);
 
       if ((d->type == DAT_FILE) && (!folded)) {
-	 strcpy(tmp, prefix);
-	 strcat(tmp, "|");
-	 add_datafile_to_list((DATAFILE **)&d->dat, tmp, clear);
+         void *ptr;
+         strcpy(tmp, prefix);
+         strcat(tmp, "|");
+         ptr = &d->dat;
+         add_datafile_to_list((DATAFILE **)ptr, tmp, clear);
       }
    }
 }
@@ -3267,8 +3271,10 @@
 	 if (!v)
 	    v = makenew_data(&size);
 
-	 if ((dat->dat) && (dat->dat->type == DAT_FILE))
-	    df = (DATAFILE **)&dat->dat->dat;
+         if ((dat->dat) && (dat->dat->type == DAT_FILE)) {
+            void *ptr = &dat->dat->dat;
+            df = (DATAFILE **)ptr;
+         }
 	 else
 	    df = dat->parent;
 


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/