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
dde25b3e
Commit
dde25b3e
authored
Oct 22, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xer_is_whitespace()
parent
867ac199
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
34 deletions
+35
-34
skeletons/BOOLEAN.c
skeletons/BOOLEAN.c
+2
-9
skeletons/asn_codecs_prim.c
skeletons/asn_codecs_prim.c
+2
-25
skeletons/xer_decoder.c
skeletons/xer_decoder.c
+23
-0
skeletons/xer_decoder.h
skeletons/xer_decoder.h
+8
-0
No files found.
skeletons/BOOLEAN.c
View file @
dde25b3e
...
...
@@ -137,7 +137,6 @@ static ssize_t
BOOLEAN__xer_body_decode
(
void
*
sptr
,
void
*
chunk_buf
,
size_t
chunk_size
)
{
BOOLEAN_t
*
st
=
(
BOOLEAN_t
*
)
sptr
;
char
*
p
=
(
char
*
)
chunk_buf
;
char
*
pend
=
p
+
chunk_size
;
if
(
chunk_size
==
0
)
return
-
1
;
...
...
@@ -158,14 +157,8 @@ BOOLEAN__xer_body_decode(void *sptr, void *chunk_buf, size_t chunk_size) {
return
-
1
;
}
}
else
{
for
(;
p
<
pend
;
p
++
)
{
switch
(
*
p
)
{
case
0x09
:
case
0x0a
:
case
0x0d
:
case
0x20
:
break
;
default:
return
-
1
;
/* Not whitespace */
}
}
if
(
!
xer_is_whitespace
(
chunk_buf
,
chunk_size
))
return
-
1
;
}
return
chunk_size
;
...
...
skeletons/asn_codecs_prim.c
View file @
dde25b3e
...
...
@@ -143,29 +143,6 @@ struct xdp_arg_s {
int
want_more
;
};
/*
* Check whether this buffer consists of entirely XER whitespace characters.
*/
static
int
xer_decode__check_whitespace
(
void
*
chunk_buf
,
size_t
chunk_size
)
{
char
*
p
=
(
char
*
)
chunk_buf
;
char
*
pend
=
p
+
chunk_size
;
for
(;
p
<
pend
;
p
++
)
{
switch
(
*
p
)
{
/* X.693, #8.1.4
* HORISONTAL TAB (9)
* LINE FEED (10)
* CARRIAGE RETURN (13)
* SPACE (32)
*/
case
0x09
:
case
0x0a
:
case
0x0d
:
case
0x20
:
break
;
default:
return
0
;
}
}
return
1
;
/* All whitespace */
}
static
int
xer_decode__unexpected_tag
(
void
*
key
,
void
*
chunk_buf
,
size_t
chunk_size
)
{
...
...
@@ -173,7 +150,7 @@ xer_decode__unexpected_tag(void *key, void *chunk_buf, size_t chunk_size) {
ssize_t
decoded
;
if
(
arg
->
decoded_something
)
{
if
(
xer_
decode__check
_whitespace
(
chunk_buf
,
chunk_size
))
if
(
xer_
is
_whitespace
(
chunk_buf
,
chunk_size
))
return
chunk_size
;
/*
* Decoding was done once already. Prohibit doing it again.
...
...
@@ -197,7 +174,7 @@ xer_decode__body(void *key, void *chunk_buf, size_t chunk_size, int have_more) {
ssize_t
decoded
;
if
(
arg
->
decoded_something
)
{
if
(
xer_
decode__check
_whitespace
(
chunk_buf
,
chunk_size
))
if
(
xer_
is
_whitespace
(
chunk_buf
,
chunk_size
))
return
chunk_size
;
/*
* Decoding was done once already. Prohibit doing it again.
...
...
skeletons/xer_decoder.c
View file @
dde25b3e
...
...
@@ -290,3 +290,26 @@ xer_decode_general(asn_codec_ctx_t *opt_codec_ctx,
RETURN
(
RC_FAIL
);
}
int
xer_is_whitespace
(
void
*
chunk_buf
,
size_t
chunk_size
)
{
char
*
p
=
(
char
*
)
chunk_buf
;
char
*
pend
=
p
+
chunk_size
;
for
(;
p
<
pend
;
p
++
)
{
switch
(
*
p
)
{
/* X.693, #8.1.4
* HORISONTAL TAB (9)
* LINE FEED (10)
* CARRIAGE RETURN (13)
* SPACE (32)
*/
case
0x09
:
case
0x0a
:
case
0x0d
:
case
0x20
:
break
;
default:
return
0
;
}
}
return
1
;
/* All whitespace */
}
skeletons/xer_decoder.h
View file @
dde25b3e
...
...
@@ -79,4 +79,12 @@ ssize_t xer_next_token(int *stateContext, void *buffer, size_t size,
xer_check_tag_e
xer_check_tag
(
const
void
*
buf_ptr
,
int
size
,
const
char
*
need_tag
);
/*
* Check whether this buffer consists of entirely XER whitespace characters.
* RETURN VALUES:
* 1: Whitespace or empty string
* 0: Non-whitespace
*/
int
xer_is_whitespace
(
void
*
chunk_buf
,
size_t
chunk_size
);
#endif
/* _XER_DECODER_H_ */
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