Source-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/security/netpgpverify/files bring over changes from sr...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/18132731afa9
branches:  trunk
changeset: 430763:18132731afa9
user:      agc <agc%pkgsrc.org@localhost>
date:      Mon May 04 01:37:54 2020 +0000

description:
bring over changes from src - cast return values

diffstat:

 security/netpgpverify/files/sha2.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r fcd41716e04b -r 18132731afa9 security/netpgpverify/files/sha2.c
--- a/security/netpgpverify/files/sha2.c        Mon May 04 01:37:28 2020 +0000
+++ b/security/netpgpverify/files/sha2.c        Mon May 04 01:37:54 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sha2.c,v 1.5 2015/09/02 17:15:09 jperkin Exp $ */
+/* $NetBSD: sha2.c,v 1.6 2020/05/04 01:37:54 agc Exp $ */
 /*     $KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $    */
 
 /*
@@ -48,7 +48,9 @@
 #   undef be32toh
 #   undef be64toh
 
+#ifndef __CAST
 #define __CAST(__dt, __st)      ((__dt)(__st)) /* srsly? */
+#endif
 
 static __inline void
 be32encode(void *buf, uint32_t u)
@@ -76,7 +78,7 @@
        uint8_t p[4];
        memcpy(p, &x, 4);
 
-       return ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+       return (((uint32_t)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
 }
 
 static uint64_t
@@ -86,8 +88,8 @@
        uint32_t u, v;
        memcpy(p, &x, 8);
 
-       u = ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
-       v = ((p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7]);
+       u = (((uint32_t)p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+       v = (((uint32_t)p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7]);
 
        return ((((uint64_t)u) << 32) | v);
 }



Home | Main Index | Thread Index | Old Index