Module Name:    src
Committed By:   christos
Date:           Fri Oct 19 00:24:57 UTC 2018

Modified Files:
        src/external/bsd/file/dist/src: apprentice.c compress.c file.h
            is_json.c readelf.c

Log Message:
lint fixes


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/external/bsd/file/dist/src/apprentice.c
cvs rdiff -u -r1.16 -r1.17 src/external/bsd/file/dist/src/compress.c
cvs rdiff -u -r1.20 -r1.21 src/external/bsd/file/dist/src/file.h
cvs rdiff -u -r1.1.1.1 -r1.2 src/external/bsd/file/dist/src/is_json.c
cvs rdiff -u -r1.18 -r1.19 src/external/bsd/file/dist/src/readelf.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/bsd/file/dist/src/apprentice.c
diff -u src/external/bsd/file/dist/src/apprentice.c:1.21 src/external/bsd/file/dist/src/apprentice.c:1.22
--- src/external/bsd/file/dist/src/apprentice.c:1.21	Thu Oct 18 20:11:48 2018
+++ src/external/bsd/file/dist/src/apprentice.c	Thu Oct 18 20:24:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: apprentice.c,v 1.21 2018/10/19 00:11:48 christos Exp $	*/
+/*	$NetBSD: apprentice.c,v 1.22 2018/10/19 00:24:57 christos Exp $	*/
 
 /*
  * Copyright (c) Ian F. Darwin 1986-1995.
@@ -37,7 +37,7 @@
 #if 0
 FILE_RCSID("@(#)$File: apprentice.c,v 1.281 2018/10/10 17:41:10 christos Exp $")
 #else
-__RCSID("$NetBSD: apprentice.c,v 1.21 2018/10/19 00:11:48 christos Exp $");
+__RCSID("$NetBSD: apprentice.c,v 1.22 2018/10/19 00:24:57 christos Exp $");
 #endif
 #endif	/* lint */
 
@@ -299,9 +299,9 @@ get_type(const struct type_tbl_s *tbl, c
 
 private off_t
 maxoff_t(void) {
-	if (sizeof(off_t) == sizeof(int))
+	if (/*CONSTCOND*/sizeof(off_t) == sizeof(int))
 		return CAST(off_t, INT_MAX);
-	if (sizeof(off_t) == sizeof(long))
+	if (/*CONSTCOND*/sizeof(off_t) == sizeof(long))
 		return CAST(off_t, LONG_MAX);
 	return 0x7fffffff;
 }

Index: src/external/bsd/file/dist/src/compress.c
diff -u src/external/bsd/file/dist/src/compress.c:1.16 src/external/bsd/file/dist/src/compress.c:1.17
--- src/external/bsd/file/dist/src/compress.c:1.16	Thu Oct 18 20:11:48 2018
+++ src/external/bsd/file/dist/src/compress.c	Thu Oct 18 20:24:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: compress.c,v 1.16 2018/10/19 00:11:48 christos Exp $	*/
+/*	$NetBSD: compress.c,v 1.17 2018/10/19 00:24:57 christos Exp $	*/
 
 /*
  * Copyright (c) Ian F. Darwin 1986-1995.
@@ -40,7 +40,7 @@
 #if 0
 FILE_RCSID("@(#)$File: compress.c,v 1.113 2018/10/15 16:29:16 christos Exp $")
 #else
-__RCSID("$NetBSD: compress.c,v 1.16 2018/10/19 00:11:48 christos Exp $");
+__RCSID("$NetBSD: compress.c,v 1.17 2018/10/19 00:24:57 christos Exp $");
 #endif
 #endif
 
@@ -428,7 +428,7 @@ file_pipe2file(struct magic_set *ms, int
 #else
 	{
 		int te;
-		int ou = umask(0);
+		mode_t ou = umask(0);
 		tfd = mkstemp(buf);
 		(void)umask(ou);
 		te = errno;

Index: src/external/bsd/file/dist/src/file.h
diff -u src/external/bsd/file/dist/src/file.h:1.20 src/external/bsd/file/dist/src/file.h:1.21
--- src/external/bsd/file/dist/src/file.h:1.20	Thu Oct 18 20:11:48 2018
+++ src/external/bsd/file/dist/src/file.h	Thu Oct 18 20:24:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: file.h,v 1.20 2018/10/19 00:11:48 christos Exp $	*/
+/*	$NetBSD: file.h,v 1.21 2018/10/19 00:24:57 christos Exp $	*/
 
 /*
  * Copyright (c) Ian F. Darwin 1986-1995.
@@ -384,7 +384,7 @@ struct mlist {
 #define CCAST(T, b)	const_cast<T>(b)
 #else
 #define CAST(T, b)	((T)(b))
-#define RCAST(T, b)	((T)(b))
+#define RCAST(T, b)	((T)(void *)(b))
 #define CCAST(T, b)	((T)(uintptr_t)(b))
 #endif
 

Index: src/external/bsd/file/dist/src/is_json.c
diff -u src/external/bsd/file/dist/src/is_json.c:1.1.1.1 src/external/bsd/file/dist/src/is_json.c:1.2
--- src/external/bsd/file/dist/src/is_json.c:1.1.1.1	Thu Oct 18 19:54:09 2018
+++ src/external/bsd/file/dist/src/is_json.c	Thu Oct 18 20:24:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: is_json.c,v 1.1.1.1 2018/10/18 23:54:09 christos Exp $	*/
+/*	$NetBSD: is_json.c,v 1.2 2018/10/19 00:24:57 christos Exp $	*/
 
 /*-
  * Copyright (c) 2018 Christos Zoulas
@@ -37,7 +37,7 @@
 #if 0
 FILE_RCSID("@(#)$File: is_json.c,v 1.11 2018/10/15 16:29:16 christos Exp $")
 #else
-__RCSID("$NetBSD: is_json.c,v 1.1.1.1 2018/10/18 23:54:09 christos Exp $");
+__RCSID("$NetBSD: is_json.c,v 1.2 2018/10/19 00:24:57 christos Exp $");
 #endif
 #endif
 
@@ -50,7 +50,7 @@ __RCSID("$NetBSD: is_json.c,v 1.1.1.1 20
 #define DPRINTF(a, b, c)	\
     printf("%s [%.2x/%c] %.20s\n", (a), *(b), *(b), (const char *)(c))
 #else
-#define DPRINTF(a, b, c)	(void)0
+#define DPRINTF(a, b, c)	do { } while (/*CONSTCOND*/0)
 #endif
 
 #define JSON_ARRAY	0

