better constraint failure reporting
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@196 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/skeletons/BIT_STRING.c b/skeletons/BIT_STRING.c
index df11c19..bca3473 100644
--- a/skeletons/BIT_STRING.c
+++ b/skeletons/BIT_STRING.c
@@ -39,18 +39,20 @@
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 25f2bb6..1da113b 100644
--- a/skeletons/GeneralizedTime.c
+++ b/skeletons/GeneralizedTime.c
@@ -107,8 +107,8 @@
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 a44a9d0..e3ae82f 100644
--- a/skeletons/IA5String.c
+++ b/skeletons/IA5String.c
@@ -43,17 +43,18 @@
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 6c8729f..aba1c72 100644
--- a/skeletons/NumericString.c
+++ b/skeletons/NumericString.c
@@ -48,17 +48,18 @@
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 063ae97..46191bc 100644
--- a/skeletons/OBJECT_IDENTIFIER.c
+++ b/skeletons/OBJECT_IDENTIFIER.c
@@ -81,13 +81,15 @@
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 8f67edd..17be2ae 100644
--- a/skeletons/PrintableString.c
+++ b/skeletons/PrintableString.c
@@ -66,18 +66,20 @@
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 8b7972c..b2ca1a6 100644
--- a/skeletons/UTCTime.c
+++ b/skeletons/UTCTime.c
@@ -48,8 +48,8 @@
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 aab4a2e..c96c71a 100644
--- a/skeletons/UTF8String.c
+++ b/skeletons/UTF8String.c
@@ -63,9 +63,10 @@
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 @@
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 @@
/* 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 aa9c99b..d1a11db 100644
--- a/skeletons/VisibleString.c
+++ b/skeletons/VisibleString.c
@@ -66,18 +66,19 @@
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 1f863fe..4ac71a6 100644
--- a/skeletons/constr_CHOICE.c
+++ b/skeletons/constr_CHOICE.c
@@ -481,7 +481,8 @@
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 @@
}
} 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 06ef4e8..87d5ab6 100644
--- a/skeletons/constr_SEQUENCE.c
+++ b/skeletons/constr_SEQUENCE.c
@@ -644,7 +644,8 @@
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 d1a81be..ba42a4f 100644
--- a/skeletons/constr_SET.c
+++ b/skeletons/constr_SET.c
@@ -659,7 +659,8 @@
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 @@
&(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 ecf16f0..e0c898d 100644
--- a/skeletons/constr_SET_OF.c
+++ b/skeletons/constr_SET_OF.c
@@ -518,7 +518,8 @@
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;
}