]> granicus.if.org Git - graphviz/commitdiff
expr print: squash a -Wconversion warning
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Mon, 26 Dec 2022 21:56:56 +0000 (13:56 -0800)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 31 Dec 2022 23:34:34 +0000 (15:34 -0800)
`integer` is known to fit into an `int` here.

lib/expr/exeval.c

index ece5423fa8589e3fe1659ad039998967abb7e199..4ae981bf0b5c6ebfc9a55a2d5b52ee2488e68136 100644 (file)
@@ -390,7 +390,7 @@ static int print(Expr_t *ex, Exnode_t *exnode, void *env, Sfio_t *sp) {
                v = eval(ex, exnode->data.print.descriptor, env);
                if (v.integer < 0 || (long long unsigned)v.integer >= elementsof(ex->file) ||
                    (!(sp = ex->file[v.integer]) &&
-                   !(sp = ex->file[v.integer] = sfnew(NULL, NULL, SF_UNBOUND, v.integer, SF_READ|SF_WRITE))))
+                   !(sp = ex->file[v.integer] = sfnew(NULL, NULL, SF_UNBOUND, (int)v.integer, SF_READ|SF_WRITE))))
                {
                        exerror("printf: %" PRIdMAX ": invalid descriptor", (intmax_t)v.integer);
                        return -1;