X-Git-Url: https://git.stg.codes/stg.git/blobdiff_plain/46b0747592074017ff0ea4b33d4a7194235886e5..1c529746ff07312e30e76fd933c628c658e3c77d:/libs/smux/BOOLEAN.c diff --git a/libs/smux/BOOLEAN.c b/libs/smux/BOOLEAN.c index bb4697c2..6e55b3e6 100644 --- a/libs/smux/BOOLEAN.c +++ b/libs/smux/BOOLEAN.c @@ -9,7 +9,7 @@ /* * BOOLEAN basic type description. */ -static ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = { +static const ber_tlv_tag_t asn_DEF_BOOLEAN_tags[] = { (ASN_TAG_CLASS_UNIVERSAL | (1 << 2)) }; asn_TYPE_descriptor_t asn_DEF_BOOLEAN = { @@ -129,7 +129,7 @@ BOOLEAN_encode_der(asn_TYPE_descriptor_t *td, void *sptr, erval.encoded += 1; - _ASN_ENCODED_OK(erval); + ASN__ENCODED_OK(erval); } @@ -161,10 +161,7 @@ BOOLEAN__xer_body_decode(asn_TYPE_descriptor_t *td, void *sptr, const void *chun } return XPBD_BODY_CONSUMED; } else { - if(xer_is_whitespace(chunk_buf, chunk_size)) - return XPBD_NOT_BODY_IGNORE; - else - return XPBD_BROKEN_ENCODING; + return XPBD_BROKEN_ENCODING; } } @@ -189,19 +186,19 @@ BOOLEAN_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, (void)ilevel; (void)flags; - if(!st) _ASN_ENCODE_FAILED; + if(!st) ASN__ENCODE_FAILED; if(*st) { - _ASN_CALLBACK("", 7); + ASN__CALLBACK("", 7); er.encoded = 7; } else { - _ASN_CALLBACK("", 8); + ASN__CALLBACK("", 8); er.encoded = 8; } - _ASN_ENCODED_OK(er); + ASN__ENCODED_OK(er); cb_failed: - _ASN_ENCODE_FAILED; + ASN__ENCODE_FAILED; } int @@ -248,7 +245,7 @@ BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, if(!st) { st = (BOOLEAN_t *)(*sptr = MALLOC(sizeof(*st))); - if(!st) _ASN_DECODE_FAILED; + if(!st) ASN__DECODE_FAILED; } /* @@ -257,7 +254,7 @@ BOOLEAN_decode_uper(asn_codec_ctx_t *opt_codec_ctx, asn_TYPE_descriptor_t *td, switch(per_get_few_bits(pd, 1)) { case 1: *st = 1; break; case 0: *st = 0; break; - case -1: default: _ASN_DECODE_FAILED; + case -1: default: ASN__DECODE_STARVED; } ASN_DEBUG("%s decoded as %s", td->name, *st ? "TRUE" : "FALSE"); @@ -272,13 +269,14 @@ asn_enc_rval_t BOOLEAN_encode_uper(asn_TYPE_descriptor_t *td, asn_per_constraints_t *constraints, void *sptr, asn_per_outp_t *po) { const BOOLEAN_t *st = (const BOOLEAN_t *)sptr; - asn_enc_rval_t er; + asn_enc_rval_t er = { 0, 0, 0 }; (void)constraints; - if(!st) _ASN_ENCODE_FAILED; + if(!st) ASN__ENCODE_FAILED; - per_put_few_bits(po, *st ? 1 : 0, 1); + if(per_put_few_bits(po, *st ? 1 : 0, 1)) + ASN__ENCODE_FAILED; - _ASN_ENCODED_OK(er); + ASN__ENCODED_OK(er); }