Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
asn1c
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
asn1c
Commits
28ba9db6
Commit
28ba9db6
authored
Aug 31, 2017
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
retain DEFAULT encoding in XER output (std)
parent
3b6cba57
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
49 deletions
+60
-49
skeletons/constr_SEQUENCE.c
skeletons/constr_SEQUENCE.c
+60
-49
No files found.
skeletons/constr_SEQUENCE.c
View file @
28ba9db6
...
...
@@ -536,7 +536,7 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td,
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr2
=
(
void
**
)((
char
*
)
sptr
+
elm
->
memb_offset
);
if
(
!*
memb_ptr2
)
{
ASN_DEBUG
(
"Element %s %
d
not present"
,
ASN_DEBUG
(
"Element %s %
zu
not present"
,
elm
->
name
,
edx
);
if
(
elm
->
optional
)
continue
;
...
...
@@ -874,59 +874,70 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
}
asn_enc_rval_t
SEQUENCE_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
er
;
int
xcan
=
(
flags
&
XER_F_CANONICAL
);
SEQUENCE_encode_xer
(
asn_TYPE_descriptor_t
*
td
,
void
*
sptr
,
int
ilevel
,
enum
xer_encoder_flags_e
flags
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_enc_rval_t
er
;
int
xcan
=
(
flags
&
XER_F_CANONICAL
);
asn_TYPE_descriptor_t
*
tmp_def_val_td
=
0
;
void
*
tmp_def_val
=
0
;
size_t
edx
;
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
er
.
encoded
=
0
;
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn_enc_rval_t
tmper
;
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
void
*
memb_ptr
;
const
char
*
mname
=
elm
->
name
;
unsigned
int
mlen
=
strlen
(
mname
);
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr
=
*
(
void
**
)((
char
*
)
sptr
+
elm
->
memb_offset
);
if
(
!
memb_ptr
)
{
if
(
elm
->
optional
)
continue
;
/* Mandatory element is missing */
ASN__ENCODE_FAILED
;
}
}
else
{
memb_ptr
=
(
void
*
)((
char
*
)
sptr
+
elm
->
memb_offset
);
}
/*
* X.693 (0112) #9.5.
* TODO: Default values' encodings shall always be present.
*/
if
(
!
xcan
)
ASN__TEXT_INDENT
(
1
,
ilevel
);
ASN__CALLBACK3
(
"<"
,
1
,
mname
,
mlen
,
">"
,
1
);
/* Print the member itself */
tmper
=
elm
->
type
->
op
->
xer_encoder
(
elm
->
type
,
memb_ptr
,
ilevel
+
1
,
flags
,
cb
,
app_key
);
if
(
tmper
.
encoded
==
-
1
)
return
tmper
;
ASN__CALLBACK3
(
"</"
,
2
,
mname
,
mlen
,
">"
,
1
);
er
.
encoded
+=
5
+
(
2
*
mlen
)
+
tmper
.
encoded
;
}
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
er
.
encoded
=
0
;
for
(
edx
=
0
;
edx
<
td
->
elements_count
;
edx
++
)
{
asn_enc_rval_t
tmper
;
asn_TYPE_member_t
*
elm
=
&
td
->
elements
[
edx
];
void
*
memb_ptr
;
const
char
*
mname
=
elm
->
name
;
unsigned
int
mlen
=
strlen
(
mname
);
if
(
elm
->
flags
&
ATF_POINTER
)
{
memb_ptr
=
*
(
void
**
)((
char
*
)
sptr
+
elm
->
memb_offset
);
if
(
!
memb_ptr
)
{
assert
(
tmp_def_val
==
0
);
if
(
elm
->
default_value
)
{
if
(
elm
->
default_value
(
1
,
&
tmp_def_val
))
{
ASN__ENCODE_FAILED
;
}
else
{
memb_ptr
=
tmp_def_val
;
tmp_def_val_td
=
elm
->
type
;
}
}
else
if
(
elm
->
optional
)
{
continue
;
}
else
{
/* Mandatory element is missing */
ASN__ENCODE_FAILED
;
}
}
}
else
{
memb_ptr
=
(
void
*
)((
char
*
)
sptr
+
elm
->
memb_offset
);
}
if
(
!
xcan
)
ASN__TEXT_INDENT
(
1
,
ilevel
);
ASN__CALLBACK3
(
"<"
,
1
,
mname
,
mlen
,
">"
,
1
);
/* Print the member itself */
tmper
=
elm
->
type
->
op
->
xer_encoder
(
elm
->
type
,
memb_ptr
,
ilevel
+
1
,
flags
,
cb
,
app_key
);
if
(
tmp_def_val
)
{
ASN_STRUCT_FREE
(
*
tmp_def_val_td
,
tmp_def_val
);
tmp_def_val
=
0
;
}
if
(
tmper
.
encoded
==
-
1
)
return
tmper
;
ASN__CALLBACK3
(
"</"
,
2
,
mname
,
mlen
,
">"
,
1
);
er
.
encoded
+=
5
+
(
2
*
mlen
)
+
tmper
.
encoded
;
}
if
(
!
xcan
)
ASN__TEXT_INDENT
(
1
,
ilevel
-
1
);
if
(
!
xcan
)
ASN__TEXT_INDENT
(
1
,
ilevel
-
1
);
ASN__ENCODED_OK
(
er
);
ASN__ENCODED_OK
(
er
);
cb_failed:
ASN__ENCODE_FAILED
;
if
(
tmp_def_val
)
ASN_STRUCT_FREE
(
*
tmp_def_val_td
,
tmp_def_val
);
ASN__ENCODE_FAILED
;
}
int
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment