From: Matthew Fernandez Date: Sat, 5 Mar 2022 18:25:24 +0000 (-0800) Subject: Xlib plugin: squash some -Wsign-compare warnings X-Git-Tag: 4.0.0~193^2~6 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f2970bb5e0617c1e6674bc15036714537ae918c;p=graphviz Xlib plugin: squash some -Wsign-compare warnings --- diff --git a/plugin/xlib/gvdevice_xlib.c b/plugin/xlib/gvdevice_xlib.c index e2423a151..5758d907a 100644 --- a/plugin/xlib/gvdevice_xlib.c +++ b/plugin/xlib/gvdevice_xlib.c @@ -10,6 +10,7 @@ #include "config.h" +#include #include #include #include @@ -64,10 +65,14 @@ static void handle_configure_notify(GVJ_t * job, XConfigureEvent * cev) /* plugin/xlib/gvdevice_xlib.c */ /* lib/gvc/gvevent.c */ + assert(cev->width >= 0 && "Xlib returned an event with negative width"); + assert(cev->height >= 0 && "Xlib returned an event with negative height"); + job->zoom *= 1 + MIN( ((double) cev->width - (double) job->width) / (double) job->width, ((double) cev->height - (double) job->height) / (double) job->height); - if (cev->width > job->width || cev->height > job->height) + if ((unsigned)cev->width > job->width || + (unsigned)cev->height > job->height) job->has_grown = true; job->width = cev->width; job->height = cev->height;