help-gnutls
[Top][All Lists]
Advanced

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

[Help-gnutls] Re: 64bit + gnutls_transport_set_ptr


From: Simon Josefsson
Subject: [Help-gnutls] Re: 64bit + gnutls_transport_set_ptr
Date: Sat, 18 Mar 2006 15:54:11 +0100
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

Oliver Lupton <address@hidden> writes:

> Is there any way I can avoid this compile warning on 64bit systems?
>
> gnutls_transport_set_ptr(session->sess, (gnutls_transport_ptr_t) fd);
>
> Gives me:
>
> m_ssl_gnutls.cpp:260: warning: cast to pointer from integer of different
> size
>
> I can see why...it's casting from a 32bit int to a 64bit void*, but is
> there any way I can lose the warning without breaking the code? :)

The API do seem wrong here, casting an int to a pointer isn't
generally safe.  It should probably be changed to take a socket
pointer instead, e.g.:

gnutls_transport_set_ptr(session->sess, (gnutls_transport_ptr_t) &fd);

But this break all existing uses.  We could invent a new API and
deprecate this one.  Opinions?  Suggestions for the API name?

If there is some easier solution, i.e, if POSIX or something says that
void* must be able to hold all int values, and there is some
workaround to avoid the warning, maybe we can recommend that instead.
Updating all callers to this function is rather tedious work,
especially if all it solves is to get rid of a warning.

Thanks.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]