Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/dc Adjust to OpenSSL 1.1
details: https://anonhg.NetBSD.org/src/rev/7a902b24803e
branches: trunk
changeset: 359298:7a902b24803e
user: christos <christos%NetBSD.org@localhost>
date: Tue Feb 06 17:58:19 2018 +0000
description:
Adjust to OpenSSL 1.1
diffstat:
usr.bin/dc/bcode.c | 21 +++++++++++----------
usr.bin/dc/inout.c | 26 ++++++++++++++------------
2 files changed, 25 insertions(+), 22 deletions(-)
diffs (160 lines):
diff -r da4b3ca8742c -r 7a902b24803e usr.bin/dc/bcode.c
--- a/usr.bin/dc/bcode.c Tue Feb 06 17:08:18 2018 +0000
+++ b/usr.bin/dc/bcode.c Tue Feb 06 17:58:19 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bcode.c,v 1.2 2017/04/10 16:37:48 christos Exp $ */
+/* $NetBSD: bcode.c,v 1.3 2018/02/06 17:58:19 christos 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.2 2017/04/10 16:37:48 christos Exp $");
+__RCSID("$NetBSD: bcode.c,v 1.3 2018/02/06 17:58:19 christos Exp $");
#include <err.h>
#include <limits.h>
@@ -32,6 +32,7 @@
#define MAX_ARRAY_INDEX 2048
#define READSTACK_SIZE 8
+#define NO_NUMBER (~0UL)
#define NO_ELSE -2 /* -1 is EOF */
#define REG_ARRAY_SIZE_SMALL (UCHAR_MAX + 1)
@@ -590,7 +591,7 @@
warnx("scale must be a nonnegative number");
else {
scale = get_ulong(n);
- if (scale != BN_MASK2 && scale <= UINT_MAX)
+ if (scale != NO_NUMBER && scale <= UINT_MAX)
bmachine.scale = (u_int)scale;
else
warnx("scale too large");
@@ -618,7 +619,7 @@
n = pop_number();
if (n != NULL) {
base = get_ulong(n);
- if (base != BN_MASK2 && base > 1 && base <= UINT_MAX)
+ if (base != NO_NUMBER && base > 1 && base <= UINT_MAX)
bmachine.obase = (u_int)base;
else
warnx("output base must be a number greater than 1");
@@ -645,7 +646,7 @@
n = pop_number();
if (n != NULL) {
base = get_ulong(n);
- if (base != BN_MASK2 && 2 <= base && base <= 16)
+ if (base != NO_NUMBER && 2 <= base && base <= 16)
bmachine.ibase = (u_int)base;
else
warnx("input base must be a number between 2 and 16 "
@@ -884,7 +885,7 @@
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 == NO_NUMBER || idx > MAX_ARRAY_INDEX)
warnx("idx too big");
else {
stack = &bmachine.reg[reg];
@@ -924,7 +925,7 @@
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 == NO_NUMBER || idx > MAX_ARRAY_INDEX) {
warnx("idx too big");
stack_free_value(value);
} else {
@@ -1205,7 +1206,7 @@
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 == NO_NUMBER ||
b > UINT_MAX)))
rscale = m;
}
@@ -1566,7 +1567,7 @@
return;
i = get_ulong(n);
free_number(n);
- if (i == BN_MASK2 || i == 0)
+ if (i == NO_NUMBER || i == 0)
warnx("Q command requires a number >= 1");
else if (bmachine.readsp < i)
warnx("Q command argument exceeded string execution depth");
@@ -1588,7 +1589,7 @@
if (n == NULL)
return;
i = get_ulong(n);
- if (i == BN_MASK2)
+ if (i == NO_NUMBER)
warnx("J command requires a number >= 0");
else if (i > 0 && bmachine.readsp < i)
warnx("J command argument exceeded string execution depth");
diff -r da4b3ca8742c -r 7a902b24803e usr.bin/dc/inout.c
--- a/usr.bin/dc/inout.c Tue Feb 06 17:08:18 2018 +0000
+++ b/usr.bin/dc/inout.c Tue Feb 06 17:58:19 2018 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: inout.c,v 1.2 2017/04/10 16:37:48 christos Exp $ */
+/* $NetBSD: inout.c,v 1.3 2018/02/06 17:58:19 christos Exp $ */
/* $OpenBSD: inout.c,v 1.20 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: inout.c,v 1.2 2017/04/10 16:37:48 christos Exp $");
+__RCSID("$NetBSD: inout.c,v 1.3 2018/02/06 17:58:19 christos Exp $");
#include <ctype.h>
#include <err.h>
@@ -331,19 +331,21 @@
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, (int)b->scale);
+ mult = BN_new();
+ stop = BN_new();
+ if (mult == NULL || stop == NULL)
+ err(1, NULL);
+ bn_check(BN_one(mult));
+ bn_check(BN_one(stop));
+ scale_number(stop, (int)b->scale);
i = 0;
- while (BN_cmp(&mult, &stop) < 0) {
+ while (BN_cmp(mult, stop) < 0) {
u_long rem;
if (i && base > 16)
@@ -361,11 +363,11 @@
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);
Home |
Main Index |
Thread Index |
Old Index