Guenter <[email protected]> writes:

> Hi,
> in libssh2.h we have:
>
> typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE
> {
>     char* text;
>     unsigned int length;
> } LIBSSH2_USERAUTH_KBDINT_RESPONSE;
>
> I would like to change this to:
>
> typedef struct _LIBSSH2_USERAUTH_KBDINT_RESPONSE
> {
>     char* text;
>     size_t length;
> } LIBSSH2_USERAUTH_KBDINT_RESPONSE;
>
> since usually the length is calculated with strlen() which returns
> size_t ...
>
> then we have a bunch of APIs which should also be corrected, f.e.:
>
> LIBSSH2_API char *libssh2_userauth_list(LIBSSH2_SESSION *session,
>                                         const char *username,
>                                         unsigned int username_len);
>
> LIBSSH2_API int libssh2_userauth_password_ex(LIBSSH2_SESSION *session,
>                                              const char *username,
>                                              unsigned int username_len,
>                                              const char *password,
>                                              unsigned int password_len,
>
> LIBSSH2_PASSWD_CHANGEREQ_FUNC((*passwd_change_cb)));
>
> and a couple more; though question is here: when can we change these
> public APIs? As it currently is there's only a prob (compiler warning)
> on 64-bit platforms; on 32-bit both uint and size_t are 32-bit ...
> so we would only produce a new compiler warning for those who are on
> 64-bit + have casted strlen() results to uint ...
>
> comments?

I'd like to see this change happen to -- it is arguable the correct type
for these variables -- but I believe it breaks the ABI on systems where
sizeof (size_t) != sizeof (unsigned int).  So we'd have to increment the
shared library version for this change...

Can we do other cleanups at the same time?  I'm not sure if it is a good
idea to break ABI compatibility just because of the change above.  On
the other hand, if we want to do it, now is a better time than later
because libssh2 is still a relatively young project.

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

Reply via email to