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
d2de48aa
Commit
d2de48aa
authored
Oct 23, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactoring
parent
0ebe8b3d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
42 deletions
+40
-42
skeletons/xer_decoder.c
skeletons/xer_decoder.c
+40
-42
No files found.
skeletons/xer_decoder.c
View file @
d2de48aa
...
@@ -189,7 +189,6 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -189,7 +189,6 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
asn_dec_rval_t
rval
;
asn_dec_rval_t
rval
;
ssize_t
consumed_myself
=
0
;
ssize_t
consumed_myself
=
0
;
pxer_chunk_type_e
ch_type
;
/* XER chunk type */
int
xer_state
;
/* XER low level parsing context */
int
xer_state
;
/* XER low level parsing context */
(
void
)
opt_codec_ctx
;
(
void
)
opt_codec_ctx
;
...
@@ -201,8 +200,9 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -201,8 +200,9 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
*/
*/
if
(
ctx
->
phase
>
1
)
RETURN
(
RC_FAIL
);
if
(
ctx
->
phase
>
1
)
RETURN
(
RC_FAIL
);
for
(
xer_state
=
ctx
->
step
;;)
{
for
(
xer_state
=
ctx
->
step
;;)
{
ssize_t
ch_size
;
/* Chunk size */
pxer_chunk_type_e
ch_type
;
/* XER chunk type */
xer_check_tag_e
tcv
;
/* Tag check value */
ssize_t
ch_size
;
/* Chunk size */
xer_check_tag_e
tcv
;
/* Tag check value */
/*
/*
* Get the next part of the XML stream.
* Get the next part of the XML stream.
...
@@ -239,51 +239,49 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -239,51 +239,49 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
assert
(
ch_type
==
PXER_TAG
&&
size
);
assert
(
ch_type
==
PXER_TAG
&&
size
);
tcv
=
xer_check_tag
(
buf_ptr
,
ch_size
,
xml_tag
);
tcv
=
xer_check_tag
(
buf_ptr
,
ch_size
,
xml_tag
);
if
(
ctx
->
phase
==
0
)
{
/*
* Phase 0:
* Expecting the opening tag
* for the type being processed.
* Phase 1:
* Waiting for the closing XML tag.
*/
switch
(
tcv
)
{
case
XCT_BOTH
:
if
(
ctx
->
phase
)
break
;
/* Finished decoding of an empty element */
XER_GOT_EMPTY
();
ADVANCE
(
ch_size
);
ctx
->
phase
=
2
;
/* Phase out */
RETURN
(
RC_OK
);
case
XCT_OPENING
:
if
(
ctx
->
phase
)
break
;
ADVANCE
(
ch_size
);
ctx
->
phase
=
1
;
/* Processing body phase */
continue
;
case
XCT_CLOSING
:
if
(
!
ctx
->
phase
)
break
;
ADVANCE
(
ch_size
);
ctx
->
phase
=
2
;
/* Phase out */
RETURN
(
RC_OK
);
case
XCT_UNEXPECTED
:
if
(
!
ctx
->
phase
)
break
;
/*
/*
* Expecting the opening tag
* Certain tags in the body may be expected.
* for the type being processed.
*/
*/
switch
(
tcv
)
{
if
(
opt_unexpected_tag_decoder
case
XCT_BOTH
:
&&
opt_unexpected_tag_decoder
(
struct_key
,
/* Finished decoding of an empty element */
buf_ptr
,
ch_size
)
==
0
)
{
XER_GOT_EMPTY
();
/* Tag's processed fine */
ADVANCE
(
ch_size
);
ctx
->
phase
=
2
;
/* Phase out */
RETURN
(
RC_OK
);
case
XCT_OPENING
:
ADVANCE
(
ch_size
);
ADVANCE
(
ch_size
);
ctx
->
phase
=
1
;
/* Processing body phase */
continue
;
continue
;
default:
break
;
/* Unexpected tag */
}
}
else
{
/*
* Waiting for the closing XML tag.
*/
switch
(
tcv
)
{
case
XCT_CLOSING
:
ADVANCE
(
ch_size
);
ctx
->
phase
=
2
;
/* Phase out */
RETURN
(
RC_OK
);
case
XCT_UNEXPECTED
:
/*
* Certain tags in the body may be expected.
*/
if
(
opt_unexpected_tag_decoder
&&
opt_unexpected_tag_decoder
(
struct_key
,
buf_ptr
,
ch_size
)
==
0
)
{
/* Tag's processed fine */
ADVANCE
(
ch_size
);
continue
;
}
/* Fall through */
default:
break
;
}
}
ASN_DEBUG
(
"Unexpected XML tag"
);
/* Fall through */
default:
break
;
/* Unexpected tag */
}
}
ASN_DEBUG
(
"Unexpected XML tag"
);
break
;
/* Dark and mysterious things have just happened */
break
;
/* Dark and mysterious things have just happened */
}
}
...
...
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