Commit fb35e088 authored by Lev Walkin's avatar Lev Walkin

whitespace changes

parent d19216f2
...@@ -276,8 +276,8 @@ main(int ac, char *av[]) { ...@@ -276,8 +276,8 @@ main(int ac, char *av[]) {
/* /*
* Decode the encoded structure from file. * Decode the encoded structure from file.
*/ */
structure = data_decode_from_file(pduType, structure = data_decode_from_file(pduType, file, name,
file, name, suggested_bufsize, first_pdu); suggested_bufsize, first_pdu);
if(!structure) { if(!structure) {
if(errno) { if(errno) {
/* Error message is already printed */ /* Error message is already printed */
...@@ -292,10 +292,11 @@ main(int ac, char *av[]) { ...@@ -292,10 +292,11 @@ main(int ac, char *av[]) {
if(opt_check) { if(opt_check) {
char errbuf[128]; char errbuf[128];
size_t errlen = sizeof(errbuf); size_t errlen = sizeof(errbuf);
if(asn_check_constraints(pduType, structure, if(asn_check_constraints(pduType, structure, errbuf, &errlen)) {
errbuf, &errlen)) { fprintf(stderr,
fprintf(stderr, "%s: ASN.1 constraint " "%s: ASN.1 constraint "
"check failed: %s\n", name, errbuf); "check failed: %s\n",
name, errbuf);
exit(EX_DATAERR); exit(EX_DATAERR);
} }
} }
...@@ -312,18 +313,16 @@ main(int ac, char *av[]) { ...@@ -312,18 +313,16 @@ main(int ac, char *av[]) {
break; break;
case OUT_XER: /* -oxer */ case OUT_XER: /* -oxer */
if(xer_fprint(stdout, pduType, structure)) { if(xer_fprint(stdout, pduType, structure)) {
fprintf(stderr, fprintf(stderr, "%s: Cannot convert %s into XML\n", name,
"%s: Cannot convert %s into XML\n", pduType->name);
name, pduType->name);
exit(EX_UNAVAILABLE); exit(EX_UNAVAILABLE);
} }
break; break;
case OUT_DER: case OUT_DER:
erv = der_encode(pduType, structure, write_out, stdout); erv = der_encode(pduType, structure, write_out, stdout);
if(erv.encoded < 0) { if(erv.encoded < 0) {
fprintf(stderr, fprintf(stderr, "%s: Cannot convert %s into DER\n", name,
"%s: Cannot convert %s into DER\n", pduType->name);
name, pduType->name);
exit(EX_UNAVAILABLE); exit(EX_UNAVAILABLE);
} }
DEBUG("Encoded in %ld bytes of DER", (long)erv.encoded); DEBUG("Encoded in %ld bytes of DER", (long)erv.encoded);
...@@ -331,9 +330,8 @@ main(int ac, char *av[]) { ...@@ -331,9 +330,8 @@ main(int ac, char *av[]) {
case OUT_OER: case OUT_OER:
erv = oer_encode(pduType, structure, write_out, stdout); erv = oer_encode(pduType, structure, write_out, stdout);
if(erv.encoded < 0) { if(erv.encoded < 0) {
fprintf(stderr, fprintf(stderr, "%s: Cannot convert %s into oER\n", name,
"%s: Cannot convert %s into oER\n", pduType->name);
name, pduType->name);
exit(EX_UNAVAILABLE); exit(EX_UNAVAILABLE);
} }
DEBUG("Encoded in %ld bytes of OER", (long)erv.encoded); DEBUG("Encoded in %ld bytes of OER", (long)erv.encoded);
...@@ -342,8 +340,8 @@ main(int ac, char *av[]) { ...@@ -342,8 +340,8 @@ main(int ac, char *av[]) {
erv = uper_encode(pduType, structure, write_out, stdout); erv = uper_encode(pduType, structure, write_out, stdout);
if(erv.encoded < 0) { if(erv.encoded < 0) {
fprintf(stderr, fprintf(stderr,
"%s: Cannot convert %s into Unaligned PER\n", "%s: Cannot convert %s into Unaligned PER\n", name,
name, pduType->name); pduType->name);
exit(EX_UNAVAILABLE); exit(EX_UNAVAILABLE);
} }
DEBUG("Encoded in %ld bits of UPER", (long)erv.encoded); DEBUG("Encoded in %ld bits of UPER", (long)erv.encoded);
...@@ -353,10 +351,11 @@ main(int ac, char *av[]) { ...@@ -353,10 +351,11 @@ main(int ac, char *av[]) {
ASN_STRUCT_FREE(*pduType, structure); ASN_STRUCT_FREE(*pduType, structure);
} }
if(file && file != stdin) if(file && file != stdin) {
fclose(file); fclose(file);
} }
} }
}
#ifdef JUNKTEST #ifdef JUNKTEST
if(opt_jprob > 0.0) { if(opt_jprob > 0.0) {
...@@ -816,15 +815,11 @@ static int argument_is_stdin(char *av[], int idx) { ...@@ -816,15 +815,11 @@ static int argument_is_stdin(char *av[], int idx) {
} }
static FILE *argument_to_file(char *av[], int idx) { static FILE *argument_to_file(char *av[], int idx) {
return argument_is_stdin(av, idx) return argument_is_stdin(av, idx) ? stdin : fopen(av[idx], "rb");
? stdin
: fopen(av[idx], "rb");
} }
static char *argument_to_name(char *av[], int idx) { static char *argument_to_name(char *av[], int idx) {
return argument_is_stdin(av, idx) return argument_is_stdin(av, idx) ? "standard input" : av[idx];
? "standard input"
: av[idx];
} }
#ifdef JUNKTEST #ifdef JUNKTEST
...@@ -854,8 +849,7 @@ junk_bytes_with_probability(uint8_t *buf, size_t size, double prob) { ...@@ -854,8 +849,7 @@ junk_bytes_with_probability(uint8_t *buf, size_t size, double prob) {
byte ^= BPROB(0x01); byte ^= BPROB(0x01);
} }
if(byte != *ptr) { if(byte != *ptr) {
DEBUG("Junk buf[%d] %02x -> %02x", DEBUG("Junk buf[%d] %02x -> %02x", ptr - buf, *ptr, byte);
ptr - buf, *ptr, byte);
*ptr = byte; *ptr = byte;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment