aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@helixcode.com>2000-11-21 10:21:03 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2000-11-21 10:21:03 +0800
commit2cf986c43b05072cdcacf05aef0c5ddd595c1f18 (patch)
tree8879fea9f0bdf1478ac533408062472a9ef6d78d
parent484334eaec8c6bd0c9118c318ceb3a503b7ac824 (diff)
downloadgsoc2013-evolution-2cf986c43b05072cdcacf05aef0c5ddd595c1f18.tar
gsoc2013-evolution-2cf986c43b05072cdcacf05aef0c5ddd595c1f18.tar.gz
gsoc2013-evolution-2cf986c43b05072cdcacf05aef0c5ddd595c1f18.tar.bz2
gsoc2013-evolution-2cf986c43b05072cdcacf05aef0c5ddd595c1f18.tar.lz
gsoc2013-evolution-2cf986c43b05072cdcacf05aef0c5ddd595c1f18.tar.xz
gsoc2013-evolution-2cf986c43b05072cdcacf05aef0c5ddd595c1f18.tar.zst
gsoc2013-evolution-2cf986c43b05072cdcacf05aef0c5ddd595c1f18.zip
Fixed to return the correct bytecount in all cases which is the real fix
2000-11-20 Jeffrey Stedfast <fejj@helixcode.com> * camel-remote-store.c (remote_recv_line): Fixed to return the correct bytecount in all cases which is the real fix to imap_parse_nstring. * providers/imap/camel-imap-command.c (imap_read_untagged): Again, don't use strlen for the post-data, use 'n'. * providers/imap/camel-imap-utils.c (imap_parse_nstring): Undo my previous temp-fix. svn path=/trunk/; revision=6621
-rw-r--r--camel/ChangeLog13
-rw-r--r--camel/camel-remote-store.c34
-rw-r--r--camel/providers/imap/camel-imap-command.c6
-rw-r--r--camel/providers/imap/camel-imap-utils.c3
4 files changed, 32 insertions, 24 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index f1919f4b6d..3fbf6b60d7 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,15 @@
+2000-11-20 Jeffrey Stedfast <fejj@helixcode.com>
+
+ * camel-remote-store.c (remote_recv_line): Fixed to return the
+ correct bytecount in all cases which is the real fix to
+ imap_parse_nstring.
+
+ * providers/imap/camel-imap-command.c (imap_read_untagged): Again,
+ don't use strlen for the post-data, use 'n'.
+
+ * providers/imap/camel-imap-utils.c (imap_parse_nstring): Undo my
+ previous temp-fix.
+
2000-11-20 Not Zed <NotZed@HelixCode.com>
* providers/nntp/camel-nntp-utils.c (get_XOVER_headers): Fixes for
@@ -112,6 +124,7 @@
parsing (all other data can be retrieved by the caller except
this).
+>>>>>>> 1.594
2000-11-17 Jeffrey Stedfast <fejj@helixcode.com>
* providers/imap/camel-imap-utils.c (imap_parse_nstring): When
diff --git a/camel/camel-remote-store.c b/camel/camel-remote-store.c
index ee5bf60b10..7c64ab6a67 100644
--- a/camel/camel-remote-store.c
+++ b/camel/camel-remote-store.c
@@ -409,8 +409,8 @@ remote_recv_line (CamelRemoteStore *store, char **dest, CamelException *ex)
{
CamelStreamBuffer *stream = CAMEL_STREAM_BUFFER (store->istream);
GByteArray *bytes;
- gchar buf[1024], *ret;
- guint nread;
+ gchar buf[1025], *ret;
+ gint nread;
*dest = NULL;
@@ -433,36 +433,34 @@ remote_recv_line (CamelRemoteStore *store, char **dest, CamelException *ex)
bytes = g_byte_array_new ();
- nread = 1024;
- while (nread == 1024) {
+ do {
nread = camel_stream_buffer_gets (stream, buf, 1024);
if (nread > 0)
- g_byte_array_append (bytes, buf, nread - 1);
- }
+ g_byte_array_append (bytes, buf, nread);
+ } while (nread == 1024);
g_byte_array_append (bytes, "", 1);
ret = bytes->data;
nread = bytes->len - 1;
g_byte_array_free (bytes, FALSE);
- /* strip off the CRLF sequence at the end of the string */
- for ( ; nread > 0; nread--) {
- if (ret[nread] == '\r') {
- ret[nread] = '\0';
- break;
- }
- }
-
- *dest = ret;
-
- if (!*dest) {
+ if (nread <= 0) {
+ g_free (ret);
+ ret = NULL;
camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
g_strerror (errno));
camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
return -1;
}
-
+
+ /* strip off the CRLF sequence */
+ while (nread > 0 && ret[nread] != '\r')
+ ret[nread--] = '\0';
+ ret[nread] = '\0';
+
+ *dest = ret;
+
#if d(!)0
if (camel_verbose_debug)
fprintf (stderr, "received: %s\n", *dest);
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index f1be74b4a9..e615453198 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -276,10 +276,10 @@ imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex)
*/
length--;
}
-
+
/* Add the length of the post-literal line. */
- fulllen += strlen (line);
-
+ fulllen += n;
+
/* p points to the "{" in the line that starts the literal.
* The length of the CR-less response must be less than or
* equal to the length of the response with CRs, therefore
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index 584cd1e754..0b947e07da 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -638,9 +638,6 @@ imap_parse_nstring (char **str_p, int *len)
return NULL;
}
- /* capture up until the end of the line - byte count may be a little off */
- for ( ; *(str + *len) && *(str + *len) != '\n'; (*len)++);
-
out = g_strndup (str, *len);
*str_p = str + *len;
return out;