aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-08-31 09:24:42 +0200
committerHarald Welte <laforge@gnumonks.org>2015-08-31 09:24:42 +0200
commit6e00cbce7304a6972e82a12bb5fa82e41fa541be (patch)
tree20bc0d3f7109888c06bd5181841f7e6b453ed562
parent8a25624bc6409c740b30b7c6d876491c02273975 (diff)
skeletons: Fix compiler warnings introduced by Eurecom aper patch
... some of which is related to the recent 'constification' of mainline asn1c.
-rw-r--r--skeletons/constr_SET.c33
-rw-r--r--skeletons/constr_SET_OF.c2
2 files changed, 20 insertions, 15 deletions
diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c
index f29e4201..8a124c09 100644
--- a/skeletons/constr_SET.c
+++ b/skeletons/constr_SET.c
@@ -578,11 +578,13 @@ SET_encode_uper(asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints,
void *sptr,
asn_per_outp_t *po) {
+ _ASN_ENCODE_FAILED;
}
asn_dec_rval_t
SET_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
asn_per_constraints_t *constraints, void **sptr, asn_per_data_t *pd) {
+ _ASN_DECODE_FAILED;
}
asn_enc_rval_t
@@ -592,9 +594,10 @@ SET_encode_aper(asn_TYPE_descriptor_t *td,
asn_per_outp_t *po) {
asn_SET_specifics_t *specs = (asn_SET_specifics_t *)td->specifics;
asn_enc_rval_t er;
- int edx, i;
+ int edx;
int t2m_build_own = (specs->tag2el_count != td->elements_count);
- asn_TYPE_tag2member_t *t2m;
+ const asn_TYPE_tag2member_t *t2m;
+ asn_TYPE_tag2member_t *t2m_build;
int t2m_count;
(void)constraints;
@@ -610,17 +613,16 @@ SET_encode_aper(asn_TYPE_descriptor_t *td,
* Use existing, or build our own tags map.
*/
if(t2m_build_own) {
- t2m = (asn_TYPE_tag2member_t *)alloca(
+ t2m_build = (asn_TYPE_tag2member_t *)alloca(
td->elements_count * sizeof(t2m[0]));
- if(!t2m) _ASN_ENCODE_FAILED; /* There are such platforms */
+ if(!t2m_build) _ASN_ENCODE_FAILED; /* There are such platforms */
t2m_count = 0;
} else {
+ t2m_build = NULL;
/*
* There is no untagged CHOICE in this SET.
* Employ existing table.
*/
- t2m = specs->tag2el;
- t2m_count = specs->tag2el_count;
}
/*
@@ -628,7 +630,6 @@ SET_encode_aper(asn_TYPE_descriptor_t *td,
*/
for(edx = 0; edx < td->elements_count; edx++) {
asn_TYPE_member_t *elm = &td->elements[edx];
- asn_enc_rval_t tmper;
void *memb_ptr;
/*
@@ -641,8 +642,8 @@ SET_encode_aper(asn_TYPE_descriptor_t *td,
/* Mandatory elements missing */
_ASN_ENCODE_FAILED;
if(t2m_build_own) {
- t2m[t2m_count].el_no = edx;
- t2m[t2m_count].el_tag = 0;
+ t2m_build[t2m_count].el_no = edx;
+ t2m_build[t2m_count].el_tag = 0;
t2m_count++;
}
continue;
@@ -655,8 +656,8 @@ SET_encode_aper(asn_TYPE_descriptor_t *td,
* Remember the outmost tag of this member.
*/
if(t2m_build_own) {
- t2m[t2m_count].el_no = edx;
- t2m[t2m_count].el_tag = asn_TYPE_outmost_tag(
+ t2m_build[t2m_count].el_no = edx;
+ t2m_build[t2m_count].el_tag = asn_TYPE_outmost_tag(
elm->type, memb_ptr, elm->tag_mode, elm->tag);
t2m_count++;
} else {
@@ -675,17 +676,21 @@ SET_encode_aper(asn_TYPE_descriptor_t *td,
* Sort the underlying members according to their
* canonical tags order. DER encoding mandates it.
*/
- qsort(t2m, t2m_count, sizeof(specs->tag2el[0]), _t2e_cmp);
+ qsort(t2m_build, t2m_count, sizeof(specs->tag2el[0]), _t2e_cmp);
+ t2m = t2m_build;
} else {
/*
* Tags are already sorted by the compiler.
*/
+ t2m = specs->tag2el;
+ t2m_count = specs->tag2el_count;
}
+ assert(t2m_count == td->elements_count);
for(edx = 0; edx < td->elements_count; edx++) {
asn_TYPE_member_t *elm = &td->elements[t2m[edx].el_no];
- asn_enc_rval_t tmper;
- void *memb_ptr; /* Pointer to the member */
+// asn_enc_rval_t tmper;
+// void *memb_ptr; /* Pointer to the member */
void **memb_ptr2; /* Pointer to that pointer */
int present;
diff --git a/skeletons/constr_SET_OF.c b/skeletons/constr_SET_OF.c
index bc294554..2fd530ec 100644
--- a/skeletons/constr_SET_OF.c
+++ b/skeletons/constr_SET_OF.c
@@ -1004,7 +1004,7 @@ SET_OF_decode_aper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td,
nelems = aper_get_length(pd, ct ? ct->upper_bound - ct->lower_bound + 1 : -1,
ct ? ct->effective_bits : -1, &repeat);
ASN_DEBUG("Got to decode %d elements (eff %d)",
- (int)nelems, (int)ct ? ct->effective_bits : -1);
+ (int)nelems, (int)(ct ? ct->effective_bits : -1));
if(nelems < 0) _ASN_DECODE_STARVED;
}