From 498aad858790c5af4209fdef4096d17ab230e0fd Mon Sep 17 00:00:00 2001 From: Yang Tse Date: Thu, 13 Jul 2006 18:50:51 +0000 Subject: [PATCH] Change to meaningful var names and take care of a compiler warning on IRIX 6.5.22 MIPSPro C 7.3 64bit --- tests/server/sockfilt.c | 50 +++++++++++++++++++++++++------------------------ 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/tests/server/sockfilt.c b/tests/server/sockfilt.c index b902a67..333e02f 100644 --- a/tests/server/sockfilt.c +++ b/tests/server/sockfilt.c @@ -98,13 +98,13 @@ static volatile int sigpipe; /* Why? It's not used */ const char *serverlogfile = (char *)DEFAULT_LOGFILE; -static void lograw(unsigned char *buffer, int len) +static void lograw(unsigned char *buffer, ssize_t len) { char data[120]; - int i; + ssize_t i; unsigned char *ptr = buffer; char *optr = data; - int width=0; + ssize_t width=0; for(i=0; i data OUT */ - long len; if(5 != read(fileno(stdin), buffer, 5)) return FALSE; - len = strtol((char *)buffer, NULL, 16); + len = (ssize_t)strtol((char *)buffer, NULL, 16); if(len != read(fileno(stdin), buffer, len)) return FALSE; logmsg("> %d bytes data, server => client", len); - lograw(buffer, (int)len); + lograw(buffer, len); if(*mode == PASSIVE_LISTEN) { logmsg("*** We are disconnected!"); @@ -303,8 +305,8 @@ static int juggle(curl_socket_t *sockfdp, else { /* send away on the socket */ bytes_written = swrite(sockfd, buffer, len); - if(bytes_written != (ssize_t)len) { - logmsg("====> Not all data was sent. Bytes to send: %d Bytes sent: %d", + if(bytes_written != len) { + logmsg("Not all data was sent. Bytes to send: %d sent: %d", len, bytes_written); } } @@ -327,7 +329,7 @@ static int juggle(curl_socket_t *sockfdp, } } else if(nread == -1){ - logmsg("read %d from stdin, exiting", (int)nread); + logmsg("read %d from stdin, exiting", nread); return FALSE; } } @@ -350,9 +352,9 @@ static int juggle(curl_socket_t *sockfdp, } /* read from socket, pass on data to stdout */ - r = sread(sockfd, buffer, sizeof(buffer)); + bytes_read = sread(sockfd, buffer, sizeof(buffer)); - if(r <= 0) { + if(bytes_read <= 0) { logmsg("====> Client disconnect"); write(fileno(stdout), "DISC\n", 5); sclose(sockfd); @@ -364,12 +366,12 @@ static int juggle(curl_socket_t *sockfdp, return TRUE; } - sprintf(data, "DATA\n%04x\n", r); + sprintf(data, "DATA\n%04x\n", bytes_read); write(fileno(stdout), data, 10); - write(fileno(stdout), buffer, r); + write(fileno(stdout), buffer, bytes_read); - logmsg("< %d bytes data, client => server", r); - lograw(buffer, r); + logmsg("< %d bytes data, client => server", bytes_read); + lograw(buffer, bytes_read); } return TRUE; -- 2.7.4