diff src/gaim_buffer.c @ 13212:64bae3cbec8d

[gaim-migrate @ 15576] Mostly documentation. Is there any reason the if statement was written the way it was? This seems more clear to me. Also, gaim_buffer.c doesn't seem like the best name for this. I mean, it's a part of Gaim, does it really need "gaim" in the filename? circbuffer.c seems better to me. Anyone else have an opinion? Because you're wrong. No, just kidding. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Fri, 10 Feb 2006 06:07:19 +0000
parents 72414fe08156
children 71a6a6b22149
line wrap: on
line diff
--- a/src/gaim_buffer.c	Fri Feb 10 05:14:46 2006 +0000
+++ b/src/gaim_buffer.c	Fri Feb 10 06:07:19 2006 +0000
@@ -90,8 +90,11 @@
 	if ((buf->buflen - buf->bufused) < len)
 		grow_circ_buffer(buf, len);
 
-	/* If we may need to wrap */
-	if ((buf->inptr - buf->outptr) >= 0)
+	/* If there is not enough room to copy all of src before hitting
+	 * the end of the buffer then we will need to do two copies.
+	 * One copy from inptr to the end of the buffer, and the
+	 * second copy from the start of the buffer to the end of src. */
+	if (buf->inptr >= buf->outptr)
 		len_stored = MIN(len, buf->buflen
 			- (buf->inptr - buf->buffer));
 	else