Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Sep 2018 07:08:27 +0000 (UTC)
From:      Jung-uk Kim <jkim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r338784 - projects/openssl111/usr.bin/dc
Message-ID:  <201809190708.w8J78RYn072133@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jkim
Date: Wed Sep 19 07:08:27 2018
New Revision: 338784
URL: https://svnweb.freebsd.org/changeset/base/338784

Log:
  Make dc(1) buildable.

Modified:
  projects/openssl111/usr.bin/dc/bcode.c
  projects/openssl111/usr.bin/dc/inout.c

Modified: projects/openssl111/usr.bin/dc/bcode.c
==============================================================================
--- projects/openssl111/usr.bin/dc/bcode.c	Wed Sep 19 07:08:04 2018	(r338783)
+++ projects/openssl111/usr.bin/dc/bcode.c	Wed Sep 19 07:08:27 2018	(r338784)
@@ -594,7 +594,7 @@ set_scale(void)
 			warnx("scale must be a nonnegative number");
 		else {
 			scale = get_ulong(n);
-			if (scale != BN_MASK2 && scale <= UINT_MAX)
+			if (scale != ULONG_MAX && scale <= UINT_MAX)
 				bmachine.scale = (u_int)scale;
 			else
 				warnx("scale too large");
@@ -622,7 +622,7 @@ set_obase(void)
 	n = pop_number();
 	if (n != NULL) {
 		base = get_ulong(n);
-		if (base != BN_MASK2 && base > 1 && base <= UINT_MAX)
+		if (base != ULONG_MAX && base > 1 && base <= UINT_MAX)
 			bmachine.obase = (u_int)base;
 		else
 			warnx("output base must be a number greater than 1");
@@ -649,7 +649,7 @@ set_ibase(void)
 	n = pop_number();
 	if (n != NULL) {
 		base = get_ulong(n);
-		if (base != BN_MASK2 && 2 <= base && base <= 16)
+		if (base != ULONG_MAX && 2 <= base && base <= 16)
 			bmachine.ibase = (u_int)base;
 		else
 			warnx("input base must be a number between 2 and 16 "
@@ -889,7 +889,7 @@ load_array(void)
 		idx = get_ulong(inumber);
 		if (BN_is_negative(inumber->number))
 			warnx("negative idx");
-		else if (idx == BN_MASK2 || idx > MAX_ARRAY_INDEX)
+		else if (idx == ULONG_MAX || idx > MAX_ARRAY_INDEX)
 			warnx("idx too big");
 		else {
 			stack = &bmachine.reg[reg];
@@ -929,7 +929,7 @@ store_array(void)
 		if (BN_is_negative(inumber->number)) {
 			warnx("negative idx");
 			stack_free_value(value);
-		} else if (idx == BN_MASK2 || idx > MAX_ARRAY_INDEX) {
+		} else if (idx == ULONG_MAX || idx > MAX_ARRAY_INDEX) {
 			warnx("idx too big");
 			stack_free_value(value);
 		} else {
@@ -1218,7 +1218,7 @@ bexp(void)
 		b = BN_get_word(p->number);
 		m = max(a->scale, bmachine.scale);
 		rscale = a->scale * (u_int)b;
-		if (rscale > m || (a->scale > 0 && (b == BN_MASK2 ||
+		if (rscale > m || (a->scale > 0 && (b == ULONG_MAX ||
 		    b > UINT_MAX)))
 			rscale = m;
 	}
@@ -1587,7 +1587,7 @@ quitN(void)
 		return;
 	i = get_ulong(n);
 	free_number(n);
-	if (i == BN_MASK2 || i == 0)
+	if (i == ULONG_MAX || i == 0)
 		warnx("Q command requires a number >= 1");
 	else if (bmachine.readsp < i)
 		warnx("Q command argument exceeded string execution depth");
@@ -1609,7 +1609,7 @@ skipN(void)
 	if (n == NULL)
 		return;
 	i = get_ulong(n);
-	if (i == BN_MASK2)
+	if (i == ULONG_MAX)
 		warnx("J command requires a number >= 0");
 	else if (i > 0 && bmachine.readsp < i)
 		warnx("J command argument exceeded string execution depth");

Modified: projects/openssl111/usr.bin/dc/inout.c
==============================================================================
--- projects/openssl111/usr.bin/dc/inout.c	Wed Sep 19 07:08:04 2018	(r338783)
+++ projects/openssl111/usr.bin/dc/inout.c	Wed Sep 19 07:08:27 2018	(r338784)
@@ -362,19 +362,21 @@ printnumber(FILE *f, const struct number *b, u_int bas
 	stack_clear(&stack);
 	if (b->scale > 0) {
 		struct number *num_base;
-		BIGNUM mult, stop;
+		BIGNUM *mult, *stop;
 
 		putcharwrap(f, '.');
 		num_base = new_number();
 		bn_check(BN_set_word(num_base->number, base));
-		BN_init(&mult);
-		bn_check(BN_one(&mult));
-		BN_init(&stop);
-		bn_check(BN_one(&stop));
-		scale_number(&stop, b->scale);
+		mult = BN_new();
+		bn_checkp(mult);
+		bn_check(BN_one(mult));
+		stop = BN_new();
+		bn_checkp(stop);
+		bn_check(BN_one(stop));
+		scale_number(stop, b->scale);
 
 		i = 0;
-		while (BN_cmp(&mult, &stop) < 0) {
+		while (BN_cmp(mult, stop) < 0) {
 			u_long rem;
 
 			if (i && base > 16)
@@ -392,11 +394,11 @@ printnumber(FILE *f, const struct number *b, u_int bas
 			    int_part->number));
 			printwrap(f, p);
 			free(p);
-			bn_check(BN_mul_word(&mult, base));
+			bn_check(BN_mul_word(mult, base));
 		}
 		free_number(num_base);
-		BN_free(&mult);
-		BN_free(&stop);
+		BN_free(mult);
+		BN_free(stop);
 	}
 	flushwrap(f);
 	free_number(int_part);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809190708.w8J78RYn072133>