mirror of
https://github.com/etlegacy/etlegacy-libs.git
synced 2025-04-08 23:42:48 +00:00
VS:added the snprintf fix for jansson
This commit is contained in:
parent
badf3ece3c
commit
d6ef7ac437
2 changed files with 26 additions and 3 deletions
|
@ -49,6 +49,20 @@
|
|||
|
||||
#cmakedefine HAVE_SNPRINTF 1
|
||||
|
||||
/* snprintf should not be defined as macro with MSC_VER >= 1900 */
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
# if defined(_MSC_VER) /* MS compiller */
|
||||
# if (_MSC_VER < 1900) /* snprintf not introduced */
|
||||
# if !defined(snprintf)
|
||||
# define snprintf _snprintf
|
||||
# define HAVE_SNPRINTF 1 /* snprintf defined manually */
|
||||
# endif
|
||||
# else
|
||||
# define HAVE_SNPRINTF 1 /* snprintf available via sdk */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
# define snprintf @JSON_SNPRINTF@
|
||||
#endif
|
||||
|
|
|
@ -91,9 +91,18 @@ char *jsonp_strdup(const char *str);
|
|||
char *jsonp_strndup(const char *str, size_t len);
|
||||
|
||||
/* Windows compatibility */
|
||||
#ifdef _WIN32
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#if defined(_WIN32) || defined(WIN32)
|
||||
# if defined(_MSC_VER) /* MS compiller */
|
||||
# if (_MSC_VER < 1900) && !defined(snprintf) /* snprintf not defined yet & not introduced */
|
||||
# define snprintf _snprintf
|
||||
# endif
|
||||
# if (_MSC_VER < 1500) && !defined(vsnprintf) /* vsnprintf not defined yet & not introduced */
|
||||
# define vsnprintf(b,c,f,a) _vsnprintf(b,c,f,a)
|
||||
# endif
|
||||
# else /* Other Windows compiller, old definition */
|
||||
# define snprintf _snprintf
|
||||
# define vsnprintf _vsnprintf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue