Commit c2346578 authored by Lev Walkin's avatar Lev Walkin
Browse files

C++ compatibility

parent 7a5e3020
......@@ -32,7 +32,7 @@ asn1_TYPE_descriptor_t asn1_DEF_BIT_STRING = {
int
BIT_STRING_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
const BIT_STRING_t *st = sptr;
const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
if(st && st->buf) {
if(st->size) {
......@@ -61,7 +61,7 @@ BIT_STRING_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
static const char *h2c = "0123456789ABCDEF";
char scratch[64];
const BIT_STRING_t *st = sptr;
const BIT_STRING_t *st = (const BIT_STRING_t *)sptr;
uint8_t *buf;
uint8_t *end;
char *p = scratch;
......
......@@ -32,7 +32,7 @@ asn1_TYPE_descriptor_t asn1_DEF_BMPString = {
int
BMPString_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
const BMPString_t *st = sptr;
const BMPString_t *st = (const BMPString_t *)sptr;
uint16_t *wchar;
uint16_t *wend;
char scratch[128]; /* Scratchpad buffer */
......
......@@ -32,14 +32,14 @@ ber_dec_rval_t
BOOLEAN_decode_ber(asn1_TYPE_descriptor_t *td,
void **bool_structure, void *buf_ptr, size_t size,
int tag_mode) {
BOOLEAN_t *st = *bool_structure;
BOOLEAN_t *st = (BOOLEAN_t *)*bool_structure;
ber_dec_rval_t rval;
ber_dec_ctx_t ctx = { 0, 0, 0, 0 };
ber_tlv_len_t length;
ber_tlv_len_t lidx;
if(st == NULL) {
st = *bool_structure = CALLOC(1, sizeof(*st));
(void *)st = *bool_structure = CALLOC(1, sizeof(*st));
if(st == NULL) {
rval.code = RC_FAIL;
rval.consumed = 0;
......@@ -96,7 +96,7 @@ BOOLEAN_encode_der(asn1_TYPE_descriptor_t *td, void *sptr,
int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) {
der_enc_rval_t erval;
BOOLEAN_t *st = sptr;
BOOLEAN_t *st = (BOOLEAN_t *)sptr;
erval.encoded = der_write_tags(td, 1, tag_mode, tag, cb, app_key);
if(erval.encoded == -1) {
......@@ -127,7 +127,7 @@ BOOLEAN_encode_der(asn1_TYPE_descriptor_t *td, void *sptr,
int
BOOLEAN_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
const BOOLEAN_t *st = sptr;
const BOOLEAN_t *st = (const BOOLEAN_t *)sptr;
(void)td; /* Unused argument */
(void)ilevel; /* Unused argument */
......
......@@ -49,7 +49,7 @@ asn1_TYPE_descriptor_t asn1_DEF_GeneralizedTime = {
int
GeneralizedTime_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
const GeneralizedTime_t *st = sptr;
const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr;
time_t tloc;
errno = EPERM; /* Just an unlikely error code */
......@@ -67,7 +67,7 @@ der_enc_rval_t
GeneralizedTime_encode_der(asn1_TYPE_descriptor_t *td, void *ptr,
int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) {
GeneralizedTime_t *st = ptr;
GeneralizedTime_t *st = (GeneralizedTime_t *)ptr;
der_enc_rval_t erval;
/* If not canonical DER, re-encode into canonical DER. */
......@@ -107,7 +107,7 @@ GeneralizedTime_encode_der(asn1_TYPE_descriptor_t *td, void *ptr,
int
GeneralizedTime_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
const GeneralizedTime_t *st = sptr;
const GeneralizedTime_t *st = (const GeneralizedTime_t *)sptr;
(void)td; /* Unused argument */
(void)ilevel; /* Unused argument */
......@@ -390,7 +390,7 @@ asn_time2GT(GeneralizedTime_t *opt_gt, const struct tm *tm, int force_gmt) {
}
/* Pre-allocate a buffer of sufficient yet small length */
buf = MALLOC(buf_size);
(void *)buf = MALLOC(buf_size);
if(!buf) return 0;
gmtoff = GMTOFF(*tm);
......@@ -433,7 +433,7 @@ asn_time2GT(GeneralizedTime_t *opt_gt, const struct tm *tm, int force_gmt) {
if(opt_gt->buf)
FREEMEM(opt_gt->buf);
} else {
opt_gt = CALLOC(1, sizeof *opt_gt);
(void *)opt_gt = CALLOC(1, sizeof *opt_gt);
if(!opt_gt) { free(buf); return 0; }
}
......
......@@ -29,7 +29,7 @@ asn1_TYPE_descriptor_t asn1_DEF_IA5String = {
int
IA5String_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
const IA5String_t *st = sptr;
const IA5String_t *st = (const IA5String_t *)sptr;
if(st && st->buf) {
uint8_t *buf = st->buf;
......
......@@ -33,7 +33,7 @@ asn1_TYPE_descriptor_t asn1_DEF_INTEGER = {
ber_dec_rval_t
INTEGER_decode_ber(asn1_TYPE_descriptor_t *td,
void **int_structure, void *buf_ptr, size_t size, int tag_mode) {
INTEGER_t *st = *int_structure;
INTEGER_t *st = (INTEGER_t *)*int_structure;
ber_dec_rval_t rval;
ber_dec_ctx_t ctx = { 0, 0, 0, 0 };
ber_tlv_len_t length;
......@@ -42,7 +42,7 @@ INTEGER_decode_ber(asn1_TYPE_descriptor_t *td,
* If the structure is not there, allocate it.
*/
if(st == NULL) {
st = *int_structure = CALLOC(1, sizeof(*st));
(void *)st = *int_structure = CALLOC(1, sizeof(*st));
if(st == NULL) {
rval.code = RC_FAIL;
rval.consumed = 0;
......@@ -74,7 +74,7 @@ INTEGER_decode_ber(asn1_TYPE_descriptor_t *td,
return rval;
}
st->buf = MALLOC(length);
st->buf = (uint8_t *)MALLOC(length);
if(st->buf) {
st->size = length;
} else {
......@@ -103,7 +103,7 @@ INTEGER_encode_der(asn1_TYPE_descriptor_t *sd, void *ptr,
int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) {
der_enc_rval_t erval;
INTEGER_t *st = ptr;
INTEGER_t *st = (INTEGER_t *)ptr;
ASN_DEBUG("%s %s as INTEGER (tm=%d)",
cb?"Encoding":"Estimating", sd->name, tag_mode);
......@@ -187,7 +187,7 @@ int
INTEGER_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
char scratch[32]; /* Enough for 64-bit integer */
const INTEGER_t *st = sptr;
const INTEGER_t *st = (const INTEGER_t *)sptr;
uint8_t *buf = st->buf;
uint8_t *buf_end = st->buf + st->size;
signed long accum;
......@@ -249,7 +249,7 @@ INTEGER_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
void
INTEGER_free(asn1_TYPE_descriptor_t *td, void *ptr, int contents_only) {
INTEGER_t *st = ptr;
INTEGER_t *st = (INTEGER_t *)ptr;
if(!td || !st)
return;
......
......@@ -40,7 +40,7 @@ asn1_TYPE_descriptor_t asn1_DEF_NativeInteger = {
ber_dec_rval_t
NativeInteger_decode_ber(asn1_TYPE_descriptor_t *td,
void **int_ptr, void *buf_ptr, size_t size, int tag_mode) {
int *Int = *int_ptr;
int *Int = (int *)*int_ptr;
ber_dec_rval_t rval;
ber_dec_ctx_t ctx = { 0, 0, 0, 0 };
ber_tlv_len_t length;
......@@ -49,7 +49,7 @@ NativeInteger_decode_ber(asn1_TYPE_descriptor_t *td,
* If the structure is not there, allocate it.
*/
if(Int == NULL) {
Int = *int_ptr = CALLOC(1, sizeof(*Int));
(void *)Int = *int_ptr = CALLOC(1, sizeof(*Int));
if(Int == NULL) {
rval.code = RC_FAIL;
rval.consumed = 0;
......@@ -89,7 +89,7 @@ NativeInteger_decode_ber(asn1_TYPE_descriptor_t *td,
{
INTEGER_t tmp;
long l;
tmp.buf = buf_ptr;
tmp.buf = (uint8_t *)buf_ptr;
tmp.size = length;
if(asn1_INTEGER2long(&tmp, &l)) {
......@@ -165,7 +165,7 @@ NativeInteger_encode_der(asn1_TYPE_descriptor_t *sd, void *ptr,
int
NativeInteger_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
const int *Int = sptr;
const int *Int = (const int *)sptr;
char scratch[32]; /* Enough for 64-bit int */
int ret;
......
......@@ -29,7 +29,7 @@ asn1_TYPE_descriptor_t asn1_DEF_NumericString = {
int
NumericString_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
const NumericString_t *st = sptr;
const NumericString_t *st = (const NumericString_t *)sptr;
if(st && st->buf) {
uint8_t *buf = st->buf;
......
......@@ -38,7 +38,7 @@ OBJECT_IDENTIFIER_encode_der(asn1_TYPE_descriptor_t *sd, void *ptr,
int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) {
der_enc_rval_t erval;
OBJECT_IDENTIFIER_t *st = ptr;
OBJECT_IDENTIFIER_t *st = (OBJECT_IDENTIFIER_t *)ptr;
ASN_DEBUG("%s %s as OBJECT IDENTIFIER (tm=%d)",
cb?"Encoding":"Estimating", sd->name, tag_mode);
......@@ -75,7 +75,7 @@ OBJECT_IDENTIFIER_encode_der(asn1_TYPE_descriptor_t *sd, void *ptr,
int
OBJECT_IDENTIFIER_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
const OBJECT_IDENTIFIER_t *st = sptr;
const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
if(st && st->buf) {
if(st->size < 1) {
......@@ -231,7 +231,7 @@ OBJECT_IDENTIFIER_print_arc(uint8_t *arcbuf, int arclen, int add,
int
OBJECT_IDENTIFIER_print(asn1_TYPE_descriptor_t *td, const void *sptr,
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
const OBJECT_IDENTIFIER_t *st = sptr;
const OBJECT_IDENTIFIER_t *st = (const OBJECT_IDENTIFIER_t *)sptr;
int startn;
int add = 0;
int i;
......@@ -372,7 +372,7 @@ OBJECT_IDENTIFIER_set_single_arc(uint8_t *arcbuf, void *arcval, unsigned int arc
if(isLittleEndian && !prepared_order) {
uint8_t *a = (unsigned char *)arcval + arcval_size - 1;
uint8_t *aend = arcval;
uint8_t *aend = (uint8_t *)arcval;
uint8_t *msb = buffer + arcval_size - 1;
for(tp = buffer; a >= aend; tp++, a--)
if((*tp = *a) && (tp < msb))
......@@ -382,7 +382,7 @@ OBJECT_IDENTIFIER_set_single_arc(uint8_t *arcbuf, void *arcval, unsigned int arc
} else {
/* Look for most significant non-zero byte */
tend = (unsigned char *)arcval + arcval_size;
for(tp = arcval; tp < tend - 1; tp++)
for(tp = (uint8_t *)arcval; tp < tend - 1; tp++)
if(*tp) break;
}
......@@ -461,7 +461,7 @@ OBJECT_IDENTIFIER_set_arcs(OBJECT_IDENTIFIER_t *oid, void *arcs, unsigned int ar
unsigned char *ps, *pe;
/* If more significant bytes are present,
* make them > 255 quick */
for(ps = arcs, pe = ps+arc_type_size - 1; ps < pe; ps++)
for(ps = (unsigned char *)arcs, pe = ps+arc_type_size - 1; ps < pe; ps++)
arc0 |= *ps, arc1 |= *(ps + arc_type_size);
arc0 = *((unsigned char *)arcs + arc_type_size - 1);
arc1 = *((unsigned char *)arcs +(arc_type_size<< 1)-1);
......@@ -499,7 +499,7 @@ OBJECT_IDENTIFIER_set_arcs(OBJECT_IDENTIFIER_t *oid, void *arcs, unsigned int ar
* * the value of the first arc which is in range (0..2)
*/
size = ((arc_type_size * CHAR_BIT + 6) / 7) * arc_slots;
bp = buf = MALLOC(size + 1);
bp = buf = (uint8_t *)MALLOC(size + 1);
if(!buf) {
/* ENOMEM */
return -1;
......@@ -534,7 +534,7 @@ OBJECT_IDENTIFIER_set_arcs(OBJECT_IDENTIFIER_t *oid, void *arcs, unsigned int ar
uint8_t *a1 = (unsigned char *)arcs + arc_type_size - 1;
for(; a1 > aend; fv++, a1--) *fv = *a1;
} else {
uint8_t *a1 = arcs;
uint8_t *a1 = (uint8_t *)arcs;
uint8_t *aend = a1 + arc_type_size;
for(; a1 < aend; fv++, a1++) *fv = *a1;
}
......
......@@ -57,7 +57,7 @@ asn1_TYPE_descriptor_t asn1_DEF_OCTET_STRING = {
while(_ns <= (size_t)(st->size + bufsize)); \
ptr = REALLOC(st->buf, _ns); \
if(ptr) { \
st->buf = ptr; \
st->buf = (uint8_t *)ptr; \
ctx->step = _ns; \
} else { \
RETURN(RC_FAIL); \
......@@ -100,7 +100,7 @@ _add_stack_el(struct _stack *st) {
nel->want_nulls = 0;
nel->bits_chopped = 0;
} else {
nel = CALLOC(1, sizeof(struct _stack_el));
(void *)nel = CALLOC(1, sizeof(struct _stack_el));
if(nel == NULL)
return NULL;
......@@ -119,7 +119,7 @@ _add_stack_el(struct _stack *st) {
static struct _stack *
_new_stack() {
struct _stack *st;
st = CALLOC(1, sizeof(struct _stack));
(void *)st = CALLOC(1, sizeof(struct _stack));
if(st == NULL)
return NULL;
......@@ -138,7 +138,7 @@ _new_stack() {
ber_dec_rval_t
OCTET_STRING_decode_ber(asn1_TYPE_descriptor_t *td,
void **os_structure, void *buf_ptr, size_t size, int tag_mode) {
OCTET_STRING_t *st = *os_structure;
OCTET_STRING_t *st = (OCTET_STRING_t *)*os_structure;
ber_dec_rval_t rval;
ber_dec_ctx_t *ctx;
ssize_t consumed_myself = 0;
......@@ -160,7 +160,7 @@ OCTET_STRING_decode_ber(asn1_TYPE_descriptor_t *td,
* Create the string if does not exist.
*/
if(st == NULL) {
st = *os_structure = CALLOC(1, sizeof(*st));
(void *)st = *os_structure = CALLOC(1, sizeof(*st));
if(st == NULL)
RETURN(RC_FAIL);
}
......@@ -189,7 +189,7 @@ OCTET_STRING_decode_ber(asn1_TYPE_descriptor_t *td,
*/
ctx->ptr = _new_stack();
if(ctx->ptr) {
stck = ctx->ptr;
(void *)stck = ctx->ptr;
if(ctx->left < 0) {
stck->cur_ptr->want_nulls = -ctx->left;
stck->cur_ptr->left = -1;
......@@ -223,7 +223,7 @@ OCTET_STRING_decode_ber(asn1_TYPE_descriptor_t *td,
/*
* Fill the stack with expectations.
*/
stck = ctx->ptr;
(void *)stck = ctx->ptr;
sel = stck->cur_ptr;
do {
ber_tlv_tag_t tlv_tag;
......@@ -307,7 +307,7 @@ OCTET_STRING_decode_ber(asn1_TYPE_descriptor_t *td,
NEXT_PHASE(ctx);
/* Fall through */
case 2:
stck = ctx->ptr;
(void *)stck = ctx->ptr;
sel = stck->cur_ptr;
ASN_DEBUG("Phase 2: Need %ld bytes, size=%ld",
(long)sel->left, (long)size);
......@@ -391,7 +391,7 @@ OCTET_STRING_encode_der(asn1_TYPE_descriptor_t *sd, void *ptr,
int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) {
der_enc_rval_t erval;
OCTET_STRING_t *st = ptr;
OCTET_STRING_t *st = (OCTET_STRING_t *)ptr;
int add_byte = 0;
ASN_DEBUG("%s %s as OCTET STRING",
......@@ -458,7 +458,7 @@ int
OCTET_STRING_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
static const char *h2c = "0123456789ABCDEF";
const OCTET_STRING_t *st = sptr;
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
char scratch[16 * 3 + 4];
char *p = scratch;
uint8_t *buf;
......@@ -495,7 +495,7 @@ OCTET_STRING_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
int
OCTET_STRING_print_ascii(asn1_TYPE_descriptor_t *td, const void *sptr,
int ilevel, asn_app_consume_bytes_f *cb, void *app_key) {
const OCTET_STRING_t *st = sptr;
const OCTET_STRING_t *st = (const OCTET_STRING_t *)sptr;
(void)td; /* Unused argument */
(void)ilevel; /* Unused argument */
......@@ -509,8 +509,8 @@ OCTET_STRING_print_ascii(asn1_TYPE_descriptor_t *td, const void *sptr,
void
OCTET_STRING_free(asn1_TYPE_descriptor_t *td, void *sptr, int contents_only) {
OCTET_STRING_t *st = sptr;
struct _stack *stck = st->_ber_dec_ctx.ptr;
OCTET_STRING_t *st = (OCTET_STRING_t *)sptr;
struct _stack *stck = (struct _stack *)st->_ber_dec_ctx.ptr;
if(!td || !st)
return;
......@@ -569,7 +569,7 @@ OCTET_STRING_fromBuf(OCTET_STRING_t *st, const char *str, int len) {
if(buf == NULL) {
return -1;
} else {
st->buf = buf;
st->buf = (uint8_t *)buf;
st->size = len;
}
......@@ -583,7 +583,7 @@ OCTET_STRING_t *
OCTET_STRING_new_fromBuf(const char *str, int len) {
OCTET_STRING_t *st;
st = CALLOC(1, sizeof(*st));
(void *)st = CALLOC(1, sizeof(*st));
if(st && str && OCTET_STRING_fromBuf(st, str, len)) {
free(st);
st = NULL;
......
......@@ -52,7 +52,7 @@ static int _PrintableString_alphabet[256] = {
int
PrintableString_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
const PrintableString_t *st = sptr;
const PrintableString_t *st = (const PrintableString_t *)sptr;
if(st && st->buf) {
uint8_t *buf = st->buf;
......
......@@ -32,7 +32,7 @@ asn1_TYPE_descriptor_t asn1_DEF_RELATIVE_OID = {
int
RELATIVE_OID_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
const RELATIVE_OID_t *st = sptr;
const RELATIVE_OID_t *st = (const RELATIVE_OID_t *)sptr;
int startn;
int i;
......@@ -112,7 +112,7 @@ RELATIVE_OID_set_arcs(RELATIVE_OID_t *roid, void *arcs, unsigned int arc_type_si
* Roughly estimate the maximum size necessary to encode these arcs.
*/
size = ((arc_type_size * CHAR_BIT + 6) / 7) * arcs_slots;
bp = buf = MALLOC(size + 1);
bp = buf = (uint8_t *)MALLOC(size + 1);
if(!buf) {
/* ENOMEM */
return -1;
......
......@@ -40,7 +40,7 @@ asn1_TYPE_descriptor_t asn1_DEF_UTCTime = {
int
UTCTime_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
const UTCTime_t *st = sptr;
const UTCTime_t *st = (const UTCTime_t *)sptr;
time_t tloc;
errno = EPERM; /* Just an unlikely error code */
......@@ -57,7 +57,7 @@ UTCTime_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
int
UTCTime_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
const UTCTime_t *st = sptr;
const UTCTime_t *st = (const UTCTime_t *)sptr;
(void)td; /* Unused argument */
(void)ilevel; /* Unused argument */
......
......@@ -39,7 +39,8 @@ int
UTF8String_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
ssize_t len;
len = UTF8String_length(sptr, td->name, app_errlog, app_key);
len = UTF8String_length((const UTF8String_t *)sptr, td->name,
app_errlog, app_key);
if(len > 0) len = 0;
return len;
}
......@@ -103,7 +104,7 @@ UTF8String_length(const UTF8String_t *st, const char *opt_type_name,
int
UTF8String_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
const UTF8String_t *st = sptr;
const UTF8String_t *st = (const UTF8String_t *)sptr;
(void)td; /* Unused argument */
(void)ilevel; /* Unused argument */
......
......@@ -30,7 +30,7 @@ asn1_TYPE_descriptor_t asn1_DEF_UniversalString = {
int
UniversalString_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
const UniversalString_t *st = sptr;
const UniversalString_t *st = (const UniversalString_t *)sptr;
uint32_t *wchar;
uint32_t *wend;
char scratch[128]; /* Scratchpad buffer */
......
......@@ -52,7 +52,7 @@ static int _VisibleString_alphabet[256] = {
int
VisibleString_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
const VisibleString_t *st = sptr;
const VisibleString_t *st = (const VisibleString_t *)sptr;
if(st && st->buf) {
uint8_t *buf = st->buf;
......
......@@ -9,7 +9,7 @@ typedef A_SEQUENCE_OF(void) asn_sequence;
void
asn_sequence_del(void *asn_sequence_of_x, int number, int _do_free) {
asn_sequence *as = asn_sequence_of_x;
asn_sequence *as = (asn_sequence *)asn_sequence_of_x;
if(as) {
void *ptr;
......
......@@ -13,7 +13,7 @@ typedef A_SET_OF(void) asn_set;
*/
int
asn_set_add(void *asn_set_of_x, void *ptr) {
asn_set *as = asn_set_of_x;
asn_set *as = (asn_set *)asn_set_of_x;
if(as == 0 || ptr == 0) {
errno = EINVAL; /* Invalid arguments */
......@@ -28,7 +28,7 @@ asn_set_add(void *asn_set_of_x, void *ptr) {
void *_new_arr;
_new_arr = REALLOC(as->array, _newsize * sizeof(as->array[0]));
if(_new_arr) {
as->array = _new_arr;
as->array = (void **)_new_arr;
as->size = _newsize;
} else {
/* ENOMEM */
......@@ -43,7 +43,7 @@ asn_set_add(void *asn_set_of_x, void *ptr) {
void
asn_set_del(void *asn_set_of_x, int number, int _do_free) {
asn_set *as = asn_set_of_x;
asn_set *as = (asn_set *)asn_set_of_x;
if(as) {
void *ptr;
......@@ -71,7 +71,7 @@ asn_set_del(void *asn_set_of_x, int number, int _do_free) {
*/
void
asn_set_empty(void *asn_set_of_x) {
asn_set *as = asn_set_of_x;
asn_set *as = (asn_set *)asn_set_of_x;
if(as) {
if(as->array) {
......
......@@ -9,7 +9,7 @@
ssize_t
ber_fetch_length(int _is_constructed, void *bufptr, size_t size,
ber_tlv_len_t *len_r) {
uint8_t *buf = bufptr;
uint8_t *buf = (uint8_t *)bufptr;
unsigned oct;
if(size == 0)
......@@ -119,7 +119,7 @@ ber_skip_length(int _is_constructed, void *ptr, size_t size) {
ssize_t
der_tlv_length_serialize(ber_tlv_len_t len, void *bufp, size_t size) {
size_t computed_size; /* Size of len encoding */
uint8_t *buf = bufp;
uint8_t *buf = (uint8_t *)bufp;
uint8_t *end;
int i;
......
......@@ -102,7 +102,7 @@ ssize_t
der_tlv_tag_serialize(ber_tlv_tag_t tag, void *bufp, size_t size) {
int tclass = BER_TAG_CLASS(tag);
ber_tlv_tag_t tval = BER_TAG_VALUE(tag);
uint8_t *buf = bufp;
uint8_t *buf = (uint8_t *)bufp;
uint8_t *end;
size_t computed_size;
int i;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment