Kalle Olavi Niemitalo <[EMAIL PROTECTED]> writes:

> There has been a similar warning in src/network/ssl/socket.c, at
> the gnutls_transport_set_ptr call.  That could also be silenced
> with an extra cast, but this would in principle also require
> changing the code that converts the pointer back to an integer,
> and I can't find where that happens, so I'm not changing it now.
> Perhaps there is no such code and the call could just be removed.

The opposite cast is in GnuTLS itself.  I have pushed the
alignof patch to elinks-0.12, as well as the following.

Debian bug 464384: fix cast warning in ssl_connect

There are warnings about casts in the Debian amd64 build logs:
http://buildd.debian.org/fetch.cgi?&pkg=elinks&ver=0.11.3-2&arch=amd64&stamp=1200348983&file=log

        [CC]   src/intl/gettext/dcigettext.o
/build/buildd/elinks-0.11.3/src/intl/gettext/dcigettext.c: In function 
'_nl_find_msg':
/build/buildd/elinks-0.11.3/src/intl/gettext/dcigettext.c:745: warning: cast 
from pointer to integer of different size
/build/buildd/elinks-0.11.3/src/intl/gettext/dcigettext.c:746: warning: cast 
from pointer to integer of different size
...
        [CC]   src/network/ssl/socket.o
/build/buildd/elinks-0.11.3/src/network/ssl/socket.c: In function 'ssl_connect':
/build/buildd/elinks-0.11.3/src/network/ssl/socket.c:219: warning: cast to 
pointer from integer of different size

The warnings in _nl_find_msg were caused by alignof, which I already
fixed.  This commit ought to fix the gnutls_transport_set_ptr call in
ssl_connect.  This warning did not yet happen in bug 464384 because
the others broke the build before it got that far.

---
commit 6555359f8e56b6e08bd1a8f40fd363506a0e3ff5
tree 39257ecb47bd8a12e6bcf1eaa2c7ecf563cd6ef4
parent d529a1f24da6f85ac2ce67f4f4c1f7084485f538
author Kalle Olavi Niemitalo <[EMAIL PROTECTED]> Sat, 09 Feb 2008 15:07:04 +0200
committer Kalle Olavi Niemitalo <[EMAIL PROTECTED]> Sat, 09 Feb 2008 15:19:20 
+0200

 NEWS                     |    2 +-
 src/network/ssl/socket.c |    9 ++++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index c8cbfd3..6ff7805 100644
--- a/NEWS
+++ b/NEWS
@@ -129,7 +129,7 @@ Miscellaneous:
 
 Build system and compile-time errors (ignore if you don't build ELinks):
 
-* serious Debian bug 464384: fix cast warning in alignof
+* serious Debian bug 464384: fix cast warnings in alignof and ssl_connect
 * bug 725: fix version checking for Ruby in 'configure'
 * enhancement: if make -k was used and a sub-Make fails, build the
   rest before propagating
diff --git a/src/network/ssl/socket.c b/src/network/ssl/socket.c
index 19b8941..eabd8a3 100644
--- a/src/network/ssl/socket.c
+++ b/src/network/ssl/socket.c
@@ -154,8 +154,15 @@ ssl_connect(struct socket *socket)
        }
 
 #elif defined(CONFIG_GNUTLS)
+       /* GnuTLS uses function pointers for network I/O.  The default
+        * functions take a file descriptor, but it must be passed in
+        * as a pointer.  GnuTLS uses the GNUTLS_INT_TO_POINTER and
+        * GNUTLS_POINTER_TO_INT macros for these conversions, but
+        * those are unfortunately not in any public header.  So
+        * ELinks must just cast the pointer the best it can and hope
+        * that the conversions match.  */
        gnutls_transport_set_ptr(*((ssl_t *) socket->ssl),
-                                (gnutls_transport_ptr) socket->fd);
+                                (gnutls_transport_ptr) (longptr_T) socket->fd);
 
        /* TODO: Some certificates fuss. --pasky */
 #endif

Attachment: pgpvLtGvxVvQM.pgp
Description: PGP signature

Reply via email to