[AD] fixed gcc warning

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


The attached patch makes Allegro's C-only version compile with --enable-
strict-warn and gcc 3.3.4. Without it, I get this:

src/c/cstretch.c: In function `stretch_line15':
src/c/cstretch.c:104: warning: use of cast expressions as lvalues is
deprecated

And some more of that.

After someone confirms there's no problem with it (there'd be no more
need at all for the type parameter now, and I'm not too sure what the
cast around an lavalue actually does - so I might be overlooking
something), I'll commit it.

-- 
Elias Pschernig
Index: src/c/cstretch.c
===================================================================
RCS file: /cvsroot/alleg/allegro/src/c/cstretch.c,v
retrieving revision 1.10
diff -u -p -r1.10 cstretch.c
--- src/c/cstretch.c	26 Mar 2003 10:27:28 -0000	1.10
+++ src/c/cstretch.c	18 Jul 2004 17:03:16 -0000
@@ -34,15 +34,15 @@ static struct
  */
 #define DECLARE_STRETCHER(type, size, set, get)                           \
 int dd = _al_stretch.dd;                                                  \
-type *s = (type*) sptr;                                                   \
+unsigned char *s = sptr;                                                   \
 unsigned long d = dptr;                                                   \
 unsigned long dend = d + _al_stretch.dw;                                  \
 ASSERT(s);                                                                \
 ASSERT(d);                                                                \
-for (; d < dend; d += (size), (unsigned char*) s += _al_stretch.sinc) {   \
+for (; d < dend; d += (size), s += _al_stretch.sinc) {                    \
    set(d, get(s));                                                        \
    if (dd >= 0)                                                           \
-      (unsigned char*) s += (size), dd += _al_stretch.i2;                 \
+      s += (size), dd += _al_stretch.i2;                                  \
    else                                                                   \
       dd += _al_stretch.i1;                                               \
 }
@@ -132,17 +132,17 @@ static void stretch_line32(unsigned long
  */
 #define DECLARE_MASKED_STRETCHER(type, size, set, get, mask)              \
 int dd = _al_stretch.dd;                                                  \
-type *s = (type*) sptr;                                                   \
+unsigned char *s = sptr;                                                  \
 unsigned long d = dptr;                                                   \
 unsigned long dend = d + _al_stretch.dw;                                  \
 ASSERT(s);                                                                \
 ASSERT(d);                                                                \
-for (; d < dend; d += (size), (unsigned char*) s += _al_stretch.sinc) {   \
+for (; d < dend; d += (size), s += _al_stretch.sinc) {                    \
    unsigned long color = get(s);                                          \
    if (color != (mask))                                                   \
    set(d, color);                                                         \
    if (dd >= 0)                                                           \
-      (unsigned char*) s += (size), dd += _al_stretch.i2;                 \
+      s += (size), dd += _al_stretch.i2;                                 \
    else                                                                   \
       dd += _al_stretch.i1;                                               \
 }


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