diff options
author | Lev Walkin <vlm@lionet.info> | 2004-08-22 13:47:59 +0000 |
---|---|---|
committer | Lev Walkin <vlm@lionet.info> | 2004-08-22 13:47:59 +0000 |
commit | 16835b66d44ba35cf1b1f671de133e39d716a848 (patch) | |
tree | 0b97dab1afad50a95d7c1473954f1f21de0677e0 /skeletons | |
parent | 730b15a2e49811d061b10bdb3a32dcafbae195f1 (diff) |
better constraint failure reporting
Diffstat (limited to 'skeletons')
-rw-r--r-- | skeletons/BIT_STRING.c | 10 | ||||
-rw-r--r-- | skeletons/GeneralizedTime.c | 4 | ||||
-rw-r--r-- | skeletons/IA5String.c | 9 | ||||
-rw-r--r-- | skeletons/NumericString.c | 11 | ||||
-rw-r--r-- | skeletons/OBJECT_IDENTIFIER.c | 8 | ||||
-rw-r--r-- | skeletons/PrintableString.c | 10 | ||||
-rw-r--r-- | skeletons/UTCTime.c | 4 | ||||
-rw-r--r-- | skeletons/UTF8String.c | 14 | ||||
-rw-r--r-- | skeletons/VisibleString.c | 11 | ||||
-rw-r--r-- | skeletons/constr_CHOICE.c | 6 | ||||
-rw-r--r-- | skeletons/constr_SEQUENCE.c | 3 | ||||
-rw-r--r-- | skeletons/constr_SET.c | 8 | ||||
-rw-r--r-- | skeletons/constr_SET_OF.c | 3 |
13 files changed, 59 insertions, 42 deletions
diff --git a/skeletons/BIT_STRING.c b/skeletons/BIT_STRING.c index df11c19c..bca34732 100644 --- a/skeletons/BIT_STRING.c +++ b/skeletons/BIT_STRING.c @@ -39,18 +39,20 @@ BIT_STRING_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, if(st->size) { if(st->size == 1 && st->buf[0] != 0) { _ASN_ERRLOG(app_errlog, app_key, - "%s: invalid padding byte", - td->name); + "%s: invalid padding byte (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } else { _ASN_ERRLOG(app_errlog, app_key, - "%s: no padding byte", td->name); + "%s: no padding byte (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } else { _ASN_ERRLOG(app_errlog, app_key, - "%s: value not given", td->name); + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } diff --git a/skeletons/GeneralizedTime.c b/skeletons/GeneralizedTime.c index 25f2bb6e..1da113b0 100644 --- a/skeletons/GeneralizedTime.c +++ b/skeletons/GeneralizedTime.c @@ -107,8 +107,8 @@ GeneralizedTime_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, tloc = asn_GT2time(st, 0, 0); if(tloc == -1 && errno != EPERM) { _ASN_ERRLOG(app_errlog, app_key, - "%s: Invalid time format: %s", - td->name, strerror(errno)); + "%s: Invalid time format: %s (%s:%d)", + td->name, strerror(errno), __FILE__, __LINE__); return -1; } diff --git a/skeletons/IA5String.c b/skeletons/IA5String.c index a44a9d0f..e3ae82fe 100644 --- a/skeletons/IA5String.c +++ b/skeletons/IA5String.c @@ -43,17 +43,18 @@ IA5String_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, if(*buf > 0x7F) { _ASN_ERRLOG(app_errlog, app_key, "%s: value byte %d out of range: " - "%d > 127", + "%d > 127 (%s:%d)", td->name, (buf - st->buf) + 1, - *buf - ); + *buf, + __FILE__, __LINE__); return -1; } } } else { _ASN_ERRLOG(app_errlog, app_key, - "%s: value not given", td->name); + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } diff --git a/skeletons/NumericString.c b/skeletons/NumericString.c index 6c8729ff..aba1c72b 100644 --- a/skeletons/NumericString.c +++ b/skeletons/NumericString.c @@ -48,17 +48,18 @@ NumericString_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, continue; } _ASN_ERRLOG(app_errlog, app_key, - "%s: value byte %d " - "not in NumericString alphabet (%d)", + "%s: value byte %d (%d) " + "not in NumericString alphabet (%s:%d)", td->name, (buf - st->buf) + 1, - *buf - ); + *buf, + __FILE__, __LINE__); return -1; } } else { _ASN_ERRLOG(app_errlog, app_key, - "%s: value not given", td->name); + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } diff --git a/skeletons/OBJECT_IDENTIFIER.c b/skeletons/OBJECT_IDENTIFIER.c index 063ae978..46191bc6 100644 --- a/skeletons/OBJECT_IDENTIFIER.c +++ b/skeletons/OBJECT_IDENTIFIER.c @@ -81,13 +81,15 @@ OBJECT_IDENTIFIER_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, if(st && st->buf) { if(st->size < 1) { _ASN_ERRLOG(app_errlog, app_key, - "%s: at least one numerical value expected", - td->name); + "%s: at least one numerical value " + "expected (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } } else { _ASN_ERRLOG(app_errlog, app_key, - "%s: value not given", td->name); + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } diff --git a/skeletons/PrintableString.c b/skeletons/PrintableString.c index 8f67eddf..17be2aed 100644 --- a/skeletons/PrintableString.c +++ b/skeletons/PrintableString.c @@ -66,18 +66,20 @@ PrintableString_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, for(; buf < end; buf++) { if(!_PrintableString_alphabet[*buf]) { _ASN_ERRLOG(app_errlog, app_key, - "%s: value byte %d " - "not in PrintableString alphabet (%d)", + "%s: value byte %d (%d) " + "not in PrintableString alphabet " + "(%s:%d)", td->name, (buf - st->buf) + 1, *buf - ); + __FILE__, __LINE__); return -1; } } } else { _ASN_ERRLOG(app_errlog, app_key, - "%s: value not given", td->name); + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } diff --git a/skeletons/UTCTime.c b/skeletons/UTCTime.c index 8b7972c0..b2ca1a66 100644 --- a/skeletons/UTCTime.c +++ b/skeletons/UTCTime.c @@ -48,8 +48,8 @@ UTCTime_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, tloc = asn_UT2time(st, 0, 0); if(tloc == -1 && errno != EPERM) { _ASN_ERRLOG(app_errlog, app_key, - "%s: Invalid time format: %s", - td->name, strerror(errno)); + "%s: Invalid time format: %s (%s:%d)", + td->name, strerror(errno), __FILE__, __LINE__); return -1; } diff --git a/skeletons/UTF8String.c b/skeletons/UTF8String.c index aab4a2e9..c96c71a4 100644 --- a/skeletons/UTF8String.c +++ b/skeletons/UTF8String.c @@ -63,9 +63,10 @@ UTF8String_length(const UTF8String_t *st, const char *opt_type_name, if(w) { _ASN_ERRLOG(app_errlog, app_key, "%s: UTF-8 expectation " - "failed at byte %d", + "failed at byte %d (%s:%d)", opt_type_name, - (buf - st->buf) + 1); + (buf - st->buf) + 1, + __FILE__, __LINE__); return -1; } want--; @@ -79,9 +80,10 @@ UTF8String_length(const UTF8String_t *st, const char *opt_type_name, case 0: _ASN_ERRLOG(app_errlog, app_key, "%s: UTF-8 expectation" - "failed at byte %d", + "failed at byte %d (%s:%d)", opt_type_name, - (buf - st->buf) + 1); + (buf - st->buf) + 1, + __FILE__, __LINE__); return -1; } want = w - 1; /* Expect this much */ @@ -92,8 +94,8 @@ UTF8String_length(const UTF8String_t *st, const char *opt_type_name, /* If still want something, then something is wrong */ if(want) { _ASN_ERRLOG(app_errlog, app_key, - "%s: truncated UTF-8 sequence", - opt_type_name); + "%s: truncated UTF-8 sequence (%s:%d)", + opt_type_name, __FILE__, __LINE__); return -1; } diff --git a/skeletons/VisibleString.c b/skeletons/VisibleString.c index aa9c99b1..d1a11dbe 100644 --- a/skeletons/VisibleString.c +++ b/skeletons/VisibleString.c @@ -66,18 +66,19 @@ VisibleString_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, for(; buf < end; buf++) { if(!_VisibleString_alphabet[*buf]) { _ASN_ERRLOG(app_errlog, app_key, - "%s: value byte %d " - "not in VisibleString alphabet (%d)", + "%s: value byte %d (%d) " + "not in VisibleString alphabet (%s:%d)", td->name, (buf - st->buf) + 1, - *buf - ); + *buf, + __FILE__, __LINE__); return -1; } } } else { _ASN_ERRLOG(app_errlog, app_key, - "%s: value not given", td->name); + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } diff --git a/skeletons/constr_CHOICE.c b/skeletons/constr_CHOICE.c index 1f863feb..4ac71a64 100644 --- a/skeletons/constr_CHOICE.c +++ b/skeletons/constr_CHOICE.c @@ -481,7 +481,8 @@ CHOICE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, - "%s: value not given", td->name); + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -515,7 +516,8 @@ CHOICE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, } } else { _ASN_ERRLOG(app_errlog, app_key, - "%s: no CHOICE element given", td->name); + "%s: no CHOICE element given", + td->name, __FILE__, __LINE__); return -1; } } diff --git a/skeletons/constr_SEQUENCE.c b/skeletons/constr_SEQUENCE.c index 06ef4e83..87d5ab66 100644 --- a/skeletons/constr_SEQUENCE.c +++ b/skeletons/constr_SEQUENCE.c @@ -644,7 +644,8 @@ SEQUENCE_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, - "%s: value not given", td->name); + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } diff --git a/skeletons/constr_SET.c b/skeletons/constr_SET.c index d1a81beb..ba42a4ff 100644 --- a/skeletons/constr_SET.c +++ b/skeletons/constr_SET.c @@ -659,7 +659,8 @@ SET_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, - "%s: value not given", td->name); + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } @@ -677,8 +678,9 @@ SET_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, &(specs->_mandatory_elements), edx)) { _ASN_ERRLOG(app_errlog, app_key, "%s: mandatory element " - "%s absent", - td->name, elm->name); + "%s absent (%s:%d)", + td->name, elm->name, + __FILE__, __LINE__); return -1; } continue; diff --git a/skeletons/constr_SET_OF.c b/skeletons/constr_SET_OF.c index ecf16f02..e0c898da 100644 --- a/skeletons/constr_SET_OF.c +++ b/skeletons/constr_SET_OF.c @@ -518,7 +518,8 @@ SET_OF_constraint(asn1_TYPE_descriptor_t *td, const void *sptr, if(!sptr) { _ASN_ERRLOG(app_errlog, app_key, - "%s: value not given", td->name); + "%s: value not given (%s:%d)", + td->name, __FILE__, __LINE__); return -1; } |