[dovecot-cvs] dovecot/src/lib base64.c, 1.12, 1.13 base64.h, 1.11, 1.12

tss at dovecot.org tss at dovecot.org
Tue Apr 3 20:42:33 EEST 2007


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv4408

Modified Files:
	base64.c base64.h 
Log Message:
API change: Returns now 1 if ok, 0 if end of base64 marker found.



Index: base64.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/base64.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- base64.c	3 Apr 2007 17:40:02 -0000	1.12
+++ base64.c	3 Apr 2007 17:42:30 -0000	1.13
@@ -111,6 +111,7 @@
 	unsigned char buf[4];
 	int c1, c2, c3, c4;
 	size_t size;
+	int ret = 1;
 
 	for (src_pos = 0; src_pos+3 < src_size; ) {
 		c1 = src_c[src_pos++];
@@ -154,6 +155,7 @@
 		buffer_append(dest, buf, size);
 		if (size < 3) {
 			/* end of base64 data */
+			ret = 0;
 			break;
 		}
 	}
@@ -166,5 +168,5 @@
 	if (src_pos_r != NULL)
 		*src_pos_r = src_pos;
 
-	return 0;
+	return ret;
 }

Index: base64.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/base64.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- base64.h	8 Oct 2004 17:51:48 -0000	1.11
+++ base64.h	3 Apr 2007 17:42:30 -0000	1.12
@@ -5,7 +5,9 @@
 void base64_encode(const void *src, size_t src_size, buffer_t *dest);
 
 /* Translates base64 data into binary and appends it to dest buffer. dest may
-   point to same buffer as src. Returns 0 if all ok, -1 if data is invalid.
+   point to same buffer as src. Returns 1 if all ok, 0 if end of base64 data
+   found, -1 if data is invalid.
+
    Any CR, LF characters are ignored, as well as whitespace at beginning or
    end of line.
 



More information about the dovecot-cvs mailing list