[Help-gnutls] Re: gnutls_transport_set_ptr()

Simon Josefsson jas at extundo.com
Thu Aug 26 16:43:01 CEST 2004


Martin Lambers <marlam at web.de> writes:

> Hello!
>
> This is the prototype of gnutls_transport_set_ptr() from version 1.0.19:
> void gnutls_transport_set_ptr(gnutls_session session, gnutls_transport_ptr ptr);
>
> gnutls_transport_ptr is void*, but the argument ptr is a file
> descriptor, therefore int.
>
> A cast from int to void* seems a little bit strange, and it gives
> compilation warnings like "warning: cast to pointer from integer of
> different size" on certain platforms, for example
> alpha-unknown-linux-gnu.
>
> Is there a different way to do the same?

I dunno, but I agree this is suboptimal and should be improved.  I
suspect the reason has to do with the push/pull layers, which I'm
unfamiliar with.  Patches welcome.

> BTW, all examples in the documentation use 
> gnutls_transport_set_ptr(session, (gnutls_transport_ptr_t) sd);
> (the _t is wrong).

This I can answer -- in 1.1 all types have been renamed, to *_t.  So
you are likely reading 1.1 documentation, but using 1.0.  All 1.0
types should still work in 1.1, though.  But the examples are correct
in using *_t.  See the links from
<http://www.gnu.org/software/gnutls/documentation.html> for which
manual correspond to the stable and development branch.

Regards,
Simon






More information about the Gnutls-help mailing list