From f7abf5c96c303e7d04fda9ddca0caff2851095bc Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Sun, 8 May 2022 13:02:31 -0700 Subject: [PATCH] dotgen: squash -Wsign-conversion warning in 'doDot' The compiler says: dotinit.c: In function 'doDot': dotinit.c:454:24: warning: conversion to 'unsigned int' from 'int' may change the sign of the result [-Wsign-conversion] 454 | pinfo.margin = Pack; | ^~~~ But from the surrounding code and the implementation of `getPack`, we can statically determine that `Pack` is non-negative at this point. --- lib/dotgen/dotinit.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/dotgen/dotinit.c b/lib/dotgen/dotinit.c index e4d086368..f9b24f121 100644 --- a/lib/dotgen/dotinit.c +++ b/lib/dotgen/dotinit.c @@ -8,7 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ - +#include #include #include #include @@ -451,7 +451,8 @@ static void doDot (Agraph_t* g) pinfo.mode = l_graph; else if (Pack < 0) Pack = CL_OFFSET; - pinfo.margin = Pack; + assert(Pack >= 0); + pinfo.margin = (unsigned)Pack; pinfo.fixed = NULL; /* components using clusters */ -- 2.40.0