No strtok_r() in Microsoft's C library, but strtok() is MT-safe, which is
authorTor Lillqvist <tml@novell.com>
Thu, 15 Sep 2005 17:59:15 +0000 (17:59 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 15 Sep 2005 17:59:15 +0000 (17:59 +0000)
2005-09-15  Tor Lillqvist  <tml@novell.com>

* 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
camel/providers/imap/camel-imap-store.c

index 1cdc78b..3031041 100644 (file)
@@ -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  <sshreyas@novell.com>
 
        ** See #314199
index d842b38..c807db2 100644 (file)
 #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))