Re: [PATCH 2/2] Fixed couple of compilator warning and removed unused macros.
Roman Dobosz <[email protected]>
| Newsgroups | gmane.compw.window-managers.windowmaker.devel |
|---|---|
| Organization | ElysiuM deeZine |
| Message-ID | <[email protected]> |
On Mon, 27 Feb 2017 09:06:48 +0100 Andreas Tscharner <[email protected]> wrote: > On 25.02.2017 08:00, Roman Dobosz wrote: > > [snip] > > diff --git a/util/wmiv.c b/util/wmiv.c > > index e99e3e3..64e6eb5 100755 > > --- a/util/wmiv.c > > +++ b/util/wmiv.c > > @@ -35,6 +35,7 @@ > > #include <unistd.h> > > #include <sys/stat.h> > > #include <getopt.h> > > +#include <math.h> > > #include "config.h" > > > > #ifdef HAVE_EXIF > > @@ -218,7 +219,7 @@ int rescale_image(void) > > long final_height = img->height; > > > > /* check if there is already a zoom factor applied */ > > - if (zoom_factor != 0) { > > + if (fabsf(zoom_factor) <= 0.0f) { > > Are you sure about that one? I don't know the other code and what or > what not can happen to "zoom_factor" but (zoom_factor != 0) and > (fabs(zoom_factor <= 0.0f) are certainly not the same. Thanks for the feedback :) And no, I'm not sure about this one. Also, there are opinions on Internet on this error, for example [1][2] and solution which I've adapted [3]. zoom_factor is a float (which have default value float 0), which is compared to value 0 - that causes compiler to complain about unsafe to compare floats to some arbitrary number (Wfloat-equal). [1] http://stackoverflow.com/questions/11421756 [2] http://stackoverflow.com/questions/29962813 [3] https://github.com/cloudyourcar/minmea/commit/40b3fdd80d995915066b04c95023c9593524a997 -- Roman Dobosz -- To unsubscribe, send mail to [email protected].