GNOME Bugzilla – Bug 151416
[PATCH] Fix CVS jhbuild build failure of gstadder.c
Last modified: 2004-12-22 21:47:04 UTC
building with jhbuild, -Werror is turned on by default. The following occurs: gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../../gst-libs -I../../gst-libs -pthread -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/home/nathanr/bin/gnome2-cvs/include/glib-2.0 -I/home/nathanr/bin/gnome2-cvs/lib64/glib-2.0/include -I/home/nathanr/bin/gnome2-cvs/include/libxml2 -I/home/nathanr/bin/gnome2-cvs/include/gstreamer-0.8 -DGST_DISABLE_DEPRECATED -Wall -Werror -g -O2 -MT libgstadder_la-gstadder.lo -MD -MP -MF .deps/libgstadder_la-gstadder.Tpo -c gstadder.c -fPIC -DPIC -o .libs/libgstadder_la-gstadder.o gstadder.c: In function `gst_adder_loop': gstadder.c:409: warning: comparison is always false due to limited range of data type gstadder.c:409: warning: comparison is always false due to limited range of data type make[3]: *** [libgstadder_la-gstadder.lo] Error 1 make[3]: Leaving directory `/home/nathanr/download/gnome-cvs/gst-plugins/gst/adder' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/nathanr/download/gnome-cvs/gst-plugins/gst' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory `/home/nathanr/download/gnome-cvs/gst-plugins' make: *** [all] Error 2 *** error during stage build of gst-plugins: could not build module *** [70/91] Offending line: out[i] = CLAMP (out[i] + in[i], MIN_INT_32, MAX_INT_32); The preprocessor output ("gcc -E") for that line is: out[i] = (((out[i] + in[i]) > (2147483647L)) ? (2147483647L) : (((out[i] + in[i]) < ((-2147483647L -1L))) ? ((-2147483647L -1L)) : (out[i] + in[i]))); It turns out the compiler is smart enough to work out that they are the bounds of an gint32, and hence the condition is always false. The patch simply casts the comparison to a gint64. Here's the patch to fix this: --- gstadder.c.~1.55.~ 2004-07-09 20:56:49.000000000 +1000 +++ gstadder.c 2004-08-30 22:14:54.322727752 +1000 @@ -406,7 +406,7 @@ gint32 *out = (gint32 *) GST_BUFFER_DATA (buf_out); for (i = 0; i < GST_BUFFER_SIZE (buf_out) / 4; i++) - out[i] = CLAMP (out[i] + in[i], MIN_INT_32, MAX_INT_32); + out[i] = CLAMP (((gint64) out[i]) + ((gint64)in[i]), MIN_INT_32, MAX_INT_32); } else if (adder->width == 16) { gint16 *in = (gint16 *) raw_in; gint16 *out = (gint16 *) GST_BUFFER_DATA (buf_out);
Hi, it's not a blocker since the release will not build with -Wall. It needs fixing though by someone more expert than me.
Fixed.