aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schneider <mail@cynapses.org>2010-05-10 14:40:00 +0200
committerAndreas Schneider <mail@cynapses.org>2010-05-10 14:41:20 +0200
commit5fe99f8b094e822f1d6322e71d4185510aa9ea59 (patch)
tree92d838d1260342d25043c6d45a8a47b1314050f9
parentaf155db080f7b9b2d8d35383a574c6c1150d73fc (diff)
downloadlibssh-5fe99f8b094e822f1d6322e71d4185510aa9ea59.tar.gz
libssh-5fe99f8b094e822f1d6322e71d4185510aa9ea59.tar.xz
libssh-5fe99f8b094e822f1d6322e71d4185510aa9ea59.zip
Fixed building libssh with VC9.
-rw-r--r--include/libssh/priv.h24
1 files changed, 17 insertions, 7 deletions
diff --git a/include/libssh/priv.h b/include/libssh/priv.h
index 7204f873..b618ce42 100644
--- a/include/libssh/priv.h
+++ b/include/libssh/priv.h
@@ -33,8 +33,8 @@
#include "config.h"
#ifdef _MSC_VER
-#undef snprintf
-#undef strtok_r
+
+#include <varargs.h>
/** Imitate define of inttypes.h */
#define PRIdS "Id"
@@ -43,16 +43,26 @@
#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)
+
+#undef strtok_r
+#define strtok_r strtok_s
+
+#undef snprintf
+#define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__)
+
+#if _MSC_VER < 1500
#define vsnprintf(s, n, f, v) _vsnprintf_s((s), (n), _TRUNCATE, (f), (v))
-#else
+
+#define strncpy(d, s, n) strncpy_s((d), (n), (s), _TRUNCATE)
+#endif /* _MSC_VER < 1500 */
+#else /* _MSC_VER */
+
#include <unistd.h>
#define PRIdS "zd"
-#endif
+
+#endif /* _MSC_VER */
#include "libssh/libssh.h"
#include "libssh/callbacks.h"