aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2001-08-11 06:07:46 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2001-08-11 06:07:46 +0800
commita16770842e12da0e527eeff70be3cdcc9075e1bb (patch)
treed765e2e4405d9b18bde03891ef5e286cad82a5f3
parent1a6ecd207d5ce8bcb93613ebedeb56b979e8906f (diff)
downloadgsoc2013-evolution-a16770842e12da0e527eeff70be3cdcc9075e1bb.tar
gsoc2013-evolution-a16770842e12da0e527eeff70be3cdcc9075e1bb.tar.gz
gsoc2013-evolution-a16770842e12da0e527eeff70be3cdcc9075e1bb.tar.bz2
gsoc2013-evolution-a16770842e12da0e527eeff70be3cdcc9075e1bb.tar.lz
gsoc2013-evolution-a16770842e12da0e527eeff70be3cdcc9075e1bb.tar.xz
gsoc2013-evolution-a16770842e12da0e527eeff70be3cdcc9075e1bb.tar.zst
gsoc2013-evolution-a16770842e12da0e527eeff70be3cdcc9075e1bb.zip
Added an assert - at this point a backtrace would be more useful than a
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. svn path=/trunk/; revision=11902
-rw-r--r--camel/ChangeLog6
-rw-r--r--camel/providers/imap/camel-imap-command.c1
-rw-r--r--camel/providers/imap/camel-imap-utils.c24
3 files changed, 24 insertions, 7 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index e64ba22187..baed2cf800 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,8 +1,12 @@
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.
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index 6dae25af85..9dcc56cbf8 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -720,6 +720,7 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt,
strlen (string), string);
} else {
char *quoted = imap_quote_string (string);
+
op += sprintf (op, "%s", quoted);
g_free (quoted);
}
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index 648712a6ad..a449ea228d 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -549,6 +549,17 @@ imap_parse_body (char **body_p, CamelFolder *folder,
*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
@@ -563,6 +574,8 @@ imap_quote_string (const char *str)
char *quoted, *q;
int len;
+ g_assert (strchr (str, '\r') == NULL);
+
len = strlen (str);
p = str;
while ((p = strpbrk (p, "\"\\"))) {
@@ -572,14 +585,13 @@ imap_quote_string (const char *str)
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;
}