From a2a32c1acdf5c1c77d49af9f9bc16e198160c809 Mon Sep 17 00:00:00 2001 From: lulf Date: Thu, 20 Nov 2008 12:52:07 +0000 Subject: - Fix build with GNU make. - Fix compiler warnings and symbol overlaps. - Don't build code that is not used yet. - Fix types and format strings. --- contrib/csup/GNUmakefile | 5 +++-- contrib/csup/lister.c | 4 ++++ contrib/csup/proto.c | 2 +- contrib/csup/rsyncfile.c | 17 ++++++++--------- contrib/csup/updater.c | 5 ++--- 5 files changed, 18 insertions(+), 15 deletions(-) (limited to 'contrib/csup') diff --git a/contrib/csup/GNUmakefile b/contrib/csup/GNUmakefile index 7aceccd..18fb071 100644 --- a/contrib/csup/GNUmakefile +++ b/contrib/csup/GNUmakefile @@ -12,8 +12,9 @@ GROUP?= 0 UNAME= $(shell uname -s) SRCS= attrstack.c config.c detailer.c diff.c fattr.c fixups.c fnmatch.c \ - globtree.c idcache.c keyword.c lister.c main.c misc.c mux.c pathcomp.c \ - parse.c proto.c status.c stream.c threads.c token.c updater.c + globtree.c idcache.c keyword.c lex.rcs.c lister.c main.c misc.c mux.c \ + pathcomp.c parse.c proto.c rcsfile.c rcsparse.c rsyncfile.c status.c \ + stream.c threads.c token.c updater.c OBJS= $(SRCS:.c=.o) WARNS= -Wall -W -Wno-unused-parameter -Wmissing-prototypes -Wpointer-arith \ diff --git a/contrib/csup/lister.c b/contrib/csup/lister.c index e969f6d..65439c1 100644 --- a/contrib/csup/lister.c +++ b/contrib/csup/lister.c @@ -64,8 +64,10 @@ static int lister_dofile(struct lister *, struct coll *, struct statusrec *); static int lister_dodead(struct lister *, struct coll *, struct statusrec *); +#if 0 static int lister_dorcsfile(struct lister *, struct coll *, struct statusrec *, int); +#endif void * lister(void *arg) @@ -400,6 +402,7 @@ send: return (0); } +#if 0 /* Handle a file live or file dead entry found in the status file. */ static int lister_dorcsfile(struct lister *l, struct coll *coll, struct statusrec *sr, @@ -449,6 +452,7 @@ lister_dorcsfile(struct lister *l, struct coll *coll, struct statusrec *sr, return (LISTER_ERR_WRITE); return (0); } +#endif /* Handle a checkout dead entry found in the status file. */ static int diff --git a/contrib/csup/proto.c b/contrib/csup/proto.c index fd574b0..04d6256 100644 --- a/contrib/csup/proto.c +++ b/contrib/csup/proto.c @@ -805,7 +805,7 @@ proto_printf(struct stream *wr, const char *format, ...) break; case 'O': off = va_arg(ap, off_t); - rv = stream_printf(wr, "%lu", off); + rv = stream_printf(wr, "%llu", off); break; case 'S': s = va_arg(ap, char *); diff --git a/contrib/csup/rsyncfile.c b/contrib/csup/rsyncfile.c index 3d5c8a5..474c536 100644 --- a/contrib/csup/rsyncfile.c +++ b/contrib/csup/rsyncfile.c @@ -67,11 +67,11 @@ struct rsyncfile { }; static size_t rsync_chooseblocksize(size_t); -static uint32_t rsync_rollsum(uint8_t *, size_t); +static uint32_t rsync_rollsum(char *, size_t); /* Open a file and initialize variable for rsync operation. */ struct rsyncfile * -rsync_open(char *path, size_t blocksize, int read) +rsync_open(char *path, size_t blocksize, int rdonly) { struct rsyncfile *rf; struct stat st; @@ -86,7 +86,7 @@ rsync_open(char *path, size_t blocksize, int read) rf->fsize = st.st_size; rf->fa = fattr_fromstat(&st); - rf->fd = open(path, read ? O_RDONLY : O_RDWR); + rf->fd = open(path, rdonly ? O_RDONLY : O_RDWR); if (rf->fd < 0) { free(rf); return (NULL); @@ -116,6 +116,7 @@ rsync_close(struct rsyncfile *rf) return (error); close(rf->fd); free(rf); + return (0); } /* @@ -154,14 +155,12 @@ rsync_chooseblocksize(size_t fsize) int rsync_nextblock(struct rsyncfile *rf) { - uint32_t rolling; - char *ptr; MD5_CTX ctx; - size_t blocksize, i; + size_t blocksize; if (rf->blockptr >= rf->end) return (0); - blocksize = min((rf->end - rf->blockptr), rf->blocksize); + blocksize = min((size_t)(rf->end - rf->blockptr), rf->blocksize); /* Calculate MD5 of the block. */ MD5_Init(&ctx); MD5_Update(&ctx, rf->blockptr, blocksize); @@ -176,10 +175,10 @@ rsync_nextblock(struct rsyncfile *rf) /* Get the rolling checksum of a file. */ static uint32_t -rsync_rollsum(uint8_t *buf, size_t len) +rsync_rollsum(char *buf, size_t len) { uint32_t a, b; - uint8_t *ptr, *limit; + char *ptr, *limit; a = b = 0; ptr = buf; diff --git a/contrib/csup/updater.c b/contrib/csup/updater.c index fd67f61..9486a97 100644 --- a/contrib/csup/updater.c +++ b/contrib/csup/updater.c @@ -1991,7 +1991,7 @@ updater_read_checkout(struct stream *src, struct stream *dest) char *line; size_t size; ssize_t nbytes; - int error, first; + int first; first = 1; line = stream_getln(src, &size); @@ -2031,12 +2031,11 @@ static int updater_rsync(struct updater *up, struct file_update *fup, size_t blocksize) { struct statusrec *sr; - struct coll *coll; struct stream *to; char md5[MD5_DIGEST_SIZE]; char *buf, *line; int error, orig; - size_t size, blocknum, blockstart, blockcount; + size_t blocknum, blockstart, blockcount; ssize_t nbytes; sr = &fup->srbuf; -- cgit v1.1