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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/PlatformSTL.h

Issue 2255153004: [DevTools] An snprintf shim for old VS compat (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698