Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(829)

Unified Diff: tests/PathOpsQuadLineIntersectionThreadedTest.cpp

Issue 2391133005: remove sprintf (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tests/PathOpsQuadLineIntersectionThreadedTest.cpp
diff --git a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
index 9ecc1f052f73fdead6352f2d2ec752bb935b9982..7766cfe0288182098dfd316e69f819f38bd2969e 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;

Powered by Google App Engine
This is Rietveld 408576698