OpenMiInk/third_party/krita-deps-management/ext_gettext/0002-Fix-uwp-build.patch
Hellings b8c8ff98e2 Hi
2026-10-16 09:05:56 -04:00

95 lines
2.8 KiB
Diff

From 01bc26c9b77c54544fc25184b1b229894f83d9fc Mon Sep 17 00:00:00 2001
From: "L. E. Segovia" <amy@amyspark.me>
Date: Sat, 20 Feb 2021 20:04:21 +0000
Subject: [PATCH 2/4] Fix uwp build
---
gettext-runtime/intl/langprefs.c | 10 ++++++++--
gettext-runtime/intl/localcharset.c | 14 ++++++++++++--
gettext-runtime/intl/localename.c | 10 ++++++++--
3 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/gettext-runtime/intl/langprefs.c b/gettext-runtime/intl/langprefs.c
index f774ba2..498933a 100644
--- a/gettext-runtime/intl/langprefs.c
+++ b/gettext-runtime/intl/langprefs.c
@@ -36,8 +36,14 @@
extern void _nl_locale_name_canonicalize (char *name);
#endif
-#if defined _WIN32
-# define WIN32_NATIVE
+#if defined _WIN32 || defined __WIN32__
+# if !defined(WINAPI_FAMILY)
+# define WIN32_NATIVE
+# else
+# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+# define WIN32_NATIVE
+# endif
+# endif
#endif
#ifdef WIN32_NATIVE
diff --git a/gettext-runtime/intl/localcharset.c b/gettext-runtime/intl/localcharset.c
index ec75427..3028bc2 100644
--- a/gettext-runtime/intl/localcharset.c
+++ b/gettext-runtime/intl/localcharset.c
@@ -36,6 +36,16 @@
# include <locale.h>
#endif
+#if defined _WIN32 || defined __WIN32__
+# if !defined(WINAPI_FAMILY)
+# define HAVE_ACP
+# else
+# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+# define HAVE_ACP
+# endif
+# endif
+#endif
+
#if defined __EMX__
/* Assume EMX program runs on OS/2, even if compiled under DOS. */
# ifndef OS2
@@ -830,7 +840,7 @@ STATIC
const char *
locale_charset (void)
{
- const char *codeset;
+ const char *codeset = NULL;
/* This function must be multithread-safe. To achieve this without using
thread-local storage, we use a simple strcpy or memcpy to fill this static
@@ -912,7 +922,7 @@ locale_charset (void)
/* The canonical name cannot be determined. */
codeset = "";
-# elif defined WINDOWS_NATIVE
+# elif defined WINDOWS_NATIVE && defined HAVE_ACP
char buf[2 + 10 + 1];
static char resultbuf[2 + 10 + 1];
diff --git a/gettext-runtime/intl/localename.c b/gettext-runtime/intl/localename.c
index 6458f75..a3845a4 100644
--- a/gettext-runtime/intl/localename.c
+++ b/gettext-runtime/intl/localename.c
@@ -72,8 +72,14 @@ extern char * getlocalename_l(int, locale_t);
# include <CoreFoundation/CFPreferences.h>
#endif
-#if defined _WIN32 && !defined __CYGWIN__
-# define WINDOWS_NATIVE
+#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
+# if !defined(WINAPI_FAMILY)
+# define WINDOWS_NATIVE
+# else
+# if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+# define WINDOWS_NATIVE
+# endif
+# endif
# if !defined IN_LIBINTL
# include "glthread/lock.h"
# endif
--
2.31.1.windows.1