From: Matthew Fernandez Date: Sat, 28 Jan 2023 16:51:55 +0000 (-0800) Subject: dotgen pf2s: replace 'sprintf' into a raw buffer with 'agxbprint' X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5ab8d58361843f1fd958d7bf51e6e195bb104840;p=graphviz dotgen pf2s: replace 'sprintf' into a raw buffer with 'agxbprint' Gitlab: #1950 --- diff --git a/lib/dotgen/compound.c b/lib/dotgen/compound.c index 47f25e6af..6b4441482 100644 --- a/lib/dotgen/compound.c +++ b/lib/dotgen/compound.c @@ -12,15 +12,15 @@ /* Module for clipping splines to cluster boxes. */ +#include #include /* pf2s: * Convert a pointf to its string representation. */ -static char *pf2s(pointf p, char *buf) -{ - sprintf(buf, "(%.5g,%.5g)", p.x, p.y); - return buf; +static char *pf2s(pointf p, agxbuf *xb) { + agxbprint(xb, "(%.5g,%.5g)", p.x, p.y); + return agxbuse(xb); } /* Return point where line segment [pp,cp] intersects @@ -66,12 +66,16 @@ static pointf boxIntersectf(pointf pp, pointf cp, boxf * bp) /* failure */ { - char ppbuf[100], cpbuf[100], llbuf[100], urbuf[100]; + agxbuf ppbuf = {0}, cpbuf = {0}, llbuf = {0}, urbuf = {0}; agerr(AGERR, "segment [%s,%s] does not intersect box ll=%s,ur=%s\n", - pf2s(pp, ppbuf), pf2s(cp, cpbuf), - pf2s(ll, llbuf), pf2s(ur, urbuf)); + pf2s(pp, &ppbuf), pf2s(cp, &cpbuf), + pf2s(ll, &llbuf), pf2s(ur, &urbuf)); + agxbfree(&ppbuf); + agxbfree(&cpbuf); + agxbfree(&llbuf); + agxbfree(&urbuf); assert(0); } return ipp;