[dovecot-cvs] dovecot/src/lib buffer.c,1.22,1.23

cras at dovecot.org cras at dovecot.org
Sun Oct 24 02:03:32 EEST 2004


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

Modified Files:
	buffer.c 
Log Message:
buffer_insert() and buffer_insert_zero() didn't work correctly when it used
to append data.



Index: buffer.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/buffer.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- buffer.c	21 Oct 2004 13:40:14 -0000	1.22
+++ buffer.c	23 Oct 2004 23:03:30 -0000	1.23
@@ -157,9 +157,10 @@
 
 	if (pos >= buf->used)
 		buffer_write(_buf, pos, data, data_size);
-
-	buffer_copy(_buf, pos + data_size, _buf, pos, (size_t)-1);
-	memcpy(buf->w_buffer + pos, data, data_size);
+	else {
+		buffer_copy(_buf, pos + data_size, _buf, pos, (size_t)-1);
+		memcpy(buf->w_buffer + pos, data, data_size);
+	}
 }
 
 void buffer_delete(buffer_t *_buf, size_t pos, size_t size)
@@ -203,9 +204,10 @@
 
 	if (pos >= buf->used)
 		buffer_write_zero(_buf, pos, data_size);
-
-	buffer_copy(_buf, pos + data_size, _buf, pos, (size_t)-1);
-	memset(buf->w_buffer + pos, 0, data_size);
+	else {
+		buffer_copy(_buf, pos + data_size, _buf, pos, (size_t)-1);
+		memset(buf->w_buffer + pos, 0, data_size);
+	}
 }
 
 void buffer_copy(buffer_t *_dest, size_t dest_pos,



More information about the dovecot-cvs mailing list