Index: third_party/WebKit/Source/platform/v8_inspector/PlatformSTL.h |
diff --git a/third_party/WebKit/Source/platform/v8_inspector/PlatformSTL.h b/third_party/WebKit/Source/platform/v8_inspector/PlatformSTL.h |
index 15dd63e3eb168a721d8bd2a108f408766b3e46de..dd1fb45a28f0704f33170f86274b262e1c25b79c 100644 |
--- a/third_party/WebKit/Source/platform/v8_inspector/PlatformSTL.h |
+++ b/third_party/WebKit/Source/platform/v8_inspector/PlatformSTL.h |
@@ -289,4 +289,23 @@ std::unique_ptr<T> wrapUnique(T* ptr) |
return std::unique_ptr<T>(ptr); |
} |
+// emulate snprintf() on windows, _snprintf() doesn't zero-terminate the buffer |
+// on overflow... |
+// VS 2015 added a standard conform snprintf |
+#if defined(_WIN32) && defined( _MSC_VER ) && (_MSC_VER < 1900) |
+#include <stdarg.h> |
+namespace std { |
+ |
+inline static int snprintf(char *buffer, size_t n, const char *format, ...) |
+{ |
+ va_list argp; |
+ va_start(argp, format); |
+ int ret = _vscprintf(format, argp); |
+ vsnprintf_s(buffer, n, _TRUNCATE, format, argp); |
+ va_end(argp); |
+ return ret; |
+} |
+} // namespace std |
+#endif // (_WIN32) && defined( _MSC_VER ) && (_MSC_VER < 1900) |
+ |
#endif // PlatformSTL_h |