Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/hash/sha2 Fix lint warnings.



details:   https://anonhg.NetBSD.org/src/rev/1cb516c8dc8f
branches:  trunk
changeset: 583817:1cb516c8dc8f
user:      tron <tron%NetBSD.org@localhost>
date:      Wed Aug 24 12:08:45 2005 +0000

description:
Fix lint warnings.

diffstat:

 lib/libc/hash/sha2/sha256hl.c |  7 ++++---
 lib/libc/hash/sha2/sha384hl.c |  7 ++++---
 lib/libc/hash/sha2/sha512hl.c |  7 ++++---
 3 files changed, 12 insertions(+), 9 deletions(-)

diffs (84 lines):

diff -r 7821c30100e7 -r 1cb516c8dc8f lib/libc/hash/sha2/sha256hl.c
--- a/lib/libc/hash/sha2/sha256hl.c     Wed Aug 24 11:33:09 2005 +0000
+++ b/lib/libc/hash/sha2/sha256hl.c     Wed Aug 24 12:08:45 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sha256hl.c,v 1.1 2005/08/23 16:20:01 elad Exp $ */
+/* $NetBSD: sha256hl.c,v 1.2 2005/08/24 12:08:45 tron Exp $ */
 
 /*
  * ----------------------------------------------------------------------------
@@ -34,7 +34,7 @@
 
        SHA256_Final(digest, ctx);
        for (i = 0; i < SHA256_DIGEST_LENGTH; i++) {
-               buf[i + i] = hex[digest[i] >> 4];
+               buf[i + i] = hex[(u_int32_t)digest[i] >> 4];
                buf[i + i + 1] = hex[digest[i] & 0x0f];
        }
        buf[i + i] = '\0';
@@ -65,7 +65,8 @@
        if (off > 0 && lseek(fd, off, SEEK_SET) < 0)
                return (NULL);
 
-       while ((nr = read(fd, buffer, MIN(sizeof(buffer), len))) > 0) {
+       while ((nr = read(fd, buffer, (size_t) MIN(sizeof(buffer), len)))
+           > 0) {
                SHA256_Update(&ctx, buffer, (size_t)nr);
                if (len > 0 && (len -= nr) == 0)
                        break;
diff -r 7821c30100e7 -r 1cb516c8dc8f lib/libc/hash/sha2/sha384hl.c
--- a/lib/libc/hash/sha2/sha384hl.c     Wed Aug 24 11:33:09 2005 +0000
+++ b/lib/libc/hash/sha2/sha384hl.c     Wed Aug 24 12:08:45 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sha384hl.c,v 1.1 2005/08/23 16:20:01 elad Exp $ */
+/* $NetBSD: sha384hl.c,v 1.2 2005/08/24 12:08:45 tron Exp $ */
 
 /*
  * ----------------------------------------------------------------------------
@@ -34,7 +34,7 @@
 
        SHA384_Final(digest, ctx);
        for (i = 0; i < SHA384_DIGEST_LENGTH; i++) {
-               buf[i + i] = hex[digest[i] >> 4];
+               buf[i + i] = hex[(u_int32_t)digest[i] >> 4];
                buf[i + i + 1] = hex[digest[i] & 0x0f];
        }
        buf[i + i] = '\0';
@@ -65,7 +65,8 @@
        if (off > 0 && lseek(fd, off, SEEK_SET) < 0)
                return (NULL);
 
-       while ((nr = read(fd, buffer, MIN(sizeof(buffer), len))) > 0) {
+       while ((nr = read(fd, buffer, (size_t) MIN(sizeof(buffer), len)))
+           > 0) {
                SHA384_Update(&ctx, buffer, (size_t)nr);
                if (len > 0 && (len -= nr) == 0)
                        break;
diff -r 7821c30100e7 -r 1cb516c8dc8f lib/libc/hash/sha2/sha512hl.c
--- a/lib/libc/hash/sha2/sha512hl.c     Wed Aug 24 11:33:09 2005 +0000
+++ b/lib/libc/hash/sha2/sha512hl.c     Wed Aug 24 12:08:45 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sha512hl.c,v 1.1 2005/08/23 16:20:01 elad Exp $ */
+/* $NetBSD: sha512hl.c,v 1.2 2005/08/24 12:08:45 tron Exp $ */
 
 /*
  * ----------------------------------------------------------------------------
@@ -34,7 +34,7 @@
 
        SHA512_Final(digest, ctx);
        for (i = 0; i < SHA512_DIGEST_LENGTH; i++) {
-               buf[i + i] = hex[digest[i] >> 4];
+               buf[i + i] = hex[(u_int32_t)digest[i] >> 4];
                buf[i + i + 1] = hex[digest[i] & 0x0f];
        }
        buf[i + i] = '\0';
@@ -65,7 +65,8 @@
        if (off > 0 && lseek(fd, off, SEEK_SET) < 0)
                return (NULL);
 
-       while ((nr = read(fd, buffer, MIN(sizeof(buffer), len))) > 0) {
+       while ((nr = read(fd, buffer, (size_t) MIN(sizeof(buffer), len)))
+           > 0) {
                SHA512_Update(&ctx, buffer, (size_t)nr);
                if (len > 0 && (len -= nr) == 0)
                        break;



Home | Main Index | Thread Index | Old Index