[dovecot-cvs] dovecot/src/lib base64.c,1.11,1.12
tss at dovecot.org
tss at dovecot.org
Tue Apr 3 20:40:04 EEST 2007
Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv4319
Modified Files:
base64.c
Log Message:
Skip trailing linefeeds/whitespace.
Index: base64.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/base64.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- base64.c 8 Oct 2004 17:51:48 -0000 1.11
+++ base64.c 3 Apr 2007 17:40:02 -0000 1.12
@@ -100,6 +100,9 @@
XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX, XX,XX,XX,XX,
};
+#define IS_EMPTY(c) \
+ ((c) == '\n' || (c) == '\r' || (c) == ' ' || (c) == '\t')
+
int base64_decode(const void *src, size_t src_size,
size_t *src_pos_r, buffer_t *dest)
{
@@ -112,7 +115,7 @@
for (src_pos = 0; src_pos+3 < src_size; ) {
c1 = src_c[src_pos++];
- if (c1 == '\n' || c1 == '\r' || c1 == ' ' || c1 == '\t')
+ if (IS_EMPTY(c1))
continue;
if (index_64[c1] == XX)
@@ -155,6 +158,11 @@
}
}
+ for (; src_pos < src_size; src_pos++) {
+ if (!IS_EMPTY(src_c[src_pos]))
+ break;
+ }
+
if (src_pos_r != NULL)
*src_pos_r = src_pos;
More information about the dovecot-cvs
mailing list