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
814cca7d
Commit
814cca7d
authored
Dec 15, 2004
by
Lev Walkin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
C++ compatibility
parent
8484ed81
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
9 deletions
+10
-9
skeletons/OCTET_STRING.c
skeletons/OCTET_STRING.c
+6
-5
skeletons/asn-decoder-template.c
skeletons/asn-decoder-template.c
+2
-2
skeletons/der_encoder.c
skeletons/der_encoder.c
+2
-2
No files found.
skeletons/OCTET_STRING.c
View file @
814cca7d
...
@@ -135,7 +135,7 @@ OS__add_stack_el(struct _stack *st) {
...
@@ -135,7 +135,7 @@ OS__add_stack_el(struct _stack *st) {
nel
->
got
=
0
;
nel
->
got
=
0
;
/* Retain the nel->cont_level, it's correct. */
/* Retain the nel->cont_level, it's correct. */
}
else
{
}
else
{
(
void
*
)
nel
=
CALLOC
(
1
,
sizeof
(
struct
_stack_el
));
nel
=
(
struct
_stack_el
*
)
CALLOC
(
1
,
sizeof
(
struct
_stack_el
));
if
(
nel
==
NULL
)
if
(
nel
==
NULL
)
return
NULL
;
return
NULL
;
...
@@ -187,7 +187,8 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -187,7 +187,8 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
* Create the string if does not exist.
* Create the string if does not exist.
*/
*/
if
(
st
==
NULL
)
{
if
(
st
==
NULL
)
{
(
void
*
)
st
=
*
os_structure
=
CALLOC
(
1
,
specs
->
struct_size
);
*
os_structure
=
CALLOC
(
1
,
specs
->
struct_size
);
st
=
(
BIT_STRING_t
*
)
*
os_structure
;
if
(
st
==
NULL
)
if
(
st
==
NULL
)
RETURN
(
RC_FAIL
);
RETURN
(
RC_FAIL
);
}
}
...
@@ -212,7 +213,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -212,7 +213,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
*/
*/
ctx
->
ptr
=
_new_stack
();
ctx
->
ptr
=
_new_stack
();
if
(
ctx
->
ptr
)
{
if
(
ctx
->
ptr
)
{
(
void
*
)
stck
=
ctx
->
ptr
;
stck
=
(
struct
_stack
*
)
ctx
->
ptr
;
}
else
{
}
else
{
RETURN
(
RC_FAIL
);
RETURN
(
RC_FAIL
);
}
}
...
@@ -234,7 +235,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -234,7 +235,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
/*
/*
* Fill the stack with expectations.
* Fill the stack with expectations.
*/
*/
(
void
*
)
stck
=
ctx
->
ptr
;
stck
=
(
struct
_stack
*
)
ctx
->
ptr
;
sel
=
stck
->
cur_ptr
;
sel
=
stck
->
cur_ptr
;
do
{
do
{
ber_tlv_tag_t
tlv_tag
;
ber_tlv_tag_t
tlv_tag
;
...
@@ -409,7 +410,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
...
@@ -409,7 +410,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
NEXT_PHASE
(
ctx
);
NEXT_PHASE
(
ctx
);
/* Fall through */
/* Fall through */
case
2
:
case
2
:
(
void
*
)
stck
=
ctx
->
ptr
;
stck
=
(
struct
_stack
*
)
ctx
->
ptr
;
sel
=
stck
->
cur_ptr
;
sel
=
stck
->
cur_ptr
;
ASN_DEBUG
(
"Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d"
,
ASN_DEBUG
(
"Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d"
,
(
long
)
sel
->
left
,
(
long
)
size
,
(
long
)
sel
->
got
,
(
long
)
sel
->
left
,
(
long
)
size
,
(
long
)
sel
->
got
,
...
...
skeletons/asn-decoder-template.c
View file @
814cca7d
...
@@ -192,7 +192,7 @@ static void buf_extend(size_t bySize) {
...
@@ -192,7 +192,7 @@ static void buf_extend(size_t bySize) {
size_t
newsize
=
(
buf_size
<<
2
)
+
bySize
;
size_t
newsize
=
(
buf_size
<<
2
)
+
bySize
;
void
*
p
=
realloc
(
buffer
,
newsize
);
void
*
p
=
realloc
(
buffer
,
newsize
);
if
(
p
)
{
if
(
p
)
{
buffer
=
p
;
buffer
=
(
char
*
)
p
;
buf_size
=
newsize
;
buf_size
=
newsize
;
DEBUG
(
"
\t
Buffer reallocated to %ld"
,
(
long
)
newsize
);
DEBUG
(
"
\t
Buffer reallocated to %ld"
,
(
long
)
newsize
);
...
@@ -228,7 +228,7 @@ static void *data_decode_from_file(const char *fname, ssize_t suggested_bufsize)
...
@@ -228,7 +228,7 @@ static void *data_decode_from_file(const char *fname, ssize_t suggested_bufsize)
/* prepare the file buffer */
/* prepare the file buffer */
if
(
fbuf_size
!=
suggested_bufsize
)
{
if
(
fbuf_size
!=
suggested_bufsize
)
{
fbuf
=
realloc
(
fbuf
,
suggested_bufsize
);
fbuf
=
(
char
*
)
realloc
(
fbuf
,
suggested_bufsize
);
if
(
!
fbuf
)
{
if
(
!
fbuf
)
{
perror
(
"realloc()"
);
perror
(
"realloc()"
);
exit
(
EX_OSERR
);
exit
(
EX_OSERR
);
...
...
skeletons/der_encoder.c
View file @
814cca7d
...
@@ -36,7 +36,7 @@ typedef struct enc_to_buf_arg {
...
@@ -36,7 +36,7 @@ typedef struct enc_to_buf_arg {
size_t
left
;
size_t
left
;
}
enc_to_buf_arg
;
}
enc_to_buf_arg
;
static
int
encode_to_buffer_cb
(
const
void
*
buffer
,
size_t
size
,
void
*
key
)
{
static
int
encode_to_buffer_cb
(
const
void
*
buffer
,
size_t
size
,
void
*
key
)
{
enc_to_buf_arg
*
arg
=
key
;
enc_to_buf_arg
*
arg
=
(
enc_to_buf_arg
*
)
key
;
if
(
arg
->
left
<
size
)
if
(
arg
->
left
<
size
)
return
-
1
;
/* Data exceeds the available buffer size */
return
-
1
;
/* Data exceeds the available buffer size */
...
@@ -64,7 +64,7 @@ der_encode_to_buffer(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr,
...
@@ -64,7 +64,7 @@ der_encode_to_buffer(asn_TYPE_descriptor_t *type_descriptor, void *struct_ptr,
struct_ptr
,
/* Pointer to the destination structure */
struct_ptr
,
/* Pointer to the destination structure */
0
,
0
,
encode_to_buffer_cb
,
&
arg
);
0
,
0
,
encode_to_buffer_cb
,
&
arg
);
if
(
ec
.
encoded
!=
-
1
)
{
if
(
ec
.
encoded
!=
-
1
)
{
assert
(
ec
.
encoded
==
(
*
buffer_size
-
arg
.
left
));
assert
(
ec
.
encoded
==
(
ssize_t
)(
*
buffer_size
-
arg
.
left
));
/* Return the encoded contents size */
/* Return the encoded contents size */
*
buffer_size
=
ec
.
encoded
;
*
buffer_size
=
ec
.
encoded
;
}
}
...
...
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