mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 23:16:14 +01:00
Separate implementation on Win32: Use the wide character API on NT-based
2006-03-01 Tor Lillqvist <tml@novell.com> * glib/gutils.c (g_listenv): Separate implementation on Win32: Use the wide character API on NT-based Windows. Return UTF-8 strings. * glib/glib.symbols: Don't mark g_listenv as PRIVATE, as that meant it wasn't present in the import library. PRIVATE is used only for the backwards-compatibility DLL ABI stability hacks.
This commit is contained in:
parent
4aff4bfa55
commit
5a2950d041
@ -1,3 +1,12 @@
|
||||
2006-03-01 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gutils.c (g_listenv): Separate implementation on Win32: Use
|
||||
the wide character API on NT-based Windows. Return UTF-8 strings.
|
||||
|
||||
* glib/glib.symbols: Don't mark g_listenv as PRIVATE, as that
|
||||
meant it wasn't present in the import library. PRIVATE is used
|
||||
only for the backwards-compatibility DLL ABI stability hacks.
|
||||
|
||||
2006-02-24 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* configure.in: Bump version
|
||||
|
@ -1,3 +1,12 @@
|
||||
2006-03-01 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gutils.c (g_listenv): Separate implementation on Win32: Use
|
||||
the wide character API on NT-based Windows. Return UTF-8 strings.
|
||||
|
||||
* glib/glib.symbols: Don't mark g_listenv as PRIVATE, as that
|
||||
meant it wasn't present in the import library. PRIVATE is used
|
||||
only for the backwards-compatibility DLL ABI stability hacks.
|
||||
|
||||
2006-02-24 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* configure.in: Bump version
|
||||
|
@ -1,3 +1,12 @@
|
||||
2006-03-01 Tor Lillqvist <tml@novell.com>
|
||||
|
||||
* glib/gutils.c (g_listenv): Separate implementation on Win32: Use
|
||||
the wide character API on NT-based Windows. Return UTF-8 strings.
|
||||
|
||||
* glib/glib.symbols: Don't mark g_listenv as PRIVATE, as that
|
||||
meant it wasn't present in the import library. PRIVATE is used
|
||||
only for the backwards-compatibility DLL ABI stability hacks.
|
||||
|
||||
2006-02-24 Matthias Clasen <mclasen@redhat.com>
|
||||
|
||||
* configure.in: Bump version
|
||||
|
@ -1239,7 +1239,7 @@ g_unsetenv PRIVATE
|
||||
g_get_home_dir PRIVATE
|
||||
g_get_host_name
|
||||
g_setenv PRIVATE
|
||||
g_listenv PRIVATE
|
||||
g_listenv
|
||||
#ifdef G_OS_WIN32
|
||||
g_find_program_in_path_utf8
|
||||
g_get_current_dir_utf8
|
||||
|
@ -1406,6 +1406,7 @@ g_unsetenv (const gchar *variable)
|
||||
gchar **
|
||||
g_listenv (void)
|
||||
{
|
||||
#ifndef G_OS_WIN32
|
||||
gchar **result, *eq;
|
||||
gint len, i, j;
|
||||
|
||||
@ -1423,6 +1424,73 @@ g_listenv (void)
|
||||
result[j] = NULL;
|
||||
|
||||
return result;
|
||||
#else
|
||||
gchar **result, *eq;
|
||||
gint len = 0, i, j;
|
||||
|
||||
if (G_WIN32_HAVE_WIDECHAR_API ())
|
||||
{
|
||||
wchar_t *p, *q;
|
||||
|
||||
p = (wchar_t *) GetEnvironmentStringsW ();
|
||||
if (p != NULL)
|
||||
{
|
||||
q = p;
|
||||
while (*q)
|
||||
{
|
||||
q += wcslen (q) + 1;
|
||||
len++;
|
||||
}
|
||||
}
|
||||
result = g_new0 (gchar *, len + 1);
|
||||
|
||||
j = 0;
|
||||
q = p;
|
||||
while (*q)
|
||||
{
|
||||
result[j] = g_utf16_to_utf8 (q, -1, NULL, NULL, NULL);
|
||||
if (result[j] != NULL)
|
||||
{
|
||||
eq = strchr (result[j], '=');
|
||||
if (eq && eq > result[j])
|
||||
{
|
||||
*eq = '\0';
|
||||
j++;
|
||||
}
|
||||
else
|
||||
g_free (result[j]);
|
||||
}
|
||||
q += wcslen (q) + 1;
|
||||
}
|
||||
result[j] = NULL;
|
||||
FreeEnvironmentStringsW (p);
|
||||
}
|
||||
else
|
||||
{
|
||||
len = g_strv_length (environ);
|
||||
result = g_new0 (gchar *, len + 1);
|
||||
|
||||
j = 0;
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
result[j] = g_locale_to_utf8 (environ[i], -1, NULL, NULL, NULL);
|
||||
if (result[j] != NULL)
|
||||
{
|
||||
eq = strchr (result[j], '=');
|
||||
if (eq && eq > result[j])
|
||||
{
|
||||
*eq = '\0';
|
||||
j++;
|
||||
}
|
||||
else
|
||||
g_free (result[j]);
|
||||
}
|
||||
}
|
||||
result[j] = NULL;
|
||||
}
|
||||
|
||||
return result;
|
||||
#endif
|
||||
}
|
||||
|
||||
G_LOCK_DEFINE_STATIC (g_utils_global);
|
||||
|
Loading…
Reference in New Issue
Block a user