Commit d839785d authored by Lev Walkin's avatar Lev Walkin

add OER ENUMERATED in -fwide-types mode

parent 945958e0
......@@ -26,8 +26,8 @@ asn_TYPE_operation_t asn_OP_ENUMERATED = {
0,
0,
#else
0,
0,
ENUMERATED_decode_oer,
ENUMERATED_encode_oer,
#endif /* ASN_DISABLE_OER_SUPPORT */
#ifdef ASN_DISABLE_PER_SUPPORT
0,
......@@ -52,6 +52,52 @@ asn_TYPE_descriptor_t asn_DEF_ENUMERATED = {
0 /* No specifics */
};
#ifndef ASN_DISABLE_OER_SUPPORT
asn_dec_rval_t
ENUMERATED_decode_oer(const asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
const asn_oer_constraints_t *constraints, void **sptr,
const void *ptr, size_t size) {
asn_dec_rval_t rval;
ENUMERATED_t *st = (ENUMERATED_t *)*sptr;
long value;
void *vptr = &value;
if(!st) {
st = (ENUMERATED_t *)(*sptr = CALLOC(1, sizeof(*st)));
if(!st) ASN__DECODE_FAILED;
}
rval = NativeEnumerated_decode_oer(opt_codec_ctx, td, constraints,
(void **)&vptr, ptr, size);
if(rval.code == RC_OK) {
if(asn_long2INTEGER(st, value)) {
rval.code = RC_FAIL;
}
}
return rval;
}
asn_enc_rval_t
ENUMERATED_encode_oer(asn_TYPE_descriptor_t *td,
const asn_oer_constraints_t *constraints, void *sptr,
asn_app_consume_bytes_f *cb, void *app_key) {
ENUMERATED_t *st = (ENUMERATED_t *)sptr;
long value;
if(asn_INTEGER2long(st, &value)) {
ASN__ENCODE_FAILED;
}
return NativeEnumerated_encode_oer(td, constraints, &value, cb, app_key);
}
#endif /* ASN_DISABLE_OER_SUPPORT */
#ifndef ASN_DISABLE_PER_SUPPORT
asn_dec_rval_t
ENUMERATED_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
asn_TYPE_descriptor_t *td,
......@@ -69,9 +115,11 @@ ENUMERATED_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
rval = NativeEnumerated_decode_uper(opt_codec_ctx, td, constraints,
(void **)&vptr, pd);
if(rval.code == RC_OK)
if(asn_long2INTEGER(st, value))
if(rval.code == RC_OK) {
if(asn_long2INTEGER(st, value)) {
rval.code = RC_FAIL;
}
}
return rval;
}
......@@ -82,9 +130,11 @@ ENUMERATED_encode_uper(asn_TYPE_descriptor_t *td,
ENUMERATED_t *st = (ENUMERATED_t *)sptr;
long value;
if(asn_INTEGER2long(st, &value))
if(asn_INTEGER2long(st, &value)) {
ASN__ENCODE_FAILED;
}
return NativeEnumerated_encode_uper(td, constraints, &value, po);
}
#endif /* ASN_DISABLE_PER_SUPPORT */
......@@ -16,6 +16,8 @@ typedef INTEGER_t ENUMERATED_t; /* Implemented via INTEGER */
extern asn_TYPE_descriptor_t asn_DEF_ENUMERATED;
extern asn_TYPE_operation_t asn_OP_ENUMERATED;
oer_type_decoder_f ENUMERATED_decode_oer;
oer_type_encoder_f ENUMERATED_encode_oer;
per_type_decoder_f ENUMERATED_decode_uper;
per_type_encoder_f ENUMERATED_encode_uper;
......
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