2001-08-10 Jeffrey Stedfast <fejj@ximian.com>
+ * providers/imap/camel-imap-utils.c (imap_quote_string): Added an
+ assert - at this point a backtrace would be more useful than a
+ transaction log for debugging.
+
* providers/imap/camel-imap-command.c (imap_command_start): Return
FALSE here, not NULL.
-
+
* providers/imap/camel-imap-folder.c (imap_rescan): Don't
g_strdup() the uid into the trigger_event call.
*body_p = body;
}
+static void
+strip (char *str, char c)
+{
+ char *src, *dst;
+
+ for (src = dst = str; *src; src++)
+ if (*src != c)
+ *dst++ = *src;
+ *dst = '\0';
+}
+
/**
* imap_quote_string:
* @str: the string to quote, which must not contain CR or LF
char *quoted, *q;
int len;
+ g_assert (strchr (str, '\r') == NULL);
+
len = strlen (str);
p = str;
while ((p = strpbrk (p, "\"\\"))) {
quoted = q = g_malloc (len + 3);
*q++ = '"';
- while ((p = strpbrk (str, "\"\\"))) {
- memcpy (q, str, p - str);
- q += p - str;
- *q++ = '\\';
+ for (p = str; *p; ) {
+ if (strchr ("\"\\", *p))
+ *q++ = '\\';
*q++ = *p++;
- str = p;
}
- sprintf (q, "%s\"", str);
+ *q++ = '"';
+ *q = '\0';
return quoted;
}