mirror of https://gerrit.osmocom.org/asn1c
strict aliasing rules
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@1122 59561ff5-6e30-0410-9f3c-9617f08c8826
This commit is contained in:
parent
4193d9dad7
commit
170e42c6eb
|
@ -19,6 +19,7 @@ check(enum encoding_type type, char *tagname, char *xmlbuf, char *verify) {
|
||||||
int verlen = verify ? strlen(verify) : 0;
|
int verlen = verify ? strlen(verify) : 0;
|
||||||
asn_TYPE_descriptor_t *td = &asn_DEF_OCTET_STRING;
|
asn_TYPE_descriptor_t *td = &asn_DEF_OCTET_STRING;
|
||||||
OCTET_STRING_t *st = 0;
|
OCTET_STRING_t *st = 0;
|
||||||
|
OCTET_STRING_t **stp = &st;
|
||||||
asn_dec_rval_t rc;
|
asn_dec_rval_t rc;
|
||||||
xer_type_decoder_f *decoder = 0;
|
xer_type_decoder_f *decoder = 0;
|
||||||
|
|
||||||
|
@ -35,7 +36,7 @@ check(enum encoding_type type, char *tagname, char *xmlbuf, char *verify) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
rc = decoder(0, td, (void **)&st, tagname, xmlbuf, xmllen);
|
rc = decoder(0, td, (void **)stp, tagname, xmlbuf, xmllen);
|
||||||
printf("[%s] => [%s]:%d vs [%s]:%d, code %d\n",
|
printf("[%s] => [%s]:%d vs [%s]:%d, code %d\n",
|
||||||
xmlbuf,
|
xmlbuf,
|
||||||
st ? (const char *)st->buf : "", st ? st->size : 0,
|
st ? (const char *)st->buf : "", st ? st->size : 0,
|
||||||
|
|
|
@ -245,13 +245,14 @@ static void check_parse(const char *oid_txt, int retval) {
|
||||||
static void check_xer(int expect_arcs, char *xer) {
|
static void check_xer(int expect_arcs, char *xer) {
|
||||||
asn_dec_rval_t rc;
|
asn_dec_rval_t rc;
|
||||||
RELATIVE_OID_t *st = 0;
|
RELATIVE_OID_t *st = 0;
|
||||||
|
RELATIVE_OID_t **stp = &st;
|
||||||
long arcs[10];
|
long arcs[10];
|
||||||
int ret;
|
int ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printf("[%s] => ", xer); fflush(stdout);
|
printf("[%s] => ", xer); fflush(stdout);
|
||||||
rc = asn_DEF_RELATIVE_OID.xer_decoder(0,
|
rc = asn_DEF_RELATIVE_OID.xer_decoder(0,
|
||||||
&asn_DEF_RELATIVE_OID, (void **)&st, "t",
|
&asn_DEF_RELATIVE_OID, (void **)stp, "t",
|
||||||
xer, strlen(xer));
|
xer, strlen(xer));
|
||||||
if(expect_arcs == -1) {
|
if(expect_arcs == -1) {
|
||||||
if(rc.code != RC_OK)
|
if(rc.code != RC_OK)
|
||||||
|
|
|
@ -152,6 +152,8 @@ check_xer(int fuzzy, double orig_value) {
|
||||||
REAL_t st;
|
REAL_t st;
|
||||||
REAL_t *newst0 = 0;
|
REAL_t *newst0 = 0;
|
||||||
REAL_t *newst1 = 0;
|
REAL_t *newst1 = 0;
|
||||||
|
REAL_t **newst0p = &newst0;
|
||||||
|
REAL_t **newst1p = &newst1;
|
||||||
double value0, value1;
|
double value0, value1;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -176,12 +178,12 @@ check_xer(int fuzzy, double orig_value) {
|
||||||
reconstr_lens[0], reconstructed[0]
|
reconstr_lens[0], reconstructed[0]
|
||||||
);
|
);
|
||||||
|
|
||||||
rc = xer_decode(0, &asn_DEF_REAL, (void **)&newst0,
|
rc = xer_decode(0, &asn_DEF_REAL, (void **)newst0p,
|
||||||
reconstructed[0], reconstr_lens[0]);
|
reconstructed[0], reconstr_lens[0]);
|
||||||
assert(rc.code == RC_OK);
|
assert(rc.code == RC_OK);
|
||||||
assert(rc.consumed < reconstr_lens[0]);
|
assert(rc.consumed < reconstr_lens[0]);
|
||||||
|
|
||||||
rc = xer_decode(0, &asn_DEF_REAL, (void **)&newst1,
|
rc = xer_decode(0, &asn_DEF_REAL, (void **)newst1p,
|
||||||
reconstructed[1], reconstr_lens[1]);
|
reconstructed[1], reconstr_lens[1]);
|
||||||
assert(rc.code == RC_OK);
|
assert(rc.code == RC_OK);
|
||||||
assert(rc.consumed == reconstr_lens[1]);
|
assert(rc.consumed == reconstr_lens[1]);
|
||||||
|
|
|
@ -39,6 +39,7 @@ static void
|
||||||
check(int size) {
|
check(int size) {
|
||||||
OCTET_STRING_t *os;
|
OCTET_STRING_t *os;
|
||||||
OCTET_STRING_t *nos = 0;
|
OCTET_STRING_t *nos = 0;
|
||||||
|
OCTET_STRING_t **nosp = &nos;
|
||||||
asn_enc_rval_t erval;
|
asn_enc_rval_t erval;
|
||||||
asn_dec_rval_t rval;
|
asn_dec_rval_t rval;
|
||||||
int i;
|
int i;
|
||||||
|
@ -61,7 +62,7 @@ check(int size) {
|
||||||
assert(erval.encoded == buf_off);
|
assert(erval.encoded == buf_off);
|
||||||
assert(buf_off > size);
|
assert(buf_off > size);
|
||||||
|
|
||||||
rval = ber_decode(0, &asn_DEF_OCTET_STRING, (void **)&nos, buf, buf_off);
|
rval = ber_decode(0, &asn_DEF_OCTET_STRING, (void **)nosp, buf, buf_off);
|
||||||
assert(rval.code == RC_OK);
|
assert(rval.code == RC_OK);
|
||||||
assert(rval.consumed == buf_off);
|
assert(rval.consumed == buf_off);
|
||||||
|
|
||||||
|
@ -116,7 +117,7 @@ main() {
|
||||||
if(sizeof(tlv_len) <= 4) {
|
if(sizeof(tlv_len) <= 4) {
|
||||||
ret = ber_fetch_length(0, buf3, sizeof(buf3), &tlv_len);
|
ret = ber_fetch_length(0, buf3, sizeof(buf3), &tlv_len);
|
||||||
printf("ret=%ld\n", (long)ret);
|
printf("ret=%ld\n", (long)ret);
|
||||||
printf("len=0x%x\n", (long)tlv_len);
|
printf("len=0x%x\n", (int)tlv_len);
|
||||||
assert(ret == -1);
|
assert(ret == -1);
|
||||||
}
|
}
|
||||||
if(sizeof(tlv_len) <= 8) {
|
if(sizeof(tlv_len) <= 8) {
|
||||||
|
|
Loading…
Reference in New Issue