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 <levitte@openssl.org>
This commit is contained in:
Matt Caswell 2016-06-15 15:59:46 +01:00
parent ac94c8fdb9
commit d012c1a179
1 changed files with 7 additions and 6 deletions

View File

@ -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;