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 lint fixes



details:   https://anonhg.NetBSD.org/src/rev/56fecb4026c3
branches:  trunk
changeset: 994083:56fecb4026c3
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Oct 19 00:24:57 2018 +0000

description:
lint fixes

diffstat:

 external/bsd/file/dist/src/apprentice.c |   8 ++++----
 external/bsd/file/dist/src/compress.c   |   6 +++---
 external/bsd/file/dist/src/file.h       |   4 ++--
 external/bsd/file/dist/src/is_json.c    |   6 +++---
 external/bsd/file/dist/src/readelf.c    |  14 +++++++-------
 5 files changed, 19 insertions(+), 19 deletions(-)

diffs (157 lines):

diff -r 4c2b63aca6a9 -r 56fecb4026c3 external/bsd/file/dist/src/apprentice.c
--- a/external/bsd/file/dist/src/apprentice.c   Fri Oct 19 00:13:56 2018 +0000
+++ b/external/bsd/file/dist/src/apprentice.c   Fri Oct 19 00:24:57 2018 +0000
@@ -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 @@
 
 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;
 }
diff -r 4c2b63aca6a9 -r 56fecb4026c3 external/bsd/file/dist/src/compress.c
--- a/external/bsd/file/dist/src/compress.c     Fri Oct 19 00:13:56 2018 +0000
+++ b/external/bsd/file/dist/src/compress.c     Fri Oct 19 00:24:57 2018 +0000
@@ -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 @@
 #else
        {
                int te;
-               int ou = umask(0);
+               mode_t ou = umask(0);
                tfd = mkstemp(buf);
                (void)umask(ou);
                te = errno;
diff -r 4c2b63aca6a9 -r 56fecb4026c3 external/bsd/file/dist/src/file.h
--- a/external/bsd/file/dist/src/file.h Fri Oct 19 00:13:56 2018 +0000
+++ b/external/bsd/file/dist/src/file.h Fri Oct 19 00:24:57 2018 +0000
@@ -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 @@
 #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
 
diff -r 4c2b63aca6a9 -r 56fecb4026c3 external/bsd/file/dist/src/is_json.c
--- a/external/bsd/file/dist/src/is_json.c      Fri Oct 19 00:13:56 2018 +0000
+++ b/external/bsd/file/dist/src/is_json.c      Fri Oct 19 00:24:57 2018 +0000
@@ -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 @@
 #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
diff -r 4c2b63aca6a9 -r 56fecb4026c3 external/bsd/file/dist/src/readelf.c
--- a/external/bsd/file/dist/src/readelf.c      Fri Oct 19 00:13:56 2018 +0000
+++ b/external/bsd/file/dist/src/readelf.c      Fri Oct 19 00:24:57 2018 +0000
@@ -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 @@
                        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 @@
        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 @@
                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;



Home | Main Index | Thread Index | Old Index