Index: src/external/bsd/file/dist/src/readelf.c
diff -u src/external/bsd/file/dist/src/readelf.c:1.18 src/external/bsd/file/dist/src/readelf.c:1.19
--- src/external/bsd/file/dist/src/readelf.c:1.18	Thu Oct 18 20:11:48 2018
+++ src/external/bsd/file/dist/src/readelf.c	Thu Oct 18 20:24:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: readelf.c,v 1.18 2018/10/19 00:11:48 christos Exp $	*/
+/*	$NetBSD: readelf.c,v 1.19 2018/10/19 00:24:57 christos Exp $	*/
 
 /*
  * Copyright (c) Christos Zoulas 2003.
@@ -32,7 +32,7 @@
 #if 0
 FILE_RCSID("@(#)$File: readelf.c,v 1.154 2018/10/15 16:29:16 christos Exp $")
 #else
-__RCSID("$NetBSD: readelf.c,v 1.18 2018/10/19 00:11:48 christos Exp $");
+__RCSID("$NetBSD: readelf.c,v 1.19 2018/10/19 00:24:57 christos Exp $");
 #endif
 #endif
 
@@ -792,8 +792,8 @@ do_core_note(struct magic_set *ms, unsig
 			pidoff = argoff + 81 + 2;
 			if (doff + pidoff + 4 <= size) {
 				if (file_printf(ms, ", pid=%u",
-				    elf_getu32(swap, *(uint32_t *)(nbuf +
-				    doff + pidoff))) == -1)
+				    elf_getu32(swap, *RCAST(uint32 *, (nbuf +
+				    doff + pidoff)))) == -1)
 					return 1;
 			}
 			*flags |= FLAGS_DID_CORE;
@@ -1148,14 +1148,14 @@ donote(struct magic_set *ms, void *vbuf,
 	if (namesz & 0x80000000) {
 		if (file_printf(ms, ", bad note name size %#lx",
 		    CAST(unsigned long, namesz)) == -1)
-			return -1;
+			return 0;
 	    return 0;
 	}
 
 	if (descsz & 0x80000000) {
 		if (file_printf(ms, ", bad note description size %#lx",
 		    CAST(unsigned long, descsz)) == -1)
-		    	return -1;
+		    	return 0;
 	    return 0;
 	}
 
@@ -1674,7 +1674,7 @@ dophn_exec(struct magic_set *ms, int cla
 		case PT_INTERP:
 			if (bufsize && nbuf[0]) {
 				nbuf[bufsize - 1] = '\0';
-				memcpy(interp, nbuf, bufsize);
+				memcpy(interp, nbuf, (size_t)bufsize);
 			} else
 				strlcpy(interp, "*empty*", sizeof(interp));
 			break;

Reply via email to