[gnet-dev] [patch] fixes some minor compiler warnings



Hi,

the attached patch fixes some compiler warnings with glib2 (observed on 
MacOSX).

Apparently the glib-2.x  g_io_channel_foo() functions take a 'gsize *' 
argument for the length to be returned, instead of a 'guint *' (as glib-1.2 
did). 

Also initialised family to 0 in gnet-private.c, which fixes another (false) 
compiler warning.

Cheers
-Tim
Index: conn.c
===================================================================
RCS file: /cvs/gnome/gnet/src/conn.c,v
retrieving revision 1.18
diff -u -b -r1.18 conn.c
--- conn.c	29 Oct 2003 00:06:18 -0000	1.18
+++ conn.c	9 Dec 2003 05:13:02 -0000
@@ -740,7 +740,7 @@
   guint  bytes_to_read;
   gchar* buffer_start;
   GIOError error;
-  guint  bytes_read;
+  gsize  bytes_read;
   
   /* Resize the buffer if it's full. */
   if (conn->length == conn->bytes_read)
@@ -1135,7 +1135,7 @@
   GIOError   error;
   guint      bytes_to_write;
   gchar*     buffer_start;
-  guint      bytes_written;
+  gsize      bytes_written;
   GConnEvent event = {GNET_CONN_ERROR, NULL, 0};
 
   write = (Write*) conn->write_queue->data;
Index: gnet-private.c
===================================================================
RCS file: /cvs/gnome/gnet/src/gnet-private.c,v
retrieving revision 1.27
diff -u -b -r1.27 gnet-private.c
--- gnet-private.c	22 Aug 2003 04:29:50 -0000	1.27
+++ gnet-private.c	9 Dec 2003 05:13:02 -0000
@@ -34,7 +34,7 @@
 int
 gnet_private_create_listen_socket (int type, const GInetAddr* iface, int port, struct sockaddr_storage* sa)
 {
-  int family;
+  int family = 0;
   int sockfd;
 
   if (iface)
Index: socks-private.c
===================================================================
RCS file: /cvs/gnome/gnet/src/socks-private.c,v
retrieving revision 1.12
diff -u -b -r1.12 socks-private.c
--- socks-private.c	4 Feb 2003 20:22:58 -0000	1.12
+++ socks-private.c	9 Dec 2003 05:13:03 -0000
@@ -160,7 +160,7 @@
 {
   struct socks4_h s4h;
   struct sockaddr_in *sa_in;
-  int len;
+  gsize len;
 
   sa_in = (struct sockaddr_in*)&dst->sa;
 
@@ -188,7 +188,7 @@
   unsigned char s5r[3];
   struct socks5_h s5h;
   struct sockaddr_in *sa_in;
-  int len;
+  gsize len;
 
   s5r[0] = 5;
   s5r[1] = 1;	/* XXX no authentication yet */
@@ -271,7 +271,7 @@
   GIOChannel *ioc;
   unsigned char s5r[3];
   struct socks5_h s5h;
-  int len;
+  gsize len;
 
   ioc = gnet_tcp_socket_get_io_channel(socket);
 
@@ -321,7 +321,7 @@
 {
   gint server_port;
   struct socks5_h s5h;
-  int len;
+  gsize len;
   GIOChannel* iochannel;
   GIOError error;
   GTcpSocket* s;


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