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

Unified Diff: src/core/SkRegion.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: src/core/SkRegion.cpp
diff --git a/src/core/SkRegion.cpp b/src/core/SkRegion.cpp
index a50425afd8e9d4f0bb2f3601db9d332e5f47a3a8..b3b1831aedcaae1a8063f73832ae51edbfd48e09 100644
--- a/src/core/SkRegion.cpp
+++ b/src/core/SkRegion.cpp
@@ -196,14 +196,15 @@ char* SkRegion::toString() {
if (result == nullptr) {
return nullptr;
}
- count = sprintf(result, "SkRegion(");
+ count = snprintf(result, max, "SkRegion(");
iter.reset(*this);
while (!iter.done()) {
const SkIRect& r = iter.rect();
- count += sprintf(result+count, "(%d,%d,%d,%d)", r.fLeft, r.fTop, r.fRight, r.fBottom);
+ count += snprintf(result+count, max - count,
+ "(%d,%d,%d,%d)", r.fLeft, r.fTop, r.fRight, r.fBottom);
iter.next();
}
- count += sprintf(result+count, ")");
+ count += snprintf(result+count, max - count, ")");
return result;
}
#endif

Powered by Google App Engine
This is Rietveld 408576698