From 8f1864386734cfa7650a5576ba453745a407ade2 Mon Sep 17 00:00:00 2001 From: caryclark Date: Thu, 6 Oct 2016 11:46:25 -0700 Subject: remove sprintf Most uses of sprintf are in pathops testing. Replace them with SkString::appendf and replace the remaining with snprintf R=scroggo@google.com BUG=skia:2716 GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2391133005 Review-Url: https://codereview.chromium.org/2391133005 --- tests/PathOpsQuadLineIntersectionThreadedTest.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'tests/PathOpsQuadLineIntersectionThreadedTest.cpp') diff --git a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp index 9ecc1f052f..7766cfe028 100644 --- a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp +++ b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp @@ -10,6 +10,7 @@ #include "SkPathOpsLine.h" #include "SkPathOpsQuad.h" #include "SkReduceOrder.h" +#include "SkString.h" static int doIntersect(SkIntersections& intersections, const SkDQuad& quad, const SkDLine& line, bool& flipped) { @@ -40,14 +41,12 @@ static int doIntersect(SkIntersections& intersections, const SkDQuad& quad, cons static void testLineIntersect(skiatest::Reporter* reporter, const SkDQuad& quad, const SkDLine& line, const double x, const double y) { - char pathStr[1024]; - sk_bzero(pathStr, sizeof(pathStr)); - char* str = pathStr; - str += sprintf(str, " path.moveTo(%1.9g, %1.9g);\n", quad[0].fX, quad[0].fY); - str += sprintf(str, " path.quadTo(%1.9g, %1.9g, %1.9g, %1.9g);\n", quad[1].fX, + SkString pathStr; + pathStr.appendf(" path.moveTo(%1.9g, %1.9g);\n", quad[0].fX, quad[0].fY); + pathStr.appendf(" path.quadTo(%1.9g, %1.9g, %1.9g, %1.9g);\n", quad[1].fX, quad[1].fY, quad[2].fX, quad[2].fY); - str += sprintf(str, " path.moveTo(%1.9g, %1.9g);\n", line[0].fX, line[0].fY); - str += sprintf(str, " path.lineTo(%1.9g, %1.9g);\n", line[1].fX, line[1].fY); + pathStr.appendf(" path.moveTo(%1.9g, %1.9g);\n", line[0].fX, line[0].fY); + pathStr.appendf(" path.lineTo(%1.9g, %1.9g);\n", line[1].fX, line[1].fY); SkIntersections intersections; bool flipped = false; -- cgit v1.2.3