Commit 23751fcd authored by Pau Espin Pedrol's avatar Pau Espin Pedrol Committed by Mouse

aper: Fix printf formatting on 32bit archs

parent abd1faa6
......@@ -87,8 +87,8 @@ INTEGER_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
? asn_uint642INTEGER(st, (unsigned long)value)
: asn_int642INTEGER(st, value))
ASN__DECODE_FAILED;
ASN_DEBUG("Got value %ld + low %ld",
value, ct->lower_bound);
ASN_DEBUG("Got value %ld + low %lld",
value, (long long int)ct->lower_bound);
} else {
long value = 0;
if (ct->range_bits < 8) {
......@@ -111,8 +111,8 @@ INTEGER_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
? asn_ulong2INTEGER(st, value)
: asn_long2INTEGER(st, value))
ASN__DECODE_FAILED;
ASN_DEBUG("Got value %ld + low %ld",
value, ct->lower_bound);
ASN_DEBUG("Got value %ld + low %lld",
value, (long long int)ct->lower_bound);
}
return rval;
} else {
......@@ -191,9 +191,10 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td,
|| uval > (unsigned long)ct->upper_bound)
inext = 1;
}
ASN_DEBUG("Value %lu (%02x/%lu) lb %ld ub %ld %s",
ASN_DEBUG("Value %lu (%02x/%zu) lb %lld ub %lld %s",
uval, st->buf[0], st->size,
ct->lower_bound, ct->upper_bound,
(long long int)ct->lower_bound,
(long long int)ct->upper_bound,
inext ? "ext" : "fix");
value = uval;
} else {
......@@ -207,9 +208,10 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td,
|| value > ct->upper_bound)
inext = 1;
}
ASN_DEBUG("Value %lu (%02x/%lu) lb %ld ub %ld %s",
ASN_DEBUG("Value %lu (%02x/%zu) lb %lld ub %lld %s",
value, st->buf[0], st->size,
ct->lower_bound, ct->upper_bound,
(long long int)ct->lower_bound,
(long long int)ct->upper_bound,
inext ? "ext" : "fix");
}
if(ct->flags & APC_EXTENSIBLE) {
......@@ -226,8 +228,9 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td,
unsigned long v;
/* #10.5.6 */
ASN_DEBUG("Encoding integer %ld (%lu) with range %d bits",
value, value - ct->lower_bound, ct->range_bits);
ASN_DEBUG("Encoding integer %ld (%lld) with range %d bits",
value, (long long int)(value - ct->lower_bound),
ct->range_bits);
v = value - ct->lower_bound;
......@@ -284,7 +287,7 @@ INTEGER_encode_aper(const asn_TYPE_descriptor_t *td,
}
if(ct && ct->lower_bound) {
ASN_DEBUG("Adjust lower bound to %ld", ct->lower_bound);
ASN_DEBUG("Adjust lower bound to %lld", (long long int)ct->lower_bound);
/* TODO: adjust lower bound */
ASN__ENCODE_FAILED;
}
......
......@@ -42,8 +42,10 @@ NativeEnumerated_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
if(ct && ct->upper_bound >= 255) {
int padding = 0;
padding = (8 - (pd->moved % 8)) % 8;
ASN_DEBUG("For NativeEnumerated %s,offset= %lu Padding bits = %d", td->name, pd->moved, padding);
ASN_DEBUG("For NativeEnumerated %s, upper bound = %lu", td->name, ct->upper_bound);
ASN_DEBUG("For NativeEnumerated %s,offset = %zu Padding bits = %d",
td->name, pd->moved, padding);
ASN_DEBUG("For NativeEnumerated %s, upper bound = %llu",
td->name, (unsigned long long)ct->upper_bound);
if(padding > 0)
per_get_few_bits(pd, padding);
}
......
......@@ -100,9 +100,10 @@ OCTET_STRING_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
if(!st) RETURN(RC_FAIL);
}
ASN_DEBUG("PER Decoding %s size %ld .. %ld bits %d",
ASN_DEBUG("PER Decoding %s size %lld .. %lld bits %d",
csiz->flags & APC_EXTENSIBLE ? "extensible" : "non-extensible",
csiz->lower_bound, csiz->upper_bound, csiz->effective_bits);
(long long int)csiz->lower_bound, (long long int)csiz->upper_bound,
csiz->effective_bits);
if(csiz->flags & APC_EXTENSIBLE) {
int inext = per_get_few_bits(pd, 1);
......@@ -136,8 +137,8 @@ OCTET_STRING_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
RETURN(RC_FAIL);
}
if(bpc) {
ASN_DEBUG("Decoding OCTET STRING size %ld",
csiz->upper_bound);
ASN_DEBUG("Decoding OCTET STRING size %lld",
(long long int)csiz->upper_bound);
ret = OCTET_STRING_per_get_characters(pd, st->buf,
csiz->upper_bound,
bpc, unit_bits,
......@@ -146,8 +147,8 @@ OCTET_STRING_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
pc);
if(ret > 0) RETURN(RC_FAIL);
} else {
ASN_DEBUG("Decoding BIT STRING size %ld",
csiz->upper_bound);
ASN_DEBUG("Decoding BIT STRING size %lld",
(long long int)csiz->upper_bound);
ret = per_get_many_bits(pd, st->buf, 0,
unit_bits * csiz->upper_bound);
}
......@@ -307,9 +308,10 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td,
}
ASN_DEBUG("Encoding %s into %d units of %d bits"
" (%ld..%ld, effective %d)%s",
" (%lld..%lld, effective %d)%s",
td->name, sizeinunits, unit_bits,
csiz->lower_bound, csiz->upper_bound,
(long long int)csiz->lower_bound,
(long long int)csiz->upper_bound,
csiz->effective_bits, ct_extensible ? " EXT" : "");
/* Figure out wheter size lies within PER visible constraint */
......@@ -339,8 +341,8 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td,
/* X.691, #16.6: short fixed length encoding (up to 2 octets) */
/* X.691, #16.7: long fixed length encoding (up to 64K octets) */
if(csiz->effective_bits >= 0) {
ASN_DEBUG("Encoding %lu bytes (%ld), length in %d bits",
st->size, sizeinunits - csiz->lower_bound,
ASN_DEBUG("Encoding %zu bytes (%lld), length in %d bits",
st->size, (long long int)(sizeinunits - csiz->lower_bound),
csiz->effective_bits);
if (csiz->effective_bits > 0) {
ret = aper_put_length(po, csiz->lower_bound, csiz->upper_bound,
......@@ -369,7 +371,7 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td,
ASN__ENCODED_OK(er);
}
ASN_DEBUG("Encoding %lu bytes", st->size);
ASN_DEBUG("Encoding %zu bytes", st->size);
if(sizeinunits == 0) {
if(aper_put_length(po, -1, -1, 0, NULL) < 0)
......
......@@ -115,7 +115,7 @@ aper_open_type_put(const asn_TYPE_descriptor_t *td,
FREEMEM(buf);
if(toGo) return -1;
ASN_DEBUG("Open type put %s of length %ld + overhead (1byte?)",
ASN_DEBUG("Open type put %s of length %zd + overhead (1byte?)",
td->name, size);
return 0;
......
......@@ -59,7 +59,7 @@ aper_get_nslength(asn_per_data_t *pd) {
if(per_get_few_bits(pd, 1) == 0) {
length = per_get_few_bits(pd, 6) + 1;
if(length <= 0) return -1;
ASN_DEBUG("l=%ld", length);
ASN_DEBUG("l=%zd", length);
return length;
} else {
int repeat;
......
......@@ -33,8 +33,9 @@ SEQUENCE_OF_encode_aper(const asn_TYPE_descriptor_t *td,
if(ct) {
int not_in_root = (list->count < ct->lower_bound
|| list->count > ct->upper_bound);
ASN_DEBUG("lb %ld ub %ld %s",
ct->lower_bound, ct->upper_bound,
ASN_DEBUG("lb %lld ub %lld %s",
(long long int)ct->lower_bound,
(long long int)ct->upper_bound,
ct->flags & APC_EXTENSIBLE ? "ext" : "fix");
if(ct->flags & APC_EXTENSIBLE) {
/* Declare whether size is in extension root */
......
......@@ -175,7 +175,7 @@ SEQUENCE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
memset(&epmd, 0, sizeof(epmd));
epmd.buffer = epres;
epmd.nbits = bmlength;
ASN_DEBUG("Read in extensions bitmap for %s of %ld bits (%x..)",
ASN_DEBUG("Read in extensions bitmap for %s of %zd bits (%x..)",
td->name, bmlength, *epres);
/* Deal with padding */
......@@ -190,7 +190,7 @@ SEQUENCE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
int present;
if(!IN_EXTENSION_GROUP(specs, edx)) {
ASN_DEBUG("%ld is not extension", edx);
ASN_DEBUG("%zu is not extension", edx);
continue;
}
......@@ -288,7 +288,7 @@ SEQUENCE_handle_extensions_aper(const asn_TYPE_descriptor_t *td,
int present;
if(!IN_EXTENSION_GROUP(specs, edx)) {
ASN_DEBUG("%s (@%ld) is not extension", elm->type->name, edx);
ASN_DEBUG("%s (@%zu) is not extension", elm->type->name, edx);
continue;
}
......@@ -302,7 +302,7 @@ SEQUENCE_handle_extensions_aper(const asn_TYPE_descriptor_t *td,
present = 1;
}
ASN_DEBUG("checking %s (@%ld) present => %d",
ASN_DEBUG("checking %s (@%zu) present => %d",
elm->type->name, edx, present);
exts_count++;
exts_present += present;
......@@ -410,7 +410,7 @@ SEQUENCE_encode_aper(const asn_TYPE_descriptor_t *td,
if(elm->flags & ATF_POINTER) {
memb_ptr2 = (const void * const *)((const char *)sptr + elm->memb_offset);
if(!*memb_ptr2) {
ASN_DEBUG("Element %s %ld not present",
ASN_DEBUG("Element %s %zu not present",
elm->name, edx);
if(elm->optional)
continue;
......
......@@ -34,7 +34,9 @@ SET_OF_encode_aper(const asn_TYPE_descriptor_t *td,
if(ct) {
int not_in_root =
(list->count < ct->lower_bound || list->count > ct->upper_bound);
ASN_DEBUG("lb %ld ub %ld %s", ct->lower_bound, ct->upper_bound,
ASN_DEBUG("lb %lld ub %lld %s",
(long long int)ct->lower_bound,
(long long int)ct->upper_bound,
ct->flags & APC_EXTENSIBLE ? "ext" : "fix");
if(ct->flags & APC_EXTENSIBLE) {
/* Declare whether size is in extension root */
......@@ -130,8 +132,8 @@ SET_OF_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
if(ct && ct->effective_bits >= 0) {
/* X.691, #19.5: No length determinant */
nelems = aper_get_nsnnwn(pd, ct->upper_bound - ct->lower_bound + 1);
ASN_DEBUG("Preparing to fetch %ld+%ld elements from %s",
(long)nelems, ct->lower_bound, td->name);
ASN_DEBUG("Preparing to fetch %ld+%lld elements from %s",
(long)nelems, (long long int)ct->lower_bound, td->name);
if(nelems < 0) ASN__DECODE_STARVED;
nelems += ct->lower_bound;
} else {
......
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