patch: typo's and gcc warnings

jw schultz jw at pegasys.ws
Thu Mar 13 00:28:18 EST 2003


On Wed, Mar 12, 2003 at 01:34:58PM +0100, Paul Slootman wrote:
> Two patches:
> one to correct the spelling of permissions (in comments, but such typos
> disturb me as well), and

OK.  I can't speel but but spelling errors impede clarity.

> one to cast inode and dev to unsigned long before comparing, to prevent
> gcc giving a warning "comparison between signed and unsigned".
> 
> 
> Paul Slootman

[snip]

> diff -ru orig/rsync-2.5.6/receiver.c rsync-2.5.6/receiver.c
> --- orig/rsync-2.5.6/receiver.c	2003-01-21 00:32:17.000000000 +0100
> +++ rsync-2.5.6/receiver.c	2003-03-10 16:28:10.000000000 +0100
> @@ -55,8 +55,8 @@
>  	if (link_stat(f_name(flist->files[j]), &st)) return 1;
>  
>  	for (i=0;i<dlist_len;i++) {
> -		if (st.st_ino == delete_list[i].inode &&
> -		    st.st_dev == delete_list[i].dev)
> +		if (st.st_ino == (unsigned long)delete_list[i].inode &&
> +		    st.st_dev == (unsigned long)delete_list[i].dev)
>  			return 1;
>  	}

I don't think this is the right fix.  Among other things it
would break things if ino_t or dev_t were a long long.
What we should be doing is even mentioned in rsync.h:

|  * FIXME: Really we need an unsigned type, and we perhaps
|  * ought to
|  * cope with platforms on which this is an unsigned int or
|  * even a
|  * struct.  Later.
|  */
| #define INO64_T int64
| #define DEV64_T int64

I've attached a patch that creates a uint64 for INO64_t and
DEV64_T and it fixes all the signed-unsigned comparison
warnings.

I've also attached a patch for Makefile.in so that header
changes will force rebuilds.  This one is clearly for
maintainer convenience.


-- 
________________________________________________________________
	J.W. Schultz            Pegasystems Technologies
	email address:		jw at pegasys.ws

		Remember Cernan and Schmitt
-------------- next part --------------
Index: Makefile.in
===================================================================
RCS file: /cvsroot/rsync/Makefile.in,v
retrieving revision 1.89
diff -u -b -r1.89 Makefile.in
--- Makefile.in	20 Jan 2003 18:26:14 -0000	1.89
+++ Makefile.in	12 Mar 2003 13:23:36 -0000
@@ -25,6 +25,7 @@
 .SUFFIXES:
 .SUFFIXES: .c .o
 
+HEADERS=byteorder.h errcode.h proto.h rsync.h
 LIBOBJ=lib/fnmatch.o lib/compat.o lib/snprintf.o lib/mdfour.o \
 	lib/permstring.o @LIBOBJS@
 ZLIBOBJ=zlib/deflate.o zlib/infblock.o zlib/infcodes.o zlib/inffast.o \
@@ -74,6 +75,9 @@
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
 
 $(OBJS): config.h
+
+config.h: $(HEADERS)
+	touch $@
 
 tls$(EXEEXT): $(TLS_OBJ)
 	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(TLS_OBJ) $(LIBS)
-------------- next part --------------
Index: rsync.h
===================================================================
RCS file: /cvsroot/rsync/rsync.h,v
retrieving revision 1.137
diff -u -b -r1.137 rsync.h
--- rsync.h	18 Feb 2003 18:07:36 -0000	1.137
+++ rsync.h	12 Mar 2003 13:22:47 -0000
@@ -261,15 +261,20 @@
 
 #if HAVE_OFF64_T
 #define int64 off64_t
+#define uint64 off64_t
 #elif (SIZEOF_LONG == 8) 
 #define int64 long
+#define uint64 unsigned long
 #elif (SIZEOF_INT == 8) 
 #define int64 int
+#define uint64 unsigned int
 #elif HAVE_LONGLONG
 #define int64 long long
+#define uint64 unsigned long long
 #else
 /* As long as it gets... */
 #define int64 off_t
+#define uint64 off_t
 #define NO_INT64
 #endif
 
@@ -304,8 +309,8 @@
  * cope with platforms on which this is an unsigned int or even a
  * struct.  Later.
  */ 
-#define INO64_T int64
-#define DEV64_T int64
+#define INO64_T uint64
+#define DEV64_T uint64
 
 #ifndef MIN
 #define MIN(a,b) ((a)<(b)?(a):(b))


More information about the rsync mailing list