Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/external/bsd/file/dist/src pacify lint.
details: https://anonhg.NetBSD.org/src/rev/8d30ab209611
branches: trunk
changeset: 351354:8d30ab209611
user: christos <christos%NetBSD.org@localhost>
date: Fri Feb 10 18:06:59 2017 +0000
description:
pacify lint.
diffstat:
external/bsd/file/dist/src/apprentice.c | 10 ++++++----
external/bsd/file/dist/src/cdf.c | 12 +++++++-----
external/bsd/file/dist/src/compress.c | 12 ++++++------
external/bsd/file/dist/src/print.c | 6 +++---
external/bsd/file/dist/src/readelf.c | 6 +++---
external/bsd/file/dist/src/softmagic.c | 9 ++++-----
6 files changed, 29 insertions(+), 26 deletions(-)
diffs (224 lines):
diff -r 3aaa6d7fe819 -r 8d30ab209611 external/bsd/file/dist/src/apprentice.c
--- a/external/bsd/file/dist/src/apprentice.c Fri Feb 10 17:56:27 2017 +0000
+++ b/external/bsd/file/dist/src/apprentice.c Fri Feb 10 18:06:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: apprentice.c,v 1.15 2017/02/10 17:53:24 christos Exp $ */
+/* $NetBSD: apprentice.c,v 1.16 2017/02/10 18:06:59 christos Exp $ */
/*
* Copyright (c) Ian F. Darwin 1986-1995.
@@ -37,7 +37,7 @@
#if 0
FILE_RCSID("@(#)$File: apprentice.c,v 1.257 2017/02/04 16:46:16 christos Exp $")
#else
-__RCSID("$NetBSD: apprentice.c,v 1.15 2017/02/10 17:53:24 christos Exp $");
+__RCSID("$NetBSD: apprentice.c,v 1.16 2017/02/10 18:06:59 christos Exp $");
#endif
#endif /* lint */
@@ -555,8 +555,10 @@
break;
case MAP_TYPE_MALLOC:
for (i = 0; i < MAGIC_SETS; i++) {
- if ((char *)map->magic[i] >= (char *)map->p &&
- (char *)map->magic[i] <= (char *)map->p + map->len)
+ void *b = map->magic[i];
+ void *p = map->p;
+ if (CAST(char *, b) >= CAST(char *, p) &&
+ CAST(char *, b) <= CAST(char *, p) + map->len)
continue;
free(map->magic[i]);
}
diff -r 3aaa6d7fe819 -r 8d30ab209611 external/bsd/file/dist/src/cdf.c
--- a/external/bsd/file/dist/src/cdf.c Fri Feb 10 17:56:27 2017 +0000
+++ b/external/bsd/file/dist/src/cdf.c Fri Feb 10 18:06:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cdf.c,v 1.12 2017/02/10 17:53:24 christos Exp $ */
+/* $NetBSD: cdf.c,v 1.13 2017/02/10 18:06:59 christos Exp $ */
/*-
* Copyright (c) 2008 Christos Zoulas
@@ -40,7 +40,7 @@
#if 0
FILE_RCSID("@(#)$File: cdf.c,v 1.88 2017/02/07 23:21:29 christos Exp $")
#else
-__RCSID("$NetBSD: cdf.c,v 1.12 2017/02/10 17:53:24 christos Exp $");
+__RCSID("$NetBSD: cdf.c,v 1.13 2017/02/10 18:06:59 christos Exp $");
#endif
#endif
@@ -817,7 +817,7 @@
== 0)
break;
if (i > 0)
- return i;
+ return CAST(int, i);
DPRINTF(("Cannot find type %d `%s'\n", type, name));
errno = ESRCH;
@@ -1074,7 +1074,7 @@
{
size_t ss = cdf_check_stream(sst, h);
const char *b = CAST(const char *, sst->sst_tab);
- const char *eb = b + ss * sst->sst_len;
+ const char *nb, *eb = b + ss * sst->sst_len;
size_t nr, i, j, k;
cdf_catalog_entry_t *ce;
uint16_t reclen;
@@ -1119,7 +1119,9 @@
cep->ce_namlen = rlen;
np = CAST(const uint16_t *, CAST(const void *, (b + 16)));
- if (RCAST(const char *, np + cep->ce_namlen) > eb) {
+ nb = CAST(const char *, CAST(const void *,
+ (np + cep->ce_namlen)));
+ if (nb > eb) {
cep->ce_namlen = 0;
break;
}
diff -r 3aaa6d7fe819 -r 8d30ab209611 external/bsd/file/dist/src/compress.c
--- a/external/bsd/file/dist/src/compress.c Fri Feb 10 17:56:27 2017 +0000
+++ b/external/bsd/file/dist/src/compress.c Fri Feb 10 18:06:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: compress.c,v 1.11 2017/02/10 17:53:24 christos Exp $ */
+/* $NetBSD: compress.c,v 1.12 2017/02/10 18:06:59 christos Exp $ */
/*
* Copyright (c) Ian F. Darwin 1986-1995.
@@ -40,7 +40,7 @@
#if 0
FILE_RCSID("@(#)$File: compress.c,v 1.101 2017/01/18 16:33:57 christos Exp $")
#else
-__RCSID("$NetBSD: compress.c,v 1.11 2017/02/10 17:53:24 christos Exp $");
+__RCSID("$NetBSD: compress.c,v 1.12 2017/02/10 18:06:59 christos Exp $");
#endif
#endif
@@ -100,7 +100,7 @@
zlibcmp(const unsigned char *buf)
{
unsigned short x = 1;
- unsigned char *s = (unsigned char *)&x;
+ unsigned char *s = CCAST(unsigned char *, &x);
if ((buf[0] & 0xf) != 8 || (buf[0] & 0x80) != 0)
return 0;
@@ -504,7 +504,7 @@
z.next_in = CCAST(Bytef *, old);
z.avail_in = CAST(uint32_t, *n);
z.next_out = *newch;
- z.avail_out = bytes_max;
+ z.avail_out = CAST(unsigned int, bytes_max);
z.zalloc = Z_NULL;
z.zfree = Z_NULL;
z.opaque = Z_NULL;
@@ -639,7 +639,7 @@
while (isspace((unsigned char)*p))
p++;
n = strlen(p);
- memmove(ubuf, p, n + 1);
+ memmove(ubuf, p, CAST(size_t, n + 1));
}
DPRINTF("Filter error after[[[%s]]]\n", (char *)ubuf);
if (islower(*ubuf))
@@ -695,7 +695,7 @@
}
for (i = 0; i < __arraycount(fdp); i++)
- copydesc(i, fdp[i]);
+ copydesc(CAST(int, i), fdp[i]);
(void)execvp(compr[method].argv[0],
(char *const *)(intptr_t)compr[method].argv);
diff -r 3aaa6d7fe819 -r 8d30ab209611 external/bsd/file/dist/src/print.c
--- a/external/bsd/file/dist/src/print.c Fri Feb 10 17:56:27 2017 +0000
+++ b/external/bsd/file/dist/src/print.c Fri Feb 10 18:06:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: print.c,v 1.9 2017/02/10 17:53:24 christos Exp $ */
+/* $NetBSD: print.c,v 1.10 2017/02/10 18:06:59 christos Exp $ */
/*
* Copyright (c) Ian F. Darwin 1986-1995.
@@ -37,7 +37,7 @@
#if 0
FILE_RCSID("@(#)$File: print.c,v 1.81 2016/01/19 15:09:03 christos Exp $")
#else
-__RCSID("$NetBSD: print.c,v 1.9 2017/02/10 17:53:24 christos Exp $");
+__RCSID("$NetBSD: print.c,v 1.10 2017/02/10 18:06:59 christos Exp $");
#endif
#endif /* lint */
@@ -244,7 +244,7 @@
if (flags & FILE_T_WINDOWS) {
struct timespec ts;
- cdf_timestamp_to_timespec(&ts, v);
+ cdf_timestamp_to_timespec(&ts, CAST(cdf_timestamp_t, v));
t = ts.tv_sec;
} else {
// XXX: perhaps detect and print something if overflow
diff -r 3aaa6d7fe819 -r 8d30ab209611 external/bsd/file/dist/src/readelf.c
--- a/external/bsd/file/dist/src/readelf.c Fri Feb 10 17:56:27 2017 +0000
+++ b/external/bsd/file/dist/src/readelf.c Fri Feb 10 18:06:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: readelf.c,v 1.12 2017/02/10 17:53:24 christos Exp $ */
+/* $NetBSD: readelf.c,v 1.13 2017/02/10 18:06:59 christos Exp $ */
/*
* Copyright (c) Christos Zoulas 2003.
@@ -32,7 +32,7 @@
#if 0
FILE_RCSID("@(#)$File: readelf.c,v 1.130 2017/01/29 19:34:24 christos Exp $")
#else
-__RCSID("$NetBSD: readelf.c,v 1.12 2017/02/10 17:53:24 christos Exp $");
+__RCSID("$NetBSD: readelf.c,v 1.13 2017/02/10 18:06:59 christos Exp $");
#endif
#endif
@@ -896,7 +896,7 @@
offset = get_offset_from_virtaddr(ms, swap, clazz, fd, ph_off, ph_num,
fsize, virtaddr);
- if ((buflen = pread(fd, buf, buflen, offset)) <= 0) {
+ if ((buflen = pread(fd, buf, CAST(size_t, buflen), offset)) <= 0) {
file_badread(ms);
return 0;
}
diff -r 3aaa6d7fe819 -r 8d30ab209611 external/bsd/file/dist/src/softmagic.c
--- a/external/bsd/file/dist/src/softmagic.c Fri Feb 10 17:56:27 2017 +0000
+++ b/external/bsd/file/dist/src/softmagic.c Fri Feb 10 18:06:59 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: softmagic.c,v 1.14 2017/02/10 17:53:24 christos Exp $ */
+/* $NetBSD: softmagic.c,v 1.15 2017/02/10 18:06:59 christos Exp $ */
/*
* Copyright (c) Ian F. Darwin 1986-1995.
@@ -37,7 +37,7 @@
#if 0
FILE_RCSID("@(#)$File: softmagic.c,v 1.243 2017/02/07 23:27:32 christos Exp $")
#else
-__RCSID("$NetBSD: softmagic.c,v 1.14 2017/02/10 17:53:24 christos Exp $");
+__RCSID("$NetBSD: softmagic.c,v 1.15 2017/02/10 18:06:59 christos Exp $");
#endif
#endif /* lint */
@@ -1023,9 +1023,8 @@
mconvert(struct magic_set *ms, struct magic *m, int flip)
{
union VALUETYPE *p = &ms->ms_value;
- uint8_t type;
- switch (type = cvt_flip(m->type, flip)) {
+ switch (cvt_flip(m->type, flip)) {
case FILE_BYTE:
if (cvt_8(p, m) == -1)
goto out;
@@ -1190,7 +1189,7 @@
case FILE_DER:
case FILE_SEARCH:
if (offset > nbytes)
- offset = nbytes;
+ offset = CAST(uint32_t, nbytes);
ms->search.s = RCAST(const char *, s) + offset;
ms->search.s_len = nbytes - offset;
ms->search.offset = offset;
Home |
Main Index |
Thread Index |
Old Index