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
fb6344ef
Commit
fb6344ef
authored
Jul 28, 2014
by
Wim Lewis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Declare most internal, constant tables as const, particularly the
"specifics" structures and the tables they point to.
parent
14e6b161
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
68 additions
and
63 deletions
+68
-63
libasn1compiler/asn1c_C.c
libasn1compiler/asn1c_C.c
+9
-9
skeletons/INTEGER.c
skeletons/INTEGER.c
+3
-3
skeletons/INTEGER.h
skeletons/INTEGER.h
+3
-3
skeletons/NativeEnumerated.c
skeletons/NativeEnumerated.c
+1
-1
skeletons/OCTET_STRING.h
skeletons/OCTET_STRING.h
+1
-1
skeletons/constr_CHOICE.c
skeletons/constr_CHOICE.c
+2
-2
skeletons/constr_CHOICE.h
skeletons/constr_CHOICE.h
+2
-2
skeletons/constr_SEQUENCE.c
skeletons/constr_SEQUENCE.c
+4
-4
skeletons/constr_SEQUENCE.h
skeletons/constr_SEQUENCE.h
+3
-3
skeletons/constr_SET.c
skeletons/constr_SET.c
+18
-15
skeletons/constr_SET.h
skeletons/constr_SET.h
+4
-4
skeletons/constr_SET_OF.h
skeletons/constr_SET_OF.h
+1
-1
skeletons/constr_TYPE.h
skeletons/constr_TYPE.h
+8
-8
skeletons/der_encoder.c
skeletons/der_encoder.c
+8
-6
skeletons/tests/check-PER-INTEGER.c
skeletons/tests/check-PER-INTEGER.c
+1
-1
No files found.
libasn1compiler/asn1c_C.c
View file @
fb6344ef
...
...
@@ -175,7 +175,7 @@ asn1c_lang_C_type_common_INTEGER(arg_t *arg) {
*/
REDIR
(
OT_STAT_DEFS
);
OUT
(
"static asn_INTEGER_enum_map_t asn_MAP_%s_value2enum_%d[] = {
\n
"
,
OUT
(
"static
const
asn_INTEGER_enum_map_t asn_MAP_%s_value2enum_%d[] = {
\n
"
,
MKID
(
expr
),
expr
->
_type_unique_index
);
qsort
(
v2e
,
el_count
,
sizeof
(
v2e
[
0
]),
compar_enumMap_byValue
);
for
(
eidx
=
0
;
eidx
<
el_count
;
eidx
++
)
{
...
...
@@ -189,7 +189,7 @@ asn1c_lang_C_type_common_INTEGER(arg_t *arg) {
OUT
(
"
\t
/* This list is extensible */
\n
"
);
OUT
(
"};
\n
"
);
OUT
(
"static unsigned int asn_MAP_%s_enum2value_%d[] = {
\n
"
,
OUT
(
"static
const
unsigned int asn_MAP_%s_enum2value_%d[] = {
\n
"
,
MKID
(
expr
),
expr
->
_type_unique_index
);
qsort
(
v2e
,
el_count
,
sizeof
(
v2e
[
0
]),
compar_enumMap_byName
);
for
(
eidx
=
0
;
eidx
<
el_count
;
eidx
++
)
{
...
...
@@ -202,7 +202,7 @@ asn1c_lang_C_type_common_INTEGER(arg_t *arg) {
OUT
(
"
\t
/* This list is extensible */
\n
"
);
OUT
(
"};
\n
"
);
OUT
(
"static asn_INTEGER_specifics_t asn_SPC_%s_specs_%d = {
\n
"
,
OUT
(
"static
const
asn_INTEGER_specifics_t asn_SPC_%s_specs_%d = {
\n
"
,
MKID
(
expr
),
expr
->
_type_unique_index
);
INDENT
(
+
1
);
OUT
(
"asn_MAP_%s_value2enum_%d,
\t
"
...
...
@@ -234,7 +234,7 @@ asn1c_lang_C_type_common_INTEGER(arg_t *arg) {
if
(
expr
->
expr_type
==
ASN_BASIC_INTEGER
&&
asn1c_type_fits_long
(
arg
,
expr
)
==
FL_FITS_UNSIGN
)
{
REDIR
(
OT_STAT_DEFS
);
OUT
(
"static asn_INTEGER_specifics_t asn_SPC_%s_specs_%d = {
\n
"
,
OUT
(
"static
const
asn_INTEGER_specifics_t asn_SPC_%s_specs_%d = {
\n
"
,
MKID
(
expr
),
expr
->
_type_unique_index
);
INDENT
(
+
1
);
OUT
(
"0,
\t
"
);
...
...
@@ -383,7 +383,7 @@ asn1c_lang_C_type_SEQUENCE_def(arg_t *arg) {
int
elm
=
0
;
int
comma
=
0
;
comp_mode
=
0
;
OUT
(
"static int asn_MAP_%s_oms_%d[] = {"
,
OUT
(
"static
const
int asn_MAP_%s_oms_%d[] = {"
,
MKID
(
expr
),
expr
->
_type_unique_index
);
TQ_FOR
(
v
,
&
(
expr
->
members
),
next
)
{
...
...
@@ -628,7 +628,7 @@ asn1c_lang_C_type_SET_def(arg_t *arg) {
/*
* Emit a map of mandatory elements.
*/
OUT
(
"static uint8_t asn_MAP_%s_mmap_%d"
,
OUT
(
"static
const
uint8_t asn_MAP_%s_mmap_%d"
,
MKID
(
expr
),
expr
->
_type_unique_index
);
p
=
MKID_safe
(
expr
);
OUT
(
"[(%d + (8 * sizeof(unsigned int)) - 1) / 8]"
,
elements
);
...
...
@@ -964,7 +964,7 @@ asn1c_lang_C_type_CHOICE_def(arg_t *arg) {
int
i
;
cmap
=
compute_canonical_members_order
(
arg
,
elements
);
if
(
cmap
)
{
OUT
(
"static int asn_MAP_%s_cmap_%d[] = {"
,
OUT
(
"static
const
int asn_MAP_%s_cmap_%d[] = {"
,
MKID
(
expr
),
expr
->
_type_unique_index
);
for
(
i
=
0
;
i
<
elements
;
i
++
)
{
...
...
@@ -1661,7 +1661,7 @@ emit_tag2member_map(arg_t *arg, tag2el_t *tag2el, int tag2el_count, const char *
if
(
!
tag2el_count
)
return
0
;
/* No top level tags */
OUT
(
"static asn_TYPE_tag2member_t asn_MAP_%s_tag2el%s_%d[] = {
\n
"
,
OUT
(
"static
const
asn_TYPE_tag2member_t asn_MAP_%s_tag2el%s_%d[] = {
\n
"
,
MKID
(
expr
),
opt_modifier
?
opt_modifier
:
""
,
expr
->
_type_unique_index
);
for
(
i
=
0
;
i
<
tag2el_count
;
i
++
)
{
...
...
@@ -1730,7 +1730,7 @@ emit_tags_vectors(arg_t *arg, asn1p_expr_t *expr, int *tags_count_r, int *all_ta
}
#define EMIT_TAGS_TABLE(name, tags, tags_count) do { \
OUT("static ber_tlv_tag_t asn_DEF_%s%s_tags_%d[] = {\n",\
OUT("static
const
ber_tlv_tag_t asn_DEF_%s%s_tags_%d[] = {\n",\
MKID(expr), name, \
expr->_type_unique_index); \
INDENT(+1); \
...
...
skeletons/INTEGER.c
View file @
fb6344ef
...
...
@@ -208,8 +208,8 @@ INTEGER_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
struct
e2v_key
{
const
char
*
start
;
const
char
*
stop
;
asn_INTEGER_enum_map_t
*
vemap
;
unsigned
int
*
evmap
;
const
asn_INTEGER_enum_map_t
*
vemap
;
const
unsigned
int
*
evmap
;
};
static
int
INTEGER__compar_enum2value
(
const
void
*
kp
,
const
void
*
am
)
{
...
...
@@ -232,7 +232,7 @@ INTEGER__compar_enum2value(const void *kp, const void *am) {
static
const
asn_INTEGER_enum_map_t
*
INTEGER_map_enum2value
(
asn_INTEGER_specifics_t
*
specs
,
const
char
*
lstart
,
const
char
*
lstop
)
{
asn_INTEGER_enum_map_t
*
el_found
;
const
asn_INTEGER_enum_map_t
*
el_found
;
int
count
=
specs
?
specs
->
map_count
:
0
;
struct
e2v_key
key
;
const
char
*
lp
;
...
...
skeletons/INTEGER.h
View file @
fb6344ef
...
...
@@ -24,9 +24,9 @@ typedef struct asn_INTEGER_enum_map_s {
}
asn_INTEGER_enum_map_t
;
/* This type describes an enumeration for INTEGER and ENUMERATED types */
typedef
struct
asn_INTEGER_specifics_s
{
asn_INTEGER_enum_map_t
*
value2enum
;
/* N -> "tag"; sorted by N */
unsigned
int
*
enum2value
;
/* "tag" => N; sorted by tag */
typedef
const
struct
asn_INTEGER_specifics_s
{
const
asn_INTEGER_enum_map_t
*
value2enum
;
/* N -> "tag"; sorted by N */
const
unsigned
int
*
enum2value
;
/* "tag" => N; sorted by tag */
int
map_count
;
/* Elements in either map */
int
extension
;
/* This map is extensible */
int
strict_enumeration
;
/* Enumeration set is fixed */
...
...
skeletons/NativeEnumerated.c
View file @
fb6344ef
...
...
@@ -145,7 +145,7 @@ NativeEnumerated_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraint_t
*
ct
;
int
inext
=
0
;
asn_INTEGER_enum_map_t
key
;
asn_INTEGER_enum_map_t
*
kf
;
const
asn_INTEGER_enum_map_t
*
kf
;
if
(
!
sptr
)
_ASN_ENCODE_FAILED
;
if
(
!
specs
)
_ASN_ENCODE_FAILED
;
...
...
skeletons/OCTET_STRING.h
View file @
fb6344ef
...
...
@@ -63,7 +63,7 @@ OCTET_STRING_t *OCTET_STRING_new_fromBuf(asn_TYPE_descriptor_t *td,
* Internally useful stuff. *
****************************/
typedef
struct
asn_OCTET_STRING_specifics_s
{
typedef
const
struct
asn_OCTET_STRING_specifics_s
{
/*
* Target structure description.
*/
...
...
skeletons/constr_CHOICE.c
View file @
fb6344ef
...
...
@@ -183,11 +183,11 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
}
do
{
asn_TYPE_tag2member_t
*
t2m
;
const
asn_TYPE_tag2member_t
*
t2m
;
asn_TYPE_tag2member_t
key
;
key
.
el_tag
=
tlv_tag
;
t2m
=
(
asn_TYPE_tag2member_t
*
)
bsearch
(
&
key
,
t2m
=
(
const
asn_TYPE_tag2member_t
*
)
bsearch
(
&
key
,
specs
->
tag2el
,
specs
->
tag2el_count
,
sizeof
(
specs
->
tag2el
[
0
]),
_search4tag
);
if
(
t2m
)
{
...
...
skeletons/constr_CHOICE.h
View file @
fb6344ef
...
...
@@ -12,7 +12,7 @@
extern
"C"
{
#endif
typedef
struct
asn_CHOICE_specifics_s
{
typedef
const
struct
asn_CHOICE_specifics_s
{
/*
* Target structure description.
*/
...
...
@@ -24,7 +24,7 @@ typedef struct asn_CHOICE_specifics_s {
/*
* Tags to members mapping table.
*/
asn_TYPE_tag2member_t
*
tag2el
;
const
asn_TYPE_tag2member_t
*
tag2el
;
int
tag2el_count
;
/* Canonical ordering of CHOICE elements, for PER */
...
...
skeletons/constr_SEQUENCE.c
View file @
fb6344ef
...
...
@@ -310,16 +310,16 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
* Resort to a binary search over
* sorted array of tags.
*/
asn_TYPE_tag2member_t
*
t2m
;
const
asn_TYPE_tag2member_t
*
t2m
;
asn_TYPE_tag2member_t
key
;
key
.
el_tag
=
tlv_tag
;
key
.
el_no
=
edx
;
t2m
=
(
asn_TYPE_tag2member_t
*
)
bsearch
(
&
key
,
t2m
=
(
const
asn_TYPE_tag2member_t
*
)
bsearch
(
&
key
,
specs
->
tag2el
,
specs
->
tag2el_count
,
sizeof
(
specs
->
tag2el
[
0
]),
_t2e_cmp
);
if
(
t2m
)
{
asn_TYPE_tag2member_t
*
best
=
0
;
asn_TYPE_tag2member_t
*
t2m_f
,
*
t2m_l
;
const
asn_TYPE_tag2member_t
*
best
=
0
;
const
asn_TYPE_tag2member_t
*
t2m_f
,
*
t2m_l
;
int
edx_max
=
edx
+
elements
[
edx
].
optional
;
/*
* Rewind to the first element with that tag,
...
...
skeletons/constr_SEQUENCE.h
View file @
fb6344ef
...
...
@@ -11,7 +11,7 @@
extern
"C"
{
#endif
typedef
struct
asn_SEQUENCE_specifics_s
{
typedef
const
struct
asn_SEQUENCE_specifics_s
{
/*
* Target structure description.
*/
...
...
@@ -21,14 +21,14 @@ typedef struct asn_SEQUENCE_specifics_s {
/*
* Tags to members mapping table (sorted).
*/
asn_TYPE_tag2member_t
*
tag2el
;
const
asn_TYPE_tag2member_t
*
tag2el
;
int
tag2el_count
;
/*
* Optional members of the extensions root (roms) or additions (aoms).
* Meaningful for PER.
*/
int
*
oms
;
/* Optional MemberS */
const
int
*
oms
;
/* Optional MemberS */
int
roms_count
;
/* Root optional members count */
int
aoms_count
;
/* Additions optional members count */
...
...
skeletons/constr_SET.c
View file @
fb6344ef
...
...
@@ -175,7 +175,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
* for optimization.
*/
for
(;;
ctx
->
step
=
0
)
{
asn_TYPE_tag2member_t
*
t2m
;
const
asn_TYPE_tag2member_t
*
t2m
;
asn_TYPE_tag2member_t
key
;
void
*
memb_ptr
;
/* Pointer to the member */
void
**
memb_ptr2
;
/* Pointer to that pointer */
...
...
@@ -225,7 +225,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
}
key
.
el_tag
=
tlv_tag
;
t2m
=
(
asn_TYPE_tag2member_t
*
)
bsearch
(
&
key
,
t2m
=
(
const
asn_TYPE_tag2member_t
*
)
bsearch
(
&
key
,
specs
->
tag2el
,
specs
->
tag2el_count
,
sizeof
(
specs
->
tag2el
[
0
]),
_t2e_cmp
);
if
(
t2m
)
{
...
...
@@ -439,7 +439,8 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
size_t
computed_size
=
0
;
asn_enc_rval_t
er
;
int
t2m_build_own
=
(
specs
->
tag2el_count
!=
td
->
elements_count
);
asn_TYPE_tag2member_t
*
t2m
;
const
asn_TYPE_tag2member_t
*
t2m
;
asn_TYPE_tag2member_t
*
t2m_build
;
int
t2m_count
;
ssize_t
ret
;
int
edx
;
...
...
@@ -448,17 +449,16 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
* Use existing, or build our own tags map.
*/
if
(
t2m_build_own
)
{
t2m
=
(
asn_TYPE_tag2member_t
*
)
alloca
(
td
->
elements_count
*
sizeof
(
t2m
[
0
]));
if
(
!
t2m
)
_ASN_ENCODE_FAILED
;
/* There are such platforms */
t2m
_build
=
(
asn_TYPE_tag2member_t
*
)
alloca
(
td
->
elements_count
*
sizeof
(
t2m
_build
[
0
]));
if
(
!
t2m
_build
)
_ASN_ENCODE_FAILED
;
/* There are such platforms */
t2m_count
=
0
;
}
else
{
t2m_build
=
NULL
;
/*
* There is no untagged CHOICE in this SET.
* Employ existing table.
*/
t2m
=
specs
->
tag2el
;
t2m_count
=
specs
->
tag2el_count
;
}
/*
...
...
@@ -479,8 +479,8 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
/* Mandatory elements missing */
_ASN_ENCODE_FAILED
;
if
(
t2m_build_own
)
{
t2m
[
t2m_count
].
el_no
=
edx
;
t2m
[
t2m_count
].
el_tag
=
0
;
t2m
_build
[
t2m_count
].
el_no
=
edx
;
t2m
_build
[
t2m_count
].
el_tag
=
0
;
t2m_count
++
;
}
continue
;
...
...
@@ -499,8 +499,8 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
* Remember the outmost tag of this member.
*/
if
(
t2m_build_own
)
{
t2m
[
t2m_count
].
el_no
=
edx
;
t2m
[
t2m_count
].
el_tag
=
asn_TYPE_outmost_tag
(
t2m
_build
[
t2m_count
].
el_no
=
edx
;
t2m
_build
[
t2m_count
].
el_tag
=
asn_TYPE_outmost_tag
(
elm
->
type
,
memb_ptr
,
elm
->
tag_mode
,
elm
->
tag
);
t2m_count
++
;
}
else
{
...
...
@@ -513,18 +513,21 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
/*
* Finalize order of the components.
*/
assert
(
t2m_count
==
td
->
elements_count
);
if
(
t2m_build_own
)
{
/*
* Sort the underlying members according to their
* canonical tags order. DER encoding mandates it.
*/
qsort
(
t2m
,
t2m_count
,
sizeof
(
specs
->
tag2el
[
0
]),
_t2e_cmp
);
qsort
(
t2m_build
,
t2m_count
,
sizeof
(
specs
->
tag2el
[
0
]),
_t2e_cmp
);
t2m
=
t2m_build
;
}
else
{
/*
* Tags are already sorted by the compiler.
*/
t2m
=
specs
->
tag2el
;
t2m_count
=
specs
->
tag2el_count
;
}
assert
(
t2m_count
==
td
->
elements_count
);
/*
* Encode the TLV for the sequence itself.
...
...
@@ -803,7 +806,7 @@ SET_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
asn_SET_specifics_t
*
specs
=
(
asn_SET_specifics_t
*
)
td
->
specifics
;
asn_enc_rval_t
er
;
int
xcan
=
(
flags
&
XER_F_CANONICAL
);
asn_TYPE_tag2member_t
*
t2m
=
specs
->
tag2el_cxer
;
const
asn_TYPE_tag2member_t
*
t2m
=
specs
->
tag2el_cxer
;
int
t2m_count
=
specs
->
tag2el_cxer_count
;
int
edx
;
...
...
skeletons/constr_SET.h
View file @
fb6344ef
...
...
@@ -12,7 +12,7 @@ extern "C" {
#endif
typedef
struct
asn_SET_specifics_s
{
typedef
const
struct
asn_SET_specifics_s
{
/*
* Target structure description.
*/
...
...
@@ -25,21 +25,21 @@ typedef struct asn_SET_specifics_s {
* Sometimes suitable for DER encoding (untagged CHOICE is present);
* if so, tag2el_count will be greater than td->elements_count.
*/
asn_TYPE_tag2member_t
*
tag2el
;
const
asn_TYPE_tag2member_t
*
tag2el
;
int
tag2el_count
;
/*
* Tags to members mapping table, second edition.
* Suitable for CANONICAL-XER encoding.
*/
asn_TYPE_tag2member_t
*
tag2el_cxer
;
const
asn_TYPE_tag2member_t
*
tag2el_cxer
;
int
tag2el_cxer_count
;
/*
* Extensions-related stuff.
*/
int
extensible
;
/* Whether SET is extensible */
unsigned
int
*
_mandatory_elements
;
/* Bitmask of mandatory ones */
const
unsigned
int
*
_mandatory_elements
;
/* Bitmask of mandatory ones */
}
asn_SET_specifics_t
;
/*
...
...
skeletons/constr_SET_OF.h
View file @
fb6344ef
...
...
@@ -11,7 +11,7 @@
extern
"C"
{
#endif
typedef
struct
asn_SET_OF_specifics_s
{
typedef
const
struct
asn_SET_OF_specifics_s
{
/*
* Target structure description.
*/
...
...
skeletons/constr_TYPE.h
View file @
fb6344ef
...
...
@@ -83,8 +83,8 @@ asn_outmost_tag_f asn_TYPE_outmost_tag;
* The definitive description of the destination language's structure.
*/
typedef
struct
asn_TYPE_descriptor_s
{
char
*
name
;
/* A name of the ASN.1 type. "" in some cases. */
char
*
xml_tag
;
/* Name used in XML tag */
c
onst
c
har
*
name
;
/* A name of the ASN.1 type. "" in some cases. */
c
onst
c
har
*
xml_tag
;
/* Name used in XML tag */
/*
* Generalized functions for dealing with the specific type.
...
...
@@ -108,10 +108,10 @@ typedef struct asn_TYPE_descriptor_s {
* Tags that are expected to occur.
*/
asn_outmost_tag_f
*
outmost_tag
;
/* <optional, internal> */
ber_tlv_tag_t
*
tags
;
/* Effective tags sequence for this type */
int
tags_count
;
/* Number of tags which are expected */
ber_tlv_tag_t
*
all_tags
;
/* Every tag for BER/containment */
int
all_tags_count
;
/* Number of tags */
const
ber_tlv_tag_t
*
tags
;
/* Effective tags sequence for this type */
int
tags_count
;
/* Number of tags which are expected */
const
ber_tlv_tag_t
*
all_tags
;
/* Every tag for BER/containment */
int
all_tags_count
;
/* Number of tags */
asn_per_constraints_t
*
per_constraints
;
/* PER compiled constraints */
...
...
@@ -125,7 +125,7 @@ typedef struct asn_TYPE_descriptor_s {
* Additional information describing the type, used by appropriate
* functions above.
*/
void
*
specifics
;
const
void
*
specifics
;
}
asn_TYPE_descriptor_t
;
/*
...
...
@@ -147,7 +147,7 @@ typedef struct asn_TYPE_member_s {
asn_constr_check_f
*
memb_constraints
;
/* Constraints validator */
asn_per_constraints_t
*
per_constraints
;
/* PER compiled constraints */
int
(
*
default_value
)(
int
setval
,
void
**
sptr
);
/* DEFAULT <value> */
char
*
name
;
/* ASN.1 identifier of the element */
c
onst
c
har
*
name
;
/* ASN.1 identifier of the element */
}
asn_TYPE_member_t
;
/*
...
...
skeletons/der_encoder.c
View file @
fb6344ef
...
...
@@ -80,8 +80,8 @@ der_write_tags(asn_TYPE_descriptor_t *sd,
ber_tlv_tag_t
tag
,
/* EXPLICIT or IMPLICIT tag */
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
ber_tlv_tag_t
*
tags
;
/* Copy of tags stream */
int
tags_count
;
/* Number of tags */
const
ber_tlv_tag_t
*
tags
;
/* Copy of tags stream */
int
tags_count
;
/* Number of tags */
size_t
overall_length
;
ssize_t
*
lens
;
int
i
;
...
...
@@ -102,8 +102,9 @@ der_write_tags(asn_TYPE_descriptor_t *sd,
* and initialize it appropriately.
*/
int
stag_offset
;
tags
=
(
ber_tlv_tag_t
*
)
alloca
((
sd
->
tags_count
+
1
)
*
sizeof
(
ber_tlv_tag_t
));
if
(
!
tags
)
{
/* Can fail on !x86 */
ber_tlv_tag_t
*
tags_buf
;
tags_buf
=
(
ber_tlv_tag_t
*
)
alloca
((
sd
->
tags_count
+
1
)
*
sizeof
(
ber_tlv_tag_t
));
if
(
!
tags_buf
)
{
/* Can fail on !x86 */
errno
=
ENOMEM
;
return
-
1
;
}
...
...
@@ -111,10 +112,11 @@ der_write_tags(asn_TYPE_descriptor_t *sd,
+
1
/* EXPLICIT or IMPLICIT tag is given */
-
((
tag_mode
==
-
1
)
&&
sd
->
tags_count
);
/* Copy tags over */
tags
[
0
]
=
tag
;
tags
_buf
[
0
]
=
tag
;
stag_offset
=
-
1
+
((
tag_mode
==
-
1
)
&&
sd
->
tags_count
);
for
(
i
=
1
;
i
<
tags_count
;
i
++
)
tags
[
i
]
=
sd
->
tags
[
i
+
stag_offset
];
tags_buf
[
i
]
=
sd
->
tags
[
i
+
stag_offset
];
tags
=
tags_buf
;
}
else
{
tags
=
sd
->
tags
;
tags_count
=
sd
->
tags_count
;
...
...
skeletons/tests/check-PER-INTEGER.c
View file @
fb6344ef
...
...
@@ -24,7 +24,7 @@ static void
check_per_encode_constrained
(
int
lineno
,
int
unsigned_
,
long
value
,
long
lbound
,
unsigned
long
ubound
,
int
bit_range
)
{
INTEGER_t
st
;
INTEGER_t
*
reconstructed_st
=
0
;
asn_INTEGER_specifics_t
specs
;
struct
asn_INTEGER_specifics_s
specs
;
asn_per_constraints_t
cts
;
asn_enc_rval_t
enc_rval
;
asn_dec_rval_t
dec_rval
;
...
...
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