summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2016-10-15 22:20:18 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2016-10-15 22:20:18 +0000
commitb1a93a0c19f6fb663d782b873ecc8df8543b09ec (patch)
tree20496e073f50ea320aebc0d6d134ca03955a80ed /usr.bin
parentfc016f0b44b85aee673c9bd5ba078fdf40c2fcdb (diff)
Quiet compiler warnings. OK tomc@ tb@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cvs/buf.c4
-rw-r--r--usr.bin/cvs/buf.h3
-rw-r--r--usr.bin/cvs/diff3.c7
-rw-r--r--usr.bin/cvs/diff_internals.c6
-rw-r--r--usr.bin/cvs/file.c14
-rw-r--r--usr.bin/cvs/getlog.c4
-rw-r--r--usr.bin/cvs/logmsg.c6
-rw-r--r--usr.bin/cvs/rcs.c10
-rw-r--r--usr.bin/cvs/update.c10
9 files changed, 31 insertions, 33 deletions
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c
index 051c30fe2cd..3a68be6fcb0 100644
--- a/usr.bin/cvs/buf.c
+++ b/usr.bin/cvs/buf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.c,v 1.83 2015/11/05 09:48:21 nicm Exp $ */
+/* $OpenBSD: buf.c,v 1.84 2016/10/15 22:20:17 millert Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -106,7 +106,7 @@ buf_load_fd(int fd)
if (lseek(fd, 0, SEEK_SET) == -1)
fatal("buf_load_fd: lseek: %s", strerror(errno));
- if (st.st_size > SIZE_MAX)
+ if ((uintmax_t)st.st_size > SIZE_MAX)
fatal("buf_load_fd: file size too big");
buf = buf_alloc(st.st_size);
if (atomicio(read, fd, buf->cb_buf, buf->cb_size) != buf->cb_size)
diff --git a/usr.bin/cvs/buf.h b/usr.bin/cvs/buf.h
index 8e282dd6f3f..0ce11437b8c 100644
--- a/usr.bin/cvs/buf.h
+++ b/usr.bin/cvs/buf.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: buf.h,v 1.28 2010/08/01 09:55:40 zinovik Exp $ */
+/* $OpenBSD: buf.h,v 1.29 2016/10/15 22:20:17 millert Exp $ */
/*
* Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -30,6 +30,7 @@
#include <sys/types.h>
typedef struct buf BUF;
+struct timeval;
BUF *buf_alloc(size_t);
BUF *buf_load(const char *);
diff --git a/usr.bin/cvs/diff3.c b/usr.bin/cvs/diff3.c
index d7842404b78..9c1d202812a 100644
--- a/usr.bin/cvs/diff3.c
+++ b/usr.bin/cvs/diff3.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff3.c,v 1.59 2015/11/05 09:48:21 nicm Exp $ */
+/* $OpenBSD: diff3.c,v 1.60 2016/10/15 22:20:17 millert Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -295,7 +295,8 @@ diff3_internal(int argc, char **argv, const char *fmark, const char *rmark)
free(overlap);
free(de);
- de = d13 = d23 = overlap = NULL;
+ de = d13 = d23 = NULL;
+ overlap = NULL;
increase();
@@ -793,7 +794,7 @@ edscript(int n)
(void)fseek(fp[2], (long)de[n].new.from, SEEK_SET);
for (k = de[n].new.to-de[n].new.from; k > 0; k-= j) {
j = k > BUFSIZ ? BUFSIZ : k;
- if (fread(block, 1, j, fp[2]) != j)
+ if (fread(block, 1, j, fp[2]) != (size_t)j)
return (-1);
block[j] = '\0';
diff_output("%s", block);
diff --git a/usr.bin/cvs/diff_internals.c b/usr.bin/cvs/diff_internals.c
index 07eb2f82b2f..b75f128fe47 100644
--- a/usr.bin/cvs/diff_internals.c
+++ b/usr.bin/cvs/diff_internals.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diff_internals.c,v 1.38 2015/11/05 09:48:21 nicm Exp $ */
+/* $OpenBSD: diff_internals.c,v 1.39 2016/10/15 22:20:17 millert Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
* All rights reserved.
@@ -455,13 +455,13 @@ prepare(int i, FILE *fd, off_t filesize, int flags)
rewind(fd);
- sz = (filesize <= SIZE_MAX ? filesize : SIZE_MAX) / 25;
+ sz = ((uintmax_t)filesize <= SIZE_MAX ? (size_t)filesize : SIZE_MAX) / 25;
if (sz < 100)
sz = 100;
p = xcalloc(sz + 3, sizeof(*p));
for (j = 0; (h = readhash(fd, flags));) {
- if (j == sz) {
+ if ((size_t)j == sz) {
sz = sz * 3 / 2;
p = xreallocarray(p, sz + 3, sizeof(*p));
}
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index bc218080272..fba1890c9cd 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.268 2016/10/13 20:51:25 fcambus Exp $ */
+/* $OpenBSD: file.c,v 1.269 2016/10/15 22:20:17 millert Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -461,12 +461,10 @@ cvs_file_walkdir(struct cvs_file *cf, struct cvs_recursion *cr)
fatal("cvs_file_walkdir: %s %s", cf->file_path,
strerror(errno));
- if (st.st_size > SIZE_MAX)
+ if ((uintmax_t)st.st_size > SIZE_MAX)
fatal("cvs_file_walkdir: %s: file size too big", cf->file_name);
- bufsize = st.st_size;
- if (bufsize < st.st_blksize)
- bufsize = st.st_blksize;
+ bufsize = (st.st_size > st.st_blksize) ? st.st_size : st.st_blksize;
buf = xmalloc(bufsize);
RB_INIT(&fl);
@@ -1030,7 +1028,7 @@ cvs_file_cmp(const char *file1, const char *file2)
if (S_ISREG(stb1.st_mode)) {
void *p1, *p2;
- if (stb1.st_size > SIZE_MAX) {
+ if ((uintmax_t)stb1.st_size > SIZE_MAX) {
ret = 1;
goto out;
}
@@ -1087,7 +1085,7 @@ cvs_file_copy(const char *from, const char *to)
char *p;
int saved_errno;
- if (st.st_size > SIZE_MAX) {
+ if ((uintmax_t)st.st_size > SIZE_MAX) {
ret = -1;
goto out;
}
@@ -1106,7 +1104,7 @@ cvs_file_copy(const char *from, const char *to)
madvise(p, st.st_size, MADV_SEQUENTIAL);
- if (atomicio(vwrite, dst, p, st.st_size) != st.st_size) {
+ if (atomicio(vwrite, dst, p, st.st_size) != (size_t)st.st_size) {
saved_errno = errno;
(void)unlink(to);
fatal("cvs_file_copy: `%s': %s", from,
diff --git a/usr.bin/cvs/getlog.c b/usr.bin/cvs/getlog.c
index 68347c4c13d..35902c8a640 100644
--- a/usr.bin/cvs/getlog.c
+++ b/usr.bin/cvs/getlog.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getlog.c,v 1.99 2016/10/13 20:51:25 fcambus Exp $ */
+/* $OpenBSD: getlog.c,v 1.100 2016/10/15 22:20:17 millert Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
@@ -234,7 +234,7 @@ cvs_log_local(struct cvs_file *cf)
if (logrev != NULL)
nrev = cvs_revision_select(cf->file_rcs, logrev);
else if (logdate != NULL) {
- if ((nrev = date_select(cf->file_rcs, logdate)) == -1) {
+ if ((nrev = date_select(cf->file_rcs, logdate)) == (u_int)-1) {
cvs_log(LP_ERR, "invalid date: %s", logdate);
return;
}
diff --git a/usr.bin/cvs/logmsg.c b/usr.bin/cvs/logmsg.c
index 4ede5049fa8..7ba9412668b 100644
--- a/usr.bin/cvs/logmsg.c
+++ b/usr.bin/cvs/logmsg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logmsg.c,v 1.58 2016/08/16 19:00:59 tb Exp $ */
+/* $OpenBSD: logmsg.c,v 1.59 2016/10/15 22:20:17 millert Exp $ */
/*
* Copyright (c) 2007 Joris Vink <joris@openbsd.org>
*
@@ -59,7 +59,7 @@ cvs_logmsg_read(const char *path)
if ((fp = fdopen(fd, "r")) == NULL)
fatal("cvs_logmsg_read: fdopen %s", strerror(errno));
- if (st.st_size > SIZE_MAX)
+ if ((uintmax_t)st.st_size > SIZE_MAX)
fatal("cvs_logmsg_read: %s: file size too big", path);
lbuf = NULL;
@@ -142,7 +142,7 @@ cvs_logmsg_create(char *dir, struct cvs_flisthead *added,
if ((rp = fdopen(rd, "r")) == NULL)
fatal("cvs_logmsg_create: fdopen %s",
strerror(errno));
- if (st.st_size > SIZE_MAX)
+ if ((uintmax_t)st.st_size > SIZE_MAX)
fatal("cvs_logmsg_create: %s: file size "
"too big", line->line);
logmsg = xmalloc(st.st_size);
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index 9a286df761c..d2b68ee0f97 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.315 2016/10/13 20:51:25 fcambus Exp $ */
+/* $OpenBSD: rcs.c,v 1.316 2016/10/15 22:20:17 millert Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -2427,7 +2427,7 @@ rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct rcs_lines *lines,
"truncated");
lp = xcalloc(1, sizeof(*lp));
- xasprintf(&(lp->l_line), "%s%s\n",
+ xasprintf((char **)&(lp->l_line), "%s%s\n",
prefix, linebuf);
lp->l_len = strlen(lp->l_line);
TAILQ_INSERT_AFTER(&(lines->l_lines), cur, lp,
@@ -2441,10 +2441,10 @@ rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct rcs_lines *lines,
lp = xcalloc(1, sizeof(*lp));
if (l_line[0] == '\0') {
- xasprintf(&(lp->l_line), "%s\n",
- sprefix);
+ xasprintf((char **)&(lp->l_line),
+ "%s\n", sprefix);
} else {
- xasprintf(&(lp->l_line),
+ xasprintf((char **)&(lp->l_line),
"%s%s\n", prefix, l_line);
}
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index 11a626c06b9..6a2d573da19 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.173 2016/10/14 20:37:07 fcambus Exp $ */
+/* $OpenBSD: update.c,v 1.174 2016/10/15 22:20:17 millert Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -259,14 +259,12 @@ cvs_update_leavedir(struct cvs_file *cf)
if (fstat(cf->fd, &st) == -1)
fatal("cvs_update_leavedir: %s", strerror(errno));
- bufsize = st.st_size;
- if (bufsize < st.st_blksize)
- bufsize = st.st_blksize;
-
- if (st.st_size > SIZE_MAX)
+ if ((uintmax_t)st.st_size > SIZE_MAX)
fatal("cvs_update_leavedir: %s: file size too big",
cf->file_name);
+ bufsize = (st.st_size > st.st_blksize) ? st.st_size : st.st_blksize;
+
isempty = 1;
buf = xmalloc(bufsize);