[Geany-devel] Breaks not fixes : SF.net SVN: geany:[5971] trunk/src/socket.c

Nick Treleaven nick.treleaven at xxxxx
Fri Sep 30 11:20:20 UTC 2011


On 30/09/2011 02:32, Lex Trotman wrote:
> Modified: trunk/src/socket.c
> ===================================================================
> --- trunk/src/socket.c  2011-09-29 17:16:58 UTC (rev 5970)
> +++ trunk/src/socket.c  2011-09-29 17:49:42 UTC (rev 5971)
> @@ -588,7 +588,7 @@
>         gint fd, sock;
>         gchar buf[BUFFER_LENGTH];
>         struct sockaddr_in caddr;
> -       guint caddr_len = sizeof(caddr);
> +       gint caddr_len = sizeof(caddr);
>         GtkWidget *window = data;
>         gboolean popup = FALSE;
>
> Hi Nick,
>
> This causes a warning on the call to accept() on Linux.
>
>    CC     socket.o
> socket.c: In function ‘socket_lock_input_cb’:
> socket.c:596: warning: pointer targets in passing argument 3 of
> ‘accept’ differ in signedness
> /usr/include/sys/socket.h:214: note: expected ‘socklen_t *
> __restrict__’ but argument is of type ‘gint *’
>
> caddr_len s/b a socklen_t not a ganything, that works here.
>
> Hopefully on your system it will be able to be assigned from sizeof
> without a warning.
 >
> Looks like your crappy windows system :) has sizeof signed, but on
> most Linux systems its unsigned.

No, the assignment wasn't the warning, just the pointer signedness.

> If socklen_t doesn't match sizeof then special windows handling is
> going to be needed.

I misunderstood a note on the linux manpage for accept, thinking int is 
the proper type. Thanks for finding the bug. I've reverted the change 
for the 0.21 release, just in case some systems don't have socklen_t, 
but used socklen_t in the unstable branch.

I should have wondered why I hadn't seen the warning on Linux.



More information about the Devel mailing list