From fc78563788f0e04b978f89830743a9e4807a6a1b Mon Sep 17 00:00:00 2001 From: Mouse Date: Sat, 17 Aug 2024 21:54:09 -0400 Subject: [PATCH] Correct the logic in switch() cases order for OCTET_STRING_aper --- skeletons/OCTET_STRING_aper.c | 46 +++++++++++++++++------------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/skeletons/OCTET_STRING_aper.c b/skeletons/OCTET_STRING_aper.c index 551a7eb6e..1f74918ae 100644 --- a/skeletons/OCTET_STRING_aper.c +++ b/skeletons/OCTET_STRING_aper.c @@ -59,16 +59,6 @@ OCTET_STRING_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, } switch(specs->subvariant) { - default: -/* - case ASN_OSUBV_ANY: - ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant); - RETURN(RC_FAIL); -*/ - case ASN_OSUBV_BIT: - canonical_unit_bits = unit_bits = 1; - bpc = OS__BPC_BIT; - break; case ASN_OSUBV_ANY: case ASN_OSUBV_STR: canonical_unit_bits = unit_bits = 8; @@ -88,6 +78,16 @@ OCTET_STRING_decode_aper(const asn_codec_ctx_t *opt_codec_ctx, unit_bits = cval->range_bits; bpc = OS__BPC_U32; break; +/* + case ASN_OSUBV_ANY: + ASN_DEBUG("Unrecognized subvariant %d", specs->subvariant); + RETURN(RC_FAIL); +*/ + case ASN_OSUBV_BIT: + default: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + break; } /* @@ -266,19 +266,7 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td, ct_extensible = csiz->flags & APC_EXTENSIBLE; switch(specs->subvariant) { - default: -/* - case ASN_OSUBV_ANY: - ASN__ENCODE_FAILED; -*/ - case ASN_OSUBV_BIT: - canonical_unit_bits = unit_bits = 1; - bpc = OS__BPC_BIT; - sizeinunits = st->size * 8 - (st->bits_unused & 0x07); - ASN_DEBUG("BIT STRING of %d bytes", - sizeinunits); - break; - case ASN_OSUBV_ANY: + case ASN_OSUBV_ANY: case ASN_OSUBV_STR: canonical_unit_bits = unit_bits = 8; /* @@ -302,6 +290,18 @@ OCTET_STRING_encode_aper(const asn_TYPE_descriptor_t *td, bpc = OS__BPC_U32; sizeinunits = st->size / 4; break; +/* + case ASN_OSUBV_ANY: + ASN__ENCODE_FAILED; +*/ + case ASN_OSUBV_BIT: + default: + canonical_unit_bits = unit_bits = 1; + bpc = OS__BPC_BIT; + sizeinunits = st->size * 8 - (st->bits_unused & 0x07); + ASN_DEBUG("BIT STRING of %d bytes", + sizeinunits); + break; } ASN_DEBUG("Encoding %s into %d units of %d bits"