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
fd71d1e5
Commit
fd71d1e5
authored
Sep 06, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaner pointer arithmetics
parent
cae1cfd0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
14 deletions
+28
-14
libasn1compiler/asn1c_constraint.c
libasn1compiler/asn1c_constraint.c
+28
-14
No files found.
libasn1compiler/asn1c_constraint.c
View file @
fd71d1e5
...
...
@@ -207,6 +207,20 @@ asn1c_emit_constraint_tables(arg_t *arg, int got_size) {
return
0
;
}
if
(
range
->
left
.
type
==
ARE_MIN
&&
range
->
right
.
type
==
ARE_MAX
)
{
/*
* The permitted alphabet constraint checker code guarantees
* that either both bounds (left/right) are present, or
* they're absent simultaneously. Thus, this assertion
* legitimately holds true.
*/
assert
(
range
->
el_count
==
0
);
/* The full range is specified. Ignore it. */
return
0
;
}
range_start
=
range
->
left
.
value
;
range_stop
=
range
->
right
.
value
;
assert
(
range
->
left
.
type
==
ARE_VALUE
);
...
...
@@ -369,28 +383,28 @@ emit_alphabet_check_loop(arg_t *arg, asn1cnst_range_t *range) {
natural_stop
=
0xffffffffUL
;
break
;
case
ASN_STRING_UniversalString
:
OUT
(
"const uint
32
_t *ch = st->buf;
\n
"
);
OUT
(
"const uint
32
_t *end = ch + st->size;
\n
"
);
OUT
(
"const uint
8
_t *ch = st->buf;
\n
"
);
OUT
(
"const uint
8
_t *end = ch + st->size;
\n
"
);
OUT
(
"
\n
"
);
OUT
(
"if(st->size %
4) return -1; /* (size
%4)! */
\n
"
);
OUT
(
"for(; ch < end; ch
++
) {
\n
"
);
OUT
(
"if(st->size %
% 4) return -1; /* (size%
%4)! */
\n
"
);
OUT
(
"for(; ch < end; ch
+= 4
) {
\n
"
);
INDENT
(
+
1
);
OUT
(
"uint32_t cv = (
((const uint8_t *)ch)
[0] << 24)
\n
"
);
OUT
(
"
\t\t
| (
((const uint8_t *)ch)
[1] << 16)
\n
"
);
OUT
(
"
\t\t
| (
((const uint8_t *)ch)
[2] << 8)
\n
"
);
OUT
(
"
\t\t
|
((const uint8_t *)ch)
[3];
\n
"
);
OUT
(
"uint32_t cv = (
ch
[0] << 24)
\n
"
);
OUT
(
"
\t\t
| (
ch
[1] << 16)
\n
"
);
OUT
(
"
\t\t
| (
ch
[2] << 8)
\n
"
);
OUT
(
"
\t\t
|
ch
[3];
\n
"
);
if
(
!
range
)
OUT
(
"if(cv > 255) return -1;
\n
"
);
natural_stop
=
0xffffffffUL
;
break
;
case
ASN_STRING_BMPString
:
OUT
(
"const uint
16
_t *ch = st->buf;
\n
"
);
OUT
(
"const uint
16
_t *end = ch + st->size;
\n
"
);
OUT
(
"const uint
8
_t *ch = st->buf;
\n
"
);
OUT
(
"const uint
8
_t *end = ch + st->size;
\n
"
);
OUT
(
"
\n
"
);
OUT
(
"if(st->size %
2) return -1; /* (size
%2)! */
\n
"
);
OUT
(
"for(; ch < end; ch
++
) {
\n
"
);
OUT
(
"if(st->size %
% 2) return -1; /* (size%
%2)! */
\n
"
);
OUT
(
"for(; ch < end; ch
+= 2
) {
\n
"
);
INDENT
(
+
1
);
OUT
(
"uint16_t cv = (
((const uint8_t *)ch)
[0] << 8)
\n
"
);
OUT
(
"
\t\t
|
((const uint8_t *)ch)
[1];
\n
"
);
OUT
(
"uint16_t cv = (
ch
[0] << 8)
\n
"
);
OUT
(
"
\t\t
|
ch
[1];
\n
"
);
if
(
!
range
)
OUT
(
"if(cv > 255) return -1;
\n
"
);
natural_stop
=
0xffff
;
break
;
...
...
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