[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: libssh and Visual C++ (again)


On Friday 21 September 2012 13:51:28 you wrote:
> I agree, I haven't found a good way to handle ssize_t definition...
> The problem is that there is no standard for ssize_t definition, except
> under linux
> Some define it as int, other as long, and under WIN64 platforms, it may by
> __int64
> I noticed that libarchive has an "internal" definition for ssize_t used by
> library's source code, and has an "external" definition named __LA_SSIZE_T
> used by library's users.
> Like this:
> 
> #if defined(_WIN32) && !defined(__CYGWIN__)
> # define        __LA_INT64_T    __int64
> # if defined(_SSIZE_T_DEFINED) || defined(_SSIZE_T_)
> #  define       __LA_SSIZE_T    ssize_t
> # elif defined(_WIN64)
> #  define       __LA_SSIZE_T    __int64
> # else
> #  define       __LA_SSIZE_T    long
> # endif
> #else
> # include <unistd.h>  /* ssize_t */
> # if defined(_SCO_DS)
> #  define       __LA_INT64_T    long long
> # else
> #  define       __LA_INT64_T    int64_t
> # endif
> # define        __LA_SSIZE_T    ssize_t
> #endif
> 
> openssl library uses the type ossl_ssize_t as follows:
> #if defined(OPENSSL_SYS_MACINTOSH_CLASSIC) && macintosh==1 &&
> !defined(MAC_OS_GUSI_SOURCE)
> #  define ossl_ssize_t long
> #endif
> #ifdef OPENSSL_SYS_MSDOS
> #  define ossl_ssize_t long
> #endif
> #if defined(NeXT) || defined(OPENSSL_SYS_NEWS4) ||
> defined(OPENSSL_SYS_SUNOS)
> #  define ssize_t int
> #endif
> #if defined(__ultrix) && !defined(ssize_t)
> #  define ossl_ssize_t int
> #endif
> #ifndef ossl_ssize_t
> #  define ossl_ssize_t ssize_t
> #endif
> I think that libssh should have the same approach, and define something
> like ssh_ssize_t for its interface, and use ssize_t only for internal
> structures invisible from outside

Ok, then we should probably use

typedef uint64_t ssh_ssize_t;


	-- andreas

-- 
Andreas Schneider                   GPG-ID: F33E3FC6
www.cryptomilk.org                asn@xxxxxxxxxxxxxx


Follow-Ups:
Re: libssh and Visual C++ (again)Werner Koch <wk@xxxxxxxxx>
References:
libssh and Visual C++ (again)Christophe Baribaud <christophe.baribaud@xxxxxxxxx>
Re: libssh and Visual C++ (again)Andreas Schneider <asn@xxxxxxxxxxxxxx>
Re: libssh and Visual C++ (again)Christophe Baribaud <christophe.baribaud@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org