From cc02864d30f57dc863af024f28dd6083f67fba17 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 15 Sep 2005 17:59:15 +0000 Subject: [PATCH] No strtok_r() in Microsoft's C library, but strtok() is MT-safe, which is 2005-09-15 Tor Lillqvist * camel-imap-store.c: No strtok_r() in Microsoft's C library, but strtok() is MT-safe, which is enough for the way it's used in this file, to tokenize only one string at a time. (connect_to_server_process, connect_to_server_wrapper): Using custom commands to connect to IMAP servers is not supported on Win32 (at least for now), so bypass that code. --- camel/providers/imap/ChangeLog | 8 +++++++- camel/providers/imap/camel-imap-store.c | 21 +++++++++++++++++++-- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/camel/providers/imap/ChangeLog b/camel/providers/imap/ChangeLog index 1cdc78b..3031041 100644 --- a/camel/providers/imap/ChangeLog +++ b/camel/providers/imap/ChangeLog @@ -7,10 +7,16 @@ need ASCII casefolding only. * camel-imap-folder.c - * camel-imap-search.c: No strtok_r() in Microsoft's C library, but + * camel-imap-search.c + * camel-imap-store.c: No strtok_r() in Microsoft's C library, but strtok() is MT-safe, which is enough for the way it's used in this file, to tokenize only one string at a time. + * camel-imap-store.c (connect_to_server_process, + connect_to_server_wrapper): Using custom commands to connect to + IMAP servers is not supported on Win32 (at least for now), so + bypass that code. + 2005-08-23 Shreyas Srinivasan ** See #314199 diff --git a/camel/providers/imap/camel-imap-store.c b/camel/providers/imap/camel-imap-store.c index d842b38..c807db2 100644 --- a/camel/providers/imap/camel-imap-store.c +++ b/camel/providers/imap/camel-imap-store.c @@ -68,6 +68,14 @@ #define IMAP_PORT "143" #define IMAPS_PORT "993" +#ifdef G_OS_WIN32 +/* The strtok() in Microsoft's C library is MT-safe (but still uses + * only one buffer pointer per thread, but for the use of strtok_r() + * here that's enough). + */ +#define strtok_r(s,sep,lasts) (*(lasts)=strtok((s),(sep))) +#endif + static CamelDiscoStoreClass *parent_class = NULL; static char imap_tag_prefix = 'A'; @@ -746,6 +754,10 @@ connect_to_server (CamelService *service, struct addrinfo *ai, int ssl_mode, Cam return FALSE; } +#ifndef G_OS_WIN32 + +/* Using custom commands to connect to IMAP servers is not supported on Win32 */ + static gboolean connect_to_server_process (CamelService *service, const char *cmd, CamelException *ex) { @@ -889,6 +901,8 @@ connect_to_server_process (CamelService *service, const char *cmd, CamelExceptio } +#endif + static struct { char *value; char *serv; @@ -905,16 +919,19 @@ static struct { static gboolean connect_to_server_wrapper (CamelService *service, CamelException *ex) { - const char *command, *ssl_mode; + const char *ssl_mode; struct addrinfo hints, *ai; int mode, ret, i; char *serv; const char *port; +#ifndef G_OS_WIN32 + const char *command; + if (camel_url_get_param(service->url, "use_command") && (command = camel_url_get_param(service->url, "command"))) return connect_to_server_process(service, command, ex); - +#endif if ((ssl_mode = camel_url_get_param (service->url, "use_ssl"))) { for (i = 0; ssl_options[i].value; i++) if (!strcmp (ssl_options[i].value, ssl_mode)) -- 2.7.4