C++ compatibility

This commit is contained in:
Lev Walkin 2004-12-15 23:23:53 +00:00
parent 8484ed81cd
commit 814cca7d24
3 changed files with 10 additions and 9 deletions

View File

@ -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,

View File

@ -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);

View File

@ -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;
}