diff options
author | Lev Walkin <vlm@lionet.info> | 2005-08-22 14:19:28 +0000 |
---|---|---|
committer | Lev Walkin <vlm@lionet.info> | 2005-08-22 14:19:28 +0000 |
commit | ac58933ce00c12f60d854bf542bb772fad06072c (patch) | |
tree | 69f86f29d58ec857377d25f900457103194e3f5f /skeletons/constr_SET.c | |
parent | 4696c74b7255861ae5c01b4f59168c91c1f36145 (diff) |
change in optionality handling resulted in stricter controls
Diffstat (limited to 'skeletons/constr_SET.c')
-rw-r--r-- | skeletons/constr_SET.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c index a45d7f9f..f99d66f4 100644 --- a/skeletons/constr_SET.c +++ b/skeletons/constr_SET.c @@ -1,5 +1,6 @@ /*- - * Copyright (c) 2003, 2004 Lev Walkin <vlm@lionet.info>. All rights reserved. + * Copyright (c) 2003, 2004, 2005 Lev Walkin <vlm@lionet.info>. + * All rights reserved. * Redistribution and modifications are permitted subject to BSD license. */ #include <asn_internal.h> @@ -477,6 +478,9 @@ SET_encode_der(asn_TYPE_descriptor_t *td, if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)sptr + elm->memb_offset); if(!memb_ptr) { + if(!elm->optional) + /* Mandatory elements missing */ + _ASN_ENCODE_FAILED; if(t2m_build_own) { t2m[t2m_count].el_no = edx; t2m[t2m_count].el_tag = 0; @@ -827,7 +831,12 @@ SET_encode_xer(asn_TYPE_descriptor_t *td, void *sptr, if(elm->flags & ATF_POINTER) { memb_ptr = *(void **)((char *)sptr + elm->memb_offset); - if(!memb_ptr) continue; /* OPTIONAL element? */ + if(!memb_ptr) { + if(elm->optional) + continue; + /* Mandatory element missing */ + _ASN_ENCODE_FAILED; + } } else { memb_ptr = (void *)((char *)sptr + elm->memb_offset); } @@ -872,7 +881,11 @@ SET_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel, if(elm->flags & ATF_POINTER) { memb_ptr = *(const void * const *)((const char *)sptr + elm->memb_offset); - if(!memb_ptr) continue; + if(!memb_ptr) { + if(elm->optional) continue; + /* Print <absent> line */ + /* Fall through */ + } } else { memb_ptr = (const void *)((const char *)sptr + elm->memb_offset); } |