Subject: Re: Visual Studio 6 compilation issues (libssh2 1.2.4)

Re: Visual Studio 6 compilation issues (libssh2 1.2.4)

From: Simon Josefsson <>
Date: Wed, 10 Mar 2010 09:11:19 +0100

"Neil Gierman" <> writes:

> I noticed 446 compiler warnings related to data type conversions when
> compiling in VS2008 Itanium mode. They are mostly size_t to unsigned
> long/int conversion warnings. We have defined that in most places the length
> of messages and packets to be unsigned long or unsigned int. In most places
> we are storing the return of strlen() and other related function in to our
> length variables. An example is the definition of libssh2_error() where we
> are storing the return of strlen(errmsg) into session->err_msglen. Strlen
> returns size_t and in Win64 builds, size_t = unsigned __int64. Long = 4
> bytes, __int64 = 8bytes
> ( There are
> quite a number of changes to sync up data types to match size_t and I don't
> know if some of those would break the API/ABI. Or we could go the easy way
> and cast the returns of strlen, etc to unsigned long (or whatever we want it
> as) however I think that is masking a future problem.

Agreed. Libssh2 is broken here, the Right Thing is to always use size_t
for string lengths. This change will break the ABI if we don't rename
all the functions though...

Received on 2010-03-10