Commit 129ed8a0 authored by Nirbheek Chauhan's avatar Nirbheek Chauhan 🐜
Browse files

glib.recipe: Add patches for WinRT/UWP compatibility

Upstreaming these is going to be a long-ish road, so put the patches
in a subdir so it doesn't bother people.

Part-of: <!497>
parent d8a6ba9d
......@@ -46,6 +46,8 @@ class Recipe(recipe.Recipe):
'glib/0001-meson-host_system-can-be-ios-when-cross-compiling.patch',
'glib/0002-meson-Autodetect-when-building-for-iOS.patch',
'glib/0003-meson-Only-look-for-_NSGetEnviron-when-building-for-.patch',
# https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1522
'glib/0001-meson-Fix-gnulib-printf-checks.patch',
]
files_libs = [
......@@ -77,7 +79,7 @@ class Recipe(recipe.Recipe):
'include/glib-2.0',
'share/aclocal/glib-2.0.m4',
'share/aclocal/glib-gettext.m4'
]
]
platform_files_devel = {
Platform.WINDOWS: ['lib/pkgconfig/gio-windows-2.0.pc', 'include/gio-win32-2.0'],
Platform.LINUX: ['lib/pkgconfig/gio-unix-2.0.pc', 'include/gio-unix-2.0'],
......@@ -127,6 +129,38 @@ class Recipe(recipe.Recipe):
# Want secure versions of stdlib functions. Glib already defines
# _WIN32_WINNT, so undefine it on the cmdline to avoid warnings
self.append_env('CFLAGS', '-DMINGW_HAS_SECURE_API=1', '-U_WIN32_WINNT')
# TODO: upstream
if self.config.variants.uwp:
# gdbus is completely disabled at present
self.files_bins.remove('gdbus')
self.files_bins_devel.remove('bin/gdbus.pdb')
self.patches += [
# Ready to upstream
'glib/uwp/0001-gio-Remove-broken-support-for-XP.patch',
'glib/uwp/0002-win_iconv-Use-LoadPackagedLibrary-when-building-UWP-.patch',
'glib/uwp/0003-glib-getpid-is-available-on-Win32-but-not-WinRT.patch',
'glib/uwp/0004-goption-Do-not-call-GetCommandlineW-on-UWP.patch',
'glib/uwp/0005-gmodule-Fix-some-more-WinRT-incompatibilities.patch',
'glib/uwp/0006-gutils-Can-t-fetch-the-username-on-UWP.patch',
'glib/uwp/0007-gutils-GetWindowsDirectory-is-not-available-on-WinRT.patch',
'glib/uwp/0008-glocalfile-File-user-info-is-not-supported-on-WinRT.patch',
'glib/uwp/0009-gwin32-Stub-out-all-version-checking-on-WinRT.patch',
'glib/uwp/0010-gutils-GetModuleHandle-is-not-available-on-WinRT.patch',
'glib/uwp/0011-gsocket-if_nametoindex-is-not-available-on-WinRT.patch',
'glib/uwp/0012-gio-ginetaddress-Fix-build-on-WinRT.patch',
# Need some more work
'glib/uwp/0013-WIP-UPSTREAM-glib-Specify-noreturn-prototype-for-MSV.patch',
'glib/uwp/0014-WIP-gspawn-Do-not-allow-spawning-or-making-pipes-on-.patch',
'glib/uwp/0015-WIP-glib-giowin32-Disallow-invalid-usage-of-GIOChann.patch',
'glib/uwp/0016-WIP-glocalfile-Trash-as-a-concept-does-not-exist-on-.patch',
'glib/uwp/0020-WIP-glib-Implement-get_special_folder-for-UWP-apps.patch',
'glib/uwp/0021-WIP-gtimezone-Partially-port-to-WinRT.patch',
# Need a lot more work
'glib/uwp/0017-TODO-gdate-gstdio-Abort-when-trying-to-use-unsupport.patch',
'glib/uwp/0018-gio-Disable-win32-API-and-modules-when-unavailable-o.patch',
'glib/uwp/0019-TODO-gdbus-Completely-disable-when-building-for-WinR.patch',
'glib/uwp/0022-TODO-gio-gcontenttype-Needs-porting-to-WinRT-model.patch',
]
elif self.config.target_platform in [Platform.DARWIN, Platform.IOS]:
self.files_devel.append(os.path.join('lib', 'glib-2.0', 'include', '*', 'glibconfig.h'))
arch = self.config.target_arch
......
From dade900c537bcdc54910a679c25368573f0e8c61 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Mon, 8 Jun 2020 18:43:04 +0530
Subject: [PATCH] meson: Fix gnulib printf checks
Some typos, and accidental usage of the strings `'true'` / `'false'`
instead of the booleans `true` / `false`.
---
.../meson.build | 20 +++++++++----------
glib/meson.build | 2 +-
2 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/glib/gnulib/gl_cv_func_printf_infinite_long_double/meson.build b/glib/gnulib/gl_cv_func_printf_infinite_long_double/meson.build
index b7a714c..509e781 100644
--- a/glib/gnulib/gl_cv_func_printf_infinite_long_double/meson.build
+++ b/glib/gnulib/gl_cv_func_printf_infinite_long_double/meson.build
@@ -170,41 +170,39 @@ if gl_cv_func_printf_long_double
if not meson.is_cross_build() or meson.has_exe_wrapper()
run_result = cc.run(printf_infinite_long_double_test,
name : 'printf supports infinite \'long double\' arguments')
- gl_cv_func_printf_infinite_long_double = (run_result.compiled() and run_result.returncode() == 0) ? 'true' : 'false'
+ gl_cv_func_printf_infinite_long_double = (run_result.compiled() and run_result.returncode() == 0)
else
if host_machine.cpu_family() == 'x86_64'
- gl_cv_func_printf_infinite_long_double = 'false'
+ gl_cv_func_printf_infinite_long_double = false
else
if host_system == 'linux'
- gl_cv_func_printf_infinite_long_double = 'true'
+ gl_cv_func_printf_infinite_long_double = true
elif (host_system.startswith ('freebsd1') or
host_system.startswith ('freebsd2') or
host_system.startswith ('freebsd3') or
host_system.startswith ('freebsd4') or
host_system.startswith ('freebsd5'))
- gl_cv_func_printf_infinite_long_double = 'false'
+ gl_cv_func_printf_infinite_long_double = false
elif (host_system.startswith ('freebsd') or
host_system.startswith ('kfreebsd'))
- gl_cv_func_printf_infinite_long_double = 'true'
+ gl_cv_func_printf_infinite_long_double = true
elif (host_system.startswith ('hpux7') or
host_system.startswith ('hpux8') or
host_system.startswith ('hpux9') or
host_system.startswith ('hpux10'))
gl_cv_func_printf_infinite = false
elif host_system.startswith ('hpux')
- gl_cv_func_printf_infinite_long_double = 'true'
+ gl_cv_func_printf_infinite_long_double = true
elif host_system == 'windows'
# Guess yes on MSVC, no on mingw.
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
- gl_cv_func_printf_infinite = 'true'
+ gl_cv_func_printf_infinite_long_double = true
else
- gl_cv_func_printf_infinite = 'false'
+ gl_cv_func_printf_infinite_long_double = false
endif
else
- gl_cv_func_printf_infinite_long_double = 'false'
+ gl_cv_func_printf_infinite_long_double = false
endif
endif
endif
-else
- gl_cv_func_printf_infinite_long_double = 'irrelevant'
endif
diff --git a/glib/meson.build b/glib/meson.build
index ef96772..914089c 100644
--- a/glib/meson.build
+++ b/glib/meson.build
@@ -99,7 +99,7 @@ else
glib_conf.set('NEED_PRINTF_INFINITE_DOUBLE', 1)
endif
- if gl_cv_func_printf_long_double and gl_cv_func_printf_infinite_long_double != 'false'
+ if gl_cv_func_printf_long_double and gl_cv_func_printf_infinite_long_double
glib_conf.set('NEED_PRINTF_INFINITE_LONG_DOUBLE', 1)
endif
--
2.27.0.windows.1
From f0a3bb580f0c4672f16947d16e19b60bc08376c7 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Wed, 3 Jun 2020 05:58:41 +0530
Subject: [PATCH 01/22] gio: Remove broken support for XP
We now require Windows 7 or newer, and the networking code hasn't
worked in a long time since we directly use symbols from iphlapi.dll
now.
---
docs/reference/gio/gio-sections-common.txt | 1 -
gio/ginetaddress.c | 7 ----
gio/glocalfile.c | 46 ++--------------------
gio/gnetworking.c | 37 -----------------
gio/gnetworking.h.in | 6 +--
gio/gsocket.c | 5 ---
gio/gwin32networking.h | 42 --------------------
gio/meson.build | 9 +----
8 files changed, 6 insertions(+), 147 deletions(-)
delete mode 100644 gio/gwin32networking.h
diff --git a/docs/reference/gio/gio-sections-common.txt b/docs/reference/gio/gio-sections-common.txt
index bb483b0..c6a62e0 100644
--- a/docs/reference/gio/gio-sections-common.txt
+++ b/docs/reference/gio/gio-sections-common.txt
@@ -4495,7 +4495,6 @@ CMSG_LEN
CMSG_SPACE
GLIB_ALIGN_TO_SIZEOF
T_SRV
-ws2funcs
</SECTION>
<SECTION>
diff --git a/gio/ginetaddress.c b/gio/ginetaddress.c
index 787c757..747a7f1 100644
--- a/gio/ginetaddress.c
+++ b/gio/ginetaddress.c
@@ -31,13 +31,6 @@
#include "glibintl.h"
#include "gnetworkingprivate.h"
-#ifdef G_OS_WIN32
-/* Ensure Windows XP runtime compatibility, while using
- * inet_pton() and inet_ntop() if available
- */
-#include "gwin32networking.h"
-#endif
-
struct _GInetAddressPrivate
{
GSocketFamily family;
diff --git a/gio/glocalfile.c b/gio/glocalfile.c
index 62f30b5..af68a59 100644
--- a/gio/glocalfile.c
+++ b/gio/glocalfile.c
@@ -825,36 +825,6 @@ get_mount_info (GFileInfo *fs_info,
#ifdef G_OS_WIN32
-static gboolean
-is_xp_or_later (void)
-{
- static int result = -1;
-
- if (result == -1)
- {
-#ifndef _MSC_VER
- OSVERSIONINFOEX ver_info = {0};
- DWORDLONG cond_mask = 0;
- int op = VER_GREATER_EQUAL;
-
- ver_info.dwOSVersionInfoSize = sizeof ver_info;
- ver_info.dwMajorVersion = 5;
- ver_info.dwMinorVersion = 1;
-
- VER_SET_CONDITION (cond_mask, VER_MAJORVERSION, op);
- VER_SET_CONDITION (cond_mask, VER_MINORVERSION, op);
-
- result = VerifyVersionInfo (&ver_info,
- VER_MAJORVERSION | VER_MINORVERSION,
- cond_mask) != 0;
-#else
- result = ((DWORD)(LOBYTE (LOWORD (GetVersion ())))) >= 5;
-#endif
- }
-
- return result;
-}
-
static wchar_t *
get_volume_for_path (const char *path)
{
@@ -913,18 +883,10 @@ get_filesystem_readonly (GFileInfo *info,
if (rootdir)
{
- if (is_xp_or_later ())
- {
- DWORD flags;
- if (GetVolumeInformationW (rootdir, NULL, 0, NULL, NULL, &flags, NULL, 0))
- g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY,
- (flags & FILE_READ_ONLY_VOLUME) != 0);
- }
- else
- {
- if (GetDriveTypeW (rootdir) == DRIVE_CDROM)
- g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY, TRUE);
- }
+ DWORD flags;
+ if (GetVolumeInformationW (rootdir, NULL, 0, NULL, NULL, &flags, NULL, 0))
+ g_file_info_set_attribute_boolean (info, G_FILE_ATTRIBUTE_FILESYSTEM_READONLY,
+ (flags & FILE_READ_ONLY_VOLUME) != 0);
}
g_free (rootdir);
diff --git a/gio/gnetworking.c b/gio/gnetworking.c
index fea4309..05507fe 100644
--- a/gio/gnetworking.c
+++ b/gio/gnetworking.c
@@ -22,13 +22,6 @@
#include "gnetworking.h"
-#ifdef G_OS_WIN32
-/* For Windows XP run-time compatibility */
-#include "gwin32networking.h"
-
-GWin32WinsockFuncs ws2funcs = {0};
-#endif
-
/**
* SECTION:gnetworking
* @title: gnetworking.h
@@ -73,40 +66,10 @@ g_networking_init (void)
if (g_once_init_enter (&inited))
{
WSADATA wsadata;
- HMODULE ws2dll, iphlpapidll;
if (WSAStartup (MAKEWORD (2, 0), &wsadata) != 0)
g_error ("Windows Sockets could not be initialized");
- /* We want to use these functions if they are available, but
- * still need to make sure the code still runs on Windows XP
- */
- ws2dll = LoadLibraryW (L"ws2_32.dll");
- iphlpapidll = LoadLibraryW (L"iphlpapi.dll");
-
- if (ws2dll != NULL)
- {
- ws2funcs.pInetNtop =
- (PFN_InetNtop) GetProcAddress (ws2dll, "inet_ntop");
- ws2funcs.pInetPton =
- (PFN_InetPton) GetProcAddress (ws2dll, "inet_pton");
- FreeLibrary (ws2dll);
- }
- else
- {
- ws2funcs.pInetNtop = NULL;
- ws2funcs.pInetPton = NULL;
- }
-
- if (iphlpapidll != NULL)
- {
- ws2funcs.pIfNameToIndex =
- (PFN_IfNameToIndex) GetProcAddress (iphlpapidll, "if_nametoindex");
- FreeLibrary (iphlpapidll);
- }
- else
- ws2funcs.pIfNameToIndex = NULL;
-
g_once_init_leave (&inited, 1);
}
#endif
diff --git a/gio/gnetworking.h.in b/gio/gnetworking.h.in
index f9582b9..2fa95ff 100644
--- a/gio/gnetworking.h.in
+++ b/gio/gnetworking.h.in
@@ -22,15 +22,11 @@
#include <glib.h>
#ifdef G_OS_WIN32
-
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0501
-#endif
#include <winsock2.h>
#include <ws2tcpip.h>
#include <windns.h>
#include <mswsock.h>
-@WSPIAPI_INCLUDE@
+#include <wspiapi.h>
#include <iphlpapi.h>
#undef interface
diff --git a/gio/gsocket.c b/gio/gsocket.c
index 66073af..5ef650c 100644
--- a/gio/gsocket.c
+++ b/gio/gsocket.c
@@ -76,11 +76,6 @@
#include "glibintl.h"
#include "gioprivate.h"
-#ifdef G_OS_WIN32
-/* For Windows XP runtime compatibility, but use the system's if_nametoindex() if available */
-#include "gwin32networking.h"
-#endif
-
/**
* SECTION:gsocket
* @short_description: Low-level socket object
diff --git a/gio/gwin32networking.h b/gio/gwin32networking.h
deleted file mode 100644
index 9e1396c..0000000
--- a/gio/gwin32networking.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* GIO - GLib Input, Output and Streaming Library
- *
- * Copyright (C) 2015 Chun-wei Fan
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General
- * Public License along with this library; if not, see <http://www.gnu.org/licenses/>.
- */
-
-#ifndef __G_WIN32_NETWORKING_H__
-#define __G_WIN32_NETWORKING_H__
-
-G_BEGIN_DECLS
-
-/* Check if more ANSI-compliant Winsock2 functions are provided */
-/* For run-time compatibility with Windows XP, remove when XP support dropped */
-
-typedef INT (WSAAPI *PFN_InetPton) (INT, PCTSTR, PVOID);
-typedef PCTSTR (WSAAPI *PFN_InetNtop) (INT, PVOID, PTSTR, size_t);
-typedef NET_IFINDEX (WINAPI *PFN_IfNameToIndex) (PCSTR);
-
-typedef struct _GWin32WinsockFuncs
-{
- PFN_InetPton pInetPton;
- PFN_InetNtop pInetNtop;
- PFN_IfNameToIndex pIfNameToIndex;
-} GWin32WinsockFuncs;
-
-extern GWin32WinsockFuncs ws2funcs;
-
-G_END_DECLS /* __G_WIN32_NETWORKING_H__ */
-
-#endif
diff --git a/gio/meson.build b/gio/meson.build
index 3535788..a7dd536 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -10,15 +10,9 @@ gio_c_args += glib_hidden_visibility_args
gnetworking_h_conf = configuration_data()
-gnetworking_h_wspiapi_include = ''
gnetworking_h_nameser_compat_include = ''
-if host_system == 'windows'
- # <wspiapi.h> in the Windows SDK and in mingw-w64 has wrappers for
- # inline workarounds for getaddrinfo, getnameinfo and freeaddrinfo if
- # they aren't present at run-time (on Windows 2000).
- gnetworking_h_wspiapi_include = '#include <wspiapi.h>'
-elif not host_system.contains('android')
+if host_system != 'windows' and not host_system.contains('android')
# Don't check for C_IN on Android since it does not define it in public
# headers, we define it ourselves wherever necessary
if not cc.compiles('''#include <sys/types.h>
@@ -168,7 +162,6 @@ if host_system.contains('android')
endif
endif
-gnetworking_h_conf.set('WSPIAPI_INCLUDE', gnetworking_h_wspiapi_include)
gnetworking_h_conf.set('NAMESER_COMPAT_INCLUDE', gnetworking_h_nameser_compat_include)
gnetworking_h = configure_file(input : 'gnetworking.h.in',
--
2.27.0.windows.1
From 2d1a5a8a6b7e3403ed7b03605659b81967dd9afb Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Wed, 14 Aug 2019 10:42:45 +0530
Subject: [PATCH 02/22] win_iconv: Use LoadPackagedLibrary when building UWP
apps
LoadLibrary is not available at all when building with
`-DWINAPI_FAMILY=WINAPI_FAMILY_APP`.
---
glib/win_iconv.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/glib/win_iconv.c b/glib/win_iconv.c
index 605e5f0..3cc2464 100644
--- a/glib/win_iconv.c
+++ b/glib/win_iconv.c
@@ -60,6 +60,12 @@
#define FLAG_TRANSLIT 2 /* //TRANSLIT */
#define FLAG_IGNORE 4 /* //IGNORE */
+/* Default family is DESKTOP_APP which is DESKTOP | APP
+ * We want to know when we're only building for apps */
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+#define G_WINAPI_ONLY_APP
+#endif
+
typedef unsigned char uchar;
typedef unsigned short ushort;
typedef unsigned int uint;
@@ -729,7 +735,13 @@ load_mlang(void)
HMODULE h;
if (ConvertINetString != NULL)
return TRUE;
+ /* When building for UWP, load app asset DLLs instead of filesystem DLLs.
+ * Needs MSVC, Windows 8 and newer, and is only usable from apps. */
+#if _WIN32_WINNT >= 0x0602 && defined(G_WINAPI_ONLY_APP)
+ h = LoadPackagedLibrary(TEXT("mlang.dll"), 0);
+#else
h = LoadLibrary(TEXT("mlang.dll"));
+#endif
if (!h)
return FALSE;
ConvertINetString = (CONVERTINETSTRING)GetProcAddressA(h, "ConvertINetString");
--
2.27.0.windows.1
From d04f32348c987210ab5cd2f8ee1fc1385ae7296f Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Wed, 27 May 2020 00:43:26 +0530
Subject: [PATCH 03/22] glib: getpid() is available on Win32, but not WinRT
---
glib/gmessages.c | 18 ++++++++++++------
glib/gslice.c | 11 +++++++++--
2 files changed, 21 insertions(+), 8 deletions(-)
diff --git a/glib/gmessages.c b/glib/gmessages.c
index bb1ab8f..201192f 100644
--- a/glib/gmessages.c
+++ b/glib/gmessages.c
@@ -203,13 +203,15 @@
#endif
#ifdef G_OS_WIN32
-#include <process.h> /* For getpid() */
+#ifndef G_WINAPI_ONLY_APP
+#include <process.h> /* For getpid(), not available on UWP */
+#endif
#include <io.h>
# include <windows.h>
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
-#endif
+#endif /* G_OS_WIN32 */
#if defined (_MSC_VER) && (_MSC_VER >=1400)
/* This is ugly, but we need it for isatty() in case we have bad fd's,
@@ -2253,7 +2255,11 @@ g_log_writer_format_fields (GLogLevelFlags log_level,
(log_level & G_LOG_LEVEL_MASK))
{
const gchar *prg_name = g_get_prgname ();
+#ifndef G_WINAPI_ONLY_APP
gulong pid = getpid ();
+#else
+ gulong pid = 0UL;
+#endif
if (prg_name == NULL)
g_string_append_printf (gstring, "(process:%lu): ", pid);
@@ -2741,7 +2747,7 @@ _g_log_writer_fallback (GLogLevelFlags log_level,
write_string_sized (stream, field->value, field->length);
}
-#ifndef G_OS_WIN32
+#ifndef G_WINAPI_ONLY_APP
{
gchar pid_string[FORMAT_UNSIGNED_BUFSIZE];
@@ -2941,7 +2947,7 @@ _g_log_fallback_handler (const gchar *log_domain,
gpointer unused_data)
{
gchar level_prefix[STRING_BUFFER_SIZE];
-#ifndef G_OS_WIN32
+#ifndef G_WINAPI_ONLY_APP
gchar pid_string[FORMAT_UNSIGNED_BUFSIZE];
#endif
FILE *stream;
@@ -2957,7 +2963,7 @@ _g_log_fallback_handler (const gchar *log_domain,
if (!message)
message = "(NULL) message";
-#ifndef G_OS_WIN32
+#ifndef G_WINAPI_ONLY_APP
format_unsigned (pid_string, getpid (), 10);
#endif
@@ -2966,7 +2972,7 @@ _g_log_fallback_handler (const gchar *log_domain,
else
write_string (stream, "\n** ");
-#ifndef G_OS_WIN32
+#ifndef G_WINAPI_ONLY_APP
write_string (stream, "(process:");
write_string (stream, pid_string);
write_string (stream, "): ");
diff --git a/glib/gslice.c b/glib/gslice.c
index 4c758c3..0b700bb 100644
--- a/glib/gslice.c
+++ b/glib/gslice.c
@@ -29,9 +29,12 @@
#ifdef G_OS_UNIX
#include <unistd.h> /* sysconf() */
#endif
+
#ifdef G_OS_WIN32
#include <windows.h>
-#include <process.h>
+#ifndef G_WINAPI_ONLY_APP
+#include <process.h> /* getpid(), not available on UWP */
+#endif
#endif
#include <stdio.h> /* fputs */
@@ -1467,10 +1470,14 @@ mem_error (const char *format,
{
const char *pname;
va_list args;
+ gulong pid = 0;
/* at least, put out "MEMORY-ERROR", in case we segfault during the rest of the function */
fputs ("\n***MEMORY-ERROR***: ", stderr);
pname = g_get_prgname();
- g_fprintf (stderr, "%s[%ld]: GSlice: ", pname ? pname : "", (long)getpid());
+#ifndef G_WINAPI_ONLY_APP
+ pid = getpid();
+#endif
+ g_fprintf (stderr, "%s[%lu]: GSlice: ", pname ? pname : "", pid);
va_start (args, format);
g_vfprintf (stderr, format, args);
va_end (args);
--
2.27.0.windows.1
From c5338d5e8d1a7e4ddd4acfb25597c58cc9f2fab3 Mon Sep 17 00:00:00 2001
From: Nirbheek Chauhan <nirbheek@centricular.com>
Date: Wed, 27 May 2020 00:48:52 +0530
Subject: [PATCH 04/22] goption: Do not call GetCommandlineW() on UWP
The function is not available there since there is no such thing as
a 'command-line' or 'command-line argument' on UWP.
---
glib/goption.c | 2 +-
glib/tests/option-argv0.c | 6 ++++--