Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -6,6 +6,9 @@
/* Overridable allocator support enabled */
#undef ENABLE_OVERRIDABLE_ALLOCATORS
/* Use classic Windows API support */
#undef HAVE_CLASSIC_WINAPI_SUPPORT
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@@ -96,6 +99,9 @@
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Don't use UWP Windows API support */
#undef HAVE_UWP_WINAPI_SUPPORT
/* Define to 1 if you have the `vasprintf' function. */
#undef HAVE_VASPRINTF

View File

@@ -1 +1 @@
801fdd9c4cde828e7e92456ad7de345487765e0b
25e0ae711c57ad4d7ea743dd6d66a29e918c9e54

View File

@@ -130,6 +130,10 @@ AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
AM_CONDITIONAL(PLATFORM_ANDROID, test x$platform_android = xyes)
# Defined for all targets/platforms using classic Windows API support.
AC_DEFINE(HAVE_CLASSIC_WINAPI_SUPPORT, 1, [Use classic Windows API support])
AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long)

View File

@@ -5,7 +5,7 @@ AM_CFLAGS = $(WERROR_CFLAGS)
win_files = \
eglib-config.hw \
gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c \
gmodule-win32.c gtimer-win32.c
gmodule-win32.c gtimer-win32.c gunicode-win32.c
unix_files = \
gdate-unix.c gdir-unix.c gfile-unix.c gmisc-unix.c \

View File

@@ -107,13 +107,14 @@ am__libeglib_la_SOURCES_DIST = eglib-remap.h sort.frag.h glib.h \
unicode-data.h gdate-unix.c gdir-unix.c gfile-unix.c \
gmisc-unix.c gmodule-unix.c gtimer-unix.c eglib-config.hw \
gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c \
gmodule-win32.c gtimer-win32.c
gmodule-win32.c gtimer-win32.c gunicode-win32.c
am__objects_1 = libeglib_la-gdate-unix.lo libeglib_la-gdir-unix.lo \
libeglib_la-gfile-unix.lo libeglib_la-gmisc-unix.lo \
libeglib_la-gmodule-unix.lo libeglib_la-gtimer-unix.lo
am__objects_2 = libeglib_la-gdate-win32.lo libeglib_la-gdir-win32.lo \
libeglib_la-gfile-win32.lo libeglib_la-gmisc-win32.lo \
libeglib_la-gmodule-win32.lo libeglib_la-gtimer-win32.lo
libeglib_la-gmodule-win32.lo libeglib_la-gtimer-win32.lo \
libeglib_la-gunicode-win32.lo
@HOST_WIN32_FALSE@am__objects_3 = $(am__objects_1)
@HOST_WIN32_TRUE@am__objects_3 = $(am__objects_2)
am_libeglib_la_OBJECTS = libeglib_la-garray.lo \
@@ -345,7 +346,7 @@ AM_CFLAGS = $(WERROR_CFLAGS)
win_files = \
eglib-config.hw \
gdate-win32.c gdir-win32.c gfile-win32.c gmisc-win32.c \
gmodule-win32.c gtimer-win32.c
gmodule-win32.c gtimer-win32.c gunicode-win32.c
unix_files = \
gdate-unix.c gdir-unix.c gfile-unix.c gmisc-unix.c \
@@ -480,6 +481,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeglib_la-gstring.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeglib_la-gtimer-unix.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeglib_la-gtimer-win32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeglib_la-gunicode-win32.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeglib_la-gunicode.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libeglib_la-gutf8.Plo@am__quote@
@@ -749,6 +751,13 @@ libeglib_la-gtimer-win32.lo: gtimer-win32.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libeglib_la_CFLAGS) $(CFLAGS) -c -o libeglib_la-gtimer-win32.lo `test -f 'gtimer-win32.c' || echo '$(srcdir)/'`gtimer-win32.c
libeglib_la-gunicode-win32.lo: gunicode-win32.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libeglib_la_CFLAGS) $(CFLAGS) -MT libeglib_la-gunicode-win32.lo -MD -MP -MF $(DEPDIR)/libeglib_la-gunicode-win32.Tpo -c -o libeglib_la-gunicode-win32.lo `test -f 'gunicode-win32.c' || echo '$(srcdir)/'`gunicode-win32.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libeglib_la-gunicode-win32.Tpo $(DEPDIR)/libeglib_la-gunicode-win32.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='gunicode-win32.c' object='libeglib_la-gunicode-win32.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libeglib_la_CFLAGS) $(CFLAGS) -c -o libeglib_la-gunicode-win32.lo `test -f 'gunicode-win32.c' || echo '$(srcdir)/'`gunicode-win32.c
mostlyclean-libtool:
-rm -f *.lo

