aboutsummaryrefslogtreecommitdiffstats
path: root/skeletons
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-12-15 23:23:53 +0000
committerLev Walkin <vlm@lionet.info>2004-12-15 23:23:53 +0000
commit814cca7d24fe33f309421477bc132884f98032dd (patch)
tree7f49d62c5beae5913a0e42b315c26d32b04065c0 /skeletons
parent8484ed81cd9de9fd3209c2d84a1c492d818f444b (diff)
C++ compatibility
Diffstat (limited to 'skeletons')
-rw-r--r--skeletons/OCTET_STRING.c11
-rw-r--r--skeletons/asn-decoder-template.c4
-rw-r--r--skeletons/der_encoder.c4
3 files changed, 10 insertions, 9 deletions
diff --git a/skeletons/OCTET_STRING.c b/skeletons/OCTET_STRING.c
index 5034e426..d1b08741 100644
--- a/skeletons/OCTET_STRING.c
+++ b/skeletons/OCTET_STRING.c
@@ -135,7 +135,7 @@ OS__add_stack_el(struct _stack *st) {
nel->got = 0;
/* Retain the nel->cont_level, it's correct. */
} else {
- (void *)nel = CALLOC(1, sizeof(struct _stack_el));
+ nel = (struct _stack_el *)CALLOC(1, sizeof(struct _stack_el));
if(nel == NULL)
return NULL;
@@ -187,7 +187,8 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
* Create the string if does not exist.
*/
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)
RETURN(RC_FAIL);
}
@@ -212,7 +213,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
*/
ctx->ptr = _new_stack();
if(ctx->ptr) {
- (void *)stck = ctx->ptr;
+ stck = (struct _stack *)ctx->ptr;
} else {
RETURN(RC_FAIL);
}
@@ -234,7 +235,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
/*
* Fill the stack with expectations.
*/
- (void *)stck = ctx->ptr;
+ stck = (struct _stack *)ctx->ptr;
sel = stck->cur_ptr;
do {
ber_tlv_tag_t tlv_tag;
@@ -409,7 +410,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
NEXT_PHASE(ctx);
/* Fall through */
case 2:
- (void *)stck = ctx->ptr;
+ stck = (struct _stack *)ctx->ptr;
sel = stck->cur_ptr;
ASN_DEBUG("Phase 2: Need %ld bytes, size=%ld, alrg=%ld, wn=%d",
(long)sel->left, (long)size, (long)sel->got,
diff --git a/skeletons/asn-decoder-template.c b/skeletons/asn-decoder-template.c
index aa893fbb..ba719e56 100644
--- a/skeletons/asn-decoder-template.c
+++ b/skeletons/asn-decoder-template.c
@@ -192,7 +192,7 @@ static void buf_extend(size_t bySize) {
size_t newsize = (buf_size << 2) + bySize;
void *p = realloc(buffer, newsize);
if(p) {
- buffer = p;
+ buffer = (char *)p;
buf_size = newsize;
DEBUG("\tBuffer reallocated to %ld", (long)newsize);
@@ -228,7 +228,7 @@ static void *data_decode_from_file(const char *fname, ssize_t suggested_bufsize)
/* prepare the file buffer */
if(fbuf_size != suggested_bufsize) {
- fbuf = realloc(fbuf, suggested_bufsize);
+ fbuf = (char *)realloc(fbuf, suggested_bufsize);
if(!fbuf) {
perror("realloc()");
exit(EX_OSERR);
diff --git a/skeletons/der_encoder.c b/skeletons/der_encoder.c
index b2763c7c..62ad757e 100644
--- a/skeletons/der_encoder.c
+++ b/skeletons/der_encoder.c
@@ -36,7 +36,7 @@ typedef struct enc_to_buf_arg {
size_t left;
} enc_to_buf_arg;
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)
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,
struct_ptr, /* Pointer to the destination structure */
0, 0, encode_to_buffer_cb, &arg);
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 */
*buffer_size = ec.encoded;
}