]> granicus.if.org Git - graphviz/commitdiff
xlib plugin handle_file_events: squash a -Wsign-conversion warning
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 31 Mar 2022 00:24:16 +0000 (17:24 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 2 Apr 2022 19:55:48 +0000 (12:55 -0700)
plugin/xlib/gvdevice_xlib.c

index 512a962fe6682fba893c155283cbda5fb37d4566..e476db531a55dc626c34cdfd6fc669082e8d7afc 100644 (file)
@@ -404,7 +404,7 @@ static int handle_stdin_events(GVJ_t *job)
 #ifdef HAVE_SYS_INOTIFY_H
 static int handle_file_events(GVJ_t *job, int inotify_fd)
 {
-    int avail, ret, len, ln, rc = 0;
+    int avail, ret, len, rc = 0;
     char *bf, *p;
     struct inotify_event *event;
 
@@ -442,9 +442,10 @@ static int handle_file_events(GVJ_t *job, int inotify_fd)
                    rc++;
                }
            }
-           ln = event->len + sizeof(struct inotify_event);
+           size_t ln = event->len + sizeof(struct inotify_event);
+            assert(ln <= (size_t)len);
             bf += ln;
-            len -= ln;
+            len -= (int)ln;
         }
         free(buf);
         if (len != 0) {