gcc4.x cleanup for net tests
Andrew Lunn
andrew@lunn.ch
Fri Sep 16 15:23:00 GMT 2005
Here are a bunch of compiler warning fixes with gcc 4.x with the net
tests.
Andrew
-------------- next part --------------
Index: net/common/current/ChangeLog
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/ChangeLog,v
retrieving revision 1.70
diff -u -r1.70 ChangeLog
--- net/common/current/ChangeLog 16 Sep 2005 14:56:25 -0000 1.70
+++ net/common/current/ChangeLog 16 Sep 2005 15:14:19 -0000
@@ -1,3 +1,14 @@
+2005-09-16 Andrew Lunn <andrew.lunn@ascom.ch>
+
+ * tests/server_test.c: use socklen_t.
+ * tests/nc_test_slave.c: use socklen_t and diag_print type fixes
+ to stop warnings with gcc4.x
+ * tests/tcp_echo.c: use socklen_t and diag_print type fixes to
+ stop warnings with gcc4.x
+ * tests/ping_test.c: use socklen_t.
+ * tests/dhcp_test.c: use socklen_t.
+
+
2005-09-05 David Vrabel <dvrabel@arcom.com>
Andrew Lunn <andrew.lunn@ascom.ch>
Index: net/common/current/tests/dhcp_test.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/tests/dhcp_test.c,v
retrieving revision 1.1
diff -u -r1.1 dhcp_test.c
--- net/common/current/tests/dhcp_test.c 20 May 2002 22:25:05 -0000 1.1
+++ net/common/current/tests/dhcp_test.c 16 Sep 2005 15:14:19 -0000
@@ -166,7 +166,8 @@
cyg_tick_count_t *tp;
long *dp;
struct sockaddr_in from;
- int i, len, fromlen;
+ int i, len;
+ socklen_t fromlen;
ok_recv = 0;
bogus_recv = 0;
Index: net/common/current/tests/flood.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/tests/flood.c,v
retrieving revision 1.2
diff -u -r1.2 flood.c
--- net/common/current/tests/flood.c 31 May 2002 01:05:55 -0000 1.2
+++ net/common/current/tests/flood.c 16 Sep 2005 15:14:20 -0000
@@ -216,7 +216,8 @@
{
unsigned char pkt[MAX_PACKET];
struct sockaddr_in from;
- int len, fromlen;
+ int len;
+ socklen_t fromlen;
diag_printf("PING listener...\n" );
for (;;) {
Index: net/common/current/tests/ftp_test.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/tests/ftp_test.c,v
retrieving revision 1.1
diff -u -r1.1 ftp_test.c
--- net/common/current/tests/ftp_test.c 20 May 2002 22:25:05 -0000 1.1
+++ net/common/current/tests/ftp_test.c 16 Sep 2005 15:14:20 -0000
@@ -54,7 +54,8 @@
static void
ftp_test(struct bootp *bp)
{
- int s, len, slen;
+ int s, slen;
+ socklen_t len;
struct sockaddr_in host, local;
struct servent *sent;
char buf[256];
Index: net/common/current/tests/nc_test_slave.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/tests/nc_test_slave.c,v
retrieving revision 1.3
diff -u -r1.3 nc_test_slave.c
--- net/common/current/tests/nc_test_slave.c 11 Apr 2003 20:47:20 -0000 1.3
+++ net/common/current/tests/nc_test_slave.c 16 Sep 2005 15:14:21 -0000
@@ -290,7 +290,8 @@
static void
do_tcp_test(int s1, struct nc_request *req, struct sockaddr_in *master)
{
- int i, s, len, td_len, seq, seq_errors, lost, test_chan, res;
+ int i, s, td_len, seq, seq_errors, lost, test_chan, res;
+ socklen_t len;
struct sockaddr_in test_chan_slave, test_chan_master;
struct nc_test_results results;
struct nc_test_data *tdp;
@@ -427,7 +428,8 @@
static void
nc_slave(test_param_t param)
{
- int s, masterlen;
+ int s;
+ socklen_t masterlen;
struct sockaddr_in my_addr, master;
struct nc_request req;
struct nc_reply reply;
@@ -603,7 +605,7 @@
load_idle = idle_thread_count;
start_load(0); // Shut down background load
percent_load = 100 - ((load_idle * 100) / no_load_idle);
- diag_printf("High Load[%d] = %d => %d%%\n", load_thread_level,
+ diag_printf("High Load[%ld] = %d => %d%%\n", load_thread_level,
(int)idle_thread_count, percent_load);
if ( percent_load > desired_load )
break; // HIGH level is indeed higher
@@ -622,7 +624,7 @@
load_idle = idle_thread_count;
start_load(0); // Shut down background load
percent_load = 100 - ((load_idle * 100) / no_load_idle);
- diag_printf("Load[%d] = %d => %d%%\n", load_thread_level,
+ diag_printf("Load[%ld] = %d => %d%%\n", load_thread_level,
(int)idle_thread_count, percent_load);
if (((high-low) <= 1) || (abs(desired_load-percent_load) <= 2)) break;
if (percent_load < desired_load) {
@@ -644,7 +646,7 @@
load_idle = idle_thread_count;
start_load(0); // Shut down background load
percent_load = 100 - ((load_idle * 100) / no_load_idle);
- diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level,
+ diag_printf("Final load[%ld] = %d => %d%%\n", load_thread_level,
(int)idle_thread_count, percent_load);
// no_load_idle_count_1_second = no_load_idle;
}
Index: net/common/current/tests/ping_test.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/tests/ping_test.c,v
retrieving revision 1.5
diff -u -r1.5 ping_test.c
--- net/common/current/tests/ping_test.c 30 Oct 2003 14:12:45 -0000 1.5
+++ net/common/current/tests/ping_test.c 16 Sep 2005 15:14:22 -0000
@@ -172,7 +172,8 @@
cyg_tick_count_t *tp;
long *dp;
struct sockaddr_in from;
- int i, len, fromlen;
+ int i, len;
+ socklen_t fromlen;
ok_recv = 0;
bogus_recv = 0;
Index: net/common/current/tests/server_test.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/tests/server_test.c,v
retrieving revision 1.1
diff -u -r1.1 server_test.c
--- net/common/current/tests/server_test.c 20 May 2002 22:25:05 -0000 1.1
+++ net/common/current/tests/server_test.c 16 Sep 2005 15:14:22 -0000
@@ -55,7 +55,8 @@
static void
server_test(struct bootp *bp)
{
- int s, client, client_len;
+ int s, client;
+ socklen_t client_len;
struct sockaddr_in client_addr, local;
char buf[256];
int one = 1;
Index: net/common/current/tests/tcp_echo.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/net/net/common/current/tests/tcp_echo.c,v
retrieving revision 1.3
diff -u -r1.3 tcp_echo.c
--- net/common/current/tests/tcp_echo.c 6 Oct 2002 13:07:53 -0000 1.3
+++ net/common/current/tests/tcp_echo.c 16 Sep 2005 15:14:22 -0000
@@ -216,7 +216,7 @@
load_idle = idle_thread_count;
start_load(0); // Shut down background load
percent_load = 100 - ((load_idle * 100) / no_load_idle);
- diag_printf("High Load[%d] = %d => %d%%\n", load_thread_level,
+ diag_printf("High Load[%ld] = %d => %d%%\n", load_thread_level,
(int)idle_thread_count, percent_load);
if ( percent_load > desired_load )
break; // HIGH level is indeed higher
@@ -235,7 +235,7 @@
load_idle = idle_thread_count;
start_load(0); // Shut down background load
percent_load = 100 - ((load_idle * 100) / no_load_idle);
- diag_printf("Load[%d] = %d => %d%%\n", load_thread_level,
+ diag_printf("Load[%ld] = %d => %d%%\n", load_thread_level,
(int)idle_thread_count, percent_load);
if (((high-low) <= 1) || (abs(desired_load-percent_load) <= 2)) break;
if (percent_load < desired_load) {
@@ -257,7 +257,7 @@
load_idle = idle_thread_count;
start_load(0); // Shut down background load
percent_load = 100 - ((load_idle * 100) / no_load_idle);
- diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level,
+ diag_printf("Final load[%ld] = %d => %d%%\n", load_thread_level,
(int)idle_thread_count, percent_load);
no_load_idle_count_1_second = no_load_idle;
}
@@ -359,7 +359,8 @@
struct sockaddr_in e_source_addr, e_sink_addr, local;
int one = 1;
fd_set in_fds;
- int i, num, len;
+ int i, num;
+ socklen_t len;
struct test_params params,nparams;
struct test_status status,nstatus;
@@ -443,7 +444,7 @@
params.bufsize = ntohl(nparams.bufsize);
params.load = ntohl(nparams.load);
- diag_printf("Using %d buffers of %d bytes each, %d%% background load\n",
+ diag_printf("Using %ld buffers of %ld bytes each, %ld%% background load\n",
params.nbufs, params.bufsize, params.load);
// Tell the sink what the parameters are
@@ -517,7 +518,7 @@
cyg_semaphore_wait(&idle_thread_sem); // Stop idle thread
start_load(0); // Shut down background load
i = 100 - ((idle_thread_count * 100) / no_load_idle_count_1_second );
- diag_printf("Final load[%d] = %d => %d%%\n", load_thread_level,
+ diag_printf("Final load[%ld] = %d => %d%%\n", load_thread_level,
(int)idle_thread_count, i);
//#ifdef CYGDBG_USE_ASSERTS
More information about the Ecos-patches
mailing list