|
From: Ethan M. <merritt@u.washington.edu> - 2009-08-31 18:21:50
|
On Monday 31 August 2009 10:54:46 Benjamin Lindner wrote:
> Hello list,
>
> I paid some attention to the compiler warnings emitted when building
> recent 4.3 and 4.4 gnuplot.
> I am using mingw32/gcc, but I guess it's not platform specific.
>
> First: two cases of missing declarations:
> in src/wxterminal/gp_cairo_helpers.c the declaration for gp_alloc() is
> missing and
> in src/internal.c the declaration of disp_value() is missing.
>
> Thr trivial fix is:
>
> diff -r 8a1e8f758422 src/wxterminal/gp_cairo_helpers.c
> --- a/src/wxterminal/gp_cairo_helpers.c Wed Jul 08 08:27:14 2009 +0200
> +++ b/src/wxterminal/gp_cairo_helpers.c Wed Jul 08 08:27:29 2009 +0200
> @@ -49,6 +49,8 @@
>
> /* for rgb functions */
> # include "getcolor.h"
> +/* for gp_alloc */
> +#include "alloc.h"
As I understand it, Timothée's intent was that the cairo code be independent
of the core gnuplot routines. So this was already fixed in CVS as of last
week by calling malloc() directly.
> Second: when building with debugging support (i.e. with -DDEBUG), then
> in scr/gp_cairo.c a pritnf format specifier is not quite correct.
>
> diff -r cc501863450d src/wxterminal/gp_cairo.c
> --- a/src/wxterminal/gp_cairo.c Wed Jul 08 08:27:29 2009 +0200
> +++ b/src/wxterminal/gp_cairo.c Wed Jul 08 08:27:33 2009 +0200
> @@ -1026,7 +1026,7 @@
> scale_x = (double)M/fabs( x2 - x1 );
> scale_y = (double)N/fabs( y2 - y1 );
>
> - FPRINTF((stderr,"M %d N %lf x1 %d y1 %d\n", M, N, x1, y1));
> + FPRINTF((stderr,"M %d N %d x1 %d y1 %d\n", M, N, x1, y1));
> cairo_save( plot->cr );
>
> /* Set clipping boundaries for image copy.
Oops. Got it. Thanks.
> Third: when compiling src/win/wpause.c at line 94, gcc emits an
> "ambiguous if-else clause" and suggests braces.
> I am not too familiar with the code to see where the braces should be
> placed, but the intendation of the code would suggest a change like:
>
> diff -r cd38a24d39cf src/win/wpause.c
> --- a/src/win/wpause.c Wed Jul 08 08:27:33 2009 +0200
> +++ b/src/win/wpause.c Wed Jul 08 08:27:38 2009 +0200
> @@ -91,9 +91,10 @@
>
> /* calculate remaining time, detect overflow */
> t1 = GetTickCount();
> - if (tstop > t0)
> + if (tstop > t0) {
> if ((t1 >= tstop) || (t1 < t0))
> rc = WAIT_TIMEOUT;
> + }
> else
> if ((t1 >= tstop) && (t1 < t0))
> rc = WAIT_TIMEOUT;
>
>
> All these are not blocking building, but for the sake of clean code I
> vote they should be fixed.
Sure. Thanks.
Ethan
|