aboutsummaryrefslogtreecommitdiffstats
path: root/skeletons
diff options
context:
space:
mode:
authorLev Walkin <vlm@lionet.info>2004-08-11 09:07:36 +0000
committerLev Walkin <vlm@lionet.info>2004-08-11 09:07:36 +0000
commitc2346578e42ffd2726d38e3a59fe4f66a111319b (patch)
tree218489b82ada10db374ddff9220cb30880d9fb44 /skeletons
parent7a5e30202e2fb605eb378703354b74417a85613f (diff)
C++ compatibility
Diffstat (limited to 'skeletons')
-rw-r--r--skeletons/BIT_STRING.c4
-rw-r--r--skeletons/BMPString.c2
-rw-r--r--skeletons/BOOLEAN.c8
-rw-r--r--skeletons/GeneralizedTime.c10
-rw-r--r--skeletons/IA5String.c2
-rw-r--r--skeletons/INTEGER.c12
-rw-r--r--skeletons/NativeInteger.c8
-rw-r--r--skeletons/NumericString.c2
-rw-r--r--skeletons/OBJECT_IDENTIFIER.c16
-rw-r--r--skeletons/OCTET_STRING.c30
-rw-r--r--skeletons/PrintableString.c2
-rw-r--r--skeletons/RELATIVE-OID.c4
-rw-r--r--skeletons/UTCTime.c4
-rw-r--r--skeletons/UTF8String.c5
-rw-r--r--skeletons/UniversalString.c2
-rw-r--r--skeletons/VisibleString.c2
-rw-r--r--skeletons/asn_SEQUENCE_OF.c2
-rw-r--r--skeletons/asn_SET_OF.c8
-rw-r--r--skeletons/ber_tlv_length.c4
-rw-r--r--skeletons/ber_tlv_tag.c2
-rw-r--r--skeletons/constr_CHOICE.c27
-rw-r--r--skeletons/constr_SEQUENCE.c24
-rw-r--r--skeletons/constr_SEQUENCE_OF.c5
-rw-r--r--skeletons/constr_SET.c28
-rw-r--r--skeletons/constr_SET_OF.c39
-rw-r--r--skeletons/constr_TYPE.c2
-rw-r--r--skeletons/constraints.c4
-rw-r--r--skeletons/der_encoder.c4
28 files changed, 137 insertions, 125 deletions
diff --git a/skeletons/BIT_STRING.c b/skeletons/BIT_STRING.c
index 16469294..ef5bd0a2 100644
--- a/skeletons/BIT_STRING.c
+++ b/skeletons/BIT_STRING.c
@@ -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;
diff --git a/skeletons/BMPString.c b/skeletons/BMPString.c
index 93584c8e..d9141682 100644
--- a/skeletons/BMPString.c
+++ b/skeletons/BMPString.c
@@ -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 */
diff --git a/skeletons/BOOLEAN.c b/skeletons/BOOLEAN.c
index 209235d7..eb89c9c2 100644
--- a/skeletons/BOOLEAN.c
+++ b/skeletons/BOOLEAN.c
@@ -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 */
diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c
index 99f2e720..c65d2960 100644
--- a/skeletons/GeneralizedTime.c
+++ b/skeletons/GeneralizedTime.c
@@ -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; }
}
diff --git a/skeletons/IA5String.c b/skeletons/IA5String.c
index 902de855..7fcb194d 100644
--- a/skeletons/IA5String.c
+++ b/skeletons/IA5String.c
@@ -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;
diff --git a/skeletons/INTEGER.c b/skeletons/INTEGER.c
index 1af06c7c..9cf146e5 100644
--- a/skeletons/INTEGER.c
+++ b/skeletons/INTEGER.c
@@ -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;
diff --git a/skeletons/NativeInteger.c b/skeletons/NativeInteger.c
index 3dce02f0..ca29049b 100644
--- a/skeletons/NativeInteger.c
+++ b/skeletons/NativeInteger.c
@@ -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;
diff --git a/skeletons/NumericString.c b/skeletons/NumericString.c
index ba589239..0bb86db9 100644
--- a/skeletons/NumericString.c
+++ b/skeletons/NumericString.c
@@ -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;
diff --git a/skeletons/OBJECT_IDENTIFIER.c b/skeletons/OBJECT_IDENTIFIER.c
index 20de2f6c..b428acad 100644
--- a/skeletons/OBJECT_IDENTIFIER.c
+++ b/skeletons/OBJECT_IDENTIFIER.c
@@ -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;
}
diff --git a/skeletons/OCTET_STRING.c b/skeletons/OCTET_STRING.c
index d5b28c30..e246314e 100644
--- a/skeletons/OCTET_STRING.c
+++ b/skeletons/OCTET_STRING.c
@@ -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;
diff --git a/skeletons/PrintableString.c b/skeletons/PrintableString.c
index 8589bd22..5c9a1fb5 100644
--- a/skeletons/PrintableString.c
+++ b/skeletons/PrintableString.c
@@ -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;
diff --git a/skeletons/RELATIVE-OID.c b/skeletons/RELATIVE-OID.c
index de0a7c37..eaf98b17 100644
--- a/skeletons/RELATIVE-OID.c
+++ b/skeletons/RELATIVE-OID.c
@@ -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;
diff --git a/skeletons/UTCTime.c b/skeletons/UTCTime.c
index c02e9f71..e15cca91 100644
--- a/skeletons/UTCTime.c
+++ b/skeletons/UTCTime.c
@@ -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 */
diff --git a/skeletons/UTF8String.c b/skeletons/UTF8String.c
index 4ec15b82..6b40b25c 100644
--- a/skeletons/UTF8String.c
+++ b/skeletons/UTF8String.c
@@ -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 */
diff --git a/skeletons/UniversalString.c b/skeletons/UniversalString.c
index 1e3444ee..241fe673 100644
--- a/skeletons/UniversalString.c
+++ b/skeletons/UniversalString.c
@@ -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 */
diff --git a/skeletons/VisibleString.c b/skeletons/VisibleString.c
index 4a335a3a..ad0426eb 100644
--- a/skeletons/VisibleString.c
+++ b/skeletons/VisibleString.c
@@ -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;
diff --git a/skeletons/asn_SEQUENCE_OF.c b/skeletons/asn_SEQUENCE_OF.c
index 71f6f0cd..7cfd45f3 100644
--- a/skeletons/asn_SEQUENCE_OF.c
+++ b/skeletons/asn_SEQUENCE_OF.c
@@ -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;
diff --git a/skeletons/asn_SET_OF.c b/skeletons/asn_SET_OF.c
index d89b357f..c6afc30f 100644
--- a/skeletons/asn_SET_OF.c
+++ b/skeletons/asn_SET_OF.c
@@ -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) {
diff --git a/skeletons/ber_tlv_length.c b/skeletons/ber_tlv_length.c
index af872366..3ce5a6b7 100644
--- a/skeletons/ber_tlv_length.c
+++ b/skeletons/ber_tlv_length.c
@@ -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;
diff --git a/skeletons/ber_tlv_tag.c b/skeletons/ber_tlv_tag.c
index 26d71222..2664b906 100644
--- a/skeletons/ber_tlv_tag.c
+++ b/skeletons/ber_tlv_tag.c
@@ -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;
diff --git a/skeletons/constr_CHOICE.c b/skeletons/constr_CHOICE.c
index a620b0ce..7bcf5c5f 100644
--- a/skeletons/constr_CHOICE.c
+++ b/skeletons/constr_CHOICE.c
@@ -66,8 +66,9 @@ static inline void _set_present_idx(void *sptr, int offset, int size, int pres);
*/
static int
_search4tag(const void *ap, const void *bp) {
- const asn1_TYPE_tag2member_t *a = ap;
- const asn1_TYPE_tag2member_t *b = bp;
+ const asn1_TYPE_tag2member_t *a = (const asn1_TYPE_tag2member_t *)ap;
+ const asn1_TYPE_tag2member_t *b = (const asn1_TYPE_tag2member_t *)bp;
+
int a_class = BER_TAG_CLASS(a->el_tag);
int b_class = BER_TAG_CLASS(b->el_tag);
@@ -97,7 +98,7 @@ CHOICE_decode_ber(asn1_TYPE_descriptor_t *sd,
/*
* Bring closer parts of structure description.
*/
- asn1_CHOICE_specifics_t *specs = sd->specifics;
+ asn1_CHOICE_specifics_t *specs = (asn1_CHOICE_specifics_t *)sd->specifics;
asn1_CHOICE_element_t *elements = specs->elements;
/*
@@ -183,7 +184,8 @@ CHOICE_decode_ber(asn1_TYPE_descriptor_t *sd,
asn1_TYPE_tag2member_t key;
key.el_tag = tlv_tag;
- t2m = bsearch(&key, specs->tag2el, specs->tag2el_count,
+ (void *)t2m = bsearch(&key,
+ specs->tag2el, specs->tag2el_count,
sizeof(specs->tag2el[0]), _search4tag);
if(t2m) {
/*
@@ -227,7 +229,7 @@ CHOICE_decode_ber(asn1_TYPE_descriptor_t *sd,
do {
asn1_CHOICE_element_t *elm; /* CHOICE's element */
void *memb_ptr; /* Pointer to the member */
- void *memb_ptr2; /* Pointer to that pointer */
+ void **memb_ptr2; /* Pointer to that pointer */
elm = &elements[ctx->step];
@@ -238,7 +240,7 @@ CHOICE_decode_ber(asn1_TYPE_descriptor_t *sd,
*/
if(elm->optional) {
/* Optional member, hereby, a simple pointer */
- memb_ptr2 = (char *)st + elm->memb_offset;
+ memb_ptr2 = (void **)((char *)st + elm->memb_offset);
} else {
/*
* A pointer to a pointer
@@ -250,8 +252,7 @@ CHOICE_decode_ber(asn1_TYPE_descriptor_t *sd,
/*
* Invoke the member fetch routine according to member's type
*/
- rval = elm->type->ber_decoder(
- (void *)elm->type,
+ rval = elm->type->ber_decoder(elm->type,
memb_ptr2, ptr, LEFT,
elm->tag_mode);
switch(rval.code) {
@@ -352,7 +353,7 @@ CHOICE_encode_der(asn1_TYPE_descriptor_t *sd,
void *struct_ptr,
int tag_mode, ber_tlv_tag_t tag,
asn_app_consume_bytes_f *cb, void *app_key) {
- asn1_CHOICE_specifics_t *specs = sd->specifics;
+ asn1_CHOICE_specifics_t *specs = (asn1_CHOICE_specifics_t *)sd->specifics;
asn1_CHOICE_element_t *elm; /* CHOICE element */
der_enc_rval_t erval;
void *memb_ptr;
@@ -442,7 +443,7 @@ CHOICE_encode_der(asn1_TYPE_descriptor_t *sd,
ber_tlv_tag_t
CHOICE_outmost_tag(asn1_TYPE_descriptor_t *td, const void *ptr, int tag_mode, ber_tlv_tag_t tag) {
- asn1_CHOICE_specifics_t *specs = td->specifics;
+ asn1_CHOICE_specifics_t *specs = (asn1_CHOICE_specifics_t *)td->specifics;
int present;
assert(tag_mode == 0);
@@ -475,7 +476,7 @@ CHOICE_outmost_tag(asn1_TYPE_descriptor_t *td, const void *ptr, int tag_mode, be
int
CHOICE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
- asn1_CHOICE_specifics_t *specs = td->specifics;
+ asn1_CHOICE_specifics_t *specs = (asn1_CHOICE_specifics_t *)td->specifics;
int present;
if(!sptr) {
@@ -509,7 +510,7 @@ CHOICE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
int
CHOICE_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
- asn1_CHOICE_specifics_t *specs = td->specifics;
+ asn1_CHOICE_specifics_t *specs = (asn1_CHOICE_specifics_t *)td->specifics;
int present;
if(!sptr) return cb("<absent>", 8, app_key);
@@ -547,7 +548,7 @@ CHOICE_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
void
CHOICE_free(asn1_TYPE_descriptor_t *td, void *ptr, int contents_only) {
- asn1_CHOICE_specifics_t *specs = td->specifics;
+ asn1_CHOICE_specifics_t *specs = (asn1_CHOICE_specifics_t *)td->specifics;
int present;
if(!td || !ptr)
diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c
index f2736811..db36f901 100644
--- a/skeletons/constr_SEQUENCE.c
+++ b/skeletons/constr_SEQUENCE.c
@@ -69,8 +69,9 @@
*/
static int
_t2e_cmp(const void *ap, const void *bp) {
- const asn1_TYPE_tag2member_t *a = ap;
- const asn1_TYPE_tag2member_t *b = bp;
+ const asn1_TYPE_tag2member_t *a = (const asn1_TYPE_tag2member_t *)ap;
+ const asn1_TYPE_tag2member_t *b = (const asn1_TYPE_tag2member_t *)bp;
+
int a_class = BER_TAG_CLASS(a->el_tag);
int b_class = BER_TAG_CLASS(b->el_tag);
@@ -107,7 +108,7 @@ SEQUENCE_decode_ber(asn1_TYPE_descriptor_t *sd,
/*
* Bring closer parts of structure description.
*/
- asn1_SEQUENCE_specifics_t *specs = sd->specifics;
+ asn1_SEQUENCE_specifics_t *specs = (asn1_SEQUENCE_specifics_t *)sd->specifics;
asn1_SEQUENCE_element_t *elements = specs->elements;
/*
@@ -184,7 +185,7 @@ SEQUENCE_decode_ber(asn1_TYPE_descriptor_t *sd,
for(edx = (ctx->step >> 1); edx < specs->elements_count;
edx++, ctx->step = (ctx->step & ~1) + 2) {
void *memb_ptr; /* Pointer to the member */
- void *memb_ptr2; /* Pointer to that pointer */
+ void **memb_ptr2; /* Pointer to that pointer */
ssize_t tag_len; /* Length of TLV's T */
int opt_edx_end; /* Next non-optional element */
int use_bsearch;
@@ -267,7 +268,8 @@ SEQUENCE_decode_ber(asn1_TYPE_descriptor_t *sd,
asn1_TYPE_tag2member_t key;
key.el_tag = tlv_tag;
key.el_no = edx;
- t2m = bsearch(&key, specs->tag2el, specs->tag2el_count,
+ (void *)t2m = bsearch(&key,
+ specs->tag2el, specs->tag2el_count,
sizeof(specs->tag2el[0]), _t2e_cmp);
if(t2m) {
asn1_TYPE_tag2member_t *best = 0;
@@ -366,7 +368,7 @@ SEQUENCE_decode_ber(asn1_TYPE_descriptor_t *sd,
*/
if(elements[edx].optional) {
/* Optional member, hereby, a simple pointer */
- memb_ptr2 = (char *)st + elements[edx].memb_offset;
+ memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset);
} else {
/*
* A pointer to a pointer
@@ -379,7 +381,7 @@ SEQUENCE_decode_ber(asn1_TYPE_descriptor_t *sd,
* Invoke the member fetch routine according to member's type
*/
rval = elements[edx].type->ber_decoder(
- (void *)elements[edx].type,
+ elements[edx].type,
memb_ptr2, ptr, LEFT,
elements[edx].tag_mode);
ASN_DEBUG("In %s SEQUENCE decoded %d %s in %d bytes code %d",
@@ -479,7 +481,7 @@ der_enc_rval_t
SEQUENCE_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) {
- asn1_SEQUENCE_specifics_t *specs = sd->specifics;
+ asn1_SEQUENCE_specifics_t *specs = (asn1_SEQUENCE_specifics_t *)sd->specifics;
size_t computed_size = 0;
der_enc_rval_t erval;
ssize_t ret;
@@ -564,7 +566,7 @@ SEQUENCE_encode_der(asn1_TYPE_descriptor_t *sd,
int
SEQUENCE_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
- asn1_SEQUENCE_specifics_t *specs = td->specifics;
+ asn1_SEQUENCE_specifics_t *specs = (asn1_SEQUENCE_specifics_t *)td->specifics;
int edx;
int ret;
@@ -612,7 +614,7 @@ SEQUENCE_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
void
SEQUENCE_free(asn1_TYPE_descriptor_t *td, void *sptr, int contents_only) {
- asn1_SEQUENCE_specifics_t *specs = td->specifics;
+ asn1_SEQUENCE_specifics_t *specs = (asn1_SEQUENCE_specifics_t *)td->specifics;
int edx;
if(!td || !sptr)
@@ -641,7 +643,7 @@ SEQUENCE_free(asn1_TYPE_descriptor_t *td, void *sptr, int contents_only) {
int
SEQUENCE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
- asn1_SEQUENCE_specifics_t *specs = td->specifics;
+ asn1_SEQUENCE_specifics_t *specs = (asn1_SEQUENCE_specifics_t *)td->specifics;
int edx;
if(!sptr) {
diff --git a/skeletons/constr_SEQUENCE_OF.c b/skeletons/constr_SEQUENCE_OF.c
index a839949d..0370a2d9 100644
--- a/skeletons/constr_SEQUENCE_OF.c
+++ b/skeletons/constr_SEQUENCE_OF.c
@@ -12,9 +12,9 @@ der_enc_rval_t
SEQUENCE_OF_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) {
- asn1_SET_OF_specifics_t *specs = sd->specifics;
+ asn1_SET_OF_specifics_t *specs = (asn1_SET_OF_specifics_t *)sd->specifics;
asn1_SET_OF_element_t *elm = specs->element;
- A_SEQUENCE_OF(void) *list = ptr;
+ A_SEQUENCE_OF(void) *list;
size_t computed_size = 0;
ssize_t encoding_size = 0;
der_enc_rval_t erval;
@@ -25,6 +25,7 @@ SEQUENCE_OF_encode_der(asn1_TYPE_descriptor_t *sd, void *ptr,
/*
* Gather the length of the underlying members sequence.
*/
+ (void *)list = ptr;
for(edx = 0; edx < list->count; edx++) {
void *memb_ptr = list->array[edx];
erval = elm->type->der_encoder(elm->type, memb_ptr,
diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c
index 2477a381..ec9caf0e 100644
--- a/skeletons/constr_SET.c
+++ b/skeletons/constr_SET.c
@@ -66,8 +66,9 @@
*/
static int
_t2e_cmp(const void *ap, const void *bp) {
- const asn1_TYPE_tag2member_t *a = ap;
- const asn1_TYPE_tag2member_t *b = bp;
+ const asn1_TYPE_tag2member_t *a = (const asn1_TYPE_tag2member_t *)ap;
+ const asn1_TYPE_tag2member_t *b = (const asn1_TYPE_tag2member_t *)bp;
+
int a_class = BER_TAG_CLASS(a->el_tag);
int b_class = BER_TAG_CLASS(b->el_tag);
@@ -97,7 +98,7 @@ SET_decode_ber(asn1_TYPE_descriptor_t *sd,
/*
* Bring closer parts of structure description.
*/
- asn1_SET_specifics_t *specs = sd->specifics;
+ asn1_SET_specifics_t *specs = (asn1_SET_specifics_t *)sd->specifics;
asn1_SET_element_t *elements = specs->elements;
/*
@@ -179,7 +180,7 @@ SET_decode_ber(asn1_TYPE_descriptor_t *sd,
ctx->step = (ctx->step & ~1) + 2,
edx = (ctx->step >> 1)) {
void *memb_ptr; /* Pointer to the member */
- void *memb_ptr2; /* Pointer to that pointer */
+ void **memb_ptr2; /* Pointer to that pointer */
ssize_t tag_len; /* Length of TLV's T */
if(ctx->step & 1)
@@ -234,7 +235,8 @@ SET_decode_ber(asn1_TYPE_descriptor_t *sd,
asn1_TYPE_tag2member_t key;
key.el_tag = tlv_tag;
- t2m = bsearch(&key, specs->tag2el, specs->tag2el_count,
+ (void *)t2m = bsearch(&key,
+ specs->tag2el, specs->tag2el_count,
sizeof(specs->tag2el[0]), _t2e_cmp);
if(t2m) {
/*
@@ -294,7 +296,7 @@ SET_decode_ber(asn1_TYPE_descriptor_t *sd,
*/
if(elements[edx].optional) {
/* Optional member, hereby, a simple pointer */
- memb_ptr2 = (char *)st + elements[edx].memb_offset;
+ memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset);
} else {
/*
* A pointer to a pointer
@@ -307,7 +309,7 @@ SET_decode_ber(asn1_TYPE_descriptor_t *sd,
* Invoke the member fetch routine according to member's type
*/
rval = elements[edx].type->ber_decoder(
- (void *)elements[edx].type,
+ elements[edx].type,
memb_ptr2, ptr, LEFT,
elements[edx].tag_mode);
switch(rval.code) {
@@ -432,7 +434,7 @@ der_enc_rval_t
SET_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) {
- asn1_SET_specifics_t *specs = sd->specifics;
+ asn1_SET_specifics_t *specs = (asn1_SET_specifics_t *)sd->specifics;
size_t computed_size = 0;
der_enc_rval_t my_erval;
int t2m_build_own = (specs->tag2el_count != specs->elements_count);
@@ -445,14 +447,14 @@ SET_encode_der(asn1_TYPE_descriptor_t *sd,
* Use existing, or build our own tags map.
*/
if(t2m_build_own) {
- t2m = alloca(specs->elements_count * sizeof(t2m[0]));
- t2m_count = 0;
+ (void *)t2m = alloca(specs->elements_count * sizeof(t2m[0]));
if(!t2m) { /* There are such platforms */
my_erval.encoded = -1;
my_erval.failed_type = sd;
my_erval.structure_ptr = ptr;
return my_erval;
}
+ t2m_count = 0;
} else {
/*
* There is no untagged CHOICE in this SET.
@@ -578,7 +580,7 @@ SET_encode_der(asn1_TYPE_descriptor_t *sd,
int
SET_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
- asn1_SET_specifics_t *specs = td->specifics;
+ asn1_SET_specifics_t *specs = (asn1_SET_specifics_t *)td->specifics;
int edx;
int ret;
@@ -625,7 +627,7 @@ SET_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
void
SET_free(asn1_TYPE_descriptor_t *td, void *ptr, int contents_only) {
- asn1_SET_specifics_t *specs = td->specifics;
+ asn1_SET_specifics_t *specs = (asn1_SET_specifics_t *)td->specifics;
int edx;
if(!td || !ptr)
@@ -654,7 +656,7 @@ SET_free(asn1_TYPE_descriptor_t *td, void *ptr, int contents_only) {
int
SET_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
- asn1_SET_specifics_t *specs = td->specifics;
+ asn1_SET_specifics_t *specs = (asn1_SET_specifics_t *)td->specifics;
int edx;
if(!sptr) {
diff --git a/skeletons/constr_SET_OF.c b/skeletons/constr_SET_OF.c
index 84fb895a..3bebf7d1 100644
--- a/skeletons/constr_SET_OF.c
+++ b/skeletons/constr_SET_OF.c
@@ -65,7 +65,7 @@ SET_OF_decode_ber(asn1_TYPE_descriptor_t *sd,
/*
* Bring closer parts of structure description.
*/
- asn1_SET_OF_specifics_t *specs = sd->specifics;
+ asn1_SET_OF_specifics_t *specs = (asn1_SET_OF_specifics_t *)sd->specifics;
asn1_SET_OF_element_t *element = specs->element;
/*
@@ -201,8 +201,7 @@ SET_OF_decode_ber(asn1_TYPE_descriptor_t *sd,
/*
* Invoke the member fetch routine according to member's type
*/
- rval = element->type->ber_decoder(
- (void *)element->type,
+ rval = element->type->ber_decoder(element->type,
&ctx->ptr, ptr, LEFT, 0);
ASN_DEBUG("In %s SET OF %s code %d consumed %d",
sd->name, element->type->name,
@@ -210,7 +209,8 @@ SET_OF_decode_ber(asn1_TYPE_descriptor_t *sd,
switch(rval.code) {
case RC_OK:
{
- A_SET_OF(void) *list = st;
+ A_SET_OF(void) *list;
+ (void *)list = st;
if(ASN_SET_ADD(list, ctx->ptr) != 0)
RETURN(RC_FAIL);
else
@@ -269,7 +269,7 @@ struct _el_buffer {
};
/* Append bytes to the above structure */
static int _el_addbytes(const void *buffer, size_t size, void *el_buf_ptr) {
- struct _el_buffer *el_buf = el_buf_ptr;
+ struct _el_buffer *el_buf = (struct _el_buffer *)el_buf_ptr;
if(el_buf->length + size > el_buf->size)
return -1;
@@ -280,8 +280,8 @@ static int _el_addbytes(const void *buffer, size_t size, void *el_buf_ptr) {
return 0;
}
static int _el_buf_cmp(const void *ap, const void *bp) {
- const struct _el_buffer *a = ap;
- const struct _el_buffer *b = bp;
+ const struct _el_buffer *a = (const struct _el_buffer *)ap;
+ const struct _el_buffer *b = (const struct _el_buffer *)bp;
int ret;
size_t common_len;
@@ -308,11 +308,11 @@ der_enc_rval_t
SET_OF_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) {
- asn1_SET_OF_specifics_t *specs = sd->specifics;
+ asn1_SET_OF_specifics_t *specs = (asn1_SET_OF_specifics_t *)sd->specifics;
asn1_SET_OF_element_t *elm = specs->element;
asn1_TYPE_descriptor_t *elm_type = elm->type;
der_type_encoder_f *der_encoder = elm_type->der_encoder;
- A_SET_OF(void) *list = ptr;
+ A_SET_OF(void) *list;
size_t computed_size = 0;
ssize_t encoding_size = 0;
struct _el_buffer *encoded_els;
@@ -326,6 +326,7 @@ SET_OF_encode_der(asn1_TYPE_descriptor_t *sd, void *ptr,
/*
* Gather the length of the underlying members sequence.
*/
+ (void *)list = ptr;
for(edx = 0; edx < list->count; edx++) {
void *memb_ptr = list->array[edx];
erval = der_encoder(elm_type, memb_ptr, 0, elm->tag, 0, 0);
@@ -361,7 +362,7 @@ SET_OF_encode_der(asn1_TYPE_descriptor_t *sd, void *ptr,
* according to their encodings. Build an array of the
* encoded elements.
*/
- encoded_els = MALLOC(list->count * sizeof(encoded_els[0]));
+ (void *)encoded_els = MALLOC(list->count * sizeof(encoded_els[0]));
if(encoded_els == NULL) {
erval.encoded = -1;
erval.failed_type = sd;
@@ -381,7 +382,7 @@ SET_OF_encode_der(asn1_TYPE_descriptor_t *sd, void *ptr,
/*
* Prepare space for encoding.
*/
- encoded_el->buf = MALLOC(max_encoded_len);
+ encoded_el->buf = (uint8_t *)MALLOC(max_encoded_len);
if(encoded_el->buf) {
encoded_el->length = 0;
encoded_el->size = max_encoded_len;
@@ -447,9 +448,9 @@ SET_OF_encode_der(asn1_TYPE_descriptor_t *sd, void *ptr,
int
SET_OF_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
asn_app_consume_bytes_f *cb, void *app_key) {
- asn1_SET_OF_specifics_t *specs = td->specifics;
+ asn1_SET_OF_specifics_t *specs = (asn1_SET_OF_specifics_t *)td->specifics;
asn1_SET_OF_element_t *element = specs->element;
- const A_SET_OF(void) *list = sptr;
+ const A_SET_OF(void) *list;
int ret;
int i;
@@ -460,6 +461,7 @@ SET_OF_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
|| cb(" ::= {\n", 7, app_key))
return -1;
+ (void *)list = sptr;
for(i = 0; i < list->count; i++) {
const void *memb_ptr = list->array[i];
if(!memb_ptr) continue;
@@ -484,15 +486,16 @@ SET_OF_print(asn1_TYPE_descriptor_t *td, const void *sptr, int ilevel,
void
SET_OF_free(asn1_TYPE_descriptor_t *td, void *ptr, int contents_only) {
if(td && ptr) {
- asn1_SET_OF_specifics_t *specs = td->specifics;
+ asn1_SET_OF_specifics_t *specs = (asn1_SET_OF_specifics_t *)td->specifics;
asn1_SET_OF_element_t *element = specs->element;
- A_SET_OF(void) *list = ptr;
+ A_SET_OF(void) *list;
int i;
/*
* Could not use set_of_empty() because of (*free)
* incompatibility.
*/
+ (void *)list = ptr;
for(i = 0; i < list->count; i++) {
void *memb_ptr = list->array[i];
if(memb_ptr)
@@ -511,9 +514,9 @@ SET_OF_free(asn1_TYPE_descriptor_t *td, void *ptr, int contents_only) {
int
SET_OF_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
asn_app_consume_bytes_f *app_errlog, void *app_key) {
- asn1_SET_OF_specifics_t *specs = td->specifics;
+ asn1_SET_OF_specifics_t *specs = (asn1_SET_OF_specifics_t *)td->specifics;
asn1_SET_OF_element_t *element = specs->element;
- const A_SET_OF(void) *list = sptr;
+ const A_SET_OF(void) *list;
int i;
if(!sptr) {
@@ -521,6 +524,8 @@ SET_OF_constraint(asn1_TYPE_descriptor_t *td, const void *sptr,
return -1;
}
+ (void *)list = sptr;
+
for(i = 0; i < list->count; i++) {
const void *memb_ptr = list->array[i];
if(!memb_ptr) continue;
diff --git a/skeletons/constr_TYPE.c b/skeletons/constr_TYPE.c
index 2a19bc98..e19f8d96 100644
--- a/skeletons/constr_TYPE.c
+++ b/skeletons/constr_TYPE.c
@@ -48,7 +48,7 @@ asn_fprint(FILE *stream, asn1_TYPE_descriptor_t *td, const void *struct_ptr) {
/* Dump the data into the specified stdio stream */
static int
_print2fp(const void *buffer, size_t size, void *app_key) {
- FILE *stream = app_key;
+ FILE *stream = (FILE *)app_key;
if(fwrite(buffer, 1, size, stream) != size)
return -1;
diff --git a/skeletons/constraints.c b/skeletons/constraints.c
index 5f01cc73..a7dce959 100644
--- a/skeletons/constraints.c
+++ b/skeletons/constraints.c
@@ -35,7 +35,7 @@ struct __fill_errbuf_arg {
static int
__fill_errbuf(const void *buffer, size_t size, void *app_key) {
- struct __fill_errbuf_arg *arg = app_key;
+ struct __fill_errbuf_arg *arg = (struct __fill_errbuf_arg *)app_key;
size_t avail = arg->errlen - arg->erroff;
if(avail > size)
@@ -107,7 +107,7 @@ _asn_i_log_error(asn_app_consume_bytes_f *cb, void *key, const char *fmt, ...) {
* More space required to hold the message.
*/
len = ret + 1;
- p = alloca(len);
+ p = (char *)alloca(len);
if(!p) return; /* Can fail on !x86. */
diff --git a/skeletons/der_encoder.c b/skeletons/der_encoder.c
index 9ed91cee..ddd0bf86 100644
--- a/skeletons/der_encoder.c
+++ b/skeletons/der_encoder.c
@@ -60,7 +60,7 @@ der_write_tags(asn1_TYPE_descriptor_t *sd,
* and initialize it appropriately.
*/
int stag_offset;
- tags = alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t));
+ tags = (ber_tlv_tag_t *)alloca((sd->tags_count + 1) * sizeof(ber_tlv_tag_t));
if(!tags) { /* Can fail on !x86 */
errno = ENOMEM;
return -1;
@@ -82,7 +82,7 @@ der_write_tags(asn1_TYPE_descriptor_t *sd,
if(tags_count == 0)
return 0;
- lens = alloca(tags_count * sizeof(lens[0]));
+ lens = (ssize_t *)alloca(tags_count * sizeof(lens[0]));
if(!lens) {
errno = ENOMEM;
return -1;