INTEGER XER decoding
git-svn-id: https://asn1c.svn.sourceforge.net/svnroot/asn1c/trunk@525 59561ff5-6e30-0410-9f3c-9617f08c8826
diff --git a/skeletons/asn_codecs_prim.c b/skeletons/asn_codecs_prim.c
index e0b545a..8791475 100644
--- a/skeletons/asn_codecs_prim.c
+++ b/skeletons/asn_codecs_prim.c
@@ -143,12 +143,38 @@
int want_more;
};
+/*
+ * Check whether this buffer consists of entirely XER whitespace characters.
+ */
+static int
+xer_decode__check_whitespace(void *chunk_buf, size_t chunk_size) {
+ char *p = (char *)chunk_buf;
+ char *pend = p + chunk_size;
+ for(; p < pend; p++) {
+ switch(*p) {
+ /* X.693, #8.1.4
+ * HORISONTAL TAB (9)
+ * LINE FEED (10)
+ * CARRIAGE RETURN (13)
+ * SPACE (32)
+ */
+ case 0x09: case 0x0a: case 0x0d: case 0x20:
+ break;
+ default:
+ return 0;
+ }
+ }
+ return 1; /* All whitespace */
+}
+
static int
xer_decode__unexpected_tag(void *key, void *chunk_buf, size_t chunk_size) {
struct xdp_arg_s *arg = (struct xdp_arg_s *)key;
ssize_t decoded;
if(arg->decoded_something) {
+ if(xer_decode__check_whitespace(chunk_buf, chunk_size))
+ return chunk_size;
/*
* Decoding was done once already. Prohibit doing it again.
*/
@@ -171,6 +197,8 @@
ssize_t decoded;
if(arg->decoded_something) {
+ if(xer_decode__check_whitespace(chunk_buf, chunk_size))
+ return chunk_size;
/*
* Decoding was done once already. Prohibit doing it again.
*/