Daniel Stenberg wrote:
> Similarly, we need a defien for "invalid sockt" as -1 is not nice
> to store there unconditionally for libssh2_socket_t. I suggest
> something like:
>
> --- a/src/libssh2_priv.h
> +++ b/src/libssh2_priv.h
> @@ -151,8 +151,10 @@ static inline int writev(int sock, struct iovec *iov, 
> int n
>
>  #ifdef WIN32
>  typedef SOCKET libssh2_socket_t;
> +#define SOCKET_BAD ~0
>  #else /* !WIN32 */
>  typedef int libssh2_socket_t;
> +#define SOCKET_BAD -1
>  #endif /* WIN32 */

Windows has such a value already, by the name of INVALID_SOCKET. I
would suggest to re-use that:

#ifndef INVALID_SOCKET
#define INVALID_SOCKET -1
#endif


//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Reply via email to