Update the doc comment: since it always NUL-terminates the buffer, it

* camel-stream-buffer.c (camel_stream_buffer_gets): Update the
	doc comment: since it always NUL-terminates the buffer, it reads
	at most @max-1 bytes, not @max.

	* camel-remote-store.c (remote_recv_line): Fix the "did
	camel_stream_buffer_gets fill the whole buffer" check. Fixes a bug
	when reading lines longer than 1024 characters (eg, IMAP SEARCH
	responses in very large folders).

svn path=/trunk/; revision=7117
This commit is contained in:
Dan Winship
2000-12-21 17:14:07 +00:00
parent d2a8b907f8
commit d812b5e331
3 changed files with 15 additions and 4 deletions

View File

@ -1,3 +1,14 @@
2000-12-21 Dan Winship <danw@helixcode.com>
* camel-stream-buffer.c (camel_stream_buffer_gets): Update the
doc comment: since it always NUL-terminates the buffer, it reads
at most @max-1 bytes, not @max.
* camel-remote-store.c (remote_recv_line): Fix the "did
camel_stream_buffer_gets fill the whole buffer" check. Fixes a bug
when reading lines longer than 1024 characters (eg, IMAP SEARCH
responses in very large folders).
2000-12-19 Dan Winship <danw@helixcode.com>
* providers/imap/camel-imap-folder.c (imap_refresh_info): Oops.

View File

@ -409,7 +409,7 @@ remote_recv_line (CamelRemoteStore *store, char **dest, CamelException *ex)
{
CamelStreamBuffer *stream = CAMEL_STREAM_BUFFER (store->istream);
GByteArray *bytes;
gchar buf[1025], *ret;
gchar buf[1024], *ret;
gint nread;
*dest = NULL;
@ -434,10 +434,10 @@ remote_recv_line (CamelRemoteStore *store, char **dest, CamelException *ex)
bytes = g_byte_array_new ();
do {
nread = camel_stream_buffer_gets (stream, buf, 1024);
nread = camel_stream_buffer_gets (stream, buf, sizeof (buf));
if (nread > 0)
g_byte_array_append (bytes, buf, nread);
} while (nread == 1024);
} while (nread == sizeof (buf) - 1);
g_byte_array_append (bytes, "", 1);
ret = bytes->data;

View File

@ -357,7 +357,7 @@ stream_eos (CamelStream *stream)
* @max: Maxmimum number of characters to store.
*
* Read a line of characters up to the next newline character or
* @max characters.
* @max-1 characters.
*
* If the newline character is encountered, then it will be
* included in the buffer @buf. The buffer will be #NUL terminated.