View File

@@ -78,3 +78,11 @@ g_file_test (const gchar *filename, GFileTest test)
}
return FALSE;
}
gchar *
g_mkdtemp (char *tmp_template)
{
char *template_copy = g_strdup (tmp_template);
return mkdtemp (template_copy);
}

View File

@@ -160,7 +160,8 @@ typedef struct _GMemChunk GMemChunk;
* Misc.
*/
const gchar * g_getenv(const gchar *variable);
gboolean g_hasenv(const gchar *variable);
gchar * g_getenv(const gchar *variable);
gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);
void g_unsetenv(const gchar *variable);
@@ -887,11 +888,7 @@ gboolean g_file_test (const gchar *filename, GFileTest test);
#define g_ascii_strtod strtod
#define g_ascii_isalnum isalnum
#ifdef WIN32
gchar *g_mkdtemp (gchar *tmpl);
#else
#define g_mkdtemp mkdtemp
#endif
/*
* Pattern matching
@@ -1068,6 +1065,10 @@ glong g_utf8_pointer_to_offset (const gchar *str, const gchar *pos);
#define _EGLIB_MINOR 0
#define GLIB_CHECK_VERSION(a,b,c) ((a < _EGLIB_MAJOR) || (a == _EGLIB_MAJOR && (b < _EGLIB_MIDDLE || (b == _EGLIB_MIDDLE && c <= _EGLIB_MINOR))))
#define G_HAVE_API_SUPPORT(x) (x)
#define G_UNSUPPORTED_API "%s:%d: '%s' not supported.", __FILE__, __LINE__
#define g_unsupported_api(name) G_STMT_START { g_warning (G_UNSUPPORTED_API, name); } G_STMT_END
G_END_DECLS

View File

@@ -39,23 +39,69 @@
#include <unistd.h>
#endif
static pthread_mutex_t env_lock = PTHREAD_MUTEX_INITIALIZER;
const gchar *
g_getenv(const gchar *variable)
/* MONO Comment
*
* As per the UNIX spec,
* "The return value from getenv() may point to static data which may be overwritten by subsequent calls to getenv(), setenv(), or unsetenv()."
* Source: Unix Manual Pages for getenv, IEEE Std 1003.1
*
* This means that using pointers returned from getenv may (and does) lead to many
* pointers which refer to the same piece of memory. When one is freed, all will be freed.
*
* This is unsafe and an ergonomics risk to fix in the callers. While the caller could lock,
* this introduces the risk for looping or exiting while inside of a lock. For this reason,
* g_getenv does not mimic the behavior of POSIX getenv anymore.
*
* The memory address returned will be unique to the invocaton, and must be freed.
* */
gchar *
g_getenv (const gchar *variable)
{
return getenv(variable);
gchar *ret = NULL;
pthread_mutex_lock (&env_lock);
gchar *res = getenv(variable);
if (res)
ret = g_strdup(res);
pthread_mutex_unlock (&env_lock);
return ret;
}
/*
* This function checks if the given variable is non-NULL
* in the environment. It's useful because it removes memory
* freeing requirements.
*
*/
gboolean
g_hasenv (const gchar *variable)
{
pthread_mutex_lock (&env_lock);
gchar *res = getenv(variable);
gboolean not_null = (res != NULL);
pthread_mutex_unlock (&env_lock);
return not_null;
}
gboolean
g_setenv(const gchar *variable, const gchar *value, gboolean overwrite)
{
return setenv(variable, value, overwrite) == 0;
gboolean res;
pthread_mutex_lock (&env_lock);
res = (setenv(variable, value, overwrite) == 0);
pthread_mutex_unlock (&env_lock);
return res;
}
void
g_unsetenv(const gchar *variable)
{
pthread_mutex_lock (&env_lock);
unsetenv(variable);
pthread_mutex_unlock (&env_lock);
}
gchar*

