Commit aa61a0f8 authored by Lev Walkin's avatar Lev Walkin

pointer warning fixes

parent daeb2160
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
* Add -fline-refs to avoid being unfriendly to version control systems. * Add -fline-refs to avoid being unfriendly to version control systems.
* Default constraint checking fix. * Default constraint checking fix.
Thanks to Bartosz Marcinkiewicz <bma@megawatt.com.pl> Thanks to Bartosz Marcinkiewicz <bma@megawatt.com.pl>
* Get rid of non-standard pointer arithmetics on void* pointer.
0.9.24: 2013-Mar-16 0.9.24: 2013-Mar-16
......
...@@ -73,6 +73,7 @@ static enum xer_pbd_rval ...@@ -73,6 +73,7 @@ static enum xer_pbd_rval
NULL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) { NULL__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chunk_buf, size_t chunk_size) {
(void)td; (void)td;
(void)sptr; (void)sptr;
(void)chunk_buf; /* Going to be empty according to the rules below. */
/* /*
* There must be no content in self-terminating <NULL/> tag. * There must be no content in self-terminating <NULL/> tag.
......
...@@ -195,7 +195,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx, ...@@ -195,7 +195,7 @@ OCTET_STRING_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
} }
/* Restore parsing context */ /* Restore parsing context */
ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset); ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
switch(ctx->phase) { switch(ctx->phase) {
case 0: case 0:
...@@ -1143,7 +1143,7 @@ OCTET_STRING__decode_xer(asn_codec_ctx_t *opt_codec_ctx, ...@@ -1143,7 +1143,7 @@ OCTET_STRING__decode_xer(asn_codec_ctx_t *opt_codec_ctx,
} }
/* Restore parsing context */ /* Restore parsing context */
ctx = (asn_struct_ctx_t *)(((void *)*sptr) + specs->ctx_offset); ctx = (asn_struct_ctx_t *)(((char *)*sptr) + specs->ctx_offset);
return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag, return xer_decode_general(opt_codec_ctx, ctx, *sptr, xml_tag,
buf_ptr, size, opt_unexpected_tag_decoder, body_receiver); buf_ptr, size, opt_unexpected_tag_decoder, body_receiver);
...@@ -1716,7 +1716,7 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { ...@@ -1716,7 +1716,7 @@ OCTET_STRING_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
? (asn_OCTET_STRING_specifics_t *)td->specifics ? (asn_OCTET_STRING_specifics_t *)td->specifics
: &asn_DEF_OCTET_STRING_specs; : &asn_DEF_OCTET_STRING_specs;
asn_struct_ctx_t *ctx = (asn_struct_ctx_t *) asn_struct_ctx_t *ctx = (asn_struct_ctx_t *)
((void *)st + specs->ctx_offset); ((char *)st + specs->ctx_offset);
struct _stack *stck; struct _stack *stck;
if(!td || !st) if(!td || !st)
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#undef ADVANCE #undef ADVANCE
#define ADVANCE(num_bytes) do { \ #define ADVANCE(num_bytes) do { \
size_t num = num_bytes; \ size_t num = num_bytes; \
ptr = ((const void *)ptr) + num;\ ptr = ((const char *)ptr) + num;\
size -= num; \ size -= num; \
if(ctx->left >= 0) \ if(ctx->left >= 0) \
ctx->left -= num; \ ctx->left -= num; \
...@@ -133,7 +133,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -133,7 +133,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* /*
* Restore parsing context. * Restore parsing context.
*/ */
ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset); ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
/* /*
* Start to parse where left previously * Start to parse where left previously
...@@ -211,7 +211,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -211,7 +211,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
skip = ber_skip_length(opt_codec_ctx, skip = ber_skip_length(opt_codec_ctx,
BER_TLV_CONSTRUCTED(ptr), BER_TLV_CONSTRUCTED(ptr),
(const void *)ptr + tag_len, (const char *)ptr + tag_len,
LEFT - tag_len); LEFT - tag_len);
switch(skip) { switch(skip) {
...@@ -244,7 +244,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -244,7 +244,7 @@ CHOICE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
*/ */
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
/* Member is a pointer to another structure */ /* Member is a pointer to another structure */
memb_ptr2 = (void **)((void *)st + elm->memb_offset); memb_ptr2 = (void **)((char *)st + elm->memb_offset);
} else { } else {
/* /*
* A pointer to a pointer * A pointer to a pointer
...@@ -390,7 +390,7 @@ CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, ...@@ -390,7 +390,7 @@ CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
*/ */
elm = &td->elements[present-1]; elm = &td->elements[present-1];
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((void *)sptr + elm->memb_offset); memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
if(memb_ptr == 0) { if(memb_ptr == 0) {
if(elm->optional) { if(elm->optional) {
erval.encoded = 0; erval.encoded = 0;
...@@ -400,7 +400,7 @@ CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr, ...@@ -400,7 +400,7 @@ CHOICE_encode_der(asn_TYPE_descriptor_t *td, void *sptr,
_ASN_ENCODE_FAILED; _ASN_ENCODE_FAILED;
} }
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
} }
/* /*
...@@ -463,10 +463,10 @@ CHOICE_outmost_tag(asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode, ber ...@@ -463,10 +463,10 @@ CHOICE_outmost_tag(asn_TYPE_descriptor_t *td, const void *ptr, int tag_mode, ber
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(const void * const *) memb_ptr = *(const void * const *)
((const void *)ptr + elm->memb_offset); ((const char *)ptr + elm->memb_offset);
} else { } else {
memb_ptr = (const void *) memb_ptr = (const void *)
((const void *)ptr + elm->memb_offset); ((const char *)ptr + elm->memb_offset);
} }
return asn_TYPE_outmost_tag(elm->type, memb_ptr, return asn_TYPE_outmost_tag(elm->type, memb_ptr,
...@@ -498,7 +498,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, ...@@ -498,7 +498,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
const void *memb_ptr; const void *memb_ptr;
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset); memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
if(!memb_ptr) { if(!memb_ptr) {
if(elm->optional) if(elm->optional)
return 0; return 0;
...@@ -508,7 +508,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, ...@@ -508,7 +508,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
return -1; return -1;
} }
} else { } else {
memb_ptr = (const void *)((const void *)sptr + elm->memb_offset); memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
} }
if(elm->memb_constraints) { if(elm->memb_constraints) {
...@@ -535,7 +535,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, ...@@ -535,7 +535,7 @@ CHOICE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
#undef XER_ADVANCE #undef XER_ADVANCE
#define XER_ADVANCE(num_bytes) do { \ #define XER_ADVANCE(num_bytes) do { \
size_t num = num_bytes; \ size_t num = num_bytes; \
buf_ptr = ((const void *)buf_ptr) + num;\ buf_ptr = (const void *)(((const char *)buf_ptr) + num); \
size -= num; \ size -= num; \
consumed_myself += num; \ consumed_myself += num; \
} while(0) } while(0)
...@@ -574,7 +574,7 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -574,7 +574,7 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* /*
* Restore parsing context. * Restore parsing context.
*/ */
ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset); ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
if(ctx->phase == 0 && !*xml_tag) if(ctx->phase == 0 && !*xml_tag)
ctx->phase = 1; /* Skip the outer tag checking phase */ ctx->phase = 1; /* Skip the outer tag checking phase */
...@@ -605,7 +605,7 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -605,7 +605,7 @@ CHOICE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
/* Member is a pointer to another structure */ /* Member is a pointer to another structure */
memb_ptr2 = (void **)((void *)st memb_ptr2 = (void **)((char *)st
+ elm->memb_offset); + elm->memb_offset);
} else { } else {
memb_ptr = (char *)st + elm->memb_offset; memb_ptr = (char *)st + elm->memb_offset;
...@@ -797,10 +797,10 @@ CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, ...@@ -797,10 +797,10 @@ CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
unsigned int mlen = strlen(mname); unsigned int mlen = strlen(mname);
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((void *)sptr + elm->memb_offset); memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
if(!memb_ptr) _ASN_ENCODE_FAILED; if(!memb_ptr) _ASN_ENCODE_FAILED;
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
} }
er.encoded = 0; er.encoded = 0;
...@@ -884,7 +884,7 @@ CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -884,7 +884,7 @@ CHOICE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
elm = &td->elements[value]; elm = &td->elements[value];
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
/* Member is a pointer to another structure */ /* Member is a pointer to another structure */
memb_ptr2 = (void **)((void *)st + elm->memb_offset); memb_ptr2 = (void **)((char *)st + elm->memb_offset);
} else { } else {
memb_ptr = (char *)st + elm->memb_offset; memb_ptr = (char *)st + elm->memb_offset;
memb_ptr2 = &memb_ptr; memb_ptr2 = &memb_ptr;
...@@ -962,7 +962,7 @@ CHOICE_encode_uper(asn_TYPE_descriptor_t *td, ...@@ -962,7 +962,7 @@ CHOICE_encode_uper(asn_TYPE_descriptor_t *td,
elm = &td->elements[present]; elm = &td->elements[present];
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
/* Member is a pointer to another structure */ /* Member is a pointer to another structure */
memb_ptr = *(void **)((void *)sptr + elm->memb_offset); memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
if(!memb_ptr) _ASN_ENCODE_FAILED; if(!memb_ptr) _ASN_ENCODE_FAILED;
} else { } else {
memb_ptr = (char *)sptr + elm->memb_offset; memb_ptr = (char *)sptr + elm->memb_offset;
...@@ -1010,10 +1010,10 @@ CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, ...@@ -1010,10 +1010,10 @@ CHOICE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
const void *memb_ptr; const void *memb_ptr;
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset); memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
if(!memb_ptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0; if(!memb_ptr) return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
} else { } else {
memb_ptr = (const void *)((const void *)sptr + elm->memb_offset); memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
} }
/* Print member's name and stuff */ /* Print member's name and stuff */
...@@ -1053,11 +1053,11 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { ...@@ -1053,11 +1053,11 @@ CHOICE_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
void *memb_ptr; void *memb_ptr;
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((void *)ptr + elm->memb_offset); memb_ptr = *(void **)((char *)ptr + elm->memb_offset);
if(memb_ptr) if(memb_ptr)
ASN_STRUCT_FREE(*elm->type, memb_ptr); ASN_STRUCT_FREE(*elm->type, memb_ptr);
} else { } else {
memb_ptr = (void *)((void *)ptr + elm->memb_offset); memb_ptr = (void *)((char *)ptr + elm->memb_offset);
ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr);
} }
} }
...@@ -1082,7 +1082,7 @@ _fetch_present_idx(const void *struct_ptr, int pres_offset, int pres_size) { ...@@ -1082,7 +1082,7 @@ _fetch_present_idx(const void *struct_ptr, int pres_offset, int pres_size) {
const void *present_ptr; const void *present_ptr;
int present; int present;
present_ptr = ((const void *)struct_ptr) + pres_offset; present_ptr = ((const char *)struct_ptr) + pres_offset;
switch(pres_size) { switch(pres_size) {
case sizeof(int): present = *(const int *)present_ptr; break; case sizeof(int): present = *(const int *)present_ptr; break;
...@@ -1100,7 +1100,7 @@ _fetch_present_idx(const void *struct_ptr, int pres_offset, int pres_size) { ...@@ -1100,7 +1100,7 @@ _fetch_present_idx(const void *struct_ptr, int pres_offset, int pres_size) {
static void static void
_set_present_idx(void *struct_ptr, int pres_offset, int pres_size, int present) { _set_present_idx(void *struct_ptr, int pres_offset, int pres_size, int present) {
void *present_ptr; void *present_ptr;
present_ptr = ((void *)struct_ptr) + pres_offset; present_ptr = ((char *)struct_ptr) + pres_offset;
switch(pres_size) { switch(pres_size) {
case sizeof(int): *(int *)present_ptr = present; break; case sizeof(int): *(int *)present_ptr = present; break;
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#undef ADVANCE #undef ADVANCE
#define ADVANCE(num_bytes) do { \ #define ADVANCE(num_bytes) do { \
size_t num = num_bytes; \ size_t num = num_bytes; \
ptr = ((const void *)ptr) + num;\ ptr = ((const char *)ptr) + num; \
size -= num; \ size -= num; \
if(ctx->left >= 0) \ if(ctx->left >= 0) \
ctx->left -= num; \ ctx->left -= num; \
...@@ -144,7 +144,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -144,7 +144,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* /*
* Restore parsing context. * Restore parsing context.
*/ */
ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset); ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
/* /*
* Start to parse where left previously * Start to parse where left previously
...@@ -366,7 +366,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -366,7 +366,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ber_tlv_tag_string(tlv_tag), edx); ber_tlv_tag_string(tlv_tag), edx);
skip = ber_skip_length(opt_codec_ctx, skip = ber_skip_length(opt_codec_ctx,
BER_TLV_CONSTRUCTED(ptr), BER_TLV_CONSTRUCTED(ptr),
(const void *)ptr + tag_len, (const char *)ptr + tag_len,
LEFT - tag_len); LEFT - tag_len);
ASN_DEBUG("Skip length %d in %s", ASN_DEBUG("Skip length %d in %s",
(int)skip, td->name); (int)skip, td->name);
...@@ -397,13 +397,13 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -397,13 +397,13 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
*/ */
if(elements[edx].flags & ATF_POINTER) { if(elements[edx].flags & ATF_POINTER) {
/* Member is a pointer to another structure */ /* Member is a pointer to another structure */
memb_ptr2 = (void **)((void *)st + elements[edx].memb_offset); memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset);
} else { } else {
/* /*
* A pointer to a pointer * A pointer to a pointer
* holding the start of the structure * holding the start of the structure
*/ */
memb_ptr = (void *)st + elements[edx].memb_offset; memb_ptr = (char *)st + elements[edx].memb_offset;
memb_ptr2 = &memb_ptr; memb_ptr2 = &memb_ptr;
} }
/* /*
...@@ -489,7 +489,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -489,7 +489,7 @@ SEQUENCE_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ll = ber_skip_length(opt_codec_ctx, ll = ber_skip_length(opt_codec_ctx,
BER_TLV_CONSTRUCTED(ptr), BER_TLV_CONSTRUCTED(ptr),
(const void *)ptr + tl, LEFT - tl); (const char *)ptr + tl, LEFT - tl);
switch(ll) { switch(ll) {
case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE);
/* Fall through */ /* Fall through */
...@@ -528,14 +528,14 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, ...@@ -528,14 +528,14 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td,
asn_TYPE_member_t *elm = &td->elements[edx]; asn_TYPE_member_t *elm = &td->elements[edx];
void *memb_ptr; void *memb_ptr;
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((void *)sptr + elm->memb_offset); memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
if(!memb_ptr) { if(!memb_ptr) {
if(elm->optional) continue; if(elm->optional) continue;
/* Mandatory element is missing */ /* Mandatory element is missing */
_ASN_ENCODE_FAILED; _ASN_ENCODE_FAILED;
} }
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
} }
erval = elm->type->der_encoder(elm->type, memb_ptr, erval = elm->type->der_encoder(elm->type, memb_ptr,
elm->tag_mode, elm->tag, elm->tag_mode, elm->tag,
...@@ -567,10 +567,10 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, ...@@ -567,10 +567,10 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td,
void *memb_ptr; void *memb_ptr;
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((void *)sptr + elm->memb_offset); memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
if(!memb_ptr) continue; if(!memb_ptr) continue;
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
} }
tmperval = elm->type->der_encoder(elm->type, memb_ptr, tmperval = elm->type->der_encoder(elm->type, memb_ptr,
elm->tag_mode, elm->tag, elm->tag_mode, elm->tag,
...@@ -595,7 +595,7 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td, ...@@ -595,7 +595,7 @@ SEQUENCE_encode_der(asn_TYPE_descriptor_t *td,
#undef XER_ADVANCE #undef XER_ADVANCE
#define XER_ADVANCE(num_bytes) do { \ #define XER_ADVANCE(num_bytes) do { \
size_t num = num_bytes; \ size_t num = num_bytes; \
buf_ptr = ((const void *)buf_ptr) + num;\ buf_ptr = ((const char *)buf_ptr) + num;\
size -= num; \ size -= num; \
consumed_myself += num; \ consumed_myself += num; \
} while(0) } while(0)
...@@ -637,7 +637,7 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -637,7 +637,7 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* /*
* Restore parsing context. * Restore parsing context.
*/ */
ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset); ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
/* /*
...@@ -667,9 +667,9 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -667,9 +667,9 @@ SEQUENCE_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
/* Member is a pointer to another structure */ /* Member is a pointer to another structure */
memb_ptr2 = (void **)((void *)st + elm->memb_offset); memb_ptr2 = (void **)((char *)st + elm->memb_offset);
} else { } else {
memb_ptr = (void *)st + elm->memb_offset; memb_ptr = (char *)st + elm->memb_offset;
memb_ptr2 = &memb_ptr; memb_ptr2 = &memb_ptr;
} }
...@@ -869,7 +869,7 @@ SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, ...@@ -869,7 +869,7 @@ SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
unsigned int mlen = strlen(mname); unsigned int mlen = strlen(mname);
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((void *)sptr + elm->memb_offset); memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
if(!memb_ptr) { if(!memb_ptr) {
if(elm->optional) if(elm->optional)
continue; continue;
...@@ -877,7 +877,7 @@ SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, ...@@ -877,7 +877,7 @@ SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
_ASN_ENCODE_FAILED; _ASN_ENCODE_FAILED;
} }
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
} }
if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel); if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel);
...@@ -917,14 +917,14 @@ SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, ...@@ -917,14 +917,14 @@ SEQUENCE_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
const void *memb_ptr; const void *memb_ptr;
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset); memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
if(!memb_ptr) { if(!memb_ptr) {
if(elm->optional) continue; if(elm->optional) continue;
/* Print <absent> line */ /* Print <absent> line */
/* Fall through */ /* Fall through */
} }
} else { } else {
memb_ptr = (const void *)((const void *)sptr + elm->memb_offset); memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
} }
/* Indentation */ /* Indentation */
...@@ -960,11 +960,11 @@ SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) { ...@@ -960,11 +960,11 @@ SEQUENCE_free(asn_TYPE_descriptor_t *td, void *sptr, int contents_only) {
asn_TYPE_member_t *elm = &td->elements[edx]; asn_TYPE_member_t *elm = &td->elements[edx];
void *memb_ptr; void *memb_ptr;
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((void *)sptr + elm->memb_offset); memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
if(memb_ptr) if(memb_ptr)
ASN_STRUCT_FREE(*elm->type, memb_ptr); ASN_STRUCT_FREE(*elm->type, memb_ptr);
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr);
} }
} }
...@@ -994,7 +994,7 @@ SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, ...@@ -994,7 +994,7 @@ SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
const void *memb_ptr; const void *memb_ptr;
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset); memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
if(!memb_ptr) { if(!memb_ptr) {
if(elm->optional) if(elm->optional)
continue; continue;
...@@ -1004,7 +1004,7 @@ SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr, ...@@ -1004,7 +1004,7 @@ SEQUENCE_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
return -1; return -1;
} }
} else { } else {
memb_ptr = (const void *)((const void *)sptr + elm->memb_offset); memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
} }
if(elm->memb_constraints) { if(elm->memb_constraints) {
...@@ -1088,9 +1088,9 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -1088,9 +1088,9 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* Fetch the pointer to this member */ /* Fetch the pointer to this member */
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr2 = (void **)((void *)st + elm->memb_offset); memb_ptr2 = (void **)((char *)st + elm->memb_offset);
} else { } else {
memb_ptr = (void *)st + elm->memb_offset; memb_ptr = (char *)st + elm->memb_offset;
memb_ptr2 = &memb_ptr; memb_ptr2 = &memb_ptr;
} }
...@@ -1171,9 +1171,9 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -1171,9 +1171,9 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* Fetch the pointer to this member */ /* Fetch the pointer to this member */
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr2 = (void **)((void *)st + elm->memb_offset); memb_ptr2 = (void **)((char *)st + elm->memb_offset);
} else { } else {
memb_ptr = (void *)((void *)st + elm->memb_offset); memb_ptr = (void *)((char *)st + elm->memb_offset);
memb_ptr2 = &memb_ptr; memb_ptr2 = &memb_ptr;
} }
...@@ -1221,7 +1221,7 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -1221,7 +1221,7 @@ SEQUENCE_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* Fetch the pointer to this member */ /* Fetch the pointer to this member */
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr2 = (void **)((void *)st memb_ptr2 = (void **)((char *)st
+ elm->memb_offset); + elm->memb_offset);
if(*memb_ptr2) continue; if(*memb_ptr2) continue;
} else { } else {
...@@ -1265,10 +1265,10 @@ SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr, ...@@ -1265,10 +1265,10 @@ SEQUENCE_handle_extensions(asn_TYPE_descriptor_t *td, void *sptr,
/* Fetch the pointer to this member */ /* Fetch the pointer to this member */
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr2 = (void **)((void *)sptr + elm->memb_offset); memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
present = (*memb_ptr2 != 0); present = (*memb_ptr2 != 0);
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
memb_ptr2 = &memb_ptr; memb_ptr2 = &memb_ptr;
present = 1; present = 1;
} }
...@@ -1334,10 +1334,10 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, ...@@ -1334,10 +1334,10 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td,
/* Fetch the pointer to this member */ /* Fetch the pointer to this member */
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr2 = (void **)((void *)sptr + elm->memb_offset); memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
present = (*memb_ptr2 != 0); present = (*memb_ptr2 != 0);
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
memb_ptr2 = &memb_ptr; memb_ptr2 = &memb_ptr;
present = 1; present = 1;
} }
...@@ -1373,7 +1373,7 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, ...@@ -1373,7 +1373,7 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td,
/* Fetch the pointer to this member */ /* Fetch the pointer to this member */
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr2 = (void **)((void *)sptr + elm->memb_offset); memb_ptr2 = (void **)((char *)sptr + elm->memb_offset);
if(!*memb_ptr2) { if(!*memb_ptr2) {
ASN_DEBUG("Element %s %d not present", ASN_DEBUG("Element %s %d not present",
elm->name, edx); elm->name, edx);
...@@ -1383,7 +1383,7 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td, ...@@ -1383,7 +1383,7 @@ SEQUENCE_encode_uper(asn_TYPE_descriptor_t *td,
_ASN_ENCODE_FAILED; _ASN_ENCODE_FAILED;
} }
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
memb_ptr2 = &memb_ptr; memb_ptr2 = &memb_ptr;
} }
......
...@@ -36,7 +36,7 @@ static int _SET_is_populated(asn_TYPE_descriptor_t *td, void *st); ...@@ -36,7 +36,7 @@ static int _SET_is_populated(asn_TYPE_descriptor_t *td, void *st);
#undef ADVANCE #undef ADVANCE
#define ADVANCE(num_bytes) do { \ #define ADVANCE(num_bytes) do { \
size_t num = num_bytes; \ size_t num = num_bytes; \
ptr = ((const void *)ptr) + num;\ ptr = ((const char *)ptr) + num;\
size -= num; \ size -= num; \
if(ctx->left >= 0) \ if(ctx->left >= 0) \
ctx->left -= num; \ ctx->left -= num; \
...@@ -132,7 +132,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -132,7 +132,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* /*
* Restore parsing context. * Restore parsing context.
*/ */
ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset); ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
/* /*
* Start to parse where left previously * Start to parse where left previously
...@@ -250,7 +250,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -250,7 +250,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
skip = ber_skip_length(opt_codec_ctx, skip = ber_skip_length(opt_codec_ctx,
BER_TLV_CONSTRUCTED(ptr), BER_TLV_CONSTRUCTED(ptr),
(const void *)ptr + tag_len, LEFT - tag_len); (const char *)ptr + tag_len, LEFT - tag_len);
switch(skip) { switch(skip) {
case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE);
...@@ -271,7 +271,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -271,7 +271,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
* Check for duplications: must not overwrite * Check for duplications: must not overwrite
* already decoded elements. * already decoded elements.
*/ */
if(ASN_SET_ISPRESENT2((void *)st + specs->pres_offset, edx)) { if(ASN_SET_ISPRESENT2((char *)st + specs->pres_offset, edx)) {
ASN_DEBUG("SET %s: Duplicate element %s (%d)", ASN_DEBUG("SET %s: Duplicate element %s (%d)",
td->name, elements[edx].name, edx); td->name, elements[edx].name, edx);
RETURN(RC_FAIL); RETURN(RC_FAIL);
...@@ -284,13 +284,13 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -284,13 +284,13 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
*/ */
if(elements[edx].flags & ATF_POINTER) { if(elements[edx].flags & ATF_POINTER) {
/* Member is a pointer to another structure */ /* Member is a pointer to another structure */
memb_ptr2 = (void **)((void *)st + elements[edx].memb_offset); memb_ptr2 = (void **)((char *)st + elements[edx].memb_offset);
} else { } else {
/* /*
* A pointer to a pointer * A pointer to a pointer
* holding the start of the structure * holding the start of the structure
*/ */
memb_ptr = (void *)st + elements[edx].memb_offset; memb_ptr = (char *)st + elements[edx].memb_offset;
memb_ptr2 = &memb_ptr; memb_ptr2 = &memb_ptr;
} }
/* /*
...@@ -302,7 +302,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -302,7 +302,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
elements[edx].tag_mode); elements[edx].tag_mode);
switch(rval.code) { switch(rval.code) {
case RC_OK: case RC_OK:
ASN_SET_MKPRESENT((void *)st + specs->pres_offset, edx); ASN_SET_MKPRESENT((char *)st + specs->pres_offset, edx);
break; break;
case RC_WMORE: /* More data expected */ case RC_WMORE: /* More data expected */
if(!SIZE_VIOLATION) { if(!SIZE_VIOLATION) {
...@@ -369,7 +369,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -369,7 +369,7 @@ SET_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
ll = ber_skip_length(opt_codec_ctx, ll = ber_skip_length(opt_codec_ctx,
BER_TLV_CONSTRUCTED(ptr), BER_TLV_CONSTRUCTED(ptr),
(const void *)ptr + tl, LEFT - tl); (const char *)ptr + tl, LEFT - tl);
switch(ll) { switch(ll) {
case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE); case 0: if(!SIZE_VIOLATION) RETURN(RC_WMORE);
/* Fall through */ /* Fall through */
...@@ -404,7 +404,7 @@ _SET_is_populated(asn_TYPE_descriptor_t *td, void *st) { ...@@ -404,7 +404,7 @@ _SET_is_populated(asn_TYPE_descriptor_t *td, void *st) {
unsigned int midx, pres, must; unsigned int midx, pres, must;
midx = edx/(8 * sizeof(specs->_mandatory_elements[0])); midx = edx/(8 * sizeof(specs->_mandatory_elements[0]));
pres = ((unsigned int *)((void *)st+specs->pres_offset))[midx]; pres = ((unsigned int *)((char *)st + specs->pres_offset))[midx];
must = sys_ntohl(specs->_mandatory_elements[midx]); must = sys_ntohl(specs->_mandatory_elements[midx]);
if((pres & must) == must) { if((pres & must) == must) {
...@@ -473,7 +473,7 @@ SET_encode_der(asn_TYPE_descriptor_t *td, ...@@ -473,7 +473,7 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
* Compute the length of the encoding of this member. * Compute the length of the encoding of this member.
*/ */
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((void *)sptr + elm->memb_offset); memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
if(!memb_ptr) { if(!memb_ptr) {
if(!elm->optional) if(!elm->optional)
/* Mandatory elements missing */ /* Mandatory elements missing */
...@@ -486,7 +486,7 @@ SET_encode_der(asn_TYPE_descriptor_t *td, ...@@ -486,7 +486,7 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
continue; continue;
} }
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
} }
tmper = elm->type->der_encoder(elm->type, memb_ptr, tmper = elm->type->der_encoder(elm->type, memb_ptr,
elm->tag_mode, elm->tag, elm->tag_mode, elm->tag,
...@@ -547,10 +547,10 @@ SET_encode_der(asn_TYPE_descriptor_t *td, ...@@ -547,10 +547,10 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
elm = &td->elements[t2m[edx].el_no]; elm = &td->elements[t2m[edx].el_no];
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((void *)sptr + elm->memb_offset); memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
if(!memb_ptr) continue; if(!memb_ptr) continue;
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
} }
tmper = elm->type->der_encoder(elm->type, memb_ptr, tmper = elm->type->der_encoder(elm->type, memb_ptr,
elm->tag_mode, elm->tag, elm->tag_mode, elm->tag,
...@@ -573,7 +573,7 @@ SET_encode_der(asn_TYPE_descriptor_t *td, ...@@ -573,7 +573,7 @@ SET_encode_der(asn_TYPE_descriptor_t *td,
#undef XER_ADVANCE #undef XER_ADVANCE
#define XER_ADVANCE(num_bytes) do { \ #define XER_ADVANCE(num_bytes) do { \
size_t num = num_bytes; \ size_t num = num_bytes; \
buf_ptr = ((const void *)buf_ptr) + num;\ buf_ptr = ((const char *)buf_ptr) + num;\
size -= num; \ size -= num; \
consumed_myself += num; \ consumed_myself += num; \
} while(0) } while(0)
...@@ -613,7 +613,7 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -613,7 +613,7 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* /*
* Restore parsing context. * Restore parsing context.
*/ */
ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset); ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
/* /*
* Phases of XER/XML processing: * Phases of XER/XML processing:
...@@ -637,7 +637,7 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -637,7 +637,7 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
void *memb_ptr; /* Pointer to the member */ void *memb_ptr; /* Pointer to the member */
void **memb_ptr2; /* Pointer to that pointer */ void **memb_ptr2; /* Pointer to that pointer */
if(ASN_SET_ISPRESENT2((void *)st + specs->pres_offset, if(ASN_SET_ISPRESENT2((char *)st + specs->pres_offset,
edx)) { edx)) {
ASN_DEBUG("SET %s: Duplicate element %s (%d)", ASN_DEBUG("SET %s: Duplicate element %s (%d)",
td->name, elements[edx].name, edx); td->name, elements[edx].name, edx);
...@@ -648,10 +648,9 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -648,10 +648,9 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
/* Member is a pointer to another structure */ /* Member is a pointer to another structure */
memb_ptr2 = (void **)((void *)st memb_ptr2 = (void **)((char *)st + elm->memb_offset);
+ elm->memb_offset);
} else { } else {
memb_ptr = (void *)st + elm->memb_offset; memb_ptr = (char *)st + elm->memb_offset;
memb_ptr2 = &memb_ptr; memb_ptr2 = &memb_ptr;
} }
...@@ -663,7 +662,7 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -663,7 +662,7 @@ SET_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
if(tmprval.code != RC_OK) if(tmprval.code != RC_OK)
RETURN(tmprval.code); RETURN(tmprval.code);
ctx->phase = 1; /* Back to body processing */ ctx->phase = 1; /* Back to body processing */
ASN_SET_MKPRESENT((void *)st + specs->pres_offset, edx); ASN_SET_MKPRESENT((char *)st + specs->pres_offset, edx);
ASN_DEBUG("XER/SET phase => %d", ctx->phase); ASN_DEBUG("XER/SET phase => %d", ctx->phase);
/* Fall through */ /* Fall through */
} }
...@@ -827,7 +826,7 @@ SET_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, ...@@ -827,7 +826,7 @@ SET_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
mlen = strlen(elm->name); mlen = strlen(elm->name);
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((void *)sptr + elm->memb_offset); memb_ptr = *(void **)((char *)sptr + elm->memb_offset);
if(!memb_ptr) { if(!memb_ptr) {
if(elm->optional) if(elm->optional)
continue; continue;
...@@ -835,7 +834,7 @@ SET_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, ...@@ -835,7 +834,7 @@ SET_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
_ASN_ENCODE_FAILED; _ASN_ENCODE_FAILED;
} }
} else { } else {
memb_ptr = (void *)((void *)sptr + elm->memb_offset); memb_ptr = (void *)((char *)sptr + elm->memb_offset);
} }
if(!xcan) if(!xcan)
...@@ -877,14 +876,14 @@ SET_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, ...@@ -877,14 +876,14 @@ SET_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
const void *memb_ptr; const void *memb_ptr;
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset); memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
if(!memb_ptr) { if(!memb_ptr) {
if(elm->optional) continue; if(elm->optional) continue;
/* Print <absent> line */ /* Print <absent> line */
/* Fall through */ /* Fall through */
} }
} else { } else {
memb_ptr = (const void *)((const void *)sptr + elm->memb_offset); memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
} }
_i_INDENT(1); _i_INDENT(1);
...@@ -919,11 +918,11 @@ SET_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { ...@@ -919,11 +918,11 @@ SET_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
asn_TYPE_member_t *elm = &td->elements[edx]; asn_TYPE_member_t *elm = &td->elements[edx];
void *memb_ptr; void *memb_ptr;
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(void **)((void *)ptr + elm->memb_offset); memb_ptr = *(void **)((char *)ptr + elm->memb_offset);
if(memb_ptr) if(memb_ptr)
ASN_STRUCT_FREE(*elm->type, memb_ptr); ASN_STRUCT_FREE(*elm->type, memb_ptr);
} else { } else {
memb_ptr = (void *)((void *)ptr + elm->memb_offset); memb_ptr = (void *)((char *)ptr + elm->memb_offset);
ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr); ASN_STRUCT_FREE_CONTENTS_ONLY(*elm->type, memb_ptr);
} }
} }
...@@ -953,7 +952,7 @@ SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr, ...@@ -953,7 +952,7 @@ SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
const void *memb_ptr; const void *memb_ptr;
if(elm->flags & ATF_POINTER) { if(elm->flags & ATF_POINTER) {
memb_ptr = *(const void * const *)((const void *)sptr + elm->memb_offset); memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset);
if(!memb_ptr) { if(!memb_ptr) {
if(elm->optional) if(elm->optional)
continue; continue;
...@@ -963,7 +962,7 @@ SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr, ...@@ -963,7 +962,7 @@ SET_constraint(asn_TYPE_descriptor_t *td, const void *sptr,
return -1; return -1;
} }
} else { } else {
memb_ptr = (const void *)((const void *)sptr + elm->memb_offset); memb_ptr = (const void *)((const char *)sptr + elm->memb_offset);
} }
if(elm->memb_constraints) { if(elm->memb_constraints) {
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#undef ADVANCE #undef ADVANCE
#define ADVANCE(num_bytes) do { \ #define ADVANCE(num_bytes) do { \
size_t num = num_bytes; \ size_t num = num_bytes; \
ptr = ((const void *)ptr) + num;\ ptr = ((const char *)ptr) + num;\
size -= num; \ size -= num; \
if(ctx->left >= 0) \ if(ctx->left >= 0) \
ctx->left -= num; \ ctx->left -= num; \
...@@ -100,7 +100,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -100,7 +100,7 @@ SET_OF_decode_ber(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* /*
* Restore parsing context. * Restore parsing context.
*/ */
ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset); ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
/* /*
* Start to parse where left previously * Start to parse where left previously
...@@ -457,7 +457,7 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr, ...@@ -457,7 +457,7 @@ SET_OF_encode_der(asn_TYPE_descriptor_t *td, void *ptr,
#undef XER_ADVANCE #undef XER_ADVANCE
#define XER_ADVANCE(num_bytes) do { \ #define XER_ADVANCE(num_bytes) do { \
size_t num = num_bytes; \ size_t num = num_bytes; \
buf_ptr = ((const void *)buf_ptr) + num;\ buf_ptr = ((const char *)buf_ptr) + num;\
size -= num; \ size -= num; \
consumed_myself += num; \ consumed_myself += num; \
} while(0) } while(0)
...@@ -505,7 +505,7 @@ SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, ...@@ -505,7 +505,7 @@ SET_OF_decode_xer(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
/* /*
* Restore parsing context. * Restore parsing context.
*/ */
ctx = (asn_struct_ctx_t *)((void *)st + specs->ctx_offset); ctx = (asn_struct_ctx_t *)((char *)st + specs->ctx_offset);
/* /*
* Phases of XER/XML processing: * Phases of XER/XML processing:
...@@ -627,7 +627,7 @@ SET_OF_encode_xer_callback(const void *buffer, size_t size, void *key) { ...@@ -627,7 +627,7 @@ SET_OF_encode_xer_callback(const void *buffer, size_t size, void *key) {
t->buffer = p; t->buffer = p;
t->size = newsize; t->size = newsize;
} }
memcpy((void *)t->buffer + t->offset, buffer, size); memcpy((char *)t->buffer + t->offset, buffer, size);
t->offset += size; t->offset += size;
return 0; return 0;
} }
...@@ -809,7 +809,7 @@ SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) { ...@@ -809,7 +809,7 @@ SET_OF_free(asn_TYPE_descriptor_t *td, void *ptr, int contents_only) {
asn_set_empty(list); /* Remove (list->array) */ asn_set_empty(list); /* Remove (list->array) */
specs = (asn_SET_OF_specifics_t *)td->specifics; specs = (asn_SET_OF_specifics_t *)td->specifics;
ctx = (asn_struct_ctx_t *)((void *)ptr + specs->ctx_offset); ctx = (asn_struct_ctx_t *)((char *)ptr + specs->ctx_offset);
if(ctx->ptr) { if(ctx->ptr) {
ASN_STRUCT_FREE(*elm->type, ctx->ptr); ASN_STRUCT_FREE(*elm->type, ctx->ptr);
ctx->ptr = 0; ctx->ptr = 0;
......
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