From: Matt Caswell Date: Wed, 15 Jun 2016 14:59:46 +0000 (+0100) Subject: Replace 4 casts with 1 X-Git-Tag: OpenSSL_1_1_0-pre6~409 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d012c1a17934d4f5aac0bc9853efcb3f831b5b23;p=openssl Replace 4 casts with 1 Changing the type of the |str| variable in asn1pars enables us to remove 4 casts with just 1. This silences an OpenBSD warning along the way. RT4378 Reviewed-by: Richard Levitte --- diff --git a/apps/asn1pars.c b/apps/asn1pars.c index d3b1970def..64a2d850cb 100644 --- a/apps/asn1pars.c +++ b/apps/asn1pars.c @@ -61,7 +61,8 @@ int asn1parse_main(int argc, char **argv) BUF_MEM *buf = NULL; STACK_OF(OPENSSL_STRING) *osk = NULL; char *genstr = NULL, *genconf = NULL; - char *infile = NULL, *str = NULL, *oidfile = NULL, *derfile = NULL; + char *infile = NULL, *oidfile = NULL, *derfile = NULL; + unsigned char *str = NULL; char *name = NULL, *header = NULL, *prog; const unsigned char *ctmpbuf; int indent = 0, noout = 0, dump = 0, strictpem = 0, informat = FORMAT_PEM; @@ -154,7 +155,7 @@ int asn1parse_main(int argc, char **argv) goto end; if (strictpem) { - if (PEM_read_bio(in, &name, &header, (unsigned char **)&str, &num) != + if (PEM_read_bio(in, &name, &header, &str, &num) != 1) { BIO_printf(bio_err, "Error reading PEM file\n"); ERR_print_errors(bio_err); @@ -198,14 +199,14 @@ int asn1parse_main(int argc, char **argv) num += i; } } - str = buf->data; + str = (unsigned char *)buf->data; } /* If any structs to parse go through in sequence */ if (sk_OPENSSL_STRING_num(osk)) { - tmpbuf = (unsigned char *)str; + tmpbuf = str; tmplen = num; for (i = 0; i < sk_OPENSSL_STRING_num(osk); i++) { ASN1_TYPE *atmp; @@ -239,7 +240,7 @@ int asn1parse_main(int argc, char **argv) tmpbuf = at->value.asn1_string->data; tmplen = at->value.asn1_string->length; } - str = (char *)tmpbuf; + str = tmpbuf; num = tmplen; } @@ -260,7 +261,7 @@ int asn1parse_main(int argc, char **argv) } } if (!noout && - !ASN1_parse_dump(bio_out, (unsigned char *)&(str[offset]), length, + !ASN1_parse_dump(bio_out, &(str[offset]), length, indent, dump)) { ERR_print_errors(bio_err); goto end;