[gnet-dev] amd64 fixes



Hi, all.
        
I'm an amd64 dev for Gentoo, and we had a bug submitted that gnet 2.0.7
didn't build with --enable-debug (which of course enables -Werror).  As
a result, I went through and fixed all the build errors with
--enable-debug, and here's the patch.  Most of these are changes of
guint to gsize, because gsize is a long, which is 64-bits on amd64.  The
only part I'm leary about is the hunk at the end.  It obviously deals
with other arches than Linux, so the define check might have to be
changed to accommodate other Unix variations.

-- 
Daniel Gryniewicz
Gentoo AMD64 Team
diff --exclude-from=/home/dang/.diffrc -u -ruN gnet-2.0.7/doc/version.xml gnet-2.0.7.amd64/doc/version.xml
--- gnet-2.0.7/doc/version.xml	2005-02-23 07:31:55.000000000 -0500
+++ gnet-2.0.7.amd64/doc/version.xml	1969-12-31 19:00:00.000000000 -0500
@@ -1 +0,0 @@
-2.0.7
diff --exclude-from=/home/dang/.diffrc -u -ruN gnet-2.0.7/examples/echoclient-async.c gnet-2.0.7.amd64/examples/echoclient-async.c
--- gnet-2.0.7/examples/echoclient-async.c	2004-09-27 20:27:43.000000000 -0400
+++ gnet-2.0.7.amd64/examples/echoclient-async.c	2005-09-12 21:50:18.000000000 -0400
@@ -122,7 +122,7 @@
     {
       GIOError error;
       gchar buffer[1024];
-      guint bytes_read;
+      gsize bytes_read;
 
       /* Read the data into our buffer */
       error = g_io_channel_read (iochannel, buffer, 
@@ -185,7 +185,7 @@
     {
       GIOError error;
       gchar buffer[1024];
-      guint bytes_read;
+      gsize bytes_read;
 
       /* Read the data into our buffer */
       error = gnet_io_channel_readline (iochannel, buffer, 
@@ -213,7 +213,7 @@
 	{
 	  GIOChannel* sin;
 	  GIOError error;
-	  guint bytes_written;
+	  gsize bytes_written;
 
 	  sin = (GIOChannel*) data;
 	  error = gnet_io_channel_writen (sin, buffer, bytes_read, 
diff --exclude-from=/home/dang/.diffrc -u -ruN gnet-2.0.7/examples/echoclient-gconn.c gnet-2.0.7.amd64/examples/echoclient-gconn.c
--- gnet-2.0.7/examples/echoclient-gconn.c	2003-02-05 18:40:39.000000000 -0500
+++ gnet-2.0.7.amd64/examples/echoclient-gconn.c	2005-09-12 21:51:20.000000000 -0400
@@ -98,7 +98,7 @@
     {
       GIOError error;
       gchar buffer[1024];
-      guint bytes_read;
+      gsize bytes_read;
 
       /* Read the data into our buffer */
       error = gnet_io_channel_readline (iochannel, buffer, 
diff --exclude-from=/home/dang/.diffrc -u -ruN gnet-2.0.7/examples/echoclient-unix.c gnet-2.0.7.amd64/examples/echoclient-unix.c
--- gnet-2.0.7/examples/echoclient-unix.c	2003-02-03 12:56:14.000000000 -0500
+++ gnet-2.0.7.amd64/examples/echoclient-unix.c	2005-09-12 21:51:43.000000000 -0400
@@ -78,7 +78,7 @@
   GUnixSocket *socket = NULL;
   GIOChannel* iochannel = NULL;
   gchar buffer[1024];
-  guint n;
+  gsize n;
   GIOError e = G_IO_ERROR_NONE;
 
   g_assert(path != NULL);
diff --exclude-from=/home/dang/.diffrc -u -ruN gnet-2.0.7/examples/echoclient.c gnet-2.0.7.amd64/examples/echoclient.c
--- gnet-2.0.7/examples/echoclient.c	2003-02-04 15:22:57.000000000 -0500
+++ gnet-2.0.7.amd64/examples/echoclient.c	2005-09-12 21:46:39.000000000 -0400
@@ -34,7 +34,7 @@
   GIOChannel* iochannel;
   GIOError error = G_IO_ERROR_NONE;
   gchar buffer[1024];
-  guint n;
+  gsize n;
 
   gnet_init ();
 
diff --exclude-from=/home/dang/.diffrc -u -ruN gnet-2.0.7/examples/echoserver-async.c gnet-2.0.7.amd64/examples/echoserver-async.c
--- gnet-2.0.7/examples/echoserver-async.c	2003-02-04 15:22:57.000000000 -0500
+++ gnet-2.0.7.amd64/examples/echoserver-async.c	2005-09-12 21:50:57.000000000 -0400
@@ -187,7 +187,7 @@
   if (condition & G_IO_IN)
     {
       GIOError error;
-      guint bytes_read;
+      gsize bytes_read;
 
       /* Read the data into our buffer */
       error = 
@@ -247,7 +247,7 @@
   if (condition & G_IO_OUT)
     {
       GIOError error;
-      guint bytes_written;
+      gsize bytes_written;
 
       /* Write the data out */
       error = g_io_channel_write(iochannel, client_state->buffer, 
diff --exclude-from=/home/dang/.diffrc -u -ruN gnet-2.0.7/examples/echoserver-unix.c gnet-2.0.7.amd64/examples/echoserver-unix.c
--- gnet-2.0.7/examples/echoserver-unix.c	2003-02-03 12:56:14.000000000 -0500
+++ gnet-2.0.7.amd64/examples/echoserver-unix.c	2005-09-12 21:52:21.000000000 -0400
@@ -95,7 +95,7 @@
 {
   GUnixSocket *client = NULL;
   gchar buffer[1024];
-  guint n;
+  gsize n;
   GIOChannel *ioclient = NULL;
   GIOError e;
 
@@ -228,7 +228,7 @@
   /* Check for data to be read (or if the socket was closed) */
   if (c & G_IO_IN) {
     GIOError e;
-    guint bytes_read;
+    gsize bytes_read;
 
     /* Read the data into our buffer */
     e = g_io_channel_read(iochannel,
@@ -259,7 +259,7 @@
   }
   if (c & G_IO_OUT) {
     GIOError e;
-    guint bytes_written;
+    gsize bytes_written;
     /* Write the data out */
     e = g_io_channel_write(iochannel, cs->buffer, cs->n,
 			   &bytes_written);
diff --exclude-from=/home/dang/.diffrc -u -ruN gnet-2.0.7/examples/echoserver.c gnet-2.0.7.amd64/examples/echoserver.c
--- gnet-2.0.7/examples/echoserver.c	2003-02-04 15:22:57.000000000 -0500
+++ gnet-2.0.7.amd64/examples/echoserver.c	2005-09-12 21:48:10.000000000 -0400
@@ -40,7 +40,7 @@
   gchar*      name;
   GTcpSocket* client = NULL;
   gchar       buffer[1024];
-  guint       n;
+  gsize       n;
   GIOChannel* ioclient = NULL;
   GIOError    error;
 
diff --exclude-from=/home/dang/.diffrc -u -ruN gnet-2.0.7/examples/hfetch.c gnet-2.0.7.amd64/examples/hfetch.c
--- gnet-2.0.7/examples/hfetch.c	2003-02-03 12:56:14.000000000 -0500
+++ gnet-2.0.7.amd64/examples/hfetch.c	2005-09-12 21:52:52.000000000 -0400
@@ -113,7 +113,7 @@
   gchar* command;
   gchar buffer[1024];
   GIOError error;
-  guint n;
+  gsize n;
 
 
   /* Create the address */
diff --exclude-from=/home/dang/.diffrc -u -ruN gnet-2.0.7/src/conn-http.c gnet-2.0.7.amd64/src/conn-http.c
--- gnet-2.0.7/src/conn-http.c	2005-02-19 12:15:51.000000000 -0500
+++ gnet-2.0.7.amd64/src/conn-http.c	2005-09-12 21:45:38.000000000 -0400
@@ -632,7 +632,7 @@
 			/* Note: this must be 1.1 */
 			g_string_append_printf (request, "POST %s HTTP/1.1\r\n", resource);
 			
-			g_snprintf(buf, sizeof(buf), "%u", conn->post_data_len);
+			g_snprintf(buf, sizeof(buf), "%"G_GSIZE_FORMAT, conn->post_data_len);
 			
 			gnet_conn_http_set_header (conn, "Expect", "100-continue", 0);
 			gnet_conn_http_set_header (conn, "Content-Length", buf, 0);
diff --exclude-from=/home/dang/.diffrc -u -ruN gnet-2.0.7/src/gnet-private.h gnet-2.0.7.amd64/src/gnet-private.h
--- gnet-2.0.7/src/gnet-private.h	2004-09-26 22:04:49.000000000 -0400
+++ gnet-2.0.7.amd64/src/gnet-private.h	2005-09-12 21:31:40.000000000 -0400
@@ -86,7 +86,7 @@
 #define SOCKET gint
 #endif
 
-#ifndef socklen_t
+#ifndef __socklen_t_defined
 #  ifdef GNET_APPLE_DARWIN
 #    define socklen_t int	/* socklen_t is int in Darwin */
 #  else


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