Build mono runtime under none desktop Windows API family, adjustments and cleanup.
[mono.git] / eglib / src / gunicode.c
index e6f4b925b61c0eeb2b063a5c686ca7941fd0d0d5..c1280f9b8bf287517374552620b1b3e2f87fff4d 100644 (file)
 #include <unicode-data.h>
 #include <errno.h>
 
-#if defined(_MSC_VER) || defined(G_OS_WIN32)
-/* FIXME */
-#  define CODESET 1
-#  include <windows.h>
-#else
-#    ifdef HAVE_LANGINFO_H
-#       include <langinfo.h>
-#    endif
+#ifndef G_OS_WIN32
 #    ifdef HAVE_LOCALCHARSET_H
 #       include <localcharset.h>
 #    endif
 #endif
 
-static const char *my_charset;
-static gboolean is_utf8;
+const char *my_charset;
 
 /*
  * Character set conversion
@@ -208,26 +200,20 @@ g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gs
        return res;
 }
 
+#ifndef G_OS_WIN32
+static gboolean is_utf8;
+
 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 ());
-               my_charset = buf;
-               is_utf8 = FALSE;
-#else
                /* These shouldn't be heap allocated */
-#if defined(HAVE_LANGINFO_H)
-               my_charset = nl_langinfo (CODESET);
-#elif defined(HAVE_LOCALCHARSET_H)
+#if defined(HAVE_LOCALCHARSET_H)
                my_charset = locale_charset ();
 #else
                my_charset = "UTF-8";
 #endif
                is_utf8 = strcmp (my_charset, "UTF-8") == 0;
-#endif
        }
        
        if (charset != NULL)
@@ -235,6 +221,7 @@ g_get_charset (G_CONST_RETURN char **charset)
 
        return is_utf8;
 }
+#endif /* G_OS_WIN32 */
 
 gchar *
 g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)