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

Unified Diff: src/core/SkError.cpp

Issue 230413005: remove sprintf (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: AnotherPatchSet Created 6 years, 8 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/SkError.cpp
diff --git a/src/core/SkError.cpp b/src/core/SkError.cpp
index 9e8ff2ddef01ff3fda1f5340f7a7e0f42713a796..421991559abc5d5be759d3e9dd757b976c06aae5 100644
--- a/src/core/SkError.cpp
+++ b/src/core/SkError.cpp
@@ -14,6 +14,12 @@
#include <stdio.h>
#include <stdarg.h>
+#ifdef SK_BUILD_FOR_WIN
+ #define SNPRINTF _snprintf
+#else
+ #define SNPRINTF snprintf
+#endif
+
namespace {
void *CreateThreadError() {
return SkNEW_ARGS(SkError, (kNoError_SkError));
@@ -129,7 +135,7 @@ void SkErrorInternals::SetError(SkError code, const char *fmt, ...) {
break;
}
- sprintf( str, "%s: ", error_name );
+ SNPRINTF(str, ERROR_STRING_LENGTH, "%s: ", error_name);
int string_left = SkToInt(ERROR_STRING_LENGTH - strlen(str));
str += strlen(str);

Powered by Google App Engine
This is Rietveld 408576698