Skip to content
Snippets Groups Projects
Commit fe1ffaff authored by Lev Walkin's avatar Lev Walkin
Browse files

removed warnings in debug mode compilation

parent 190419b2
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,7 @@ uper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -21,7 +21,7 @@ uper_decode_complete(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
rval.consumed >>= 3; rval.consumed >>= 3;
} else if(rval.code == RC_OK) { } else if(rval.code == RC_OK) {
if(size) { if(size) {
if(((uint8_t *)buffer)[0] == 0) { if(((const uint8_t *)buffer)[0] == 0) {
rval.consumed = 1; /* 1 byte */ rval.consumed = 1; /* 1 byte */
} else { } else {
ASN_DEBUG("Expecting single zeroed byte"); ASN_DEBUG("Expecting single zeroed byte");
...@@ -81,8 +81,8 @@ uper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sp ...@@ -81,8 +81,8 @@ uper_decode(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, void **sp
/* Return the number of consumed bits */ /* Return the number of consumed bits */
rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3) rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3)
+ pd.nboff - skip_bits; + pd.nboff - skip_bits;
ASN_DEBUG("PER decoding consumed %d, counted %d", ASN_DEBUG("PER decoding consumed %ld, counted %ld",
rval.consumed, pd.moved); (long)rval.consumed, (long)pd.moved);
assert(rval.consumed == pd.moved); assert(rval.consumed == pd.moved);
} else { } else {
/* PER codec is not a restartable */ /* PER codec is not a restartable */
......
...@@ -88,7 +88,7 @@ uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cons ...@@ -88,7 +88,7 @@ uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cons
} }
default: default:
*buffer_r = key.buffer; *buffer_r = key.buffer;
ASN_DEBUG("Complete encoded in %d bits", er.encoded); ASN_DEBUG("Complete encoded in %ld bits", (long)er.encoded);
return ((er.encoded + 7) >> 3); return ((er.encoded + 7) >> 3);
} }
} }
......
...@@ -49,8 +49,8 @@ uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints ...@@ -49,8 +49,8 @@ uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints
FREEMEM(buf); FREEMEM(buf);
if(toGo) return -1; if(toGo) return -1;
ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)", ASN_DEBUG("Open type put %s of length %ld + overhead (1byte?)",
td->name, size); td->name, (long)size);
return 0; return 0;
} }
...@@ -94,8 +94,8 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, ...@@ -94,8 +94,8 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
bufLen += chunk_bytes; bufLen += chunk_bytes;
} while(repeat); } while(repeat);
ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name, ASN_DEBUG("Getting open type %s encoded in %ld bytes", td->name,
bufLen); (long)bufLen);
memset(&spd, 0, sizeof(spd)); memset(&spd, 0, sizeof(spd));
spd.buffer = buf; spd.buffer = buf;
...@@ -118,7 +118,7 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, ...@@ -118,7 +118,7 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
} }
FREEMEM(buf); FREEMEM(buf);
if(padding >= 8) { if(padding >= 8) {
ASN_DEBUG("Too large padding %d in open type", padding); ASN_DEBUG("Too large padding %d in open type", (int)padding);
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} else { } else {
ASN_DEBUG("Non-zero padding"); ASN_DEBUG("Non-zero padding");
...@@ -170,24 +170,23 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, ...@@ -170,24 +170,23 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
return rv; return rv;
} }
ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d" ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d", td->name,
, td->name,
per_data_string(pd), per_data_string(pd),
per_data_string(&arg.oldpd), per_data_string(&arg.oldpd),
arg.unclaimed, arg.repeat); (int)arg.unclaimed, (int)arg.repeat);
padding = pd->moved % 8; padding = pd->moved % 8;
if(padding) { if(padding) {
int32_t pvalue; int32_t pvalue;
if(padding > 7) { if(padding > 7) {
ASN_DEBUG("Too large padding %d in open type", ASN_DEBUG("Too large padding %d in open type",
padding); (int)padding);
rv.code = RC_FAIL; rv.code = RC_FAIL;
UPDRESTOREPD; UPDRESTOREPD;
return rv; return rv;
} }
padding = 8 - padding; padding = 8 - padding;
ASN_DEBUG("Getting padding of %d bits", padding); ASN_DEBUG("Getting padding of %d bits", (int)padding);
pvalue = per_get_few_bits(pd, padding); pvalue = per_get_few_bits(pd, padding);
switch(pvalue) { switch(pvalue) {
case -1: case -1:
...@@ -197,7 +196,7 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, ...@@ -197,7 +196,7 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
case 0: break; case 0: break;
default: default:
ASN_DEBUG("Non-blank padding (%d bits 0x%02x)", ASN_DEBUG("Non-blank padding (%d bits 0x%02x)",
padding, (int)pvalue); (int)padding, (int)pvalue);
UPDRESTOREPD; UPDRESTOREPD;
_ASN_DECODE_FAILED; _ASN_DECODE_FAILED;
} }
...@@ -217,14 +216,14 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, ...@@ -217,14 +216,14 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
UPDRESTOREPD; UPDRESTOREPD;
/* Skip data not consumed by the decoder */ /* Skip data not consumed by the decoder */
if(arg.unclaimed) ASN_DEBUG("Getting unclaimed %d", arg.unclaimed);
if(arg.unclaimed) { if(arg.unclaimed) {
ASN_DEBUG("Getting unclaimed %d", (int)arg.unclaimed);
switch(per_skip_bits(pd, arg.unclaimed)) { switch(per_skip_bits(pd, arg.unclaimed)) {
case -1: case -1:
ASN_DEBUG("Claim of %d failed", arg.unclaimed); ASN_DEBUG("Claim of %d failed", (int)arg.unclaimed);
_ASN_DECODE_STARVED; _ASN_DECODE_STARVED;
case 0: case 0:
ASN_DEBUG("Got claim of %d", arg.unclaimed); ASN_DEBUG("Got claim of %d", (int)arg.unclaimed);
break; break;
default: default:
/* Padding must be blank */ /* Padding must be blank */
...@@ -248,9 +247,7 @@ asn_dec_rval_t ...@@ -248,9 +247,7 @@ asn_dec_rval_t
uper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td, uper_open_type_get(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) { asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
return uper_open_type_get_simple(ctx, td, constraints, return uper_open_type_get_simple(ctx, td, constraints, sptr, pd);
sptr, pd);
} }
int int
...@@ -298,8 +295,8 @@ uper_ugot_refill(asn_per_data_t *pd) { ...@@ -298,8 +295,8 @@ uper_ugot_refill(asn_per_data_t *pd) {
asn_per_data_t *oldpd = &arg->oldpd; asn_per_data_t *oldpd = &arg->oldpd;
ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d", ASN_DEBUG("REFILLING pd->moved=%ld, oldpd->moved=%ld",
pd->moved, oldpd->moved); (long)pd->moved, (long)oldpd->moved);
/* Advance our position to where pd is */ /* Advance our position to where pd is */
oldpd->buffer = pd->buffer; oldpd->buffer = pd->buffer;
...@@ -319,7 +316,8 @@ uper_ugot_refill(asn_per_data_t *pd) { ...@@ -319,7 +316,8 @@ uper_ugot_refill(asn_per_data_t *pd) {
pd->buffer = oldpd->buffer; pd->buffer = oldpd->buffer;
pd->nboff = oldpd->nboff - 1; pd->nboff = oldpd->nboff - 1;
pd->nbits = oldpd->nbits; pd->nbits = oldpd->nbits;
ASN_DEBUG("UNCLAIMED <- return from (pd->moved=%d)", pd->moved); ASN_DEBUG("UNCLAIMED <- return from (pd->moved=%ld)",
(long)pd->moved);
return 0; return 0;
} }
...@@ -329,8 +327,8 @@ uper_ugot_refill(asn_per_data_t *pd) { ...@@ -329,8 +327,8 @@ uper_ugot_refill(asn_per_data_t *pd) {
} }
next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat); next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat);
ASN_DEBUG("Open type LENGTH %d bytes at off %d, repeat %d", ASN_DEBUG("Open type LENGTH %ld bytes at off %ld, repeat %ld",
next_chunk_bytes, oldpd->moved, arg->repeat); (long)next_chunk_bytes, (long)oldpd->moved, (long)arg->repeat);
if(next_chunk_bytes < 0) return -1; if(next_chunk_bytes < 0) return -1;
if(next_chunk_bytes == 0) { if(next_chunk_bytes == 0) {
pd->refill = 0; /* No more refills, naturally */ pd->refill = 0; /* No more refills, naturally */
...@@ -341,14 +339,16 @@ uper_ugot_refill(asn_per_data_t *pd) { ...@@ -341,14 +339,16 @@ uper_ugot_refill(asn_per_data_t *pd) {
if(avail >= next_chunk_bits) { if(avail >= next_chunk_bits) {
pd->nbits = oldpd->nboff + next_chunk_bits; pd->nbits = oldpd->nboff + next_chunk_bits;
arg->unclaimed = 0; arg->unclaimed = 0;
ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)", ASN_DEBUG("!+Parent frame %ld bits, alloting %ld [%ld..%ld] (%ld)",
next_chunk_bits, oldpd->moved, (long)next_chunk_bits, (long)oldpd->moved,
oldpd->nboff, oldpd->nbits, (long)oldpd->nboff, (long)oldpd->nbits,
oldpd->nbits - oldpd->nboff); (long)(oldpd->nbits - oldpd->nboff));
} else { } else {
pd->nbits = oldpd->nbits; pd->nbits = oldpd->nbits;
arg->unclaimed = next_chunk_bits - avail; arg->unclaimed = next_chunk_bits - avail;
ASN_DEBUG("!-Parent frame %d, require %d, will claim %d", avail, next_chunk_bits, arg->unclaimed); ASN_DEBUG("!-Parent frame %ld, require %ld, will claim %ld",
(long)avail, (long)next_chunk_bits,
(long)arg->unclaimed);
} }
pd->buffer = oldpd->buffer; pd->buffer = oldpd->buffer;
pd->nboff = oldpd->nboff; pd->nboff = oldpd->nboff;
......
...@@ -13,11 +13,11 @@ per_data_string(asn_per_data_t *pd) { ...@@ -13,11 +13,11 @@ per_data_string(asn_per_data_t *pd) {
static int n; static int n;
n = (n+1) % 2; n = (n+1) % 2;
snprintf(buf[n], sizeof(buf), snprintf(buf[n], sizeof(buf),
"{m=%d span %+d[%d..%d] (%d)}", "{m=%ld span %+d[%d..%d] (%d)}",
pd->moved, (long)pd->moved,
(((int)pd->buffer) & 0xf), (((int)pd->buffer) & 0xf),
pd->nboff, pd->nbits, (int)pd->nboff, (int)pd->nbits,
pd->nbits - pd->nboff); (int)(pd->nbits - pd->nboff));
return buf[n]; return buf[n];
} }
...@@ -49,7 +49,8 @@ per_get_few_bits(asn_per_data_t *pd, int nbits) { ...@@ -49,7 +49,8 @@ per_get_few_bits(asn_per_data_t *pd, int nbits) {
int32_t tailv, vhead; int32_t tailv, vhead;
if(!pd->refill || nbits > 31) return -1; if(!pd->refill || nbits > 31) return -1;
/* Accumulate unused bytes before refill */ /* Accumulate unused bytes before refill */
ASN_DEBUG("Obtain the rest %d bits (want %d)", nleft, nbits); ASN_DEBUG("Obtain the rest %d bits (want %d)",
(int)nleft, (int)nbits);
tailv = per_get_few_bits(pd, nleft); tailv = per_get_few_bits(pd, nleft);
if(tailv < 0) return -1; if(tailv < 0) return -1;
/* Refill (replace pd contents with new data) */ /* Refill (replace pd contents with new data) */
...@@ -104,12 +105,12 @@ per_get_few_bits(asn_per_data_t *pd, int nbits) { ...@@ -104,12 +105,12 @@ per_get_few_bits(asn_per_data_t *pd, int nbits) {
accum &= (((uint32_t)1 << nbits) - 1); accum &= (((uint32_t)1 << nbits) - 1);
ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+d[%d..%d]:%02x (%d) => 0x%x]", ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+d[%d..%d]:%02x (%d) => 0x%x]",
nbits, nleft, (int)nbits, (int)nleft,
pd->moved, (int)pd->moved,
(((int)pd->buffer) & 0xf), (((int)pd->buffer) & 0xf),
pd->nboff, pd->nbits, (int)pd->nboff, (int)pd->nbits,
pd->buffer[0], pd->buffer[0],
pd->nbits - pd->nboff, (int)(pd->nbits - pd->nboff),
(int)accum); (int)accum);
return accum; return accum;
...@@ -200,7 +201,7 @@ uper_get_nslength(asn_per_data_t *pd) { ...@@ -200,7 +201,7 @@ uper_get_nslength(asn_per_data_t *pd) {
if(per_get_few_bits(pd, 1) == 0) { if(per_get_few_bits(pd, 1) == 0) {
length = per_get_few_bits(pd, 6) + 1; length = per_get_few_bits(pd, 6) + 1;
if(length <= 0) return -1; if(length <= 0) return -1;
ASN_DEBUG("l=%d", length); ASN_DEBUG("l=%d", (int)length);
return length; return length;
} else { } else {
int repeat; int repeat;
...@@ -275,7 +276,7 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { ...@@ -275,7 +276,7 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) {
if(obits <= 0 || obits >= 32) return obits ? -1 : 0; if(obits <= 0 || obits >= 32) return obits ? -1 : 0;
ASN_DEBUG("[PER put %d bits %x to %p+%d bits]", ASN_DEBUG("[PER put %d bits %x to %p+%d bits]",
obits, (int)bits, po->buffer, po->nboff); obits, (int)bits, po->buffer, (int)po->nboff);
/* /*
* Normalize position indicator. * Normalize position indicator.
...@@ -291,8 +292,8 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { ...@@ -291,8 +292,8 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) {
*/ */
if(po->nboff + obits > po->nbits) { if(po->nboff + obits > po->nbits) {
int complete_bytes = (po->buffer - po->tmpspace); int complete_bytes = (po->buffer - po->tmpspace);
ASN_DEBUG("[PER output %d complete + %d]", ASN_DEBUG("[PER output %ld complete + %ld]",
complete_bytes, po->flushed_bytes); (long)complete_bytes, (long)po->flushed_bytes);
if(po->outper(po->tmpspace, complete_bytes, po->op_key) < 0) if(po->outper(po->tmpspace, complete_bytes, po->op_key) < 0)
return -1; return -1;
if(po->nboff) if(po->nboff)
...@@ -314,7 +315,9 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { ...@@ -314,7 +315,9 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) {
ASN_DEBUG("[PER out %d %u/%x (t=%d,o=%d) %x&%x=%x]", obits, ASN_DEBUG("[PER out %d %u/%x (t=%d,o=%d) %x&%x=%x]", obits,
(int)bits, (int)bits, (int)bits, (int)bits,
po->nboff, off, buf[0], omsk&0xff, buf[0] & omsk); (int)po->nboff, (int)off,
buf[0], (int)(omsk&0xff),
(int)(buf[0] & omsk));
if(off <= 8) /* Completely within 1 byte */ if(off <= 8) /* Completely within 1 byte */
po->nboff = off, po->nboff = off,
...@@ -339,14 +342,13 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) { ...@@ -339,14 +342,13 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) {
buf[2] = bits >> 8, buf[2] = bits >> 8,
buf[3] = bits; buf[3] = bits;
else { else {
ASN_DEBUG("->[PER out split %d]", obits);
per_put_few_bits(po, bits >> (obits - 24), 24); per_put_few_bits(po, bits >> (obits - 24), 24);
per_put_few_bits(po, bits, obits - 24); per_put_few_bits(po, bits, obits - 24);
ASN_DEBUG("<-[PER out split %d]", obits);
} }
ASN_DEBUG("[PER out %u/%x => %02x buf+%d]", ASN_DEBUG("[PER out %u/%x => %02x buf+%ld]",
(int)bits, (int)bits, buf[0], po->buffer - po->tmpspace); (int)bits, (int)bits, buf[0],
(long)(po->buffer - po->tmpspace));
return 0; return 0;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment