Daniel Stenberg <[EMAIL PROTECTED]> writes:

> On Fri, 26 Jan 2007, Simon Josefsson wrote:
>
>>> libssh2_sftp_read() might need attention anyway since it is documented to 
>>> return -1 on error which is hard to do on unsigned variables, and because 
>>> the normal read() returns ssize_t and I think this should mimic that.
>>
>> Yup, that sounds simply like a bug that should be fixed.
>
> Would ssize_t be suitable to use? IIRC, it is not present in windows...

The type seems appropriate, since POSIX read() uses it.  For Windows,
you could use an autoconf snippet like this:

  AC_CACHE_CHECK([for ssize_t], [gt_cv_ssize_t],
    [AC_TRY_COMPILE([#include <sys/types.h>],
       [int x = sizeof (ssize_t *) + sizeof (ssize_t);
        return !x;],
       [gt_cv_ssize_t=yes], [gt_cv_ssize_t=no])])
  if test $gt_cv_ssize_t = no; then
    AC_DEFINE([ssize_t], [int],
              [Define as a signed type of the same size as size_t.])
  fi

I recall that some Windows versions have the types 'SSIZE_T' or
'_ssize_t' (which were not the same size as 'int' on some
architectures, IIRC), which could also be checked for...

>> In general, I'd like to see all the string lengths be 'size_t' instead of 
>> 'unsigned int' or 'unsigned long' too...  however, I didn't start on that 
>> since it typically ends up changing the entire code base, and ultimately the 
>> APIs too, something I didn't want to do in my first commit.
>
> I completely agree with this. And I'm also in favour of fixing this once and 
> for all, even if that means API breakage.

Yup.

/Simon

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
libssh2-devel mailing list
libssh2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libssh2-devel

Reply via email to