Jelajahi Sumber

Fix g_get_charset for windows.

	Patch by Horst Kakuschke that fixes bug #660412.
Gonzalo Paniagua Javier 15 tahun lalu
induk
melakukan
34c0e89ebd
1 mengubah file dengan 6 tambahan dan 6 penghapusan
  1. 6 6
      eglib/src/gunicode.c

+ 6 - 6
eglib/src/gunicode.c

@@ -300,13 +300,13 @@ g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gs
 gboolean
 g_get_charset (G_CONST_RETURN char **charset)
 {
+	if (my_charset == NULL) {
 #ifdef G_OS_WIN32
-	static char buf[14];
-	sprintf (buf, "CP%u", GetACP ());
-	*charset = buf;
-	is_utf8 = FALSE;
+		static char buf [14];
+		sprintf (buf, "CP%u", GetACP ());
+		my_charset = buf;
+		is_utf8 = FALSE;
 #else
-	if (my_charset == NULL){
 		/* These shouldn't be heap allocated */
 #if HAVE_LOCALCHARSET_H
 		my_charset = locale_charset ();
@@ -316,12 +316,12 @@ g_get_charset (G_CONST_RETURN char **charset)
 		my_charset = "UTF-8";
 #endif
 		is_utf8 = strcmp (my_charset, "UTF-8") == 0;
+#endif
 	}
 	
 	if (charset != NULL)
 		*charset = my_charset;
 
-#endif
 	return is_utf8;
 }