aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2010-04-06 23:06:37 +0200
committerAndreas Schneider <mail@cynapses.org>2010-05-10 10:45:51 +0200
commit4bfe7f024caad27a09b148a053da01ed1ac04fa1 (patch)
treeea5e168e72347a65b3be4817b85afd8e89f1e7e8
parent99ea177eeac73d6f6f8f925b1ab977d567b0e285 (diff)
downloadlibssh-4bfe7f024caad27a09b148a053da01ed1ac04fa1.tar.gz
libssh-4bfe7f024caad27a09b148a053da01ed1ac04fa1.tar.xz
libssh-4bfe7f024caad27a09b148a053da01ed1ac04fa1.zip
Added more defines to use secure VC functions.
-rw-r--r--include/libssh/priv.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 81bb7510..7204f873 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -33,15 +33,8 @@
#include "config.h"
#ifdef _MSC_VER
-#define snprintf _snprintf
-
-#ifndef HAVE_VSNPRINTF
-#ifdef HAVE__VSNPRINTF
-#define vsnprintf _vsnprintf
-#else
-#error "neither vsnprintf or vnsprintf available, this may fail"
-#endif /* HAVE__VSNPRINTF */
-#endif /* HAVE_VSNPRINTF */
+#undef snprintf
+#undef strtok_r
/** Imitate define of inttypes.h */
#define PRIdS "Id"
@@ -49,6 +42,13 @@
#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 <unistd.h>
#define PRIdS "zd"