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,
rval.consumed >>= 3;
} else if(rval.code == RC_OK) {
if(size) {
if(((uint8_t *)buffer)[0] == 0) {
if(((const uint8_t *)buffer)[0] == 0) {
rval.consumed = 1; /* 1 byte */
} else {
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
/* Return the number of consumed bits */
rval.consumed = ((pd.buffer - (const uint8_t *)buffer) << 3)
+ pd.nboff - skip_bits;
ASN_DEBUG("PER decoding consumed %d, counted %d",
rval.consumed, pd.moved);
ASN_DEBUG("PER decoding consumed %ld, counted %ld",
(long)rval.consumed, (long)pd.moved);
assert(rval.consumed == pd.moved);
} else {
/* 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
}
default:
*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);
}
}
......
......@@ -49,8 +49,8 @@ uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints
FREEMEM(buf);
if(toGo) return -1;
ASN_DEBUG("Open type put %s of length %d + overhead (1byte?)",
td->name, size);
ASN_DEBUG("Open type put %s of length %ld + overhead (1byte?)",
td->name, (long)size);
return 0;
}
......@@ -94,8 +94,8 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
bufLen += chunk_bytes;
} while(repeat);
ASN_DEBUG("Getting open type %s encoded in %d bytes", td->name,
bufLen);
ASN_DEBUG("Getting open type %s encoded in %ld bytes", td->name,
(long)bufLen);
memset(&spd, 0, sizeof(spd));
spd.buffer = buf;
......@@ -118,7 +118,7 @@ uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
}
FREEMEM(buf);
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;
} else {
ASN_DEBUG("Non-zero padding");
......@@ -170,24 +170,23 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
return rv;
}
ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d"
, td->name,
ASN_DEBUG("OpenType %s pd%s old%s unclaimed=%d, repeat=%d", td->name,
per_data_string(pd),
per_data_string(&arg.oldpd),
arg.unclaimed, arg.repeat);
(int)arg.unclaimed, (int)arg.repeat);
padding = pd->moved % 8;
if(padding) {
int32_t pvalue;
if(padding > 7) {
ASN_DEBUG("Too large padding %d in open type",
padding);
(int)padding);
rv.code = RC_FAIL;
UPDRESTOREPD;
return rv;
}
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);
switch(pvalue) {
case -1:
......@@ -197,7 +196,7 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
case 0: break;
default:
ASN_DEBUG("Non-blank padding (%d bits 0x%02x)",
padding, (int)pvalue);
(int)padding, (int)pvalue);
UPDRESTOREPD;
_ASN_DECODE_FAILED;
}
......@@ -217,14 +216,14 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
UPDRESTOREPD;
/* Skip data not consumed by the decoder */
if(arg.unclaimed) ASN_DEBUG("Getting unclaimed %d", arg.unclaimed);
if(arg.unclaimed) {
ASN_DEBUG("Getting unclaimed %d", (int)arg.unclaimed);
switch(per_skip_bits(pd, arg.unclaimed)) {
case -1:
ASN_DEBUG("Claim of %d failed", arg.unclaimed);
ASN_DEBUG("Claim of %d failed", (int)arg.unclaimed);
_ASN_DECODE_STARVED;
case 0:
ASN_DEBUG("Got claim of %d", arg.unclaimed);
ASN_DEBUG("Got claim of %d", (int)arg.unclaimed);
break;
default:
/* Padding must be blank */
......@@ -248,9 +247,7 @@ asn_dec_rval_t
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) {
return uper_open_type_get_simple(ctx, td, constraints,
sptr, pd);
return uper_open_type_get_simple(ctx, td, constraints, sptr, pd);
}
int
......@@ -298,8 +295,8 @@ uper_ugot_refill(asn_per_data_t *pd) {
asn_per_data_t *oldpd = &arg->oldpd;
ASN_DEBUG("REFILLING pd->moved=%d, oldpd->moved=%d",
pd->moved, oldpd->moved);
ASN_DEBUG("REFILLING pd->moved=%ld, oldpd->moved=%ld",
(long)pd->moved, (long)oldpd->moved);
/* Advance our position to where pd is */
oldpd->buffer = pd->buffer;
......@@ -319,7 +316,8 @@ uper_ugot_refill(asn_per_data_t *pd) {
pd->buffer = oldpd->buffer;
pd->nboff = oldpd->nboff - 1;
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;
}
......@@ -329,8 +327,8 @@ uper_ugot_refill(asn_per_data_t *pd) {
}
next_chunk_bytes = uper_get_length(oldpd, -1, &arg->repeat);
ASN_DEBUG("Open type LENGTH %d bytes at off %d, repeat %d",
next_chunk_bytes, oldpd->moved, arg->repeat);
ASN_DEBUG("Open type LENGTH %ld bytes at off %ld, repeat %ld",
(long)next_chunk_bytes, (long)oldpd->moved, (long)arg->repeat);
if(next_chunk_bytes < 0) return -1;
if(next_chunk_bytes == 0) {
pd->refill = 0; /* No more refills, naturally */
......@@ -341,14 +339,16 @@ uper_ugot_refill(asn_per_data_t *pd) {
if(avail >= next_chunk_bits) {
pd->nbits = oldpd->nboff + next_chunk_bits;
arg->unclaimed = 0;
ASN_DEBUG("!+Parent frame %d bits, alloting %d [%d..%d] (%d)",
next_chunk_bits, oldpd->moved,
oldpd->nboff, oldpd->nbits,
oldpd->nbits - oldpd->nboff);
ASN_DEBUG("!+Parent frame %ld bits, alloting %ld [%ld..%ld] (%ld)",
(long)next_chunk_bits, (long)oldpd->moved,
(long)oldpd->nboff, (long)oldpd->nbits,
(long)(oldpd->nbits - oldpd->nboff));
} else {
pd->nbits = oldpd->nbits;
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->nboff = oldpd->nboff;
......
......@@ -13,11 +13,11 @@ per_data_string(asn_per_data_t *pd) {
static int n;
n = (n+1) % 2;
snprintf(buf[n], sizeof(buf),
"{m=%d span %+d[%d..%d] (%d)}",
pd->moved,
"{m=%ld span %+d[%d..%d] (%d)}",
(long)pd->moved,
(((int)pd->buffer) & 0xf),
pd->nboff, pd->nbits,
pd->nbits - pd->nboff);
(int)pd->nboff, (int)pd->nbits,
(int)(pd->nbits - pd->nboff));
return buf[n];
}
......@@ -49,7 +49,8 @@ per_get_few_bits(asn_per_data_t *pd, int nbits) {
int32_t tailv, vhead;
if(!pd->refill || nbits > 31) return -1;
/* 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);
if(tailv < 0) return -1;
/* Refill (replace pd contents with new data) */
......@@ -104,12 +105,12 @@ per_get_few_bits(asn_per_data_t *pd, int nbits) {
accum &= (((uint32_t)1 << nbits) - 1);
ASN_DEBUG(" [PER got %2d<=%2d bits => span %d %+d[%d..%d]:%02x (%d) => 0x%x]",
nbits, nleft,
pd->moved,
(int)nbits, (int)nleft,
(int)pd->moved,
(((int)pd->buffer) & 0xf),
pd->nboff, pd->nbits,
(int)pd->nboff, (int)pd->nbits,
pd->buffer[0],
pd->nbits - pd->nboff,
(int)(pd->nbits - pd->nboff),
(int)accum);
return accum;
......@@ -200,7 +201,7 @@ uper_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=%d", length);
ASN_DEBUG("l=%d", (int)length);
return length;
} else {
int repeat;
......@@ -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;
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.
......@@ -291,8 +292,8 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) {
*/
if(po->nboff + obits > po->nbits) {
int complete_bytes = (po->buffer - po->tmpspace);
ASN_DEBUG("[PER output %d complete + %d]",
complete_bytes, po->flushed_bytes);
ASN_DEBUG("[PER output %ld complete + %ld]",
(long)complete_bytes, (long)po->flushed_bytes);
if(po->outper(po->tmpspace, complete_bytes, po->op_key) < 0)
return -1;
if(po->nboff)
......@@ -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,
(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 */
po->nboff = off,
......@@ -339,14 +342,13 @@ per_put_few_bits(asn_per_outp_t *po, uint32_t bits, int obits) {
buf[2] = bits >> 8,
buf[3] = bits;
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);
ASN_DEBUG("<-[PER out split %d]", obits);
}
ASN_DEBUG("[PER out %u/%x => %02x buf+%d]",
(int)bits, (int)bits, buf[0], po->buffer - po->tmpspace);
ASN_DEBUG("[PER out %u/%x => %02x buf+%ld]",
(int)bits, (int)bits, buf[0],
(long)(po->buffer - po->tmpspace));
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