From 9e7c44b4e01008a5bc0b42389f05b215115e7f8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Eichler?= Date: Wed, 18 Nov 2015 16:06:47 +0100 Subject: [PATCH] Fix compilation on Visual Studio 2015 --- binding.gyp | 1 - src/color.cc | 5 +++++ src/init.cc | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/binding.gyp b/binding.gyp index b0d7137..1c25248 100755 --- a/binding.gyp +++ b/binding.gyp @@ -62,7 +62,6 @@ '<(GTK_Root)/include/cairo', ], 'defines': [ - 'snprintf=_snprintf', '_USE_MATH_DEFINES' # for M_PI ], 'configurations': { diff --git a/src/color.cc b/src/color.cc index effcf89..bede494 100644 --- a/src/color.cc +++ b/src/color.cc @@ -10,6 +10,11 @@ #include #include +// Compatibility with Visual Studio versions prior to VS2015 +#if defined(_MSC_VER) && _MSC_VER < 1900 +#define snprintf _snprintf +#endif + /* * Parse integer value */ diff --git a/src/init.cc b/src/init.cc index e496c80..e5f44fc 100755 --- a/src/init.cc +++ b/src/init.cc @@ -17,6 +17,11 @@ #include "FontFace.h" #endif +// Compatibility with Visual Studio versions prior to VS2015 +#if defined(_MSC_VER) && _MSC_VER < 1900 +#define snprintf _snprintf +#endif + NAN_MODULE_INIT(init) { Canvas::Initialize(target); Image::Initialize(target);