View File

@@ -26,17 +26,26 @@
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
#include <stdlib.h>
#include <glib.h>
#include <windows.h>
#ifdef _MSC_VER
#if _MSC_VER && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#include <shlobj.h>
#endif
#include <direct.h>
#include <io.h>
#include <assert.h>
const gchar *
gboolean
g_hasenv (const gchar *variable)
{
return g_getenv (variable) != NULL;
}
gchar *
g_getenv(const gchar *variable)
{
gunichar2 *var, *buffer;
@@ -87,6 +96,7 @@ g_unsetenv(const gchar *variable)
g_free(var);
}
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
gchar*
g_win32_getlocale(void)
{
@@ -97,6 +107,7 @@ g_win32_getlocale(void)
ccBuf += GetLocaleInfoA(lcid, LOCALE_SISO3166CTRYNAME, buf + ccBuf, 9);
return g_strdup (buf);
}
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
gboolean
g_path_is_absolute (const char *filename)
@@ -116,20 +127,35 @@ g_path_is_absolute (const char *filename)
return FALSE;
}
const gchar *
g_get_home_dir (void)
#if _MSC_VER && G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
static gchar*
g_get_known_folder_path (void)
{
gchar *home_dir = NULL;
#ifdef _MSC_VER
gchar *folder_path = NULL;
PWSTR profile_path = NULL;
HRESULT hr = SHGetKnownFolderPath (&FOLDERID_Profile, KF_FLAG_DEFAULT, NULL, &profile_path);
if (SUCCEEDED(hr)) {
home_dir = u16to8 (profile_path);
folder_path = u16to8 (profile_path);
CoTaskMemFree (profile_path);
}
return folder_path;
}
#else
static inline gchar *
g_get_known_folder_path (void)
{
return NULL;
}
#endif
const gchar *
g_get_home_dir (void)
{
gchar *home_dir = g_get_known_folder_path ();
if (!home_dir) {
home_dir = (gchar *) g_getenv ("USERPROFILE");
}
@@ -180,4 +206,3 @@ g_get_tmp_dir (void)
}
return tmp_dir;
}

View File

@@ -28,10 +28,11 @@
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <config.h>
#include <glib.h>
#include <gmodule.h>
#include <windows.h>
#include <psapi.h>
#include <gmodule-win32-internals.h>
#define LIBSUFFIX ".dll"
#define LIBPREFIX ""
@@ -68,7 +69,8 @@ g_module_open (const gchar *file, GModuleFlags flags)
return module;
}
static gpointer
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
gpointer
w32_find_symbol (const gchar *symbol_name)
{
HMODULE *modules;
@@ -114,6 +116,7 @@ w32_find_symbol (const gchar *symbol_name)
g_free (modules);
return NULL;
}
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
gboolean
g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
@@ -134,6 +137,7 @@ g_module_symbol (GModule *module, const gchar *symbol_name, gpointer *symbol)
}
}
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
const gchar *
g_module_error (void)
{
@@ -150,6 +154,7 @@ g_module_error (void)
return ret;
}
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
gboolean
g_module_close (GModule *module)

View File

@@ -47,8 +47,10 @@ g_print (const gchar *format, ...)
va_list args;
va_start (args, format);
if (g_vasprintf (&msg, format, args) < 0)
if (g_vasprintf (&msg, format, args) < 0) {
va_end (args);
return;
}
va_end (args);
if (!stdout_handler)
@@ -65,8 +67,10 @@ g_printerr (const gchar *format, ...)
va_list args;
va_start (args, format);
if (g_vasprintf (&msg, format, args) < 0)
if (g_vasprintf (&msg, format, args) < 0) {
va_end (args);
return;
}
va_end (args);
if (!stderr_handler)

View File

