about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2016-07-13 16:00:20 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2016-07-13 16:00:20 +0200
commitb32ef0fd5a468fa95355799b15ac365d420550d5 (patch)
tree2b5d84a094cdc9573ea1bf28d62768078d3a89a7
parent8ba55bae99f5b65a681463d04b878ecf5db460bd (diff)
downloadmblaze-b32ef0fd5a468fa95355799b15ac365d420550d5.tar.gz
mblaze-b32ef0fd5a468fa95355799b15ac365d420550d5.tar.xz
mblaze-b32ef0fd5a468fa95355799b15ac365d420550d5.zip
blaze822_priv.h: add isfws
-rw-r--r--blaze822_priv.h2
-rw-r--r--rfc2047.c4
2 files changed, 4 insertions, 2 deletions
diff --git a/blaze822_priv.h b/blaze822_priv.h
index 5276ff7..1da4d96 100644
--- a/blaze822_priv.h
+++ b/blaze822_priv.h
@@ -9,5 +9,7 @@ struct message {
 //          WSP            =  SP / HTAB
 #define iswsp(c)  (((c) == ' ' || (c) == '\t'))
 
+#define isfws(c)  (((unsigned char)(c) == ' ' || (unsigned char)(c) == '\t' || (unsigned char)(c) == '\n' || (unsigned char)(c) == '\r'))
+
 // ASCII lowercase without alpha check (wrong for "@[\]^_")
 #define lc(c) ((c) | 0x20)
diff --git a/rfc2047.c b/rfc2047.c
index 9559608..a52c612 100644
--- a/rfc2047.c
+++ b/rfc2047.c
@@ -75,7 +75,7 @@ blaze822_decode_b64(char *s, char *e, char **deco, size_t *decleno)
 	*deco = buf;
 
 	while (s + 4 <= e) {
-		while (s < e && isspace((unsigned char) *s))
+		while (s < e && isfws((unsigned char) *s))
 			s++;
 		if (s < e) {
 			uint32_t v = 0;
@@ -116,7 +116,7 @@ blaze822_decode_rfc2047(char *dst, char *src, size_t dlen, char *tgtenc)
 		char *t;
 		t = b;
 		while (t < s)  // strip space-only inbetween encoded words
-			if (!isspace((unsigned char) *t++)) {
+			if (!isfws(*t++)) {
 				while (b < s && dlen) {
 					*dst++ = *b++;
 					dlen--;