Commit d62a662d authored by Lev Walkin's avatar Lev Walkin

const fix

parent c336c4ac
...@@ -109,15 +109,18 @@ INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr, ...@@ -109,15 +109,18 @@ INTEGER_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
return der_encode_primitive(td, sptr, tag_mode, tag, cb, app_key); return der_encode_primitive(td, sptr, tag_mode, tag, cb, app_key);
} }
static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop); static const asn_INTEGER_enum_map_t *INTEGER_map_enum2value(
const asn_INTEGER_specifics_t *specs, const char *lstart,
const char *lstop);
/* /*
* INTEGER specific human-readable output. * INTEGER specific human-readable output.
*/ */
static ssize_t static ssize_t
INTEGER__dump(const asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) { INTEGER__dump(const asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_consume_bytes_f *cb, void *app_key, int plainOrXER) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
char scratch[32]; /* Enough for 64-bit integer */ (const asn_INTEGER_specifics_t *)td->specifics;
char scratch[32]; /* Enough for 64-bit integer */
uint8_t *buf = st->buf; uint8_t *buf = st->buf;
uint8_t *buf_end = st->buf + st->size; uint8_t *buf_end = st->buf + st->size;
intmax_t value; intmax_t value;
...@@ -241,8 +244,9 @@ INTEGER__compar_enum2value(const void *kp, const void *am) { ...@@ -241,8 +244,9 @@ INTEGER__compar_enum2value(const void *kp, const void *am) {
} }
static const asn_INTEGER_enum_map_t * static const asn_INTEGER_enum_map_t *
INTEGER_map_enum2value(asn_INTEGER_specifics_t *specs, const char *lstart, const char *lstop) { INTEGER_map_enum2value(const asn_INTEGER_specifics_t *specs, const char *lstart,
const asn_INTEGER_enum_map_t *el_found; const char *lstop) {
const asn_INTEGER_enum_map_t *el_found;
int count = specs ? specs->map_count : 0; int count = specs ? specs->map_count : 0;
struct e2v_key key; struct e2v_key key;
const char *lp; const char *lp;
...@@ -289,7 +293,7 @@ INTEGER__compar_value2enum(const void *kp, const void *am) { ...@@ -289,7 +293,7 @@ INTEGER__compar_value2enum(const void *kp, const void *am) {
} }
const asn_INTEGER_enum_map_t * const asn_INTEGER_enum_map_t *
INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value) { INTEGER_map_value2enum(const asn_INTEGER_specifics_t *specs, long value) {
int count = specs ? specs->map_count : 0; int count = specs ? specs->map_count : 0;
if(!count) return 0; if(!count) return 0;
return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum, return (asn_INTEGER_enum_map_t *)bsearch(&value, specs->value2enum,
...@@ -417,7 +421,7 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun ...@@ -417,7 +421,7 @@ INTEGER__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun
if(state == ST_LEADSPACE) { if(state == ST_LEADSPACE) {
const asn_INTEGER_enum_map_t *el; const asn_INTEGER_enum_map_t *el;
el = INTEGER_map_enum2value( el = INTEGER_map_enum2value(
(asn_INTEGER_specifics_t *) (const asn_INTEGER_specifics_t *)
td->specifics, lstart, lstop); td->specifics, lstart, lstop);
if(el) { if(el) {
ASN_DEBUG("Found \"%s\" => %ld", ASN_DEBUG("Found \"%s\" => %ld",
...@@ -568,8 +572,9 @@ asn_dec_rval_t ...@@ -568,8 +572,9 @@ asn_dec_rval_t
INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, INTEGER_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void **sptr, const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) { asn_per_data_t *pd) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
asn_dec_rval_t rval = { RC_OK, 0 }; (const asn_INTEGER_specifics_t *)td->specifics;
asn_dec_rval_t rval = { RC_OK, 0 };
INTEGER_t *st = (INTEGER_t *)*sptr; INTEGER_t *st = (INTEGER_t *)*sptr;
const asn_per_constraint_t *ct; const asn_per_constraint_t *ct;
int repeat; int repeat;
...@@ -680,8 +685,9 @@ asn_enc_rval_t ...@@ -680,8 +685,9 @@ asn_enc_rval_t
INTEGER_encode_uper(asn_TYPE_descriptor_t *td, INTEGER_encode_uper(asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void *sptr, const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) { asn_per_outp_t *po) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
asn_enc_rval_t er; (const asn_INTEGER_specifics_t *)td->specifics;
asn_enc_rval_t er;
INTEGER_t *st = (INTEGER_t *)sptr; INTEGER_t *st = (INTEGER_t *)sptr;
const uint8_t *buf; const uint8_t *buf;
const uint8_t *end; const uint8_t *end;
......
...@@ -85,7 +85,8 @@ enum asn_strtox_result_e asn_strtoimax_lim(const char *str, const char **end, in ...@@ -85,7 +85,8 @@ enum asn_strtox_result_e asn_strtoimax_lim(const char *str, const char **end, in
/* /*
* Convert the integer value into the corresponding enumeration map entry. * Convert the integer value into the corresponding enumeration map entry.
*/ */
const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(asn_INTEGER_specifics_t *specs, long value); const asn_INTEGER_enum_map_t *INTEGER_map_value2enum(
const asn_INTEGER_specifics_t *specs, long value);
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -13,7 +13,8 @@ asn_dec_rval_t ...@@ -13,7 +13,8 @@ asn_dec_rval_t
INTEGER_decode_oer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, INTEGER_decode_oer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
const asn_oer_constraints_t *constraints, void **sptr, const asn_oer_constraints_t *constraints, void **sptr,
const void *ptr, size_t size) { const void *ptr, size_t size) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
(const asn_INTEGER_specifics_t *)td->specifics;
asn_dec_rval_t rval = {RC_OK, 0}; asn_dec_rval_t rval = {RC_OK, 0};
INTEGER_t *st = (INTEGER_t *)*sptr; INTEGER_t *st = (INTEGER_t *)*sptr;
struct asn_oer_constraint_number_s ct = {0, 0}; struct asn_oer_constraint_number_s ct = {0, 0};
......
...@@ -58,9 +58,10 @@ asn_enc_rval_t ...@@ -58,9 +58,10 @@ asn_enc_rval_t
NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, NativeEnumerated_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
int ilevel, enum xer_encoder_flags_e flags, int ilevel, enum xer_encoder_flags_e flags,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
asn_enc_rval_t er; (const asn_INTEGER_specifics_t *)td->specifics;
const long *native = (const long *)sptr; asn_enc_rval_t er;
const long *native = (const long *)sptr;
const asn_INTEGER_enum_map_t *el; const asn_INTEGER_enum_map_t *el;
(void)ilevel; (void)ilevel;
...@@ -88,8 +89,9 @@ asn_dec_rval_t ...@@ -88,8 +89,9 @@ asn_dec_rval_t
NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx, NativeEnumerated_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints, asn_TYPE_descriptor_t *td, const asn_per_constraints_t *constraints,
void **sptr, asn_per_data_t *pd) { void **sptr, asn_per_data_t *pd) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
asn_dec_rval_t rval = { RC_OK, 0 }; (const asn_INTEGER_specifics_t *)td->specifics;
asn_dec_rval_t rval = { RC_OK, 0 };
long *native = (long *)*sptr; long *native = (long *)*sptr;
const asn_per_constraint_t *ct; const asn_per_constraint_t *ct;
long value; long value;
...@@ -154,8 +156,9 @@ asn_enc_rval_t ...@@ -154,8 +156,9 @@ asn_enc_rval_t
NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td, NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, const asn_per_constraints_t *constraints,
void *sptr, asn_per_outp_t *po) { void *sptr, asn_per_outp_t *po) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
asn_enc_rval_t er; (const asn_INTEGER_specifics_t *)td->specifics;
asn_enc_rval_t er;
long native, value; long native, value;
const asn_per_constraint_t *ct; const asn_per_constraint_t *ct;
int inext = 0; int inext = 0;
......
...@@ -62,8 +62,9 @@ asn_dec_rval_t ...@@ -62,8 +62,9 @@ asn_dec_rval_t
NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx, NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, asn_TYPE_descriptor_t *td,
void **nint_ptr, const void *buf_ptr, size_t size, int tag_mode) { void **nint_ptr, const void *buf_ptr, size_t size, int tag_mode) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
long *native = (long *)*nint_ptr; (const asn_INTEGER_specifics_t *)td->specifics;
long *native = (long *)*nint_ptr;
asn_dec_rval_t rval; asn_dec_rval_t rval;
ber_tlv_len_t length; ber_tlv_len_t length;
...@@ -184,8 +185,9 @@ asn_dec_rval_t ...@@ -184,8 +185,9 @@ asn_dec_rval_t
NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx, NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname, asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
const void *buf_ptr, size_t size) { const void *buf_ptr, size_t size) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
asn_dec_rval_t rval; (const asn_INTEGER_specifics_t *)td->specifics;
asn_dec_rval_t rval;
INTEGER_t st; INTEGER_t st;
void *st_ptr = (void *)&st; void *st_ptr = (void *)&st;
long *native = (long *)*sptr; long *native = (long *)*sptr;
...@@ -225,8 +227,9 @@ asn_enc_rval_t ...@@ -225,8 +227,9 @@ asn_enc_rval_t
NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
int ilevel, enum xer_encoder_flags_e flags, int ilevel, enum xer_encoder_flags_e flags,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
char scratch[32]; /* Enough for 64-bit int */ (const asn_INTEGER_specifics_t *)td->specifics;
char scratch[32]; /* Enough for 64-bit int */
asn_enc_rval_t er; asn_enc_rval_t er;
const long *native = (const long *)sptr; const long *native = (const long *)sptr;
...@@ -252,8 +255,9 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx, ...@@ -252,8 +255,9 @@ NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void **sptr, const asn_per_constraints_t *constraints, void **sptr,
asn_per_data_t *pd) { asn_per_data_t *pd) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
asn_dec_rval_t rval; (const asn_INTEGER_specifics_t *)td->specifics;
asn_dec_rval_t rval;
long *native = (long *)*sptr; long *native = (long *)*sptr;
INTEGER_t tmpint; INTEGER_t tmpint;
void *tmpintptr = &tmpint; void *tmpintptr = &tmpint;
...@@ -287,8 +291,9 @@ asn_enc_rval_t ...@@ -287,8 +291,9 @@ asn_enc_rval_t
NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, NativeInteger_encode_uper(asn_TYPE_descriptor_t *td,
const asn_per_constraints_t *constraints, void *sptr, const asn_per_constraints_t *constraints, void *sptr,
asn_per_outp_t *po) { asn_per_outp_t *po) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
asn_enc_rval_t er; (const asn_INTEGER_specifics_t *)td->specifics;
asn_enc_rval_t er;
long native; long native;
INTEGER_t tmpint; INTEGER_t tmpint;
...@@ -316,8 +321,9 @@ NativeInteger_encode_uper(asn_TYPE_descriptor_t *td, ...@@ -316,8 +321,9 @@ NativeInteger_encode_uper(asn_TYPE_descriptor_t *td,
int int
NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key) {
asn_INTEGER_specifics_t *specs=(asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
const long *native = (const long *)sptr; (const asn_INTEGER_specifics_t *)td->specifics;
const long *native = (const long *)sptr;
char scratch[32]; /* Enough for 64-bit int */ char scratch[32]; /* Enough for 64-bit int */
int ret; int ret;
......
...@@ -14,7 +14,8 @@ NativeInteger_decode_oer(asn_codec_ctx_t *opt_codec_ctx, ...@@ -14,7 +14,8 @@ NativeInteger_decode_oer(asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td, asn_TYPE_descriptor_t *td,
const asn_oer_constraints_t *constraints, const asn_oer_constraints_t *constraints,
void **nint_ptr, const void *ptr, size_t size) { void **nint_ptr, const void *ptr, size_t size) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
(const asn_INTEGER_specifics_t *)td->specifics;
asn_dec_rval_t rval = {RC_OK, 0}; asn_dec_rval_t rval = {RC_OK, 0};
long *native = (long *)*nint_ptr; long *native = (long *)*nint_ptr;
INTEGER_t tmpint; INTEGER_t tmpint;
...@@ -70,7 +71,8 @@ asn_enc_rval_t ...@@ -70,7 +71,8 @@ asn_enc_rval_t
NativeInteger_encode_oer(asn_TYPE_descriptor_t *td, NativeInteger_encode_oer(asn_TYPE_descriptor_t *td,
const asn_oer_constraints_t *constraints, void *sptr, const asn_oer_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) { asn_app_consume_bytes_f *cb, void *app_key) {
asn_INTEGER_specifics_t *specs = (asn_INTEGER_specifics_t *)td->specifics; const asn_INTEGER_specifics_t *specs =
(const asn_INTEGER_specifics_t *)td->specifics;
INTEGER_t tmpint; INTEGER_t tmpint;
long native; long native;
......
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