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
8946c21d
Commit
8946c21d
authored
Mar 19, 2018
by
Uri Blumenthal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add initializers to address valgrind error reports
parent
4a668cbf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
56 deletions
+56
-56
skeletons/INTEGER.c
skeletons/INTEGER.c
+17
-17
skeletons/constr_CHOICE.c
skeletons/constr_CHOICE.c
+27
-27
skeletons/per_encoder.c
skeletons/per_encoder.c
+12
-12
No files found.
skeletons/INTEGER.c
View file @
8946c21d
...
@@ -64,8 +64,8 @@ INTEGER_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
...
@@ -64,8 +64,8 @@ INTEGER_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
int
tag_mode
,
ber_tlv_tag_t
tag
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
void
*
app_key
)
{
const
INTEGER_t
*
st
=
(
const
INTEGER_t
*
)
sptr
;
const
INTEGER_t
*
st
=
(
const
INTEGER_t
*
)
sptr
;
asn_enc_rval_t
rval
;
asn_enc_rval_t
rval
=
{
0
}
;
INTEGER_t
effective_integer
;
INTEGER_t
effective_integer
=
{
0
}
;
ASN_DEBUG
(
"%s %s as INTEGER (tm=%d)"
,
ASN_DEBUG
(
"%s %s as INTEGER (tm=%d)"
,
cb
?
"Encoding"
:
"Estimating"
,
td
->
name
,
tag_mode
);
cb
?
"Encoding"
:
"Estimating"
,
td
->
name
,
tag_mode
);
...
@@ -77,7 +77,7 @@ INTEGER_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
...
@@ -77,7 +77,7 @@ INTEGER_encode_der(const asn_TYPE_descriptor_t *td, const void *sptr,
if
(
st
->
buf
)
{
if
(
st
->
buf
)
{
uint8_t
*
buf
=
st
->
buf
;
uint8_t
*
buf
=
st
->
buf
;
uint8_t
*
end1
=
buf
+
st
->
size
-
1
;
uint8_t
*
end1
=
buf
+
st
->
size
-
1
;
int
shift
;
int
shift
=
0
;
/* Compute the number of superfluous leading bytes */
/* Compute the number of superfluous leading bytes */
for
(;
buf
<
end1
;
buf
++
)
{
for
(;
buf
<
end1
;
buf
++
)
{
...
@@ -135,10 +135,10 @@ INTEGER__dump(const asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_cons
...
@@ -135,10 +135,10 @@ INTEGER__dump(const asn_TYPE_descriptor_t *td, const INTEGER_t *st, asn_app_cons
char
scratch
[
32
];
char
scratch
[
32
];
uint8_t
*
buf
=
st
->
buf
;
uint8_t
*
buf
=
st
->
buf
;
uint8_t
*
buf_end
=
st
->
buf
+
st
->
size
;
uint8_t
*
buf_end
=
st
->
buf
+
st
->
size
;
intmax_t
value
;
intmax_t
value
=
0
;
ssize_t
wrote
=
0
;
ssize_t
wrote
=
0
;
char
*
p
;
char
*
p
=
NULL
;
int
ret
;
int
ret
=
-
1
;
if
(
specs
&&
specs
->
field_unsigned
)
if
(
specs
&&
specs
->
field_unsigned
)
ret
=
asn_INTEGER2umax
(
st
,
(
uintmax_t
*
)
&
value
);
ret
=
asn_INTEGER2umax
(
st
,
(
uintmax_t
*
)
&
value
);
...
@@ -209,7 +209,7 @@ int
...
@@ -209,7 +209,7 @@ int
INTEGER_print
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
INTEGER_print
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
INTEGER_t
*
st
=
(
const
INTEGER_t
*
)
sptr
;
const
INTEGER_t
*
st
=
(
const
INTEGER_t
*
)
sptr
;
ssize_t
ret
;
ssize_t
ret
=
-
1
;
(
void
)
ilevel
;
(
void
)
ilevel
;
...
...
skeletons/constr_CHOICE.c
View file @
8946c21d
...
@@ -561,9 +561,9 @@ CHOICE_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
...
@@ -561,9 +561,9 @@ CHOICE_decode_xer(const asn_codec_ctx_t *opt_codec_ctx,
void
*
st
=
*
struct_ptr
;
/* Target structure. */
void
*
st
=
*
struct_ptr
;
/* Target structure. */
asn_struct_ctx_t
*
ctx
;
/* Decoder context */
asn_struct_ctx_t
*
ctx
;
/* Decoder context */
asn_dec_rval_t
rval
;
/* Return value of a decoder */
asn_dec_rval_t
rval
=
{
0
}
;
/* Return value of a decoder */
ssize_t
consumed_myself
=
0
;
/* Consumed bytes from ptr */
ssize_t
consumed_myself
=
0
;
/* Consumed bytes from ptr */
size_t
edx
;
/* Element index */
size_t
edx
=
0
;
/* Element index */
/*
/*
* Create the target structure if it is not present already.
* Create the target structure if it is not present already.
...
@@ -781,8 +781,8 @@ CHOICE_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
...
@@ -781,8 +781,8 @@ CHOICE_encode_xer(const asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
void
*
app_key
)
{
void
*
app_key
)
{
const
asn_CHOICE_specifics_t
*
specs
=
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
asn_enc_rval_t
er
;
asn_enc_rval_t
er
=
{
0
}
;
unsigned
present
;
unsigned
present
=
0
;
if
(
!
sptr
)
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
ASN__ENCODE_FAILED
;
...
@@ -836,13 +836,13 @@ CHOICE_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
...
@@ -836,13 +836,13 @@ CHOICE_decode_uper(const asn_codec_ctx_t *opt_codec_ctx,
asn_per_data_t
*
pd
)
{
asn_per_data_t
*
pd
)
{
const
asn_CHOICE_specifics_t
*
specs
=
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
asn_dec_rval_t
rv
;
asn_dec_rval_t
rv
=
{
0
}
;
const
asn_per_constraint_t
*
ct
;
const
asn_per_constraint_t
*
ct
;
asn_TYPE_member_t
*
elm
;
/* CHOICE's element */
asn_TYPE_member_t
*
elm
=
{
0
}
;
/* CHOICE's element */
void
*
memb_ptr
;
void
*
memb_ptr
=
NULL
;
void
**
memb_ptr2
;
void
**
memb_ptr2
=
NULL
;
void
*
st
=
*
sptr
;
void
*
st
=
*
sptr
;
int
value
;
int
value
=
0
;
if
(
ASN__STACK_OVERFLOW_CHECK
(
opt_codec_ctx
))
if
(
ASN__STACK_OVERFLOW_CHECK
(
opt_codec_ctx
))
ASN__DECODE_FAILED
;
ASN__DECODE_FAILED
;
...
@@ -921,11 +921,11 @@ CHOICE_encode_uper(const asn_TYPE_descriptor_t *td,
...
@@ -921,11 +921,11 @@ CHOICE_encode_uper(const asn_TYPE_descriptor_t *td,
const
asn_per_constraints_t
*
constraints
,
const
void
*
sptr
,
const
asn_per_constraints_t
*
constraints
,
const
void
*
sptr
,
asn_per_outp_t
*
po
)
{
asn_per_outp_t
*
po
)
{
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
asn_TYPE_member_t
*
elm
;
/* CHOICE's element */
asn_TYPE_member_t
*
elm
=
{
0
}
;
/* CHOICE's element */
const
asn_per_constraint_t
*
ct
;
const
asn_per_constraint_t
*
ct
;
const
void
*
memb_ptr
;
const
void
*
memb_ptr
=
NULL
;
unsigned
present
;
unsigned
present
=
0
;
int
present_enc
;
int
present_enc
=
0
;
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
...
@@ -1015,13 +1015,13 @@ CHOICE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
...
@@ -1015,13 +1015,13 @@ CHOICE_decode_aper(const asn_codec_ctx_t *opt_codec_ctx,
const
asn_TYPE_descriptor_t
*
td
,
const
asn_TYPE_descriptor_t
*
td
,
const
asn_per_constraints_t
*
constraints
,
void
**
sptr
,
asn_per_data_t
*
pd
)
{
const
asn_per_constraints_t
*
constraints
,
void
**
sptr
,
asn_per_data_t
*
pd
)
{
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
asn_dec_rval_t
rv
;
asn_dec_rval_t
rv
=
{
0
}
;
const
asn_per_constraint_t
*
ct
;
const
asn_per_constraint_t
*
ct
;
asn_TYPE_member_t
*
elm
;
/* CHOICE's element */
asn_TYPE_member_t
*
elm
=
{
0
}
;
/* CHOICE's element */
void
*
memb_ptr
;
void
*
memb_ptr
=
NULL
;
void
**
memb_ptr2
;
void
**
memb_ptr2
=
NULL
;
void
*
st
=
*
sptr
;
void
*
st
=
*
sptr
;
int
value
;
int
value
=
0
;
if
(
ASN__STACK_OVERFLOW_CHECK
(
opt_codec_ctx
))
if
(
ASN__STACK_OVERFLOW_CHECK
(
opt_codec_ctx
))
ASN__DECODE_FAILED
;
ASN__DECODE_FAILED
;
...
@@ -1098,10 +1098,10 @@ CHOICE_encode_aper(const asn_TYPE_descriptor_t *td,
...
@@ -1098,10 +1098,10 @@ CHOICE_encode_aper(const asn_TYPE_descriptor_t *td,
const
asn_per_constraints_t
*
constraints
,
const
asn_per_constraints_t
*
constraints
,
const
void
*
sptr
,
asn_per_outp_t
*
po
)
{
const
void
*
sptr
,
asn_per_outp_t
*
po
)
{
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
const
asn_TYPE_member_t
*
elm
;
/* CHOICE's element */
const
asn_TYPE_member_t
*
elm
=
{
0
}
;
/* CHOICE's element */
const
asn_per_constraint_t
*
ct
;
const
asn_per_constraint_t
*
ct
;
const
void
*
memb_ptr
;
const
void
*
memb_ptr
=
NULL
;
int
present
;
int
present
=
0
;
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
if
(
!
sptr
)
ASN__ENCODE_FAILED
;
...
@@ -1180,7 +1180,7 @@ int
...
@@ -1180,7 +1180,7 @@ int
CHOICE_print
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
CHOICE_print
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
sptr
,
int
ilevel
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
unsigned
present
;
unsigned
present
=
0
;
if
(
!
sptr
)
return
(
cb
(
"<absent>"
,
8
,
app_key
)
<
0
)
?
-
1
:
0
;
if
(
!
sptr
)
return
(
cb
(
"<absent>"
,
8
,
app_key
)
<
0
)
?
-
1
:
0
;
...
@@ -1222,7 +1222,7 @@ CHOICE_free(const asn_TYPE_descriptor_t *td, void *ptr,
...
@@ -1222,7 +1222,7 @@ CHOICE_free(const asn_TYPE_descriptor_t *td, void *ptr,
enum
asn_struct_free_method
method
)
{
enum
asn_struct_free_method
method
)
{
const
asn_CHOICE_specifics_t
*
specs
=
const
asn_CHOICE_specifics_t
*
specs
=
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
(
const
asn_CHOICE_specifics_t
*
)
td
->
specifics
;
unsigned
present
;
unsigned
present
=
0
;
if
(
!
td
||
!
ptr
)
if
(
!
td
||
!
ptr
)
return
;
return
;
...
@@ -1276,8 +1276,8 @@ CHOICE_free(const asn_TYPE_descriptor_t *td, void *ptr,
...
@@ -1276,8 +1276,8 @@ CHOICE_free(const asn_TYPE_descriptor_t *td, void *ptr,
static
unsigned
static
unsigned
_fetch_present_idx
(
const
void
*
struct_ptr
,
unsigned
pres_offset
,
_fetch_present_idx
(
const
void
*
struct_ptr
,
unsigned
pres_offset
,
unsigned
pres_size
)
{
unsigned
pres_size
)
{
const
void
*
present_ptr
;
const
void
*
present_ptr
=
NULL
;
unsigned
present
;
unsigned
present
=
0
;
present_ptr
=
((
const
char
*
)
struct_ptr
)
+
pres_offset
;
present_ptr
=
((
const
char
*
)
struct_ptr
)
+
pres_offset
;
...
@@ -1354,8 +1354,8 @@ _get_member_ptr(const asn_TYPE_descriptor_t *td, const void *sptr,
...
@@ -1354,8 +1354,8 @@ _get_member_ptr(const asn_TYPE_descriptor_t *td, const void *sptr,
int
int
CHOICE_compare
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
aptr
,
const
void
*
bptr
)
{
CHOICE_compare
(
const
asn_TYPE_descriptor_t
*
td
,
const
void
*
aptr
,
const
void
*
bptr
)
{
asn_TYPE_member_t
*
aelm
;
asn_TYPE_member_t
*
aelm
=
NULL
;
asn_TYPE_member_t
*
belm
;
asn_TYPE_member_t
*
belm
=
NULL
;
unsigned
apresent
=
0
;
unsigned
apresent
=
0
;
unsigned
bpresent
=
0
;
unsigned
bpresent
=
0
;
const
void
*
amember
=
_get_member_ptr
(
td
,
aptr
,
&
aelm
,
&
apresent
);
const
void
*
amember
=
_get_member_ptr
(
td
,
aptr
,
&
aelm
,
&
apresent
);
...
...
skeletons/per_encoder.c
View file @
8946c21d
...
@@ -16,8 +16,8 @@ asn_enc_rval_t
...
@@ -16,8 +16,8 @@ asn_enc_rval_t
uper_encode
(
const
asn_TYPE_descriptor_t
*
td
,
uper_encode
(
const
asn_TYPE_descriptor_t
*
td
,
const
asn_per_constraints_t
*
constraints
,
const
void
*
sptr
,
const
asn_per_constraints_t
*
constraints
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_per_outp_t
po
;
asn_per_outp_t
po
=
{
0
}
;
asn_enc_rval_t
er
;
asn_enc_rval_t
er
=
{
0
}
;
/*
/*
* Invoke type-specific encoder.
* Invoke type-specific encoder.
...
@@ -71,7 +71,7 @@ asn_enc_rval_t
...
@@ -71,7 +71,7 @@ asn_enc_rval_t
uper_encode_to_buffer
(
const
asn_TYPE_descriptor_t
*
td
,
uper_encode_to_buffer
(
const
asn_TYPE_descriptor_t
*
td
,
const
asn_per_constraints_t
*
constraints
,
const
asn_per_constraints_t
*
constraints
,
const
void
*
sptr
,
void
*
buffer
,
size_t
buffer_size
)
{
const
void
*
sptr
,
void
*
buffer
,
size_t
buffer_size
)
{
enc_to_buf_arg
key
;
enc_to_buf_arg
key
=
{
0
}
;
key
.
buffer
=
buffer
;
key
.
buffer
=
buffer
;
key
.
left
=
buffer_size
;
key
.
left
=
buffer_size
;
...
@@ -114,8 +114,8 @@ ssize_t
...
@@ -114,8 +114,8 @@ ssize_t
uper_encode_to_new_buffer
(
const
asn_TYPE_descriptor_t
*
td
,
uper_encode_to_new_buffer
(
const
asn_TYPE_descriptor_t
*
td
,
const
asn_per_constraints_t
*
constraints
,
const
asn_per_constraints_t
*
constraints
,
const
void
*
sptr
,
void
**
buffer_r
)
{
const
void
*
sptr
,
void
**
buffer_r
)
{
asn_enc_rval_t
er
;
asn_enc_rval_t
er
=
{
0
}
;
enc_dyn_arg
key
;
enc_dyn_arg
key
=
{
0
}
;
memset
(
&
key
,
0
,
sizeof
(
key
));
memset
(
&
key
,
0
,
sizeof
(
key
));
...
@@ -148,7 +148,7 @@ uper_encode_to_new_buffer(const asn_TYPE_descriptor_t *td,
...
@@ -148,7 +148,7 @@ uper_encode_to_new_buffer(const asn_TYPE_descriptor_t *td,
/* Flush partially filled buffer */
/* Flush partially filled buffer */
static
int
static
int
_uper_encode_flush_outp
(
asn_per_outp_t
*
po
)
{
_uper_encode_flush_outp
(
asn_per_outp_t
*
po
)
{
uint8_t
*
buf
;
uint8_t
*
buf
=
{
0
}
;
if
(
po
->
nboff
==
0
&&
po
->
buffer
==
po
->
tmpspace
)
if
(
po
->
nboff
==
0
&&
po
->
buffer
==
po
->
tmpspace
)
return
0
;
return
0
;
...
@@ -167,7 +167,7 @@ asn_enc_rval_t
...
@@ -167,7 +167,7 @@ asn_enc_rval_t
aper_encode_to_buffer
(
const
asn_TYPE_descriptor_t
*
td
,
aper_encode_to_buffer
(
const
asn_TYPE_descriptor_t
*
td
,
const
asn_per_constraints_t
*
constraints
,
const
asn_per_constraints_t
*
constraints
,
const
void
*
sptr
,
void
*
buffer
,
size_t
buffer_size
)
{
const
void
*
sptr
,
void
*
buffer
,
size_t
buffer_size
)
{
enc_to_buf_arg
key
;
enc_to_buf_arg
key
=
{
0
}
;
key
.
buffer
=
buffer
;
key
.
buffer
=
buffer
;
key
.
left
=
buffer_size
;
key
.
left
=
buffer_size
;
...
@@ -181,8 +181,8 @@ ssize_t
...
@@ -181,8 +181,8 @@ ssize_t
aper_encode_to_new_buffer
(
const
asn_TYPE_descriptor_t
*
td
,
aper_encode_to_new_buffer
(
const
asn_TYPE_descriptor_t
*
td
,
const
asn_per_constraints_t
*
constraints
,
const
asn_per_constraints_t
*
constraints
,
const
void
*
sptr
,
void
**
buffer_r
)
{
const
void
*
sptr
,
void
**
buffer_r
)
{
asn_enc_rval_t
er
;
asn_enc_rval_t
er
=
{
0
}
;
enc_dyn_arg
key
;
enc_dyn_arg
key
=
{
0
}
;
memset
(
&
key
,
0
,
sizeof
(
key
));
memset
(
&
key
,
0
,
sizeof
(
key
));
...
@@ -210,7 +210,7 @@ aper_encode_to_new_buffer(const asn_TYPE_descriptor_t *td,
...
@@ -210,7 +210,7 @@ aper_encode_to_new_buffer(const asn_TYPE_descriptor_t *td,
static
int
static
int
_aper_encode_flush_outp
(
asn_per_outp_t
*
po
)
{
_aper_encode_flush_outp
(
asn_per_outp_t
*
po
)
{
uint8_t
*
buf
;
uint8_t
*
buf
=
NULL
;
if
(
po
->
nboff
==
0
&&
po
->
buffer
==
po
->
tmpspace
)
if
(
po
->
nboff
==
0
&&
po
->
buffer
==
po
->
tmpspace
)
return
0
;
return
0
;
...
@@ -232,8 +232,8 @@ asn_enc_rval_t
...
@@ -232,8 +232,8 @@ asn_enc_rval_t
aper_encode
(
const
asn_TYPE_descriptor_t
*
td
,
aper_encode
(
const
asn_TYPE_descriptor_t
*
td
,
const
asn_per_constraints_t
*
constraints
,
const
asn_per_constraints_t
*
constraints
,
const
void
*
sptr
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
const
void
*
sptr
,
asn_app_consume_bytes_f
*
cb
,
void
*
app_key
)
{
asn_per_outp_t
po
;
asn_per_outp_t
po
=
{
0
}
;
asn_enc_rval_t
er
;
asn_enc_rval_t
er
=
{
0
}
;
/*
/*
* Invoke type-specific encoder.
* Invoke type-specific encoder.
...
...
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