]> granicus.if.org Git - graphviz/commitdiff
gvpr fwriteFile: squash a -Wsign-compare warning
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 28 Jul 2022 02:11:01 +0000 (19:11 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Tue, 2 Aug 2022 04:33:30 +0000 (21:33 -0700)
lib/gvpr/actions.c

index 1c0b8fd0492f58341b527c835a56cab96552d05f..c7150834433e4fb267781617893e0aaa68d98c51 100644 (file)
@@ -643,7 +643,8 @@ int fwriteFile(Expr_t * ex, Agraph_t * g, int fd, Agiodisc_t* io)
 {
     Sfio_t *sp;
 
-    if (fd < 0 || fd >= elementsof(ex->file)
+    if (fd < 0 ||
+        (elementsof(ex->file) <= INT_MAX && fd >= (int)elementsof(ex->file))
        || !((sp = ex->file[fd]))) {
        exerror("fwriteG: %d: invalid descriptor", fd);
        return 0;