From 9278dc0666de70f11b459e5b80e0c2ab6bbbe54c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Tue, 6 Apr 2010 23:06:37 +0200 Subject: [PATCH] Added more defines to use secure VC functions. --- include/libssh/priv.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/include/libssh/priv.h b/include/libssh/priv.h index 47039149..a3342816 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -33,13 +33,22 @@ #include "config.h" #ifdef _MSC_VER -#define snprintf _snprintf +#undef snprintf +#undef strtok_r + /** Imitate define of inttypes.h */ #define PRIdS "Id" #define strcasecmp _stricmp #define strncasecmp _strnicmp #define strtoull _strtoui64 #define isblank(ch) ((ch) == ' ' || (ch) == '\t' || (ch) == '\n' || (ch) == '\r') + +#define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__) +#define strdup _strdup +#define strncpy(d, s, n) strncpy_s((d), (n), (s), _TRUNCATE) +#define strtok_r strtok_s +#define usleep(X) Sleep(((X)+1000)/1000) +#define vsnprintf(s, n, f, v) _vsnprintf_s((s), (n), _TRUNCATE, (f), (v)) #else #include #define PRIdS "zd"