Commit f8a1af4a authored by Pau Espin Pedrol's avatar Pau Espin Pedrol Committed by Mouse

aper: cosmetic: fix whitespace

Drop spacing and use tabs everywhere.
parent 30219de2
...@@ -95,22 +95,22 @@ aper_get_nsnnwn(asn_per_data_t *pd, int range) { ...@@ -95,22 +95,22 @@ aper_get_nsnnwn(asn_per_data_t *pd, int range) {
//return -1; //return -1;
int length; int length;
/* handle indefinite range */ /* handle indefinite range */
length = per_get_few_bits(pd, 1); length = per_get_few_bits(pd, 1);
if (length == 0) if (length == 0)
return per_get_few_bits(pd, 6); return per_get_few_bits(pd, 6);
if (aper_get_align(pd) < 0) if (aper_get_align(pd) < 0)
return -1; return -1;
length = per_get_few_bits(pd, 8); length = per_get_few_bits(pd, 8);
/* the length is not likely to be that big */ /* the length is not likely to be that big */
if (length > 4) if (length > 4)
return -1; return -1;
value = 0; value = 0;
if (per_get_many_bits(pd, (uint8_t *)&value, 0, length * 8) < 0) if (per_get_many_bits(pd, (uint8_t *)&value, 0, length * 8) < 0)
return -1; return -1;
return value; return value;
} }
if (aper_get_align(pd) < 0) if (aper_get_align(pd) < 0)
return -1; return -1;
...@@ -120,26 +120,26 @@ aper_get_nsnnwn(asn_per_data_t *pd, int range) { ...@@ -120,26 +120,26 @@ aper_get_nsnnwn(asn_per_data_t *pd, int range) {
#else /* old APER codec */ #else /* old APER codec */
ssize_t ssize_t
aper_get_nsnnwn(asn_per_data_t *pd, int dummy_range) { aper_get_nsnnwn(asn_per_data_t *pd, int dummy_range) {
ssize_t value; ssize_t value;
ASN_DEBUG("Get the normally small non-negative whole number APER"); ASN_DEBUG("Get the normally small non-negative whole number APER");
value = per_get_few_bits(pd, 7); value = per_get_few_bits(pd, 7);
if(value & 64) { /* implicit (value < 0) */ if(value & 64) { /* implicit (value < 0) */
value &= 63; value &= 63;
value <<= 2; value <<= 2;
value |= per_get_few_bits(pd, 2); value |= per_get_few_bits(pd, 2);
if(value & 128) /* implicit (value < 0) */ if(value & 128) /* implicit (value < 0) */
return -1; return -1;
if(value == 0) if(value == 0)
return 0; return 0;
if(value >= 3) if(value >= 3)
return -1; return -1;
value = per_get_few_bits(pd, 8 * value); value = per_get_few_bits(pd, 8 * value);
return value; return value;
} }
return value; return value;
} }
#endif /* don't use old APER */ #endif /* don't use old APER */
...@@ -155,10 +155,10 @@ int aper_put_align(asn_per_outp_t *po) { ...@@ -155,10 +155,10 @@ int aper_put_align(asn_per_outp_t *po) {
ssize_t ssize_t
aper_put_length(asn_per_outp_t *po, int range, size_t length, int *need_eom) { aper_put_length(asn_per_outp_t *po, int range, size_t length, int *need_eom) {
int dummy = 0; int dummy = 0;
if(!need_eom) need_eom = &dummy; if(!need_eom) need_eom = &dummy;
*need_eom = 0; *need_eom = 0;
ASN_DEBUG("APER put length %zu with range %d", length, range); ASN_DEBUG("APER put length %zu with range %d", length, range);
...@@ -169,7 +169,7 @@ aper_put_length(asn_per_outp_t *po, int range, size_t length, int *need_eom) { ...@@ -169,7 +169,7 @@ aper_put_length(asn_per_outp_t *po, int range, size_t length, int *need_eom) {
if (aper_put_align(po) < 0) if (aper_put_align(po) < 0)
return -1; return -1;
if(length <= 127) /* #10.9.3.6 */{ if(length <= 127) { /* #10.9.3.6 */
return per_put_few_bits(po, length, 8) return per_put_few_bits(po, length, 8)
? -1 : (ssize_t)length; ? -1 : (ssize_t)length;
} }
...@@ -177,12 +177,12 @@ aper_put_length(asn_per_outp_t *po, int range, size_t length, int *need_eom) { ...@@ -177,12 +177,12 @@ aper_put_length(asn_per_outp_t *po, int range, size_t length, int *need_eom) {
return per_put_few_bits(po, length|0x8000, 16) return per_put_few_bits(po, length|0x8000, 16)
? -1 : (ssize_t)length; ? -1 : (ssize_t)length;
*need_eom = 0 == (length & 16383); *need_eom = 0 == (length & 16383);
length >>= 14; length >>= 14;
if(length > 4) { if(length > 4) {
*need_eom = 0; *need_eom = 0;
length = 4; length = 4;
} }
return per_put_few_bits(po, 0xC0 | length, 8) return per_put_few_bits(po, 0xC0 | length, 8)
? -1 : (ssize_t)(length << 14); ? -1 : (ssize_t)(length << 14);
...@@ -211,7 +211,7 @@ int ...@@ -211,7 +211,7 @@ int
aper_put_nsnnwn(asn_per_outp_t *po, int range, int number) { aper_put_nsnnwn(asn_per_outp_t *po, int range, int number) {
int bytes; int bytes;
ASN_DEBUG("aper put nsnnwn %d with range %d", number, range); ASN_DEBUG("aper put nsnnwn %d with range %d", number, range);
/* 10.5.7.1 X.691 */ /* 10.5.7.1 X.691 */
if(range < 0) { if(range < 0) {
int i; int i;
...@@ -254,30 +254,30 @@ aper_put_nsnnwn(asn_per_outp_t *po, int range, int number) { ...@@ -254,30 +254,30 @@ aper_put_nsnnwn(asn_per_outp_t *po, int range, int number) {
/* if(per_put_few_bits(po, bytes, 8)) /* if(per_put_few_bits(po, bytes, 8))
return -1; return -1;
*/ */
return per_put_few_bits(po, number, 8 * bytes); return per_put_few_bits(po, number, 8 * bytes);
} }
#else /* preserve old code base in case */ #else /* preserve old code base in case */
int int
aper_put_nsnnwn(asn_per_outp_t *po, int dummy_range, int n) { aper_put_nsnnwn(asn_per_outp_t *po, int dummy_range, int n) {
int bytes; int bytes;
ASN_DEBUG("aper_put_nsnnwn"); ASN_DEBUG("aper_put_nsnnwn");
if(n <= 63) { if(n <= 63) {
if(n < 0) return -1; if(n < 0) return -1;
return per_put_few_bits(po, n, 7); return per_put_few_bits(po, n, 7);
} }
if(n < 256) if(n < 256)
bytes = 1; bytes = 1;
else if(n < 65536) else if(n < 65536)
bytes = 2; bytes = 2;
else if(n < 256 * 65536) else if(n < 256 * 65536)
bytes = 3; bytes = 3;
else else
return -1; /* This is not a "normally small" value */ return -1; /* This is not a "normally small" value */
if(per_put_few_bits(po, bytes, 8)) if(per_put_few_bits(po, bytes, 8))
return -1; return -1;
return per_put_few_bits(po, n, 8 * bytes); return per_put_few_bits(po, n, 8 * bytes);
} }
#endif /* which aper_put_nsnnwn() */ #endif /* which aper_put_nsnnwn() */
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