Commit 714887d0 authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist

glib/glib.symbols glib/gutils.h Make also g_getenv(), g_setenv(),

2005-01-01  Tor Lillqvist  <tml@iki.fi>

	* glib/glib.symbols
	* glib/gutils.h
	* glib/gutils.c: Make also g_getenv(), g_setenv(), g_unsetenv()
	and g_find_program_in_path() take and return UTF-8 strings on
	Win32. Implement DLL ABI backward compatility for them, too. Move
	all the DLL ABI stability wrappers to the end of the file. Use
	wide character API when available in inner_find_program_in_path().

	* glib/gfileutils.c: With the UTF-8ness of g_getenv() above, just
	use g_getenv() to get PATHEXT. (Yeah, it's probably overdoing it
	to consider somebody actually having anything else than ASCII
	in PATHEXT, but...)
parent 7e6be89c
2005-01-01 Tor Lillqvist <tml@iki.fi>
* glib/glib.symbols
* glib/gutils.h
* glib/gutils.c: Make also g_getenv(), g_setenv(), g_unsetenv()
and g_find_program_in_path() take and return UTF-8 strings on
Win32. Implement DLL ABI backward compatility for them, too. Move
all the DLL ABI stability wrappers to the end of the file. Use
wide character API when available in inner_find_program_in_path().
* glib/gfileutils.c: With the UTF-8ness of g_getenv() above, just
use g_getenv() to get PATHEXT. (Yeah, it's probably overdoing it
to consider somebody actually having anything else than ASCII
in PATHEXT, but...)
2004-12-31 Tor Lillqvist <tml@iki.fi>
* glib/gfileutils.c (g_file_test): Rewrite the Win32 version to
......
2005-01-01 Tor Lillqvist <tml@iki.fi>
* glib/glib.symbols
* glib/gutils.h
* glib/gutils.c: Make also g_getenv(), g_setenv(), g_unsetenv()
and g_find_program_in_path() take and return UTF-8 strings on
Win32. Implement DLL ABI backward compatility for them, too. Move
all the DLL ABI stability wrappers to the end of the file. Use
wide character API when available in inner_find_program_in_path().
* glib/gfileutils.c: With the UTF-8ness of g_getenv() above, just
use g_getenv() to get PATHEXT. (Yeah, it's probably overdoing it
to consider somebody actually having anything else than ASCII
in PATHEXT, but...)
2004-12-31 Tor Lillqvist <tml@iki.fi>
* glib/gfileutils.c (g_file_test): Rewrite the Win32 version to
......
2005-01-01 Tor Lillqvist <tml@iki.fi>
* glib/glib.symbols
* glib/gutils.h
* glib/gutils.c: Make also g_getenv(), g_setenv(), g_unsetenv()
and g_find_program_in_path() take and return UTF-8 strings on
Win32. Implement DLL ABI backward compatility for them, too. Move
all the DLL ABI stability wrappers to the end of the file. Use
wide character API when available in inner_find_program_in_path().
* glib/gfileutils.c: With the UTF-8ness of g_getenv() above, just
use g_getenv() to get PATHEXT. (Yeah, it's probably overdoing it
to consider somebody actually having anything else than ASCII
in PATHEXT, but...)
2004-12-31 Tor Lillqvist <tml@iki.fi>
* glib/gfileutils.c (g_file_test): Rewrite the Win32 version to
......
2005-01-01 Tor Lillqvist <tml@iki.fi>
* glib/glib.symbols
* glib/gutils.h
* glib/gutils.c: Make also g_getenv(), g_setenv(), g_unsetenv()
and g_find_program_in_path() take and return UTF-8 strings on
Win32. Implement DLL ABI backward compatility for them, too. Move
all the DLL ABI stability wrappers to the end of the file. Use
wide character API when available in inner_find_program_in_path().
* glib/gfileutils.c: With the UTF-8ness of g_getenv() above, just
use g_getenv() to get PATHEXT. (Yeah, it's probably overdoing it
to consider somebody actually having anything else than ASCII
in PATHEXT, but...)
2004-12-31 Tor Lillqvist <tml@iki.fi>
* glib/gfileutils.c (g_file_test): Rewrite the Win32 version to
......
2005-01-01 Tor Lillqvist <tml@iki.fi>
* glib/glib.symbols
* glib/gutils.h
* glib/gutils.c: Make also g_getenv(), g_setenv(), g_unsetenv()
and g_find_program_in_path() take and return UTF-8 strings on
Win32. Implement DLL ABI backward compatility for them, too. Move
all the DLL ABI stability wrappers to the end of the file. Use
wide character API when available in inner_find_program_in_path().
* glib/gfileutils.c: With the UTF-8ness of g_getenv() above, just
use g_getenv() to get PATHEXT. (Yeah, it's probably overdoing it
to consider somebody actually having anything else than ASCII
in PATHEXT, but...)
2004-12-31 Tor Lillqvist <tml@iki.fi>
* glib/gfileutils.c (g_file_test): Rewrite the Win32 version to
......
......@@ -146,7 +146,7 @@ g_file_test (const gchar *filename,
if (test & G_FILE_TEST_IS_EXECUTABLE)
{
const gchar *lastdot = strrchr (filename, '.');
gchar *pathext = NULL, *tem, *p;
const gchar *pathext = NULL, *p;
int extlen;
if (lastdot == NULL)
......@@ -160,53 +160,11 @@ g_file_test (const gchar *filename,
/* Check if it is one of the types listed in %PATHEXT% */
/* Perhaps unfortunately, g_getenv() doesn't return UTF-8, but
* system codepage. And _wgetenv() isn't useful either, as the C
* runtime just keeps system codepage versions of the
* environment variables in applications that aren't built
* specially. So use GetEnvironmentVariableW().
*/
if (G_WIN32_HAVE_WIDECHAR_API ())
{
wchar_t dummy[2], *wvar;
int len;
len = GetEnvironmentVariableW (L"PATHEXT", dummy, 2);
if (len == 0)
return FALSE;
wvar = g_new (wchar_t, len);
if (GetEnvironmentVariableW (L"PATHEXT", wvar, len) == len - 1)
pathext = g_utf16_to_utf8 (wvar, -1, NULL, NULL, NULL);
g_free (wvar);
}
else
{
gchar dummy[2], *cpvar;
int len;
len = GetEnvironmentVariableA ("PATHEXT", dummy, 2);
if (len == 0)
return FALSE;
cpvar = g_new (gchar, len);
if (GetEnvironmentVariableA ("PATHEXT", cpvar, len) == len - 1)
pathext = g_locale_to_utf8 (cpvar, -1, NULL, NULL, NULL);
g_free (cpvar);
}
pathext = g_getenv ("PATHEXT");
if (pathext == NULL)
return FALSE;
tem = pathext;
pathext = g_utf8_casefold (pathext, -1);
g_free (tem);
lastdot = g_utf8_casefold (lastdot, -1);
extlen = strlen (lastdot);
......@@ -214,13 +172,13 @@ g_file_test (const gchar *filename,
p = pathext;
while (TRUE)
{
gchar *q = strchr (p, ';');
const gchar *q = strchr (p, ';');
if (q == NULL)
q = p + strlen (p);
if (extlen == q - p &&
memcmp (lastdot, p, extlen) == 0)
{
g_free (pathext);
g_free ((gchar *) pathext);
g_free ((gchar *) lastdot);
return TRUE;
}
......@@ -230,7 +188,7 @@ g_file_test (const gchar *filename,
break;
}
g_free (pathext);
g_free ((gchar *) pathext);
g_free ((gchar *) lastdot);
return FALSE;
}
......
......@@ -195,7 +195,10 @@ g_file_test PRIVATE
#ifdef G_OS_WIN32
g_file_test_utf8
#endif
g_find_program_in_path
g_find_program_in_path PRIVATE
#ifdef G_OS_WIN32
g_find_program_in_path_utf8
#endif
g_fopen
g_fprintf G_GNUC_PRINTF(2,3)
g_free
......@@ -208,7 +211,10 @@ g_get_current_dir_utf8
#endif
g_get_current_time
g_get_filename_charsets
g_getenv
g_getenv PRIVATE
#ifdef G_OS_WIN32
g_getenv_utf8
#endif
g_get_home_dir PRIVATE
#ifdef G_OS_WIN32
g_get_home_dir_utf8
......@@ -645,7 +651,10 @@ g_scanner_sync_file_offset
g_scanner_unexp_token
g_scanner_warn G_GNUC_PRINTF(2,3)
g_set_application_name
g_setenv
g_setenv PRIVATE
#ifdef G_OS_WIN32
g_setenv_utf8
#endif
g_set_error G_GNUC_PRINTF(4,5)
g_set_prgname
g_set_printerr_handler
......@@ -882,7 +891,10 @@ g_unichar_xdigit_value G_GNUC_CONST
g_unicode_canonical_decomposition G_GNUC_MALLOC
g_unicode_canonical_ordering
g_unlink
g_unsetenv
g_unsetenv PRIVATE
#ifdef G_OS_WIN32
g_unsetenv_utf8
#endif
g_uri_list_extract_uris G_GNUC_MALLOC
g_usleep
g_utf16_to_ucs4 G_GNUC_MALLOC
......
This diff is collapsed.
......@@ -192,6 +192,13 @@ void g_nullify_pointer (gpointer *nullify_location);
/* return the environment string for the variable. The returned memory
* must not be freed. */
#ifdef G_OS_WIN32
#define g_getenv g_getenv_utf8
#define g_setenv g_setenv_utf8
#define g_unsetenv g_unsetenv_utf8
#define g_find_program_in_path g_find_program_in_path_utf8
#endif
G_CONST_RETURN gchar* g_getenv (const gchar *variable);
gboolean g_setenv (const gchar *variable,
const gchar *value,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment