Skip to content

Commit

Permalink
Merge pull request #154 from CedricRouxEurecom/opentype-per-constraints
Browse files Browse the repository at this point in the history
PER: fix encoding and decoding of OPENTYPE with size constraints
  • Loading branch information
mouse07410 authored Dec 16, 2023
2 parents bbde80f + 03d1877 commit df2b288
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
5 changes: 3 additions & 2 deletions skeletons/OPEN_TYPE_aper.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ OPEN_TYPE_aper_get(const asn_codec_ctx_t *opt_codec_ctx,
(char *)*memb_ptr2
+ elm->type->elements[selected.presence_index - 1].memb_offset;

rv = aper_open_type_get(opt_codec_ctx, selected.type_descriptor, NULL,
rv = aper_open_type_get(opt_codec_ctx, selected.type_descriptor,
elm->type->elements[selected.presence_index - 1].encoding_constraints.per_constraints,
&inner_value, pd);
switch(rv.code) {
case RC_OK:
Expand Down Expand Up @@ -110,7 +111,7 @@ OPEN_TYPE_encode_aper(const asn_TYPE_descriptor_t *td,
memb_ptr = (const char *)sptr + elm->memb_offset;
}

if(aper_open_type_put(elm->type, NULL, memb_ptr, po) < 0) {
if(aper_open_type_put(elm->type, elm->encoding_constraints.per_constraints, memb_ptr, po) < 0) {
ASN__ENCODE_FAILED;
}

Expand Down
7 changes: 5 additions & 2 deletions skeletons/OPEN_TYPE_uper.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ OPEN_TYPE_uper_get(const asn_codec_ctx_t *opt_codec_ctx,
(char *)*memb_ptr2
+ elm->type->elements[selected.presence_index - 1].memb_offset;

rv = uper_open_type_get(opt_codec_ctx, selected.type_descriptor, NULL,
rv = uper_open_type_get(opt_codec_ctx, selected.type_descriptor,
elm->type->elements[selected.presence_index - 1].encoding_constraints.per_constraints,
&inner_value, pd);
switch(rv.code) {
case RC_OK:
Expand Down Expand Up @@ -110,7 +111,9 @@ OPEN_TYPE_encode_uper(const asn_TYPE_descriptor_t *td,
memb_ptr = (const char *)sptr + elm->memb_offset;
}

if(uper_open_type_put(elm->type, NULL, memb_ptr, po) < 0) {
if(uper_open_type_put(elm->type,
elm->encoding_constraints.per_constraints,
memb_ptr, po) < 0) {
ASN__ENCODE_FAILED;
}

Expand Down

0 comments on commit df2b288

Please sign in to comment.