diff options
author | Andreas Schneider <asn@cynapses.org> | 2010-07-13 17:27:52 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cynapses.org> | 2010-07-13 17:27:52 +0200 |
commit | ac54a26c5d39a4b30e62384eb10d2398ac6ab789 (patch) | |
tree | 806a6985fbc40a851c34f5520dbaa410eb1f46a1 | |
parent | fd53ebc7b62415d815edf7ad256fe8a17f6f813f (diff) | |
download | libssh-ac54a26c5d39a4b30e62384eb10d2398ac6ab789.tar.gz libssh-ac54a26c5d39a4b30e62384eb10d2398ac6ab789.tar.xz libssh-ac54a26c5d39a4b30e62384eb10d2398ac6ab789.zip |
build: Fixed the Windows build.
We have to include stdio.h for the printf function before we can do
anything.
-rw-r--r-- | config.h.cmake | 59 | ||||
-rw-r--r-- | include/libssh/priv.h | 62 |
2 files changed, 61 insertions, 60 deletions
diff --git a/config.h.cmake b/config.h.cmake index 6832af80..bd74d89a 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -116,62 +116,3 @@ /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #cmakedefine WORDS_BIGENDIAN 1 - -/************************* MS Windows ***************************/ - -#ifdef _WIN32 -# ifdef _MSC_VER -/* On Microsoft compilers define inline to __inline on all others use inline */ -# undef inline -# define inline __inline - -# undef strdup -# define strdup _strdup - -/* 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 usleep(X) Sleep(((X)+1000)/1000) - -# undef strtok_r -# define strtok_r strtok_s - -# if defined(HAVE__SNPRINTF_S) -# undef snprintf -# define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__) -# else /* HAVE__SNPRINTF_S */ -# if defined(HAVE__SNPRINTF) -# undef snprintf -# define snprintf _snprintf -# else /* HAVE__SNPRINTF */ -# if !defined(HAVE_SNPRINTF) -# error "no snprintf compatible function found" -# endif /* HAVE_SNPRINTF */ -# endif /* HAVE__SNPRINTF */ -# endif /* HAVE__SNPRINTF_S */ - -# if defined(HAVE__VSNPRINTF_S) -# undef vsnprintf -# define vsnprintf(s, n, f, v) _vsnprintf_s((s), (n), _TRUNCATE, (f), (v)) -# else /* HAVE__VSNPRINTF_S */ -# if deffined(HAVE__VSNPRINTF) -# undef vsnprintf -# define vsnprintf _vsnprintf -# else -# if !defined(HAVE_VSNPRINTF) -# error "No vsnprintf compatible function found" -# endif /* HAVE_VSNPRINTF */ -# endif /* HAVE__VSNPRINTF */ -# endif /* HAVE__VSNPRINTF_S */ - -# ifndef HAVE_STRNCPY -# define strncpy(d, s, n) strncpy_s((d), (n), (s), _TRUNCATE) -# endif -# endif /* _MSC_VER */ -#endif /* _WIN32 */ - diff --git a/include/libssh/priv.h b/include/libssh/priv.h index 1672fb48..9b6e85aa 100644 --- a/include/libssh/priv.h +++ b/include/libssh/priv.h @@ -32,9 +32,69 @@ #include "config.h" -#ifndef _WIN32 +#ifdef _WIN32 + +# ifdef _MSC_VER +# include <stdio.h> + +/* On Microsoft compilers define inline to __inline on all others use inline */ +# undef inline +# define inline __inline + +# undef strdup +# define strdup _strdup + +/* 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 usleep(X) Sleep(((X)+1000)/1000) + +# undef strtok_r +# define strtok_r strtok_s + +# if defined(HAVE__SNPRINTF_S) +# undef snprintf +# define snprintf(d, n, ...) _snprintf_s((d), (n), _TRUNCATE, __VA_ARGS__) +# else /* HAVE__SNPRINTF_S */ +# if defined(HAVE__SNPRINTF) +# undef snprintf +# define snprintf _snprintf +# else /* HAVE__SNPRINTF */ +# if !defined(HAVE_SNPRINTF) +# error "no snprintf compatible function found" +# endif /* HAVE_SNPRINTF */ +# endif /* HAVE__SNPRINTF */ +# endif /* HAVE__SNPRINTF_S */ + +# if defined(HAVE__VSNPRINTF_S) +# undef vsnprintf +# define vsnprintf(s, n, f, v) _vsnprintf_s((s), (n), _TRUNCATE, (f), (v)) +# else /* HAVE__VSNPRINTF_S */ +# if defined(HAVE__VSNPRINTF) +# undef vsnprintf +# define vsnprintf _vsnprintf +# else +# if !defined(HAVE_VSNPRINTF) +# error "No vsnprintf compatible function found" +# endif /* HAVE_VSNPRINTF */ +# endif /* HAVE__VSNPRINTF */ +# endif /* HAVE__VSNPRINTF_S */ + +# ifndef HAVE_STRNCPY +# define strncpy(d, s, n) strncpy_s((d), (n), (s), _TRUNCATE) +# endif +# endif /* _MSC_VER */ + +#else /* _WIN32 */ + #include <unistd.h> #define PRIdS "zd" + #endif /* _WIN32 */ #include "libssh/libssh.h" |