@@ -0,0 +1,39 @@
/*
* gunicode-win32.c: Windows unicode support.
*
* Copyright 2016 Microsoft
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <config.h>
#include <glib.h>
#if G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT)
#define CODESET 1
#include <windows.h>
extern const char *my_charset;
static gboolean is_utf8;
gboolean
g_get_charset (G_CONST_RETURN char **charset)
{
if (my_charset == NULL) {
static char buf [14];
sprintf (buf, "CP%u", GetACP ());
my_charset = buf;
is_utf8 = FALSE;
}
if (charset != NULL)
*charset = my_charset;
return is_utf8;
}
#else /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */
#ifdef _MSC_VER
// Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
void __mono_win32_mono_gunicode_win32_quiet_lnk4221(void) {}
#endif
#endif /* G_HAVE_API_SUPPORT(HAVE_CLASSIC_WINAPI_SUPPORT) */

View File

@@ -39,18 +39,13 @@
#include <unicode-data.h>
#include <errno.h>
#if defined(_MSC_VER) || defined(G_OS_WIN32)
/* FIXME */
# define CODESET 1
# include <windows.h>
#else
#ifndef G_OS_WIN32
# ifdef HAVE_LOCALCHARSET_H
# include <localcharset.h>
# endif
#endif
static const char *my_charset;
static gboolean is_utf8;
const char *my_charset;
/*
* Character set conversion
@@ -205,16 +200,13 @@ g_filename_from_utf8 (const gchar *utf8string, gssize len, gsize *bytes_read, gs
return res;
}
#ifndef G_OS_WIN32
static gboolean is_utf8;
gboolean
g_get_charset (G_CONST_RETURN char **charset)
{
if (my_charset == NULL) {
#ifdef G_OS_WIN32
static char buf [14];
sprintf (buf, "CP%u", GetACP ());
my_charset = buf;
is_utf8 = FALSE;
#else
/* These shouldn't be heap allocated */
#if defined(HAVE_LOCALCHARSET_H)
my_charset = locale_charset ();
@@ -222,7 +214,6 @@ g_get_charset (G_CONST_RETURN char **charset)
my_charset = "UTF-8";
#endif
is_utf8 = strcmp (my_charset, "UTF-8") == 0;
#endif
}
if (charset != NULL)
@@ -230,6 +221,7 @@ g_get_charset (G_CONST_RETURN char **charset)
return is_utf8;
}
#endif /* G_OS_WIN32 */
gchar *
g_locale_to_utf8 (const gchar *opsysstring, gssize len, gsize *bytes_read, gsize *bytes_written, GError **error)

View File

@@ -28,7 +28,10 @@
#include <config.h>
#include "test.h"
#ifndef DRIVER_EXTERNAL_TESTS
#include "tests.h"
#endif
#include <stdio.h>
#ifdef HAVE_GETOPT_H
@@ -102,7 +105,11 @@ static void print_help(char *s)
printf("\n");
}
#ifdef DRIVER_EXTERNAL_MAIN
gint run_tests_main(gint argc, gchar **argv)
#else
gint main(gint argc, gchar **argv)
#endif
{
gint i, j, c, iterations = 1;
StringArray *tests_to_run = NULL;

View File

@@ -78,4 +78,30 @@
#define VERSION "0.1"
#define HAVE_STRTOK_R 1
#ifndef HAVE_WINAPI_FAMILY_SUPPORT
#define HAVE_WINAPI_FAMILY_SUPPORT
/* WIN API Family support */
#include <winapifamily.h>
#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
#define HAVE_CLASSIC_WINAPI_SUPPORT 1
#define HAVE_UWP_WINAPI_SUPPORT 0
#elif WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
#define HAVE_CLASSIC_WINAPI_SUPPORT 0
#define HAVE_UWP_WINAPI_SUPPORT 1
#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
#error Unsupported WINAPI family
#endif
#else
#define HAVE_CLASSIC_WINAPI_SUPPORT 0
#define HAVE_UWP_WINAPI_SUPPORT 0
#ifndef HAVE_EXTERN_DEFINED_WINAPI_SUPPORT
#error Unsupported WINAPI family
#endif
#endif
#endif
#endif