]> git.stg.codes - stg.git/blobdiff - libs/smux/BOOLEAN.c
Start replacing notifiers with subscriptions.
[stg.git] / libs / smux / BOOLEAN.c
index bb4697c28ce12e647bec8dbeb0ff1a33bf565a7f..6e55b3e6f34b0191aa1d9df4819dd0a0e71ce628 100644 (file)
@@ -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("<true/>", 7);
+               ASN__CALLBACK("<true/>", 7);
                er.encoded = 7;
        } else {
-               _ASN_CALLBACK("<false/>", 8);
+               ASN__CALLBACK("<false/>", 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);
 }