Commit 494fb707 authored by Lev Walkin's avatar Lev Walkin

fix warnings

parent 6021ec03
......@@ -822,30 +822,6 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx, asn_struct_ctx_t *ctx,
return rv;
}
asn_dec_rval_t
OCTET_STRING_decode_uper(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *cts, void **sptr,
asn_per_data_t *pd) {
asn_dec_rval_t rv = {0, 0};
(void)ctx;
(void)td;
(void)cts;
(void)sptr;
(void)pd;
return rv;
}
asn_enc_rval_t
OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *cts,
void *sptr, asn_per_outp_t *po) {
asn_enc_rval_t er = {0, 0, 0};
(void)td;
(void)cts;
(void)sptr;
(void)po;
return er;
}
size_t
xer_whitespace_span(const void *chunk_buf, size_t chunk_size) {
(void)chunk_buf;
......
......@@ -181,7 +181,7 @@ static int ANY__consume_bytes(const void *buffer, size_t size, void *key) {
asn_dec_rval_t
ANY_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr,
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
asn_OCTET_STRING_specifics_t *specs =
td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics
......@@ -236,8 +236,9 @@ ANY_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
}
asn_enc_rval_t
ANY_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
void *sptr, asn_per_outp_t *po) {
ANY_encode_uper(asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
const ANY_t *st = (const ANY_t *)sptr;
asn_enc_rval_t er = {0, 0, 0};
const uint8_t *buf;
......
......@@ -13,7 +13,7 @@ extern "C" {
typedef struct BIT_STRING_s {
uint8_t *buf; /* BIT STRING body */
int size; /* Size of the above buffer */
size_t size; /* Size of the above buffer */
int bits_unused;/* Unused trailing bits in the last octet (0..7) */
......
......@@ -249,8 +249,9 @@ BOOLEAN_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
asn_dec_rval_t
BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
asn_dec_rval_t rv;
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
asn_dec_rval_t rv;
BOOLEAN_t *st = (BOOLEAN_t *)*sptr;
(void)opt_codec_ctx;
......@@ -281,8 +282,9 @@ BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_enc_rval_t
BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
asn_enc_rval_t er = { 0, 0, 0 };
(void)constraints;
......
......@@ -50,9 +50,11 @@ asn_TYPE_descriptor_t asn_DEF_ENUMERATED = {
};
asn_dec_rval_t
ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
asn_dec_rval_t rval;
ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
asn_dec_rval_t rval;
ENUMERATED_t *st = (ENUMERATED_t *)*sptr;
long value;
void *vptr = &value;
......@@ -72,8 +74,9 @@ ENUMERATED_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td
asn_enc_rval_t
ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
ENUMERATED_t *st = (ENUMERATED_t *)sptr;
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
ENUMERATED_t *st = (ENUMERATED_t *)sptr;
long value;
if(asn_INTEGER2long(st, &value))
......
......@@ -565,11 +565,12 @@ INTEGER_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
asn_dec_rval_t
INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
asn_dec_rval_t rval = { RC_OK, 0 };
INTEGER_t *st = (INTEGER_t *)*sptr;
asn_per_constraint_t *ct;
const asn_per_constraint_t *ct;
int repeat;
(void)opt_codec_ctx;
......@@ -676,13 +677,14 @@ INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_enc_rval_t
INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
asn_enc_rval_t er;
INTEGER_t *st = (INTEGER_t *)sptr;
const uint8_t *buf;
const uint8_t *end;
asn_per_constraint_t *ct;
const asn_per_constraint_t *ct;
long value = 0;
unsigned long v = 0;
......
......@@ -11,7 +11,7 @@
asn_dec_rval_t
INTEGER_decode_oer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_oer_constraints_t *constraints, void **sptr,
const asn_oer_constraints_t *constraints, void **sptr,
const void *ptr, size_t size) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics;
asn_dec_rval_t rval = {RC_OK, 0};
......@@ -99,7 +99,7 @@ INTEGER_decode_oer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
*/
asn_enc_rval_t
INTEGER_encode_oer(asn_TYPE_descriptor_t *td,
asn_oer_constraints_t *constraints, void *sptr,
const asn_oer_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
const INTEGER_t *st = sptr;
asn_enc_rval_t er;
......
......@@ -123,8 +123,9 @@ NULL_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_dec_rval_t
NULL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
asn_dec_rval_t rv;
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
asn_dec_rval_t rv;
(void)opt_codec_ctx;
(void)td;
......@@ -150,9 +151,10 @@ NULL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
}
asn_enc_rval_t
NULL_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
void *sptr, asn_per_outp_t *po) {
asn_enc_rval_t er;
NULL_encode_uper(asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
asn_enc_rval_t er;
(void)td;
(void)constraints;
......
......@@ -85,12 +85,12 @@ NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
asn_dec_rval_t
NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints,
void **sptr, asn_per_data_t *pd) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics;
asn_dec_rval_t rval = { RC_OK, 0 };
long *native = (long *)*sptr;
asn_per_constraint_t *ct;
const asn_per_constraint_t *ct;
long value;
(void)opt_codec_ctx;
......@@ -151,11 +151,12 @@ NativeEnumerated__compar_value2enum(const void *ap, const void *bp) {
asn_enc_rval_t
NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics;
const asn_per_constraints_t *constraints,
void *sptr, asn_per_outp_t *po) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics;
asn_enc_rval_t er;
long native, value;
asn_per_constraint_t *ct;
const asn_per_constraint_t *ct;
int inext = 0;
asn_INTEGER_enum_map_t key;
const asn_INTEGER_enum_map_t *kf;
......
......@@ -248,10 +248,10 @@ NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
asn_dec_rval_t
NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
asn_dec_rval_t rval;
long *native = (long *)*sptr;
INTEGER_t tmpint;
......@@ -284,8 +284,9 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
asn_enc_rval_t
NativeInteger_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics;
asn_enc_rval_t er;
long native;
INTEGER_t tmpint;
......
......@@ -12,8 +12,8 @@
asn_dec_rval_t
NativeInteger_decode_oer(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
asn_oer_constraints_t *constraints, void **nint_ptr,
const void *ptr, size_t size) {
const asn_oer_constraints_t *constraints,
void **nint_ptr, const void *ptr, size_t size) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics;
asn_dec_rval_t rval = {RC_OK, 0};
long *native = (long *)*nint_ptr;
......@@ -68,8 +68,8 @@ NativeInteger_decode_oer(asn_codec_ctx_t *opt_codec_ctx,
*/
asn_enc_rval_t
NativeInteger_encode_oer(asn_TYPE_descriptor_t *td,
asn_oer_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
const asn_oer_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics;
INTEGER_t tmpint;
long native;
......
......@@ -206,9 +206,10 @@ NativeReal_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
*/
asn_dec_rval_t
NativeReal_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
void **dbl_ptr, asn_per_data_t *pd) {
double *Dbl = (double *)*dbl_ptr;
asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void **dbl_ptr,
asn_per_data_t *pd) {
double *Dbl = (double *)*dbl_ptr;
asn_dec_rval_t rval;
REAL_t tmp;
void *ptmp = &tmp;
......@@ -246,8 +247,9 @@ NativeReal_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
*/
asn_enc_rval_t
NativeReal_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
double Dbl = *(const double *)sptr;
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
double Dbl = *(const double *)sptr;
asn_enc_rval_t erval;
REAL_t tmp;
......
......@@ -237,9 +237,9 @@ OBJECT_IDENTIFIER_print_arc(const uint8_t *arcbuf, int arclen, int add,
static ssize_t
OBJECT_IDENTIFIER__dump_body(const OBJECT_IDENTIFIER_t *st, asn_app_consume_bytes_f *cb, void *app_key) {
ssize_t wrote_len = 0;
int startn;
size_t startn;
int add = 0;
int i;
size_t i;
for(i = 0, startn = 0; i < st->size; i++) {
uint8_t b = st->buf[i];
......@@ -379,7 +379,7 @@ OBJECT_IDENTIFIER_get_arcs(const OBJECT_IDENTIFIER_t *oid, void *arcs,
int num_arcs = 0;
int startn = 0;
int add = 0;
int i;
size_t i;
if(!oid || !oid->buf || (arc_slots && arc_type_size <= 1)) {
errno = EINVAL;
......
......@@ -124,14 +124,14 @@ asn_TYPE_descriptor_t asn_DEF_OCTET_STRING = {
* No, I am not going to explain what the following stuff is.
*/
struct _stack_el {
ber_tlv_len_t left; /* What's left to read (or -1) */
ber_tlv_len_t got; /* What was actually processed */
int cont_level; /* Depth of subcontainment */
int want_nulls; /* Want null "end of content" octets? */
int bits_chopped; /* Flag in BIT STRING mode */
ber_tlv_tag_t tag; /* For debugging purposes */
struct _stack_el *prev;
struct _stack_el *next;
ber_tlv_len_t left; /* What's left to read (or -1) */
ber_tlv_len_t got; /* What was actually processed */
size_t cont_level; /* Depth of subcontainment */
int want_nulls; /* Want null "end of content" octets? */
int bits_chopped; /* Flag in BIT STRING mode */
ber_tlv_tag_t tag; /* For debugging purposes */
struct _stack_el *prev;
struct _stack_el *next;
};
struct _stack {
struct _stack_el *tail;
......@@ -344,7 +344,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
case ASN_OSUBV_STR:
default:
if(sel) {
int level = sel->cont_level;
size_t level = sel->cont_level;
if(level < td->all_tags_count) {
expected_tag = td->all_tags[level];
break;
......@@ -801,8 +801,8 @@ static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_b
uint8_t *buf;
/* Reallocate buffer according to high cap estimation */
ssize_t _ns = st->size + (chunk_size + 1) / 2;
void *nptr = REALLOC(st->buf, _ns + 1);
size_t new_size = st->size + (chunk_size + 1) / 2;
void *nptr = REALLOC(st->buf, new_size + 1);
if(!nptr) return -1;
st->buf = (uint8_t *)nptr;
buf = st->buf + st->size;
......@@ -859,7 +859,7 @@ static ssize_t OCTET_STRING__convert_hexadecimal(void *sptr, const void *chunk_b
}
st->size = buf - st->buf; /* Adjust the buffer size */
assert(st->size <= _ns);
assert(st->size <= new_size);
st->buf[st->size] = 0; /* Courtesy termination */
return (chunk_stop - (const char *)chunk_buf); /* Converted size */
......@@ -876,8 +876,8 @@ static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, s
uint8_t *buf;
/* Reallocate buffer according to high cap estimation */
ssize_t _ns = st->size + (chunk_size + 7) / 8;
void *nptr = REALLOC(st->buf, _ns + 1);
size_t new_size = st->size + (chunk_size + 7) / 8;
void *nptr = REALLOC(st->buf, new_size + 1);
if(!nptr) return -1;
st->buf = (uint8_t *)nptr;
buf = st->buf + st->size;
......@@ -921,7 +921,7 @@ static ssize_t OCTET_STRING__convert_binary(void *sptr, const void *chunk_buf, s
st->bits_unused = bits_unused;
}
assert(st->size <= _ns);
assert(st->size <= new_size);
st->buf[st->size] = 0; /* Courtesy termination */
return chunk_size; /* Converted in full */
......@@ -977,8 +977,8 @@ static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf,
uint8_t *buf;
/* Reallocate buffer */
ssize_t _ns = st->size + chunk_size;
void *nptr = REALLOC(st->buf, _ns + 1);
size_t new_size = st->size + chunk_size;
void *nptr = REALLOC(st->buf, new_size + 1);
if(!nptr) return -1;
st->buf = (uint8_t *)nptr;
buf = st->buf + st->size;
......@@ -1101,7 +1101,7 @@ static ssize_t OCTET_STRING__convert_entrefs(void *sptr, const void *chunk_buf,
}
st->size = buf - st->buf;
assert(st->size <= _ns);
assert(st->size <= new_size);
st->buf[st->size] = 0; /* Courtesy termination */
return chunk_size; /* Converted in full */
......@@ -1205,7 +1205,7 @@ OCTET_STRING_decode_xer_utf8(asn_codec_ctx_t *opt_codec_ctx,
static int
OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf,
size_t units, unsigned int bpc, unsigned int unit_bits,
long lb, long ub, asn_per_constraints_t *pc) {
long lb, long ub, const asn_per_constraints_t *pc) {
uint8_t *end = buf + units * bpc;
ASN_DEBUG("Expanding %d characters into (%ld..%ld):%d",
......@@ -1269,7 +1269,7 @@ OCTET_STRING_per_get_characters(asn_per_data_t *po, uint8_t *buf,
static int
OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf,
size_t units, unsigned int bpc, unsigned int unit_bits,
long lb, long ub, asn_per_constraints_t *pc) {
long lb, long ub, const asn_per_constraints_t *pc) {
const uint8_t *end = buf + units * bpc;
ASN_DEBUG("Squeezing %d characters into (%ld..%ld):%d (%d bpc)",
......@@ -1335,16 +1335,16 @@ OCTET_STRING_per_put_characters(asn_per_outp_t *po, const uint8_t *buf,
asn_dec_rval_t
OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
void **sptr, asn_per_data_t *pd) {
asn_OCTET_STRING_specifics_t *specs = td->specifics
asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
asn_OCTET_STRING_specifics_t *specs = td->specifics
? (asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_SPC_OCTET_STRING_specs;
asn_per_constraints_t *pc = constraints ? constraints
: td->per_constraints;
asn_per_constraint_t *cval;
asn_per_constraint_t *csiz;
const asn_per_constraints_t *pc =
constraints ? constraints : td->per_constraints;
const asn_per_constraint_t *cval;
const asn_per_constraint_t *csiz;
asn_dec_rval_t rval = { RC_OK, 0 };
BIT_STRING_t *st = (BIT_STRING_t *)*sptr;
ssize_t consumed_myself = 0;
......@@ -1507,15 +1507,15 @@ OCTET_STRING_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
asn_enc_rval_t
OCTET_STRING_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
asn_OCTET_STRING_specifics_t *specs = td->specifics
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
asn_OCTET_STRING_specifics_t *specs = td->specifics
? (asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_SPC_OCTET_STRING_specs;
asn_per_constraints_t *pc = constraints ? constraints
const asn_per_constraints_t *pc = constraints ? constraints
: td->per_constraints;
asn_per_constraint_t *cval;
asn_per_constraint_t *csiz;
const asn_per_constraint_t *cval;
const asn_per_constraint_t *csiz;
const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
asn_enc_rval_t er = { 0, 0, 0 };
int inext = 0; /* Lies not within extension root */
......
......@@ -13,7 +13,7 @@ extern "C" {
typedef struct OCTET_STRING {
uint8_t *buf; /* Buffer with consecutive OCTET_STRING bits */
int size; /* Size of the buffer */
size_t size; /* Size of the buffer */
asn_struct_ctx_t _asn_ctx; /* Parsing across buffer boundaries */
} OCTET_STRING_t;
......
......@@ -11,15 +11,15 @@
asn_dec_rval_t
OCTET_STRING_decode_oer(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
asn_oer_constraints_t *constraints, void **sptr,
const void *ptr, size_t size) {
asn_TYPE_descriptor_t *td,
const asn_oer_constraints_t *constraints, void **sptr,
const void *ptr, size_t size) {
asn_OCTET_STRING_specifics_t *specs =
td->specifics
? (asn_OCTET_STRING_specifics_t *)td->specifics
: (asn_OCTET_STRING_specifics_t *)&asn_DEF_OCTET_STRING.specifics;
OCTET_STRING_t *st = (OCTET_STRING_t *)*sptr;
asn_oer_constraints_t *cts =
const asn_oer_constraints_t *cts =
constraints ? constraints : td->oer_constraints;
ssize_t ct_size = cts ? cts->size : -1;
asn_dec_rval_t rval = {RC_OK, 0};
......@@ -102,14 +102,14 @@ OCTET_STRING_decode_oer(asn_codec_ctx_t *opt_codec_ctx,
*/
asn_enc_rval_t
OCTET_STRING_encode_oer(asn_TYPE_descriptor_t *td,
asn_oer_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
const asn_oer_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
asn_OCTET_STRING_specifics_t *specs =
td->specifics
? (asn_OCTET_STRING_specifics_t *)td->specifics
: (asn_OCTET_STRING_specifics_t *)&asn_DEF_OCTET_STRING.specifics;
OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
asn_oer_constraints_t *cts =
const asn_oer_constraints_t *cts =
constraints ? constraints : td->oer_constraints;
ssize_t ct_size = cts ? cts->size : -1;
asn_enc_rval_t er = {0, 0, 0};
......
......@@ -391,17 +391,18 @@ REAL_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
}
asn_dec_rval_t
REAL_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints,
void **sptr, asn_per_data_t *pd) {
(void)constraints; /* No PER visible constraints */
REAL_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
(void)constraints; /* No PER visible constraints */
return OCTET_STRING_decode_uper(opt_codec_ctx, td, 0, sptr, pd);
}
asn_enc_rval_t
REAL_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
(void)constraints; /* No PER visible constraints */
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
(void)constraints; /* No PER visible constraints */
return OCTET_STRING_encode_uper(td, 0, sptr, po);
}
......@@ -538,7 +539,7 @@ asn_REAL2double(const REAL_t *st, double *dbl_value) {
sign = (octv & 0x40); /* bit 7 */
scaleF = (octv & 0x0C) >> 2; /* bits 4 to 3 */
if(st->size <= (int)(1 + (octv & 0x03))) {
if(st->size <= 1 + (octv & 0x03)) {
errno = EINVAL;
return -1;
}
......@@ -546,7 +547,7 @@ asn_REAL2double(const REAL_t *st, double *dbl_value) {
elen = (octv & 0x03); /* bits 2 to 1; 8.5.6.4 */
if(elen == 0x03) { /* bits 2 to 1 = 11; 8.5.6.4, case d) */
elen = st->buf[1]; /* unsigned binary number */
if(elen == 0 || st->size <= (int)(2 + elen)) {
if(elen == 0 || st->size <= (2 + elen)) {
errno = EINVAL;
return -1;
}
......
......@@ -57,8 +57,8 @@ static ssize_t
RELATIVE_OID__dump_body(const RELATIVE_OID_t *st, asn_app_consume_bytes_f *cb, void *app_key) {
ssize_t wrote = 0;
ssize_t ret;
int startn;
int i;
size_t startn;
size_t i;
for(i = 0, startn = 0; i < st->size; i++) {
uint8_t b = st->buf[i];
......@@ -179,8 +179,8 @@ RELATIVE_OID_get_arcs(const RELATIVE_OID_t *roid,
void *arcs, unsigned int arc_type_size, unsigned int arc_slots) {
void *arcs_end = (char *)arcs + (arc_slots * arc_type_size);
int num_arcs = 0;
int startn = 0;
int i;
size_t startn = 0;
size_t i;
if(!roid || !roid->buf) {
errno = EINVAL;
......
......@@ -13,7 +13,7 @@ extern "C" {
typedef struct ASN__PRIMITIVE_TYPE_s {
uint8_t *buf; /* Buffer with consecutive primitive encoding bytes */
int size; /* Size of the buffer */
size_t size; /* Size of the buffer */
} ASN__PRIMITIVE_TYPE_t; /* Do not use this type directly! */
asn_struct_free_f ASN__PRIMITIVE_TYPE_free;
......
......@@ -112,7 +112,7 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx,
td->name, (long)size, tag_mode, step, tagno);
/* assert(td->tags_count >= 1) May not be the case for CHOICE or ANY */
if(tag_mode == 0 && tagno == td->tags_count) {
if(tag_mode == 0 && tagno == (int)td->tags_count) {
/*
* This must be the _untagged_ ANY type,
* which outermost tag isn't known in advance.
......@@ -134,9 +134,9 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx,
(long)(tag_len + len_len));
ADVANCE(tag_len + len_len);
} else {
assert(tagno < td->tags_count); /* At least one loop */
assert(tagno < (int)td->tags_count); /* At least one loop */
}
for((void)tagno; tagno < td->tags_count; tagno++, step++) {
for((void)tagno; tagno < (int)td->tags_count; tagno++, step++) {
/*
* Fetch and process T from TLV.
......@@ -186,7 +186,7 @@ ber_check_tags(asn_codec_ctx_t *opt_codec_ctx,
* If this one is the last one, check that the tag form
* matches the one given in descriptor.
*/
if(tagno < (td->tags_count - 1)) {
if(tagno < ((int)td->tags_count - 1)) {
if(tlv_constr == 0) {
ASN_DEBUG("tlv_constr = %d, expfail",
tlv_constr);
......
......@@ -376,7 +376,7 @@ CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
* If the structure was not initialized, it cannot be encoded:
* can't deduce what to encode in the choice type.
*/
if(present <= 0 || present > td->elements_count) {
if(present <= 0 || (unsigned)present > td->elements_count) {
if(present == 0 && td->elements_count == 0) {
/* The CHOICE is empty?! */
erval.encoded = 0;
......@@ -457,7 +457,7 @@ CHOICE_outmost_tag(const asn_TYPE_descriptor_t *td, const void *ptr, int tag_mod
*/
present = _fetch_present_idx(ptr, specs->pres_offset, specs->pres_size);
if(present > 0 || present <= td->elements_count) {
if(present > 0 && (unsigned)present <= td->elements_count) {
const asn_TYPE_member_t *elm = &td->elements[present-1];
const void *memb_ptr;
......@@ -493,7 +493,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
* Figure out which CHOICE element is encoded.
*/
present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size);
if(present > 0 && present <= td->elements_count) {
if(present > 0 && (unsigned)present <= td->elements_count) {
asn_TYPE_member_t *elm = &td->elements[present-1];
const void *memb_ptr;
......@@ -561,7 +561,7 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_dec_rval_t rval; /* Return value of a decoder */
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */
int edx; /* Element index */
size_t edx; /* Element index */
/*
* Create the target structure if it is not present already.
......@@ -787,7 +787,7 @@ CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
*/
present = _fetch_present_idx(sptr, specs->pres_offset,specs->pres_size);
if(present <= 0 || present > td->elements_count) {
if(present <= 0 || (unsigned)present > td->elements_count) {
ASN__ENCODE_FAILED;
} else {
asn_enc_rval_t tmper;
......@@ -826,10 +826,11 @@ cb_failed:
asn_dec_rval_t
CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics;
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics;
asn_dec_rval_t rv;
asn_per_constraint_t *ct;
const asn_per_constraint_t *ct;
asn_TYPE_member_t *elm; /* CHOICE's element */
void *memb_ptr;
void **memb_ptr2;
......@@ -870,7 +871,7 @@ CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
value = uper_get_nsnnwn(pd);
if(value < 0) ASN__DECODE_STARVED;
value += specs->ext_start;
if(value >= td->elements_count)
if((unsigned)value >= td->elements_count)
ASN__DECODE_FAILED;
}
......@@ -904,13 +905,14 @@ CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
elm->name, td->name, rv.code);
return rv;
}
asn_enc_rval_t
CHOICE_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics;
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
asn_CHOICE_specifics_t *specs = (asn_CHOICE_specifics_t *)td->specifics;
asn_TYPE_member_t *elm; /* CHOICE's element */
asn_per_constraint_t *ct;
const asn_per_constraint_t *ct;
void *memb_ptr;
int present;
int present_enc;
......@@ -930,7 +932,7 @@ CHOICE_encode_uper(asn_TYPE_descriptor_t *td,
* If the structure was not initialized properly, it cannot be encoded:
* can't deduce what to encode in the choice type.
*/
if(present <= 0 || present > td->elements_count)
if(present <= 0 || (unsigned)present > td->elements_count)
ASN__ENCODE_FAILED;
else
present--;
......@@ -1005,7 +1007,7 @@ CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
/*
* Print that element.
*/
if(present > 0 && present <= td->elements_count) {
if(present > 0 && (unsigned)present <= td->elements_count) {
asn_TYPE_member_t *elm = &td->elements[present-1];
const void *memb_ptr;
......@@ -1048,7 +1050,7 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
/*
* Free that element.
*/
if(present > 0 && present <= td->elements_count) {
if(present > 0 && (unsigned)present <= td->elements_count) {
asn_TYPE_member_t *elm = &td->elements[present-1];
void *memb_ptr;
......
......@@ -25,15 +25,15 @@ typedef const struct asn_CHOICE_specifics_s {
* Tags to members mapping table.
*/
const asn_TYPE_tag2member_t *tag2el;
int tag2el_count;
unsigned tag2el_count;
/* Canonical ordering of CHOICE elements, for PER */
/* Canonical ordering of CHOICE elements, for PER */
int *canonical_order;
/*
* Extensions-related stuff.
*/
int ext_start; /* First member of extensions, or -1 */
signed ext_start; /* First member of extensions, or -1 */
} asn_CHOICE_specifics_t;
/*
......
......@@ -66,8 +66,8 @@
* Check whether we are inside the extensions group.
*/
#define IN_EXTENSION_GROUP(specs, memb_idx) \
( ((memb_idx) > (specs)->ext_after) \
&&((memb_idx) < (specs)->ext_before))
( (((signed)(memb_idx)) > (specs)->ext_after) \
&&(((signed)(memb_idx)) < (specs)->ext_before))
/*
......@@ -127,7 +127,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_dec_rval_t rval; /* Return code from subparsers */
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */
int edx; /* SEQUENCE element's index */
size_t edx; /* SEQUENCE element's index */
ASN_DEBUG("Decoding %s as SEQUENCE", td->name);
......@@ -186,14 +186,14 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
* that member:
* step = (<member_number> * 2 + <microphase>).
*/
for(edx = (ctx->step >> 1); edx < td->elements_count;
for(edx = ((size_t)ctx->step >> 1); edx < td->elements_count;
edx++, ctx->step = (ctx->step & ~1) + 2) {
void *memb_ptr; /* Pointer to the member */
void **memb_ptr2; /* Pointer to that pointer */
ssize_t tag_len; /* Length of TLV's T */
int opt_edx_end; /* Next non-optional element */
size_t opt_edx_end; /* Next non-optional element */
size_t n;
int use_bsearch;
int n;
if(ctx->step & 1)
goto microphase2;
......@@ -215,7 +215,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
||
/* All extensions are optional */
(IN_EXTENSION_GROUP(specs, edx)
&& specs->ext_before > td->elements_count)
&& specs->ext_before > (signed)td->elements_count)
)
) {
ASN_DEBUG("End of SEQUENCE %s", td->name);
......@@ -247,14 +247,14 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
else
RETURN(RC_WMORE);
} else if(((const uint8_t *)ptr)[1] == 0) {
ASN_DEBUG("edx = %d, opt = %d, ec=%d",
ASN_DEBUG("edx = %zu, opt = %d, ec=%d",
edx, elements[edx].optional,
td->elements_count);
if((edx + elements[edx].optional
== td->elements_count)
|| (IN_EXTENSION_GROUP(specs, edx)
&& specs->ext_before
> td->elements_count)) {
> (signed)td->elements_count)) {
/*
* Yeah, baby! Found the terminator
* of the indefinite length structure.
......@@ -320,7 +320,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
if(t2m) {
const asn_TYPE_tag2member_t *best = 0;
const asn_TYPE_tag2member_t *t2m_f, *t2m_l;
int edx_max = edx + elements[edx].optional;
size_t edx_max = edx + elements[edx].optional;
/*
* Rewind to the first element with that tag,
* `cause bsearch() does not guarantee order.
......@@ -516,7 +516,7 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td,
size_t computed_size = 0;
asn_enc_rval_t erval;
ssize_t ret;
int edx;
size_t edx;
ASN_DEBUG("%s %s as SEQUENCE",
cb?"Encoding":"Estimating", td->name);
......@@ -623,8 +623,7 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_dec_rval_t rval; /* Return value from a decoder */
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */
int edx; /* Element index */
int edx_end;
size_t edx; /* Element index */
/*
* Create the target structure if it is not present already.
......@@ -653,7 +652,6 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ssize_t ch_size; /* Chunk size */
xer_check_tag_e tcv; /* Tag check value */
asn_TYPE_member_t *elm;
int n;
/*
* Go inside the inner member of a sequence.
......@@ -746,7 +744,7 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* All extensions are optional */
(IN_EXTENSION_GROUP(specs, edx)
&& specs->ext_before
> td->elements_count)
> (signed)td->elements_count)
) {
XER_ADVANCE(ch_size);
ctx->phase = 4; /* Phase out */
......@@ -777,7 +775,8 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/*
* Search which member corresponds to this tag.
*/
edx_end = edx + elements[edx].optional + 1;
size_t n;
size_t edx_end = edx + elements[edx].optional + 1;
if(edx_end > td->elements_count)
edx_end = td->elements_count;
for(n = edx; n < edx_end; n++) {
......@@ -855,7 +854,7 @@ SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
asn_enc_rval_t er;
int xcan = (flags & XER_F_CANONICAL);
int edx;
size_t edx;
if(!sptr)
ASN__ENCODE_FAILED;
......@@ -903,7 +902,7 @@ cb_failed:
int
SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
int edx;
size_t edx;
int ret;
if(!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
......@@ -950,7 +949,7 @@ SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
void
SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
int edx;
size_t edx;
if(!td || !sptr)
return;
......@@ -978,7 +977,7 @@ SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
int
SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
int edx;
size_t edx;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
......@@ -1029,14 +1028,15 @@ SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_dec_rval_t
SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics;
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics;
void *st = *sptr; /* Target structure. */
int extpresent; /* Extension additions are present */
uint8_t *opres; /* Presence of optional root members */
asn_per_data_t opmd;
asn_dec_rval_t rv;
int edx;
size_t edx;
(void)constraints;
......@@ -1249,7 +1249,7 @@ SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr,
= (asn_SEQUENCE_specifics_t *)td->specifics;
int exts_present = 0;
int exts_count = 0;
int edx;
size_t edx;
if(specs->ext_before < 0)
return 0;
......@@ -1296,13 +1296,14 @@ SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr,
asn_enc_rval_t
SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
asn_SEQUENCE_specifics_t *specs
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
asn_SEQUENCE_specifics_t *specs
= (asn_SEQUENCE_specifics_t *)td->specifics;
asn_enc_rval_t er;
int n_extensions;
int edx;
int i;
size_t edx;
size_t i;
(void)constraints;
......@@ -1320,7 +1321,10 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td,
*/
if(specs->ext_before >= 0) {
n_extensions = SEQUENCE_handle_extensions(td, sptr, 0, 0);
per_put_few_bits(po, n_extensions ? 1 : 0, 1);
if(n_extensions < 0)
ASN__ENCODE_FAILED;
if(per_put_few_bits(po, n_extensions ? 1 : 0, 1))
ASN__ENCODE_FAILED;
} else {
n_extensions = 0; /* There are no extensions to encode */
}
......
......@@ -22,21 +22,21 @@ typedef const struct asn_SEQUENCE_specifics_s {
* Tags to members mapping table (sorted).
*/
const asn_TYPE_tag2member_t *tag2el;
int tag2el_count;
unsigned tag2el_count;
/*
/*
* Optional members of the extensions root (roms) or additions (aoms).
* Meaningful for PER.
*/
const int *oms; /* Optional MemberS */
int roms_count; /* Root optional members count */
int aoms_count; /* Additions optional members count */
const int *oms; /* Optional MemberS */
unsigned roms_count; /* Root optional members count */
unsigned aoms_count; /* Additions optional members count */
/*
/*
* Description of an extensions group.
*/
int ext_after; /* Extensions start after this member */
int ext_before; /* Extensions stop before this member */
signed ext_after; /* Extensions start after this member */
signed ext_before; /* Extensions stop before this member */
} asn_SEQUENCE_specifics_t;
......
......@@ -142,9 +142,10 @@ cb_failed:
asn_enc_rval_t
SEQUENCE_OF_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) {
asn_anonymous_sequence_ *list;
asn_per_constraint_t *ct;
const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) {
asn_anonymous_sequence_ *list;
const asn_per_constraint_t *ct;
asn_enc_rval_t er;
asn_TYPE_member_t *elm = td->elements;
int seq;
......
......@@ -37,8 +37,8 @@
* Check whether we are inside the extensions group.
*/
#define IN_EXTENSION_GROUP(specs, memb_idx) \
( ((memb_idx) > (specs)->ext_after) \
&&((memb_idx) < (specs)->ext_before))
( (((ssize_t)(memb_idx)) > (specs)->ext_after) \
&&(((ssize_t)(memb_idx)) < (specs)->ext_before))
/*
* Return a standardized complex structure.
......@@ -70,8 +70,8 @@ static void *element_ptr(void *struct_ptr, asn_TYPE_member_t *elm) {
asn_dec_rval_t
SEQUENCE_decode_oer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_oer_constraints_t *constraints, void **struct_ptr,
const void *ptr, size_t size) {
const asn_oer_constraints_t *constraints, void **struct_ptr,
const void *ptr, size_t size) {
asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics;
asn_dec_rval_t rval = {RC_OK, 0};
void *st = *struct_ptr; /* Target structure */
......@@ -80,6 +80,7 @@ SEQUENCE_decode_oer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
(void)opt_codec_ctx;
(void)constraints;
(void)specs;
/*
......@@ -378,8 +379,8 @@ SEQUENCE_decode_oer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
*/
asn_enc_rval_t
SEQUENCE_encode_oer(asn_TYPE_descriptor_t *td,
asn_oer_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
const asn_oer_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
asn_SEQUENCE_specifics_t *specs = (asn_SEQUENCE_specifics_t *)td->specifics;
size_t computed_size = 0;
int has_extensions_bit = (specs->ext_before >= 0);
......@@ -388,6 +389,8 @@ SEQUENCE_encode_oer(asn_TYPE_descriptor_t *td,
size_t edx;
int ret;
(void)constraints;
if(preamble_bits) {
asn_per_outp_t preamble;
......@@ -396,8 +399,8 @@ SEQUENCE_encode_oer(asn_TYPE_descriptor_t *td,
preamble.op_key = app_key;
if(has_extensions_bit) {
for(edx = specs->ext_after + 1; edx < specs->ext_before - 1;
edx++) {
for(edx = specs->ext_after + 1;
(ssize_t)edx < specs->ext_before - 1; edx++) {
asn_TYPE_member_t *elm = &td->elements[edx];
if(element_ptr(sptr, elm)) {
has_extensions = 1;
......@@ -491,7 +494,8 @@ SEQUENCE_encode_oer(asn_TYPE_descriptor_t *td,
if(ret < 0) ASN__ENCODE_FAILED;
/* Encode presence bitmap #16.4.3 */
for(edx = specs->ext_after + 1; edx < specs->ext_before - 1; edx++) {
for(edx = specs->ext_after + 1; (ssize_t)edx < specs->ext_before - 1;
edx++) {
asn_TYPE_member_t *elm = &td->elements[edx];
void *memb_ptr = element_ptr(sptr, elm);
ret |= per_put_few_bits(&extadds, memb_ptr ? 1 : 0, 1);
......@@ -502,7 +506,8 @@ SEQUENCE_encode_oer(asn_TYPE_descriptor_t *td,
computed_size += extadds.flushed_bytes;
/* Now, encode extensions */
for(edx = specs->ext_after + 1; edx < specs->ext_before - 1; edx++) {
for(edx = specs->ext_after + 1; (ssize_t)edx < specs->ext_before - 1;
edx++) {
asn_TYPE_member_t *elm = &td->elements[edx];
void *memb_ptr = element_ptr(sptr, elm);
......
......@@ -112,7 +112,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_dec_rval_t rval; /* Return code from subparsers */
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */
int edx; /* SET element's index */
size_t edx; /* SET element's index */
ASN_DEBUG("Decoding %s as SET", td->name);
......@@ -394,7 +394,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
static int
_SET_is_populated(asn_TYPE_descriptor_t *td, void *st) {
asn_SET_specifics_t *specs = (asn_SET_specifics_t *)td->specifics;
int edx;
size_t edx;
/*
* Check that all mandatory elements are present.
......@@ -441,9 +441,9 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
int t2m_build_own = (specs->tag2el_count != td->elements_count);
const asn_TYPE_tag2member_t *t2m;
asn_TYPE_tag2member_t *t2m_build;
int t2m_count;
size_t t2m_count;
ssize_t ret;
int edx;
size_t edx;
/*
* Use existing, or build our own tags map.
......@@ -603,7 +603,7 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_dec_rval_t rval; /* Return value from a decoder */
ssize_t consumed_myself = 0; /* Consumed bytes from ptr */
int edx; /* Element index */
size_t edx; /* Element index */
/*
* Create the target structure if it is not present already.
......@@ -808,8 +808,8 @@ SET_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
asn_enc_rval_t er;
int xcan = (flags & XER_F_CANONICAL);
const asn_TYPE_tag2member_t *t2m = specs->tag2el_cxer;
int t2m_count = specs->tag2el_cxer_count;
int edx;
size_t t2m_count = specs->tag2el_cxer_count;
size_t edx;
if(!sptr)
ASN__ENCODE_FAILED;
......@@ -865,7 +865,7 @@ cb_failed:
int
SET_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
int edx;
size_t edx;
int ret;
if(!sptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
......@@ -911,7 +911,7 @@ SET_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
void
SET_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
int edx;
size_t edx;
if(!td || !ptr)
return;
......@@ -939,7 +939,7 @@ SET_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
int
SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
int edx;
size_t edx;
if(!sptr) {
ASN__CTFAIL(app_key, td, sptr,
......
......@@ -13,33 +13,33 @@ extern "C" {
typedef const struct asn_SET_specifics_s {
/*
* Target structure description.
*/
int struct_size; /* Size of the target structure. */
int ctx_offset; /* Offset of the asn_struct_ctx_t member */
int pres_offset; /* Offset of _presence_map member */
/*
* Target structure description.
*/
unsigned struct_size; /* Size of the target structure. */
unsigned ctx_offset; /* Offset of the asn_struct_ctx_t member */
unsigned pres_offset; /* Offset of _presence_map member */
/*
* Tags to members mapping table (sorted).
* Sometimes suitable for DER encoding (untagged CHOICE is present);
* if so, tag2el_count will be greater than td->elements_count.
*/
const asn_TYPE_tag2member_t *tag2el;
int tag2el_count;
/*
* Tags to members mapping table (sorted).
* Sometimes suitable for DER encoding (untagged CHOICE is present);
* if so, tag2el_count will be greater than td->elements_count.
*/
const asn_TYPE_tag2member_t *tag2el;
unsigned tag2el_count;
/*
* Tags to members mapping table, second edition.
* Suitable for CANONICAL-XER encoding.
*/
const asn_TYPE_tag2member_t *tag2el_cxer;
int tag2el_cxer_count;
/*
* Tags to members mapping table, second edition.
* Suitable for CANONICAL-XER encoding.
*/
const asn_TYPE_tag2member_t *tag2el_cxer;
unsigned tag2el_cxer_count;
/*
* Extensions-related stuff.
*/
int extensible; /* Whether SET is extensible */
const unsigned int *_mandatory_elements; /* Bitmask of mandatory ones */
/*
* Extensions-related stuff.
*/
int extensible; /* Whether SET is extensible */
const unsigned int *_mandatory_elements; /* Bitmask of mandatory ones */
} asn_SET_specifics_t;
/*
......
......@@ -866,13 +866,14 @@ SET_OF_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
asn_dec_rval_t
SET_OF_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
asn_dec_rval_t rv;
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
asn_dec_rval_t rv;
asn_SET_OF_specifics_t *specs = (asn_SET_OF_specifics_t *)td->specifics;
asn_TYPE_member_t *elm = td->elements; /* Single one */
void *st = *sptr;
asn_anonymous_set_ *list;
asn_per_constraint_t *ct;
const asn_per_constraint_t *ct;
int repeat = 0;
ssize_t nelems;
......
......@@ -113,9 +113,9 @@ typedef struct asn_TYPE_descriptor_s {
*/
asn_outmost_tag_f *outmost_tag; /* <optional, internal> */
const ber_tlv_tag_t *tags; /* Effective tags sequence for this type */
int tags_count; /* Number of tags which are expected */
unsigned tags_count; /* Number of tags which are expected */
const ber_tlv_tag_t *all_tags; /* Every tag for BER/containment */
int all_tags_count; /* Number of tags */
unsigned all_tags_count; /* Number of tags */
asn_oer_constraints_t *oer_constraints; /* OER constraints */
asn_per_constraints_t *per_constraints; /* PER constraints */
......@@ -124,7 +124,7 @@ typedef struct asn_TYPE_descriptor_s {
* An ASN.1 production type members (members of SEQUENCE, SET, CHOICE).
*/
struct asn_TYPE_member_s *elements;
int elements_count;
unsigned elements_count;
/*
* Additional information describing the type, used by appropriate
......@@ -143,27 +143,27 @@ typedef struct asn_TYPE_descriptor_s {
ATF_OPEN_TYPE = 0x02 /* ANY type, without meaningful tag */
};
typedef struct asn_TYPE_member_s {
enum asn_TYPE_flags_e flags; /* Element's presentation flags */
int optional; /* Following optional members, including current */
int memb_offset; /* Offset of the element */
ber_tlv_tag_t tag; /* Outmost (most immediate) tag */
int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */
asn_TYPE_descriptor_t *type; /* Member type descriptor */
asn_constr_check_f *memb_constraints; /* Constraints validator */
asn_oer_constraints_t *oer_constraints; /* OER compiled constraints */
asn_per_constraints_t *per_constraints; /* PER compiled constraints */
int (*default_value)(int setval, void **sptr); /* DEFAULT <value> */
const char *name; /* ASN.1 identifier of the element */
enum asn_TYPE_flags_e flags; /* Element's presentation flags */
unsigned optional; /* Following optional members, including current */
unsigned memb_offset; /* Offset of the element */
ber_tlv_tag_t tag; /* Outmost (most immediate) tag */
int tag_mode; /* IMPLICIT/no/EXPLICIT tag at current level */
asn_TYPE_descriptor_t *type; /* Member type descriptor */
asn_constr_check_f *memb_constraints; /* Constraints validator */
asn_oer_constraints_t *oer_constraints; /* OER compiled constraints */
asn_per_constraints_t *per_constraints; /* PER compiled constraints */
int (*default_value)(int setval, void **sptr); /* DEFAULT <value> */
const char *name; /* ASN.1 identifier of the element */
} asn_TYPE_member_t;
/*
* BER tag to element number mapping.
*/
typedef struct asn_TYPE_tag2member_s {
ber_tlv_tag_t el_tag; /* Outmost tag of the member */
int el_no; /* Index of the associated member, base 0 */
int toff_first; /* First occurence of the el_tag, relative */
int toff_last; /* Last occurence of the el_tag, relatvie */
ber_tlv_tag_t el_tag; /* Outmost tag of the member */
unsigned el_no; /* Index of the associated member, base 0 */
unsigned toff_first; /* First occurence of the el_tag, relative */
unsigned toff_last; /* Last occurence of the el_tag, relative */
} asn_TYPE_tag2member_t;
/*
......
......@@ -32,7 +32,7 @@ asn_dec_rval_t oer_decode(struct asn_codec_ctx_s *opt_codec_ctx,
typedef asn_dec_rval_t(oer_type_decoder_f)(
struct asn_codec_ctx_s *opt_codec_ctx,
struct asn_TYPE_descriptor_s *type_descriptor,
asn_oer_constraints_t *constraints,
const asn_oer_constraints_t *constraints,
void **struct_ptr,
const void *buf_ptr,
size_t size);
......
......@@ -47,7 +47,7 @@ static int encode_to_buffer_cb(const void *buffer, size_t size, void *key) {
*/
asn_enc_rval_t
oer_encode_to_buffer(struct asn_TYPE_descriptor_s *type_descriptor,
asn_oer_constraints_t *constraints,
const asn_oer_constraints_t *constraints,
void *struct_ptr, /* Structure to be encoded */
void *buffer, /* Pre-allocated buffer */
size_t buffer_size /* Initial buffer size (maximum) */
......
......@@ -26,7 +26,7 @@ asn_enc_rval_t oer_encode(struct asn_TYPE_descriptor_s *type_descriptor,
/* A variant of oer_encode() which encodes data into the pre-allocated buffer */
asn_enc_rval_t oer_encode_to_buffer(
struct asn_TYPE_descriptor_s *type_descriptor,
asn_oer_constraints_t *constraints,
const asn_oer_constraints_t *constraints,
void *struct_ptr, /* Structure to be encoded */
void *buffer, /* Pre-allocated buffer */
size_t buffer_size /* Initial buffer size (maximum) */
......@@ -37,7 +37,7 @@ asn_enc_rval_t oer_encode_to_buffer(
*/
typedef asn_enc_rval_t(oer_type_encoder_f)(
struct asn_TYPE_descriptor_s *type_descriptor,
asn_oer_constraints_t *constraints,
const asn_oer_constraints_t *constraints,
void *struct_ptr, /* Structure to be encoded */
asn_app_consume_bytes_f *consume_bytes_cb, /* Callback */
void *app_key /* Arbitrary callback argument */
......
......@@ -47,7 +47,7 @@ oer_fetch_length(const void *bufptr, size_t size, size_t *len_r) {
/* Skip the leading 0-bytes */
}
if((bend - b) > sizeof(size_t)) {
if((bend - b) > (ssize_t)sizeof(size_t)) {
/* Length is not representable by the native size_t type */
*len_r = 0;
return -1;
......
......@@ -15,11 +15,11 @@ extern "C" {
/*
* Pre-computed OER constraints.
*/
typedef const struct asn_oer_constraint_number_s {
typedef struct asn_oer_constraint_number_s {
unsigned width; /* ±8,4,2,1 fixed bytes */
unsigned positive; /* 1 for unsigned number, 0 for signed */
} asn_oer_constraint_number_t;
typedef const struct asn_oer_constraints_s {
typedef struct asn_oer_constraints_s {
asn_oer_constraint_number_t value;
ssize_t size; /* -1 (no constraint) or >= 0 */
} asn_oer_constraints_t;
......
......@@ -44,7 +44,7 @@ asn_dec_rval_t uper_decode(struct asn_codec_ctx_s *opt_codec_ctx,
*/
typedef asn_dec_rval_t (per_type_decoder_f)(asn_codec_ctx_t *opt_codec_ctx,
struct asn_TYPE_descriptor_s *type_descriptor,
asn_per_constraints_t *constraints,
const asn_per_constraints_t *constraints,
void **struct_ptr,
asn_per_data_t *per_data
);
......
......@@ -2,7 +2,7 @@
#include <asn_internal.h>
#include <per_encoder.h>
static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key);
static asn_enc_rval_t uper_encode_internal(asn_TYPE_descriptor_t *td, const asn_per_constraints_t *, void *sptr, asn_app_consume_bytes_f *cb, void *app_key);
asn_enc_rval_t
uper_encode(asn_TYPE_descriptor_t *td, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) {
......@@ -65,8 +65,10 @@ encode_dyn_cb(const void *buffer, size_t size, void *key) {
return 0;
}
ssize_t
uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, void **buffer_r) {
asn_enc_rval_t er;
uper_encode_to_new_buffer(asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void *sptr,
void **buffer_r) {
asn_enc_rval_t er;
enc_dyn_arg key;
memset(&key, 0, sizeof(key));
......@@ -116,8 +118,10 @@ _uper_encode_flush_outp(asn_per_outp_t *po) {
}
static asn_enc_rval_t
uper_encode_internal(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_app_consume_bytes_f *cb, void *app_key) {
asn_per_outp_t po;
uper_encode_internal(asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
asn_per_outp_t po;
asn_enc_rval_t er;
/*
......
......@@ -47,7 +47,7 @@ asn_enc_rval_t uper_encode_to_buffer(
*/
ssize_t uper_encode_to_new_buffer(
struct asn_TYPE_descriptor_s *type_descriptor,
asn_per_constraints_t *constraints,
const asn_per_constraints_t *constraints,
void *struct_ptr, /* Structure to be encoded */
void **buffer_r /* Buffer allocated and returned */
);
......@@ -57,7 +57,7 @@ ssize_t uper_encode_to_new_buffer(
*/
typedef asn_enc_rval_t (per_type_encoder_f)(
struct asn_TYPE_descriptor_s *type_descriptor,
asn_per_constraints_t *constraints,
const asn_per_constraints_t *constraints,
void *struct_ptr,
asn_per_outp_t *per_output
);
......
......@@ -16,7 +16,10 @@ typedef struct uper_ugot_key {
static int uper_ugot_refill(asn_per_data_t *pd);
static int per_skip_bits(asn_per_data_t *pd, int skip_nbits);
static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t *, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd);
static asn_dec_rval_t uper_sot_suck(asn_codec_ctx_t *,
asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints,
void **sptr, asn_per_data_t *pd);
/*
* Encode an "open type field".
......@@ -55,7 +58,7 @@ uper_open_type_put(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints
static asn_dec_rval_t
uper_open_type_get_simple(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
asn_dec_rval_t rv;
ssize_t chunk_bytes;
int repeat;
......@@ -243,9 +246,9 @@ uper_open_type_get_complex(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
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);
const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) {
return uper_open_type_get_simple(ctx, td, constraints, sptr, pd);
}
int
......@@ -269,7 +272,7 @@ uper_open_type_skip(asn_codec_ctx_t *ctx, asn_per_data_t *pd) {
static asn_dec_rval_t
uper_sot_suck(asn_codec_ctx_t *ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
asn_dec_rval_t rv;
(void)ctx;
......
......@@ -9,7 +9,7 @@
extern "C" {
#endif
asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd);
asn_dec_rval_t uper_open_type_get(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd);
int uper_open_type_skip(asn_codec_ctx_t *opt_codec_ctx, asn_per_data_t *pd);
......
......@@ -15,7 +15,7 @@ extern "C" {
/*
* Pre-computed PER constraints.
*/
typedef const struct asn_per_constraint_s {
typedef struct asn_per_constraint_s {
enum asn_per_constraint_flags {
APC_UNCONSTRAINED = 0x0, /* No PER visible constraints */
APC_SEMI_CONSTRAINED = 0x1, /* Constrained at "lb" */
......@@ -27,9 +27,9 @@ typedef const struct asn_per_constraint_s {
long lower_bound; /* "lb" value */
long upper_bound; /* "ub" value */
} asn_per_constraint_t;
typedef const struct asn_per_constraints_s {
struct asn_per_constraint_s value;
struct asn_per_constraint_s size;
typedef struct asn_per_constraints_s {
asn_per_constraint_t value;
asn_per_constraint_t size;
int (*value2code)(unsigned int value);
int (*code2value)(unsigned int code);
} asn_per_constraints_t;
......
......@@ -54,7 +54,7 @@ encode(time_t tloc, const char *expect, int force_gmt) {
assert(expect);
printf("[%s] vs [%s] (%d)\n",
gt->buf, expect, force_gmt);
assert(gt->size == (int)strlen((char *)gt->buf));
assert(gt->size == strlen((char *)gt->buf));
assert(!strcmp((char *)gt->buf, expect));
} else {
assert(!expect);
......
......@@ -14,7 +14,7 @@ static int _print2buf(const void *buf, size_t size, void *key) {
}
static void
check(uint8_t *buf, int size, long check_long, int check_ret) {
check(uint8_t *buf, size_t size, long check_long, int check_ret) {
char scratch[128];
char verify[32];
INTEGER_t val;
......
......@@ -10,8 +10,8 @@ enum encoding_type { HEX, BINARY, UTF8 };
static void
check(enum encoding_type type, char *tagname, char *xmlbuf, char *verify) {
int xmllen = strlen(xmlbuf);
int verlen = verify ? strlen(verify) : 0;
size_t xmllen = strlen(xmlbuf);
size_t verlen = verify ? strlen(verify) : 0;
asn_TYPE_descriptor_t *td = &asn_DEF_OCTET_STRING;
OCTET_STRING_t *st = 0;
OCTET_STRING_t **stp = &st;
......@@ -32,7 +32,7 @@ check(enum encoding_type type, char *tagname, char *xmlbuf, char *verify) {
}
rc = decoder(0, td, (void **)stp, tagname, xmlbuf, xmllen);
printf("[%s] => [%s]:%d vs [%s]:%d, code %d\n",
printf("[%s] => [%s]:%zu vs [%s]:%zu, code %d\n",
xmlbuf,
st ? (const char *)st->buf : "", st ? st->size : 0,
verify ? verify : "", verlen, rc.code);
......
......@@ -10,11 +10,10 @@
#define CHECK_ENCODE_BAD(a, b, c) check_encode(__LINE__, 1, a, b, c);
static asn_oer_constraints_t *
setup_constraints(int lineno, const char *process, unsigned width,
unsigned positive) {
setup_constraints(unsigned width, unsigned positive) {
static struct asn_oer_constraints_s empty_constraints;
struct asn_oer_constraints_s *constraints = &empty_constraints;
struct asn_oer_constraint_number_s *ct_value = &constraints->value;
asn_oer_constraints_t *constraints = &empty_constraints;
asn_oer_constraint_number_t *ct_value = &constraints->value;
memset(&empty_constraints, 0, sizeof(empty_constraints));
......@@ -33,8 +32,7 @@ check_decode(int lineno, enum asn_dec_rval_code_e code, intmax_t control, const
INTEGER_t *st = NULL;
asn_dec_rval_t ret;
asn_oer_constraints_t *constraints =
setup_constraints(lineno, "decoding", width, positive);
asn_oer_constraints_t *constraints = setup_constraints(width, positive);
fprintf(stderr, "%d: buf[%zu]={%d, %d, ...}\n", lineno, size,
((const uint8_t *)buf)[0],
......@@ -105,7 +103,7 @@ check_roundtrip(int lineno, intmax_t value, intmax_t lower_bound, intmax_t upper
asn_enc_rval_t er;
asn_dec_rval_t ret;
asn_oer_constraints_t *constraints =
setup_constraints(lineno, "encoding", lower_bound, upper_bound);
setup_constraints(lower_bound, upper_bound);
if(asn_imax2INTEGER(stOut, value) == -1) {
assert(!"Unreachable imax2INTEGER failure");
......@@ -164,8 +162,7 @@ check_encode(int lineno, int bad, intmax_t value, unsigned width, unsigned posit
INTEGER_t *stOut = (INTEGER_t *)calloc(1, sizeof(*stOut));
asn_enc_rval_t er;
asn_oer_constraints_t *constraints =
setup_constraints(lineno, "encoding", width, positive);
asn_oer_constraints_t *constraints = setup_constraints(width, positive);
if(asn_imax2INTEGER(stOut, value) == -1) {
assert(!"Unreachable imax2INTEGER failure");
......
......@@ -30,7 +30,7 @@ check_OID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) {
rval = ber_decode(0, &asn_DEF_OBJECT_IDENTIFIER, (void *)&oid, buf, len);
assert(rval.code == RC_OK);
assert(oid->size == (ssize_t)len - 2);
assert((ssize_t)oid->size == (ssize_t)len - 2);
/*
* Print the contents for visual debugging.
......@@ -77,7 +77,7 @@ check_ROID(uint8_t *buf, size_t len, int *ck_buf, int ck_len) {
rval = ber_decode(0, &asn_DEF_RELATIVE_OID, (void *)&oid, buf, len);
assert(rval.code == RC_OK);
assert(oid->size == (ssize_t)len - 2);
assert((ssize_t)oid->size == (ssize_t)len - 2);
/*
* Print the contents for visual debugging.
......
......@@ -90,7 +90,7 @@ check_impl(REAL_t *rn, double orig_dbl, const char *sample, const char *canonica
printf("converted into [");
for(p = rn->buf, end = p + rn->size; p < end; p++)
printf("%02x", *p);
printf("]: %d\n", rn->size);
printf("]: %zu\n", rn->size);
ret = asn_REAL2double(rn, &val);
assert(ret == 0);
......
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