Mercurial > audlegacy
comparison libaudacious/beepctrl.c @ 1581:68aec931b0b6 trunk
[svn] - gcc 4.1.1 fixes
author | nenolod |
---|---|
date | Mon, 14 Aug 2006 17:47:24 -0700 |
parents | 8f3c0c773c92 |
children | d7af2755a397 |
comparison
equal
deleted
inserted
replaced
1580:dae6b30c0148 | 1581:68aec931b0b6 |
---|---|
47 | 47 |
48 static gint | 48 static gint |
49 read_all(gint fd, gpointer buf, size_t count) | 49 read_all(gint fd, gpointer buf, size_t count) |
50 { | 50 { |
51 size_t left = count; | 51 size_t left = count; |
52 GTimer *timer; | |
53 gulong usec; | |
54 gint r; | 52 gint r; |
55 | |
56 timer = g_timer_new(); | |
57 | 53 |
58 do { | 54 do { |
59 if ((r = read(fd, buf, left)) < 0) { | 55 if ((r = read(fd, buf, left)) < 0) { |
60 count = -1; | 56 count = -1; |
61 break; | 57 break; |
62 } | 58 } |
63 left -= r; | 59 left -= r; |
64 buf = (gchar *) buf + r; | 60 buf = (gchar *) buf + r; |
65 g_timer_elapsed(timer, &usec); | 61 } |
66 } | 62 while (left > 0); |
67 while (left > 0 && usec <= CTRLSOCKET_IO_TIMEOUT_USEC); | 63 |
68 | |
69 g_timer_destroy(timer); | |
70 return count - left; | 64 return count - left; |
71 } | 65 } |
72 | 66 |
73 static gint | 67 static gint |
74 write_all(gint fd, gconstpointer buf, size_t count) | 68 write_all(gint fd, gconstpointer buf, size_t count) |
75 { | 69 { |
76 size_t left = count; | 70 size_t left = count; |
77 GTimer *timer; | |
78 gulong usec; | |
79 gint written; | 71 gint written; |
80 | |
81 timer = g_timer_new(); | |
82 | 72 |
83 do { | 73 do { |
84 if ((written = write(fd, buf, left)) < 0) { | 74 if ((written = write(fd, buf, left)) < 0) { |
85 count = -1; | 75 count = -1; |
86 break; | 76 break; |
87 } | 77 } |
88 left -= written; | 78 left -= written; |
89 buf = (gchar *) buf + written; | 79 buf = (gchar *) buf + written; |
90 g_timer_elapsed(timer, &usec); | 80 } |
91 } | 81 while (left > 0); |
92 while (left > 0 && usec <= CTRLSOCKET_IO_TIMEOUT_USEC); | 82 |
93 | |
94 g_timer_destroy(timer); | |
95 return count - left; | 83 return count - left; |
96 } | 84 } |
97 | 85 |
98 static gpointer | 86 static gpointer |
99 remote_read_packet(gint fd, ServerPktHeader * pkt_hdr) | 87 remote_read_packet(gint fd, ServerPktHeader * pkt_hdr) |