On Win32, NSS wants the directory name in system codepage, not UTF-8. No
authorTor Lillqvist <tml@novell.com>
Thu, 15 Jun 2006 20:50:17 +0000 (20:50 +0000)
committerTor Lillqvist <tml@src.gnome.org>
Thu, 15 Jun 2006 20:50:17 +0000 (20:50 +0000)
2006-06-15  Tor Lillqvist  <tml@novell.com>

* camel.c (camel_init): On Win32, NSS wants the directory name in
system codepage, not UTF-8. No need to handle g_atexit()
differently on Win32 any longer, in current GLib it is on Win32
just a #define for atexit().

camel/ChangeLog
camel/camel.c

index d626b85..0bbfd66 100644 (file)
@@ -1,3 +1,10 @@
+2006-06-15  Tor Lillqvist  <tml@novell.com>
+
+       * camel.c (camel_init): On Win32, NSS wants the directory name in
+       system codepage, not UTF-8. No need to handle g_atexit()
+       differently on Win32 any longer, in current GLib it is on Win32
+       just a #define for atexit().
+
 2006-06-15  Andre Klapper  <a9016009@gmx.de>
 
        * camel-gpg-context.c: 
index 6ce755c..06bd1e6 100644 (file)
@@ -89,16 +89,24 @@ camel_init (const char *configdir, gboolean nss_init)
 
 #ifdef HAVE_NSS
        if (nss_init) {
+               char *nss_configdir;
+
                PR_Init (PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 10);
                
-               if (NSS_InitReadWrite (configdir) == SECFailure) {
+#ifndef G_OS_WIN32
+               nss_configdir = g_strdup (configdir);
+#else
+               nss_configdir = g_win32_locale_filename_from_utf8 (configdir);
+#endif
+
+               if (NSS_InitReadWrite (nss_configdir) == SECFailure) {
                        /* fall back on using volatile dbs? */
-                       if (NSS_NoDB_Init (configdir) == SECFailure) {
+                       if (NSS_NoDB_Init (nss_configdir) == SECFailure) {
                                g_warning ("Failed to initialize NSS");
                                return -1;
                        }
                }
-               
+
                NSS_SetDomesticPolicy ();
                
                SSL_OptionSetDefault (SSL_ENABLE_SSL2, PR_TRUE);
@@ -121,22 +129,7 @@ camel_init (const char *configdir, gboolean nss_init)
        
        camel_object_unref (certdb);
        
-#ifndef G_OS_WIN32
        g_atexit (camel_shutdown);
-#else
-       /* In GLib (<= 2.8.0 at least, might get fixed later),
-        * g_atexit() is a function in the GLib DLL that calls the
-        * atexit() in the C runtime DLL. atexit() is implemented so
-        * that registered function will be called when the DLL
-        * containing the calling function is being detached from a
-        * process (not when exit() is called).
-        *
-        * We want to run camel_shutdown when the the process exits,
-        * or at least when the camel DLL is being detached, not when
-        * the GLib DLL is being detached.
-        */
-       atexit (camel_shutdown);
-#endif
        
        initialised = TRUE;