changeset 1582:d7af2755a397 trunk

[svn] - gcc 4.1.0, 4.1.1, 4.1.2 tree optimization workaround: Remove read_all() and write_all() routines. They had no effect nor merit here, and generally caused trouble.
author nenolod
date Mon, 14 Aug 2006 17:55:44 -0700
parents 68aec931b0b6
children 58f3eb64f390
files ChangeLog audacious/controlsocket.c libaudacious/beepctrl.c
diffstat 3 files changed, 17 insertions(+), 90 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Aug 14 17:47:24 2006 -0700
+++ b/ChangeLog	Mon Aug 14 17:55:44 2006 -0700
@@ -1,3 +1,12 @@
+2006-08-15 00:47:24 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [2077]
+  - gcc 4.1.1 fixes
+  
+
+  Changes:        Modified:
+  +2 -14          trunk/libaudacious/beepctrl.c  
+
+
 2006-08-15 00:13:38 +0000  William Pitcock <nenolod@nenolod.net>
   revision [2075]
   - gcc 4.1.1 fix
--- a/audacious/controlsocket.c	Mon Aug 14 17:47:24 2006 -0700
+++ b/audacious/controlsocket.c	Mon Aug 14 17:55:44 2006 -0700
@@ -242,25 +242,6 @@
     g_mutex_unlock(status_mutex);
 }
 
-static gint
-write_all(gint fd, gconstpointer buf, size_t count)
-{
-    size_t left = count;
-    gint written;
-
-    do {
-        if ((written = write(fd, buf, left)) < 0) {
-            count = -1;
-            break;
-        }
-        left -= written;
-        buf = (gchar *) buf + written;
-    }
-    while (left > 0);
-
-    return count - left;
-}
-
 static void
 ctrl_write_packet(gint fd, gpointer data, gint length)
 {
@@ -268,10 +249,10 @@
 
     pkthdr.version = XMMS_PROTOCOL_VERSION;
     pkthdr.data_length = length;
-    if ((size_t)write_all(fd, &pkthdr, sizeof(ServerPktHeader)) < sizeof(pkthdr))
+    if ((size_t)write(fd, &pkthdr, sizeof(ServerPktHeader)) < sizeof(pkthdr))
         return;
     if (data && length > 0)
-        write_all(fd, data, length);
+        write(fd, data, length);
 }
 
 static void
@@ -308,31 +289,6 @@
     g_free(pkt);
 }
 
-static gint
-read_all(gint fd, gpointer buf, size_t count)
-{
-    size_t left = count;
-    GTimer *timer;
-    gulong usec;
-    gint r;
-
-    timer = g_timer_new();
-
-    do {
-        if ((r = read(fd, buf, left)) < 0) {
-            count = -1;
-            break;
-        }
-        left -= r;
-        buf = (gchar *) buf + r;
-        g_timer_elapsed(timer, &usec);
-    }
-    while (left > 0 && usec <= CTRLSOCKET_IO_TIMEOUT_USEC);
-
-    g_timer_destroy(timer);
-    return count - left;
-}
-
 static gboolean
 ctrlsocket_is_going(void)
 {
@@ -375,7 +331,7 @@
             continue;
 
         pkt = g_new0(PacketNode, 1);
-        if ((size_t)read_all(fd, &pkt->hdr, sizeof(ClientPktHeader))
+        if ((size_t)read(fd, &pkt->hdr, sizeof(ClientPktHeader))
             < sizeof(ClientPktHeader)) {
             g_free(pkt);
             continue;
@@ -384,7 +340,7 @@
         if (pkt->hdr.data_length) {
             size_t data_length = pkt->hdr.data_length;
             pkt->data = g_malloc0(data_length);
-            if ((size_t)read_all(fd, pkt->data, data_length) < data_length) {
+            if ((size_t)read(fd, pkt->data, data_length) < data_length) {
                 g_free(pkt->data);
                 g_free(pkt);
                 g_warning("ctrlsocket_func(): Incomplete data packet dropped");
--- a/libaudacious/beepctrl.c	Mon Aug 14 17:47:24 2006 -0700
+++ b/libaudacious/beepctrl.c	Mon Aug 14 17:55:44 2006 -0700
@@ -45,55 +45,17 @@
 #include <unistd.h>
 #endif
 
-static gint
-read_all(gint fd, gpointer buf, size_t count)
-{
-    size_t left = count;
-    gint r;
-
-    do {
-        if ((r = read(fd, buf, left)) < 0) {
-            count = -1;
-            break;
-        }
-        left -= r;
-        buf = (gchar *) buf + r;
-    }
-    while (left > 0);
-
-    return count - left;
-}
-
-static gint
-write_all(gint fd, gconstpointer buf, size_t count)
-{
-    size_t left = count;
-    gint written;
-
-    do {
-        if ((written = write(fd, buf, left)) < 0) {
-            count = -1;
-            break;
-        }
-        left -= written;
-        buf = (gchar *) buf + written;
-    }
-    while (left > 0);
-
-    return count - left;
-}
-
 static gpointer
 remote_read_packet(gint fd, ServerPktHeader * pkt_hdr)
 {
     gpointer data = NULL;
 
-    if (read_all(fd, pkt_hdr, sizeof(ServerPktHeader)) ==
+    if (read(fd, pkt_hdr, sizeof(ServerPktHeader)) ==
         sizeof(ServerPktHeader)) {
         if (pkt_hdr->data_length) {
             size_t data_length = pkt_hdr->data_length;
             data = g_malloc0(data_length);
-            if ((size_t)read_all(fd, data, data_length) < data_length) {
+            if ((size_t)read(fd, data, data_length) < data_length) {
                 g_free(data);
                 data = NULL;
             }
@@ -123,10 +85,10 @@
     pkt_hdr.version = XMMS_PROTOCOL_VERSION;
     pkt_hdr.command = command;
     pkt_hdr.data_length = data_length;
-    if ((size_t)write_all(fd, &pkt_hdr, sizeof(ClientPktHeader)) < sizeof(pkt_hdr))
+    if ((size_t)write(fd, &pkt_hdr, sizeof(ClientPktHeader)) < sizeof(pkt_hdr))
         return;
     if (data_length && data)
-        write_all(fd, data, data_length);
+        write(fd, data, data_length);
 }
 
 static void