bug-cvs
[Top][All Lists]
Advanced

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

size_t/int warnings


From: Alexander Taler
Subject: size_t/int warnings
Date: Sun, 10 Oct 2004 11:08:24 -0400

[ Resend.  Patch in the other email was corrupted by the signing
process.  That's annoying! ]

After my recent size_t/int woes, I searched for more such
compiler warnings, and found some in buffer.c, server.c and
zlib.c.  I am including a patch which corrects them.  The zlib.c
warnings were easy to fix.  The server.c and buffer.c ones were
interrelated, and caused by using size_t's with the buffer.c
functions that take int.  The fix grew a bit from these initial
files to include some functions in client.c.

To correct the problem, I chose to change several functions in
buffer.c to use size_t instead of int when referring to buffer
sizes, offsets, and counts.  Here is a summary of the new
prototypes:

void buf_output (struct buffer *, const char *, size_t);
int buf_input_data (struct buffer *, size_t *);
int buf_read_line (struct buffer *, char **, size_t *);
int buf_read_data (struct buffer *, size_t, char **, size_t *);

Also, the packetizing_buffer struct contains function pointers,
which are passed to packetizing_buffer_initialize.  The new
prototypes for those functions are:

     int (*inpfn) (void *fnclosure, const char *input, char *output,
                   size_t size);
     int (*outfn) (void *fnclosure, const char *input, char *output,
                   size_t size, size_t *translated);

There was no need to change the corresponding function pointers
in struct buffer, since they already used size_t.

Furthermore, I changed the type of the size member of struct
buffer_data.

To accomodate the new function prototypes, I changed the types of
several variable in buffer.c and server.c.  Sometimes these were
used with strlen or memcpy, making the change seem reasonable.

It transpired that in client.c read_line_via() returns a value
returned by buf_read_line(), which is now of type size_t.  I
changed the return type of read_line_via() and read_line() to
size_t, which necessitated a change to the parameters of all the
handle_* functions.  That parameter is only used rarely in the
handle_* functions, and is passed to fwrite in two cases, where
size_t is the correct type anyway.

Several other prototypes in client.c and server.c were also
changed.

I removed some casts of the NULL pointer.  Does the cvs coding
style require these?  They aren't always present.

I've run sanity.sh against these changes, which was successful up
to the log-13 test, but is blocked beyond that due to my other
getopt problems.

Here are the compiler warnings as reference:

if gcc -DHAVE_CONFIG_H -I. -I/home/cvstest/cvs-nightly/src -I..  
-I/home/cvstest/
cvs-nightly/lib -I../lib  -I/home/cvstest/cvs-nightly/diff 
-I/home/cvstest/cvs-ni
ghtly/zlib  -Ino/include  -g -O2 -MT buffer.o -MD -MP -MF ".deps/buffer.Tpo" -c 
-
o buffer.o /home/cvstest/cvs-nightly/src/buffer.c;  then mv -f 
".deps/buffer.Tpo"
 ".deps/buffer.Po"; else rm -f ".deps/buffer.Tpo"; exit 1; fi
/home/cvstest/cvs-nightly/src/buffer.c: In function `buf_send_output':
/home/cvstest/cvs-nightly/src/buffer.c:299: warning: passing arg 4 of pointer 
to 
function from incompatible pointer type
/home/cvstest/cvs-nightly/src/buffer.c: In function `buf_input_data':
/home/cvstest/cvs-nightly/src/buffer.c:798: warning: passing arg 5 of pointer 
to 
function from incompatible pointer type
/home/cvstest/cvs-nightly/src/buffer.c: In function `buf_read_line':
/home/cvstest/cvs-nightly/src/buffer.c:834: warning: passing arg 3 of 
`buf_read_s
hort_line' from incompatible pointer type
/home/cvstest/cvs-nightly/src/buffer.c: In function `buf_read_short_line':
/home/cvstest/cvs-nightly/src/buffer.c:951: warning: passing arg 5 of pointer 
to 
function from incompatible pointer type
/home/cvstest/cvs-nightly/src/buffer.c: In function `buf_read_data':
/home/cvstest/cvs-nightly/src/buffer.c:1027: warning: passing arg 5 of pointer 
to
 function from incompatible pointer type
/home/cvstest/cvs-nightly/src/buffer.c: In function `packetizing_buffer_input':
/home/cvstest/cvs-nightly/src/buffer.c:1473: warning: passing arg 4 of 
`buf_read_
data' from incompatible pointer type
/home/cvstest/cvs-nightly/src/buffer.c:1532: warning: passing arg 4 of 
`buf_read_
data' from incompatible pointer type
/home/cvstest/cvs-nightly/src/buffer.c: In function `packetizing_buffer_output':
/home/cvstest/cvs-nightly/src/buffer.c:1684: warning: passing arg 5 of pointer 
to
 function from incompatible pointer type
if gcc -DHAVE_CONFIG_H -I. -I/home/cvstest/cvs-nightly/src -I..  
-I/home/cvstest/
cvs-nightly/lib -I../lib  -I/home/cvstest/cvs-nightly/diff 
-I/home/cvstest/cvs-ni
ghtly/zlib  -Ino/include  -g -O2 -MT server.o -MD -MP -MF ".deps/server.Tpo" -c 
-
o server.o /home/cvstest/cvs-nightly/src/server.c;  then mv -f 
".deps/server.Tpo"
 ".deps/server.Po"; else rm -f ".deps/server.Tpo"; exit 1; fi
/home/cvstest/cvs-nightly/src/server.c: In function `become_proxy':
/home/cvstest/cvs-nightly/src/server.c:2525: warning: passing arg 2 of 
`buf_input
_data' from incompatible pointer type
/home/cvstest/cvs-nightly/src/server.c:2536: warning: passing arg 4 of 
`buf_read_
data' from incompatible pointer type
/home/cvstest/cvs-nightly/src/server.c:2556: warning: passing arg 4 of 
`buf_read_
data' from incompatible pointer type
if gcc -DHAVE_CONFIG_H -I. -I/home/cvstest/cvs-nightly/src -I..  
-I/home/cvstest/
cvs-nightly/lib -I../lib  -I/home/cvstest/cvs-nightly/diff 
-I/home/cvstest/cvs-ni
ghtly/zlib  -Ino/include  -g -O2 -MT zlib.o -MD -MP -MF ".deps/zlib.Tpo" -c -o 
zl
ib.o /home/cvstest/cvs-nightly/src/zlib.c;  then mv -f ".deps/zlib.Tpo" 
".deps/zl
ib.Po"; else rm -f ".deps/zlib.Tpo"; exit 1; fi
/home/cvstest/cvs-nightly/src/zlib.c: In function `compress_buffer_input':
/home/cvstest/cvs-nightly/src/zlib.c:221: warning: passing arg 5 of pointer to 
fu
nction from incompatible pointer type
/home/cvstest/cvs-nightly/src/zlib.c: In function 
`compress_buffer_shutdown_input
':
/home/cvstest/cvs-nightly/src/zlib.c:372: warning: passing arg 5 of 
`compress_buf
fer_input' from incompatible pointer type



Index: src/ChangeLog
===================================================================
RCS file: /cvs/ccvs/src/ChangeLog,v
retrieving revision 1.2960
diff -u -r1.2960 ChangeLog
--- src/ChangeLog       8 Oct 2004 19:45:19 -0000       1.2960
+++ src/ChangeLog       10 Oct 2004 14:41:05 -0000
@@ -1,3 +1,27 @@
+2004-10-10  
+
+       * buffer.h, buffer.c (buf_output, buf_input_data, buf_read_line,
+       buf_read_data, struct packetizing_buffer,
+       packetizing_buffer_initialize)
+       * client.c (read_line_via, read_line, try_read_from_server,
+       get_server_response, handle_ok, handle_error,
+       handle_valid_requests, handle_checked_in, handle_new_entry,
+       handle_checksum, handle_copy_file, handle_updated, handle_merged,
+       handle_patched, handle_rcs_diff, handle_removed,
+       handle_remove_entry, handle_set_static_directory,
+       handle_clear_static_directory, handle_set_sticky,
+       handle_clear_sticky, handle_clear_template,
+       handle_module_expansion, handle_wrapper_rcs_option, handle_m,
+       handle_e, handle_f, handle_notified)
+       * client.h (struct response)
+       * server.c (receive_partial_file, receive_file, serve_modified,
+       do_cvs_command)
+       * zlib.c (compress_buffer_input, compress_buffer_shutdown_input)
+       Use size_t instead of int.  Silences warnings in buffer.c,
+       server.c, and zlib.c on OpenBSD sparc64 where sizeof(int) is not
+       the same as sizeof(size_t).
+       (Patch from Alexander Taler <address@hidden>.)
+
 2004-10-08  Derek Price  <address@hidden>
 
        * client.c (send_args): Carry through a const to silence gcc -Wall.
Index: src/buffer.c
===================================================================
RCS file: /cvs/ccvs/src/buffer.c,v
retrieving revision 1.49
diff -u -r1.49 buffer.c
--- src/buffer.c        24 Sep 2004 17:55:27 -0000      1.49
+++ src/buffer.c        10 Oct 2004 14:41:05 -0000
@@ -193,7 +193,7 @@
 
 /* Add data DATA of length LEN to BUF.  */
 void
-buf_output (struct buffer *buf, const char *data, int len)
+buf_output (struct buffer *buf, const char *data, size_t len)
 {
     if (buf->data != NULL
        && (((buf->last->text + BUFFER_DATA_SIZE)
@@ -293,7 +293,8 @@
 
        if (data->size > 0)
        {
-           int status, nbytes;
+           int status;
+           size_t nbytes;
 
            status = (*buf->output) (buf->closure, data->bufp, data->size,
                                     &nbytes);
@@ -754,7 +755,7 @@
  * bytes read.
  */
 int
-buf_input_data (struct buffer *buf, int *countp)
+buf_input_data (struct buffer *buf, size_t *countp)
 {
     assert (buf->input != NULL);
 
@@ -763,8 +764,8 @@
 
     while (1)
     {
-       int get;
-       int status, nbytes;
+       int status;
+       size_t get, nbytes;
 
        if (buf->data == NULL
            || (buf->last->bufp + buf->last->size
@@ -829,7 +830,7 @@
  * Maintains LAST_INDEX & LAST_COUNT.
  */
 int
-buf_read_line (struct buffer *buf, char **line, int *lenp)
+buf_read_line (struct buffer *buf, char **line, size_t *lenp)
 {
     return buf_read_short_line (buf, line, lenp, SIZE_MAX);
 }
@@ -916,7 +917,8 @@
        predicted_len = 0;
        while (1)
        {
-           int size, status, nbytes;
+           int status;
+           size_t size, nbytes;
            char *mem;
 
            if (buf->data == NULL
@@ -985,7 +987,7 @@
  * Maintains LAST_INDEX & LAST_COUNT.
  */
 int
-buf_read_data (struct buffer *buf, int want, char **retdata, int *got)
+buf_read_data (struct buffer *buf, size_t want, char **retdata, size_t *got)
 {
     assert (buf->input != NULL);
 
@@ -1004,7 +1006,8 @@
     if (buf->data == NULL)
     {
        struct buffer_data *data;
-       int get, status, nbytes;
+       int status;
+       size_t get, nbytes;
 
        data = get_buffer_data ();
        if (data == NULL)
@@ -1343,7 +1346,7 @@
        SIZE is the amount of data in INPUT, and is also the size of
        OUTPUT.  This should return 0 on success, or an errno code.  */
     int (*inpfn) (void *fnclosure, const char *input, char *output,
-                       int size);
+                       size_t size);
     /* The output translation function.  This should translate the
        data in INPUT, storing the result in OUTPUT.  The first two
        bytes in INPUT will be the size of the data, and so will SIZE.
@@ -1351,7 +1354,7 @@
        OUTPUT.  OUTPUT is large enough to hold SIZE + PACKET_SLOP
        bytes.  This should return 0 on success, or an errno code.  */
     int (*outfn) (void *fnclosure, const char *input, char *output,
-                       int size, int *translated);
+                       size_t size, size_t *translated);
     /* A closure for the translation function.  */
     void *fnclosure;
     /* For an input buffer, we may have to buffer up data here.  */
@@ -1386,9 +1389,9 @@
 struct buffer *
 packetizing_buffer_initialize (struct buffer *buf,
                                int (*inpfn) (void *, const char *, char *,
-                                             int),
+                                             size_t),
                                int (*outfn) (void *, const char *, char *,
-                                             int, int *),
+                                             size_t, size_t *),
                                void *fnclosure,
                                void (*memory) (struct buffer *))
 {
Index: src/buffer.h
===================================================================
RCS file: /cvs/ccvs/src/buffer.h,v
retrieving revision 1.19
diff -u -r1.19 buffer.h
--- src/buffer.h        18 Sep 2004 01:16:36 -0000      1.19
+++ src/buffer.h        10 Oct 2004 14:41:06 -0000
@@ -97,7 +97,7 @@
     char *bufp;
 
     /* The number of data bytes found at BUFP.  */
-    int size;
+    size_t size;
 
     /*
      * Actual buffer.  This never changes after the structure is
@@ -127,12 +127,12 @@
 struct buffer *compress_buffer_initialize (struct buffer *, int, int,
                                           void (*) (struct buffer *));
 struct buffer *packetizing_buffer_initialize
-       (struct buffer *, int (*) (void *, const char *, char *, int),
-        int (*) (void *, const char *, char *, int, int *), void *,
+       (struct buffer *, int (*) (void *, const char *, char *, size_t),
+        int (*) (void *, const char *, char *, size_t, size_t *), void *,
         void (*) (struct buffer *));
 int buf_empty (struct buffer *);
 int buf_empty_p (struct buffer *);
-void buf_output (struct buffer *, const char *, int);
+void buf_output (struct buffer *, const char *, size_t);
 void buf_output0 (struct buffer *, const char *);
 void buf_append_char (struct buffer *, int);
 int buf_send_output (struct buffer *);
@@ -147,11 +147,11 @@
 int buf_read_file (FILE *, long, struct buffer_data **, struct buffer_data **);
 int buf_read_file_to_eof (FILE *, struct buffer_data **,
                          struct buffer_data **);
-int buf_input_data (struct buffer *, int *);
-int buf_read_line (struct buffer *, char **, int *);
+int buf_input_data (struct buffer *, size_t *);
+int buf_read_line (struct buffer *, char **, size_t *);
 int buf_read_short_line (struct buffer *buf, char **line, size_t *lenp,
                          size_t max);
-int buf_read_data (struct buffer *, int, char **, int *);
+int buf_read_data (struct buffer *, size_t, char **, size_t *);
 void buf_copy_lines (struct buffer *, struct buffer *, int);
 int buf_copy_counted (struct buffer *, struct buffer *, int *);
 int buf_chain_length (struct buffer_data *);
Index: src/client.c
===================================================================
RCS file: /cvs/ccvs/src/client.c,v
retrieving revision 1.397
diff -u -r1.397 client.c
--- src/client.c        8 Oct 2004 19:45:19 -0000       1.397
+++ src/client.c        10 Oct 2004 14:41:07 -0000
@@ -69,30 +69,30 @@
 int update (int argc, char **argv);
 
 /* All the response handling functions.  */
-static void handle_ok (char *, int);
-static void handle_error (char *, int);
-static void handle_valid_requests (char *, int);
-static void handle_checked_in (char *, int);
-static void handle_new_entry (char *, int);
-static void handle_checksum (char *, int);
-static void handle_copy_file (char *, int);
-static void handle_updated (char *, int);
-static void handle_merged (char *, int);
-static void handle_patched (char *, int);
-static void handle_rcs_diff (char *, int);
-static void handle_removed (char *, int);
-static void handle_remove_entry (char *, int);
-static void handle_set_static_directory (char *, int);
-static void handle_clear_static_directory (char *, int);
-static void handle_set_sticky (char *, int);
-static void handle_clear_sticky (char *, int);
-static void handle_clear_template (char *, int);
-static void handle_module_expansion (char *, int);
-static void handle_wrapper_rcs_option (char *, int);
-static void handle_m (char *, int);
-static void handle_e (char *, int);
-static void handle_f (char *, int);
-static void handle_notified (char *, int);
+static void handle_ok (char *, size_t);
+static void handle_error (char *, size_t);
+static void handle_valid_requests (char *, size_t);
+static void handle_checked_in (char *, size_t);
+static void handle_new_entry (char *, size_t);
+static void handle_checksum (char *, size_t);
+static void handle_copy_file (char *, size_t);
+static void handle_updated (char *, size_t);
+static void handle_merged (char *, size_t);
+static void handle_patched (char *, size_t);
+static void handle_rcs_diff (char *, size_t);
+static void handle_removed (char *, size_t);
+static void handle_remove_entry (char *, size_t);
+static void handle_set_static_directory (char *, size_t);
+static void handle_clear_static_directory (char *, size_t);
+static void handle_set_sticky (char *, size_t);
+static void handle_clear_sticky (char *, size_t);
+static void handle_clear_template (char *, size_t);
+static void handle_module_expansion (char *, size_t);
+static void handle_wrapper_rcs_option (char *, size_t);
+static void handle_m (char *, size_t);
+static void handle_e (char *, size_t);
+static void handle_f (char *, size_t);
+static void handle_notified (char *, size_t);
 
 static size_t try_read_from_server (char *, size_t);
 
@@ -414,13 +414,13 @@
  *
  * Returns number of bytes read.
  */
-static int
+static size_t
 read_line_via (struct buffer *via_from_buffer, struct buffer *via_to_buffer,
                char **resultp)
 {
     int status;
     char *result;
-    int len;
+    size_t len;
 
     status = buf_flush (via_to_buffer, 1);
     if (status != 0)
@@ -448,7 +448,7 @@
 
 
 
-static int
+static size_t
 read_line (char **resultp)
 {
   return read_line_via (global_from_server, global_to_server, resultp);
@@ -487,7 +487,7 @@
 
 
 static void
-handle_ok (char *args, int len)
+handle_ok (char *args, size_t len)
 {
     return;
 }
@@ -495,7 +495,7 @@
 
 
 static void
-handle_error (char *args, int len)
+handle_error (char *args, size_t len)
 {
     int something_printed;
     
@@ -531,7 +531,7 @@
 
 
 static void
-handle_valid_requests (char *args, int len)
+handle_valid_requests (char *args, size_t len)
 {
     char *p = args;
     char *q;
@@ -589,7 +589,7 @@
  *   current_parsed_root       Updated to point to the new CVSROOT.
  */
 static void
-handle_redirect (char *args, int len)
+handle_redirect (char *args, size_t len)
 {
     TRACE (TRACE_FUNCTION, "handle_redirect (%s)", args);
 
@@ -1077,7 +1077,7 @@
 
 
 static void
-handle_copy_file (char *args, int len)
+handle_copy_file (char *args, size_t len)
 {
     call_in_directory (args, copy_a_file, NULL);
 }
@@ -1212,7 +1212,7 @@
 static int stored_checksum_valid;
 static unsigned char stored_checksum[16];
 static void
-handle_checksum (char *args, int len)
+handle_checksum (char *args, size_t len)
 {
     char *s;
     char buf[3];
@@ -1245,7 +1245,7 @@
 /* Mode that we got in a "Mode" response (malloc'd), or NULL if none.  */
 static char *stored_mode;
 static void
-handle_mode (char *args, int len)
+handle_mode (char *args, size_t len)
 {
     if (stored_mode != NULL)
        error (1, 0, "protocol error: duplicate Mode");
@@ -1259,7 +1259,7 @@
 /* Time specified in Mod-time.  */
 static time_t stored_modtime;
 static void
-handle_mod_time (char *args, int len)
+handle_mod_time (char *args, size_t len)
 {
     if (stored_modtime_valid)
        error (0, 0, "protocol error: duplicate Mod-time");
@@ -1857,7 +1857,7 @@
 
 
 static void
-handle_checked_in (char *args, int len)
+handle_checked_in (char *args, size_t len)
 {
     struct update_entries_data dat;
     dat.contents = UPDATE_ENTRIES_CHECKIN;
@@ -1869,7 +1869,7 @@
 
 
 static void
-handle_new_entry (char *args, int len)
+handle_new_entry (char *args, size_t len)
 {
     struct update_entries_data dat;
     dat.contents = UPDATE_ENTRIES_CHECKIN;
@@ -1881,7 +1881,7 @@
 
 
 static void
-handle_updated (char *args, int len)
+handle_updated (char *args, size_t len)
 {
     struct update_entries_data dat;
     dat.contents = UPDATE_ENTRIES_UPDATE;
@@ -1893,7 +1893,7 @@
 
 
 static void
-handle_created (char *args, int len)
+handle_created (char *args, size_t len)
 {
     struct update_entries_data dat;
     dat.contents = UPDATE_ENTRIES_UPDATE;
@@ -1905,7 +1905,7 @@
 
 
 static void
-handle_update_existing (char *args, int len)
+handle_update_existing (char *args, size_t len)
 {
     struct update_entries_data dat;
     dat.contents = UPDATE_ENTRIES_UPDATE;
@@ -1917,7 +1917,7 @@
 
 
 static void
-handle_merged (char *args, int len)
+handle_merged (char *args, size_t len)
 {
     struct update_entries_data dat;
     dat.contents = UPDATE_ENTRIES_UPDATE;
@@ -1930,7 +1930,7 @@
 
 
 static void
-handle_patched (char *args, int len)
+handle_patched (char *args, size_t len)
 {
     struct update_entries_data dat;
     dat.contents = UPDATE_ENTRIES_PATCH;
@@ -1943,7 +1943,7 @@
 
 
 static void
-handle_rcs_diff (char *args, int len)
+handle_rcs_diff (char *args, size_t len)
 {
     struct update_entries_data dat;
     dat.contents = UPDATE_ENTRIES_RCS_DIFF;
@@ -1965,7 +1965,7 @@
 
 
 static void
-handle_remove_entry (char *args, int len)
+handle_remove_entry (char *args, size_t len)
 {
     call_in_directory (args, remove_entry, NULL);
 }
@@ -1989,7 +1989,7 @@
 
 
 static void
-handle_removed (char *args, int len)
+handle_removed (char *args, size_t len)
 {
     call_in_directory (args, remove_entry_and_file, NULL);
 }
@@ -2021,7 +2021,7 @@
 
 
 static void
-handle_set_static_directory (char *args, int len)
+handle_set_static_directory (char *args, size_t len)
 {
     if (strcmp (cvs_cmd_name, "export") == 0)
     {
@@ -2045,7 +2045,7 @@
 
 
 static void
-handle_clear_static_directory (char *pathname, int len)
+handle_clear_static_directory (char *pathname, size_t len)
 {
     if (strcmp (cvs_cmd_name, "export") == 0)
     {
@@ -2099,7 +2099,7 @@
 
 
 static void
-handle_set_sticky (char *pathname, int len)
+handle_set_sticky (char *pathname, size_t len)
 {
     if (strcmp (cvs_cmd_name, "export") == 0)
     {
@@ -2139,7 +2139,7 @@
 
 
 static void
-handle_clear_sticky (char *pathname, int len)
+handle_clear_sticky (char *pathname, size_t len)
 {
     if (strcmp (cvs_cmd_name, "export") == 0)
     {
@@ -2165,7 +2165,7 @@
 /* Handle the client-side support for a successful edit.
  */
 static void
-handle_edit_file (char *pathname, int len)
+handle_edit_file (char *pathname, size_t len)
 {
     call_in_directory (pathname, edit_file, NULL);
 }
@@ -2187,7 +2187,7 @@
 
 
 static void
-handle_template (char *pathname, int len)
+handle_template (char *pathname, size_t len)
 {
     call_in_directory (pathname, template, NULL);
 }
@@ -2205,7 +2205,7 @@
 
 
 static void
-handle_clear_template (char *pathname, int len)
+handle_clear_template (char *pathname, size_t len)
 {
     call_in_directory (pathname, clear_template, NULL);
 }
@@ -2528,7 +2528,7 @@
 static char **modules_vector;
 
 static void
-handle_module_expansion (char *args, int len)
+handle_module_expansion (char *args, size_t len)
 {
     if (modules_vector == NULL)
     {
@@ -2628,7 +2628,7 @@
    We need to know the keyword expansion mode so we know whether to
    read the file in text or binary mode.  */
 static void
-handle_wrapper_rcs_option (char *args, int len)
+handle_wrapper_rcs_option (char *args, size_t len)
 {
     char *p;
 
@@ -2656,7 +2656,7 @@
 
 
 static void
-handle_m (char *args, int len)
+handle_m (char *args, size_t len)
 {
     fd_set wfds;
     int s;
@@ -2680,7 +2680,7 @@
 
 
 static void
-handle_mbinary (char *args, int len)
+handle_mbinary (char *args, size_t len)
 {
     char *size_string;
     size_t size;
@@ -2716,7 +2716,7 @@
 
 
 static void
-handle_e (char *args, int len)
+handle_e (char *args, size_t len)
 {
     fd_set wfds;
     int s;
@@ -2743,7 +2743,7 @@
 
 /*ARGSUSED*/
 static void
-handle_f  (char *args, int len)
+handle_f  (char *args, size_t len)
 {
     fflush (stderr);
 }
@@ -2751,7 +2751,7 @@
 
 
 static void
-handle_mt (char *args, int len)
+handle_mt (char *args, size_t len)
 {
     char *p;
     char *tag = args;
@@ -3008,7 +3008,8 @@
 static size_t
 try_read_from_server( char *buf, size_t len )
 {
-    int status, nread;
+    int status;
+    size_t nread;
     char *data;
 
     status = buf_read_data (global_from_server, len, &data, &nread);
@@ -3061,13 +3062,13 @@
     do
     {
        char *cmd;
-       int len;
+       size_t len;
        
        len = read_line (&cmd);
        for (rs = responses; rs->name != NULL; ++rs)
            if (strncmp (cmd, rs->name, strlen (rs->name)) == 0)
            {
-               int cmdlen = strlen (rs->name);
+               size_t cmdlen = strlen (rs->name);
                if (cmd[cmdlen] == '\0')
                    ;
                else if (cmd[cmdlen] == ' ')
@@ -5067,7 +5068,7 @@
 
 
 static void
-handle_notified (char *args, int len)
+handle_notified (char *args, size_t len)
 {
     call_in_directory (args, notified_a_file, NULL);
 }
Index: src/client.h
===================================================================
RCS file: /cvs/ccvs/src/client.h,v
retrieving revision 1.54
diff -u -r1.54 client.h
--- src/client.h        7 Oct 2004 17:45:34 -0000       1.54
+++ src/client.h        10 Oct 2004 14:41:07 -0000
@@ -138,7 +138,7 @@
      * Note that although LEN is given, ARGS is also guaranteed to be
      * '\0' terminated.
      */
-    void (*func) (char *args, int len);
+    void (*func) (char *args, size_t len);
 
     /*
      * ok and error are special; they indicate we are at the end of the
Index: src/server.c
===================================================================
RCS file: /cvs/ccvs/src/server.c,v
retrieving revision 1.388
diff -u -r1.388 server.c
--- src/server.c        5 Oct 2004 01:30:43 -0000       1.388
+++ src/server.c        10 Oct 2004 14:41:25 -0000
@@ -1494,11 +1494,12 @@
  * enough.  Or something.
  */
 static void
-receive_partial_file (int size, int file)
+receive_partial_file (size_t size, int file)
 {
     while (size > 0)
     {
-       int status, nread;
+       int status;
+       size_t nread;
        char *data;
 
        status = buf_read_data (buf_from_net, size, &data, &nread);
@@ -1531,7 +1532,7 @@
 
        while (nread > 0)
        {
-           int nwrote;
+           size_t nwrote;
 
            nwrote = write (file, data, nread);
            if (nwrote < 0)
@@ -1544,7 +1545,8 @@
                /* Read and discard the file data.  */
                while (size > 0)
                {
-                   int status, nread;
+                   int status;
+                   size_t nread;
                    char *data;
 
                    status = buf_read_data (buf_from_net, size, &data, &nread);
@@ -1563,7 +1565,7 @@
 
 /* Receive SIZE bytes, write to filename FILE.  */
 static void
-receive_file (int size, char *file, int gzipped)
+receive_file (size_t size, char *file, int gzipped)
 {
     int fd;
     char *arg = file;
@@ -1588,7 +1590,7 @@
           bugs).  Given that this feature is mainly for
           compatibility, that is the better tradeoff.  */
 
-       int toread = size;
+       size_t toread = size;
        char *filebuf;
        char *p;
 
@@ -1598,7 +1600,8 @@
 
        while (toread > 0)
        {
-           int status, nread;
+           int status;
+           size_t nread;
            char *data;
 
            status = buf_read_data (buf_from_net, toread, &data, &nread);
@@ -1819,7 +1822,8 @@
 static void
 serve_modified (char *arg)
 {
-    int size, status;
+    size_t size;
+    int status;
     char *size_text;
     char *mode_text;
 
@@ -1900,7 +1904,8 @@
        /* Now that we know the size, read and discard the file data.  */
        while (size > 0)
        {
-           int status, nread;
+           int status;
+           size_t nread;
            char *data;
 
            status = buf_read_data (buf_from_net, size, &data, &nread);
@@ -3897,7 +3902,7 @@
                && (FD_ISSET (protocol_pipe[0], &readfds)))
            {
                int status;
-               int count_read;
+               size_t count_read;
 
                status = buf_input_data (protocol_inbuf, &count_read);
 
@@ -3971,7 +3976,7 @@
            {
                int status;
 
-               status = buf_input_data (stdoutbuf, (int *) NULL);
+               status = buf_input_data (stdoutbuf, NULL);
 
                buf_copy_lines (buf_to_net, stdoutbuf, 'M');
 
@@ -3996,7 +4001,7 @@
            {
                int status;
 
-               status = buf_input_data (stderrbuf, (int *) NULL);
+               status = buf_input_data (stderrbuf, NULL);
 
                buf_copy_lines (buf_to_net, stderrbuf, 'E');
 
Index: src/zlib.c
===================================================================
RCS file: /cvs/ccvs/src/zlib.c,v
retrieving revision 1.23
diff -u -r1.23 zlib.c
--- src/zlib.c  6 Oct 2004 15:12:37 -0000       1.23
+++ src/zlib.c  10 Oct 2004 14:41:25 -0000
@@ -167,7 +167,8 @@
 
     while (1)
     {
-       int zstatus, sofar, status, nread;
+       int zstatus, sofar, status;
+       size_t nread;
 
        /* First try to inflate any data we already have buffered up.
           This is useful even if we don't have any buffered data,
@@ -366,7 +367,8 @@
     /* Pick up any trailing data, such as the checksum.  */
     while (1)
     {
-       int status, nread;
+       int status;
+       size_t nread;
        char buf[100];
 
        status = compress_buffer_input (cb, buf, 0, sizeof buf, &nread);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]