From 050206484190b18c1e1b1cc6c36c71574fc11d04 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Thu, 16 Sep 2021 21:22:08 -0700 Subject: [PATCH] gxl2gv characterDataHandler: squash -Wsign-conversion warnings --- cmd/tools/gxl2gv.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cmd/tools/gxl2gv.c b/cmd/tools/gxl2gv.c index 4a5dcb6c1..758cd660f 100644 --- a/cmd/tools/gxl2gv.c +++ b/cmd/tools/gxl2gv.c @@ -8,7 +8,7 @@ * Contributors: Details at https://graphviz.org *************************************************************************/ - +#include #include "convert.h" #include #ifdef HAVE_EXPAT @@ -689,15 +689,18 @@ static void characterDataHandler(void *userData, const char *s, int length) { userdata_t *ud = userData; + assert(length >= 0 && "Expat returned negative length data"); + size_t len = (size_t)length; + if (!ud->listen) return; if (ud->compositeReadState) { - agxbput_n(&ud->composite_buffer, s, length); + agxbput_n(&ud->composite_buffer, s, len); return; } - agxbput_n(&ud->xml_attr_value, s, length); + agxbput_n(&ud->xml_attr_value, s, len); } Agraph_t *gxl_to_gv(FILE * gxlFile) -- 2.40.0