Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:hiberis:mingw:win64
mingw64-glib2
glib-2.30.0-Add-g_win32_get_utf8_argv.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File glib-2.30.0-Add-g_win32_get_utf8_argv.patch of Package mingw64-glib2
diff -Naur glib-2.30.0/docs/reference/glib/glib-sections.txt glib-2.30.0.new/docs/reference/glib/glib-sections.txt --- glib-2.30.0/docs/reference/glib/glib-sections.txt 2011-09-26 22:54:50.000000000 +0200 +++ glib-2.30.0.new/docs/reference/glib/glib-sections.txt 2011-10-04 12:24:22.438914324 +0200 @@ -1940,6 +1940,7 @@ g_win32_get_package_installation_subdirectory g_win32_get_windows_version g_win32_locale_filename_from_utf8 +g_win32_get_utf8_argv G_WIN32_DLLMAIN_FOR_DLL_NAME G_WIN32_HAVE_WIDECHAR_API G_WIN32_IS_NT_BASED diff -Naur glib-2.30.0/glib/glib.symbols glib-2.30.0.new/glib/glib.symbols --- glib-2.30.0/glib/glib.symbols 2011-09-26 22:54:50.000000000 +0200 +++ glib-2.30.0.new/glib/glib.symbols 2011-10-04 12:24:22.438914324 +0200 @@ -1565,6 +1565,7 @@ g_win32_get_windows_version g_win32_getlocale g_win32_locale_filename_from_utf8 +g_win32_get_utf8_argv #endif g_hostname_is_non_ascii g_hostname_is_ascii_encoded diff -Naur glib-2.30.0/glib/gwin32.c glib-2.30.0.new/glib/gwin32.c --- glib-2.30.0/glib/gwin32.c 2011-09-26 22:54:50.000000000 +0200 +++ glib-2.30.0.new/glib/gwin32.c 2011-10-04 12:24:22.442914345 +0200 @@ -594,3 +594,63 @@ } return retval; } + +/** + * g_win32_get_utf8_argv(): + * @expand_wildcards: %TRUE if wildcards should be expanded. + * @argc: (allow-none): a location to store the array length + * + * Creates an array containing the Windows Unicode command line arguments + * retrieved with __wgetmainargs. + * + * Unlike the arguments that the system passes to main and WinMain, + * the Unicode command line contains sufficient information + * to correctly open files with names that are not representable + * in the system codepage. This situation can arise when e.g. files + * with Chinese names are opened on an English version of Windows. + * + * Returns: (array length=argc) (element-type utf-8): the newly allocated array of + * command line arguments + * + * Since: 2.26 + */ + +typedef struct { + int newmode; +} _startupinfo; + +extern void __wgetmainargs(int *argc, + wchar_t ***wargv, + wchar_t ***wenviron, + int expand_wildcards, + _startupinfo *startupinfo); + +gchar** +g_win32_get_utf8_argv (gboolean expand_wildcards, gint *argc) +{ + gchar **argv; + wchar_t **wargv, **wenviron; + gint i, n; + int dowildcard; + + if (expand_wildcards) + dowildcard = -1; + else + dowildcard = 0; + + _startupinfo si = { 0 }; + + __wgetmainargs (&n, &wargv, &wenviron, dowildcard, &si); + + if (argc) + *argc = n; + + argv = g_new0 (gchar *, n + 1); + + for (i = 0; i < n; ++i) + argv[i] = g_utf16_to_utf8 ((gunichar2 *) wargv[i], -1, NULL, NULL, NULL); + argv[n] = NULL; + + return argv; +} + diff -Naur glib-2.30.0/glib/gwin32.h glib-2.30.0.new/glib/gwin32.h --- glib-2.30.0/glib/gwin32.h 2011-09-09 21:58:10.000000000 +0200 +++ glib-2.30.0.new/glib/gwin32.h 2011-10-04 12:24:22.442914345 +0200 @@ -105,6 +105,8 @@ gchar* g_win32_locale_filename_from_utf8 (const gchar *utf8filename); +gchar** g_win32_get_utf8_argv (gboolean expand_wildcards, gint *argc); + /* As of GLib 2.14 we only support NT-based Windows */ #define G_WIN32_IS_NT_BASED() TRUE #define G_WIN32_HAVE_WIDECHAR_API() TRUE
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor