Source-Changes-HG archive

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

[src/netbsd-10]: src/usr.bin/dc Pull up following revision(s) (requested by m...



details:   https://anonhg.NetBSD.org/src/rev/0a18b03e675f
branches:  netbsd-10
changeset: 377192:0a18b03e675f
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Fri Jun 30 18:10:12 2023 +0000

description:
Pull up following revision(s) (requested by martin in ticket #220):
        usr.bin/dc/bcode.c: revision 1.4
Make this compile when BIGNUM limbs (BN_ULONG) are not the same
size as "unsigned long" (e.g. in bn(64/32) configurations of openssl).

diffstat:

 usr.bin/dc/bcode.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (69 lines):

diff -r fb910e3063f9 -r 0a18b03e675f usr.bin/dc/bcode.c
--- a/usr.bin/dc/bcode.c        Fri Jun 30 17:21:33 2023 +0000
+++ b/usr.bin/dc/bcode.c        Fri Jun 30 18:10:12 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bcode.c,v 1.3 2018/02/06 17:58:19 christos Exp $       */
+/*     $NetBSD: bcode.c,v 1.3.14.1 2023/06/30 18:10:12 bouyer Exp $    */
 /*     $OpenBSD: bcode.c,v 1.51 2017/02/26 11:29:55 otto Exp $ */
 
 /*
@@ -17,7 +17,7 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: bcode.c,v 1.3 2018/02/06 17:58:19 christos Exp $");
+__RCSID("$NetBSD: bcode.c,v 1.3.14.1 2023/06/30 18:10:12 bouyer Exp $");
 
 #include <err.h>
 #include <limits.h>
@@ -338,7 +338,7 @@ max(u_int a, u_int b)
        return a > b ? a : b;
 }
 
-static unsigned long factors[] = {
+static BN_ULONG factors[] = {
        0, 10, 100, 1000, 10000, 100000, 1000000, 10000000,
        100000000, 1000000000
 };
@@ -370,7 +370,7 @@ scale_number(BIGNUM *n, int s)
                bn_checkp(ctx);
 
                bn_check(BN_set_word(a, 10));
-               bn_check(BN_set_word(p, abs_scale));
+               bn_check(BN_set_word(p, (BN_ULONG)abs_scale));
                bn_check(BN_exp(a, a, p, ctx));
                if (s > 0)
                        bn_check(BN_mul(n, n, a, ctx));
@@ -394,7 +394,7 @@ split_number(const struct number *n, BIG
        else if (n->scale < sizeof(factors)/sizeof(factors[0])) {
                rem = BN_div_word(i, factors[n->scale]);
                if (f != NULL)
-                       bn_check(BN_set_word(f, rem));
+                       bn_check(BN_set_word(f, (BN_ULONG)rem));
        } else {
                BIGNUM *a, *p;
                BN_CTX *ctx;
@@ -663,7 +663,7 @@ stackdepth(void)
 
        i = stack_size(&bmachine.stack);
        n = new_number();
-       bn_check(BN_set_word(n->number, i));
+       bn_check(BN_set_word(n->number, (BN_ULONG)i));
        push_number(n);
 }
 
@@ -732,12 +732,12 @@ num_digits(void)
                case BCODE_NUMBER:
                        digits = count_digits(value->u.num);
                        n = new_number();
-                       bn_check(BN_set_word(n->number, digits));
+                       bn_check(BN_set_word(n->number, (BN_ULONG)digits));
                        break;
                case BCODE_STRING:
                        digits = strlen(value->u.string);
                        n = new_number();
-                       bn_check(BN_set_word(n->number, digits));
+                       bn_check(BN_set_word(n->number, (BN_ULONG)digits));
                        break;
                }
                stack_free_value(value);



Home | Main Index | Thread Index | Old Index