mirror of https://gerrit.osmocom.org/asn1c
allow local cleanup
This commit is contained in:
parent
d519380089
commit
942fd08131
|
@ -126,6 +126,8 @@ BIT_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
|
|||
if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1);
|
||||
|
||||
return er;
|
||||
cb_failed:
|
||||
_ASN_ENCODE_FAILED;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -148,6 +148,8 @@ BOOLEAN_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
|
|||
}
|
||||
|
||||
return er;
|
||||
cb_failed:
|
||||
_ASN_ENCODE_FAILED;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -571,12 +571,8 @@ OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
|
|||
uint8_t *end;
|
||||
size_t i;
|
||||
|
||||
if(!st || !st->buf) {
|
||||
er.encoded = -1;
|
||||
er.failed_type = td;
|
||||
er.structure_ptr = sptr;
|
||||
return er;
|
||||
}
|
||||
if(!st || !st->buf)
|
||||
_ASN_ENCODE_FAILED;
|
||||
|
||||
er.encoded = 0;
|
||||
|
||||
|
@ -621,6 +617,8 @@ OCTET_STRING_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
|
|||
}
|
||||
|
||||
return er;
|
||||
cb_failed:
|
||||
_ASN_ENCODE_FAILED;
|
||||
}
|
||||
|
||||
asn_enc_rval_t
|
||||
|
@ -636,7 +634,8 @@ OCTET_STRING_encode_xer_ascii(asn_TYPE_descriptor_t *td, void *sptr,
|
|||
if(!st || !st->buf)
|
||||
_ASN_ENCODE_FAILED;
|
||||
|
||||
_ASN_CALLBACK(st->buf, st->size);
|
||||
if(cb(st->buf, st->size, app_key) < 0)
|
||||
_ASN_ENCODE_FAILED;
|
||||
er.encoded = st->size;
|
||||
|
||||
return er;
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#undef INT_MAX
|
||||
#define INT_MAX ((int)(((unsigned int)-1) >> 1))
|
||||
|
||||
static const double real_zero;
|
||||
static volatile double real_zero = 0.0;
|
||||
#ifndef NAN
|
||||
#define NAN (real_zero/real_zero)
|
||||
#endif
|
||||
|
|
|
@ -46,9 +46,9 @@ static void ASN_DEBUG(const char *fmt, ...) { (void)fmt; };
|
|||
/*
|
||||
* Invoke the application-supplied callback and fail, if something is wrong.
|
||||
*/
|
||||
#define __ASN_E_cbc(buf, size) (cb((buf), (size), app_key) == -1)
|
||||
#define __ASN_E_cbc(buf, size) (cb((buf), (size), app_key) < 0)
|
||||
#define _ASN_E_CALLBACK(foo) do { \
|
||||
if(foo) _ASN_ENCODE_FAILED; \
|
||||
if(foo) goto cb_failed; \
|
||||
} while(0)
|
||||
#define _ASN_CALLBACK(buf, size) \
|
||||
_ASN_E_CALLBACK(__ASN_E_cbc(buf, size))
|
||||
|
|
|
@ -588,6 +588,8 @@ CHOICE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
|
|||
if(!(flags & XER_F_CANONICAL)) _i_ASN_TEXT_INDENT(1, ilevel - 1);
|
||||
|
||||
return er;
|
||||
cb_failed:
|
||||
_ASN_ENCODE_FAILED;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -623,6 +623,8 @@ SEQUENCE_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
|
|||
if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1);
|
||||
|
||||
return er;
|
||||
cb_failed:
|
||||
_ASN_ENCODE_FAILED;
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -128,5 +128,7 @@ SEQUENCE_OF_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
|
|||
if(!xcan) _i_ASN_TEXT_INDENT(1, ilevel - 1);
|
||||
|
||||
return er;
|
||||
cb_failed:
|
||||
_ASN_ENCODE_FAILED;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,12 +19,7 @@ xer_encode(asn_TYPE_descriptor_t *td, void *sptr,
|
|||
size_t mlen;
|
||||
int xcan = (xer_flags & XER_F_CANONICAL) ? 1 : 2;
|
||||
|
||||
if(!td || !sptr) {
|
||||
er.encoded = -1;
|
||||
er.failed_type = td;
|
||||
er.structure_ptr = sptr;
|
||||
return er;
|
||||
}
|
||||
if(!td || !sptr) goto cb_failed;
|
||||
|
||||
mname = td->name;
|
||||
mlen = strlen(mname);
|
||||
|
@ -34,11 +29,13 @@ xer_encode(asn_TYPE_descriptor_t *td, void *sptr,
|
|||
tmper = td->xer_encoder(td, sptr, 1, xer_flags, cb, app_key);
|
||||
if(tmper.encoded == -1) return tmper;
|
||||
|
||||
_ASN_CALLBACK3("</", xcan, mname, mlen, ">\n",xcan);
|
||||
_ASN_CALLBACK3("</", 2, mname, mlen, ">\n", xcan);
|
||||
|
||||
er.encoded = 2 + (2 * xcan) + (2 * mlen) + tmper.encoded;
|
||||
er.encoded = 4 + xcan + (2 * mlen) + tmper.encoded;
|
||||
|
||||
return er;
|
||||
cb_failed:
|
||||
_ASN_ENCODE_FAILED;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue