OSDN Git Service

Use real snprintf when available.
authorNicolas Capens <capn@google.com>
Mon, 17 Jul 2017 18:34:55 +0000 (14:34 -0400)
committerNicolas Capens <nicolascapens@google.com>
Mon, 17 Jul 2017 19:13:24 +0000 (19:13 +0000)
Visual C++ 2015 provides an actual snprintf implementation, so we
shouldn't use _snprintf, which does not guarantee null-termination.

Bug swiftshader:75

Change-Id: Ia45e49e77a6076e8f9f12ad74c6ad50dbdbf2dbd
Reviewed-on: https://swiftshader-review.googlesource.com/10688
Tested-by: Nicolas Capens <nicolascapens@google.com>
Reviewed-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <nicolascapens@google.com>
src/OpenGL/compiler/SymbolTable.cpp

index 89ad4d1..b2e48e8 100644 (file)
@@ -27,8 +27,8 @@
 #include <limits.h>
 #include <algorithm>
 
-#if defined(_MSC_VER)
-#define snprintf _snprintf
+#if defined(_MSC_VER) && MSC_VER < 1900\r
+#define snprintf _snprintf\r
 #endif
 
 int TSymbolTableLevel::uniqueId = 0;