Intrinsicify SpanHelpers.IndexOf(char) (dotnet/coreclr#22505)
[mono-project.git] / mono / eglib / gmisc-win32-uwp.c
blobcdf5896de4228f88b29875f4c0e8e8b9cfb151f8
1 /*
2 * gmisc-win32-uwp.c: UWP misc support.
4 * Copyright 2016 Microsoft
5 * Licensed under the MIT license. See LICENSE file in the project root for full license information.
6 */
7 #include <config.h>
8 #include <glib.h>
10 #if G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT)
11 #include <windows.h>
12 #include <assert.h>
14 gchar*
15 g_win32_getlocale(void)
17 gunichar2 buf[19];
18 gint ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO639LANGNAME, buf, 9);
19 assert (ccBuf <= 9);
20 if (ccBuf != 0) {
21 buf[ccBuf - 1] = L'-';
22 ccBuf = GetLocaleInfoEx (LOCALE_NAME_USER_DEFAULT, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
23 assert (ccBuf <= 9);
26 // Check for GetLocaleInfoEx failure.
27 if (ccBuf == 0)
28 buf[0] = L'\0';
30 return u16to8 (buf);
33 #else /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */
35 #ifdef _MSC_VER
36 // Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
37 void __mono_win32_gmisc_win32_uwp_quiet_lnk4221(void) {}
38 #endif
39 #endif /* G_HAVE_API_SUPPORT(HAVE_UWP_WINAPI_SUPPORT) */