mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
When the sublangid is SUBLANG_DEFAULT, return the locale of the language's
2001-09-24 Bruno Haible <haible@clisp.cons.org> * glib/gwin32.c (g_win32_getlocale): When the sublangid is SUBLANG_DEFAULT, return the locale of the language's main country, not a country-neutral locale. E.g. "en_US" instead of "en". Add handling of LANG_SORBIAN. Fix typo for SUBLANG_CHINESE_SIMPLIFIED (China == CN, CH == Switzerland). Ignore empty environment variable values. 2001-09-28 Tor Lillqvist <tml@iki.fi> * glib/makefile.{mingw,msc}.in: Add localcharset.o. Just copy the source file from libcharset and compile in this directory. * glib/giochannel.c: Mark rest of g_set_error strings for translation, too. * glib/giowin32.c: Add some debugging output functions, call them when debugging. (create_events, g_io_win32_msg_write): Free message fetched with g_win32_error_message (). (g_io_win32_check): Indentation fixes. (g_io_win32_fd_read,g_io_win32_sock_read): Don't always return G_IO_STATUS_NORMAL. Do return G_IO_STATUS_EOF if we got 0 bytes, like on Unix. This helps making the test programs run successfully. * glib/gmain.c (g_poll): Return the code ifdeffed out with TEST_WITHOUT_THIS. Can't remember why it was ifdeffed out. Things seem to work as previously with the code in place. Especially spawn-test didn't work with the code ifdeffed out (Bug#61067). * glib/grand.c (g_rand_new): Don't try to use /dev/urandom unless on Unix. * glib/gspawn-win32-helper.c (WinMain): Remove Sleep(10000) accidentally left in. gthread: 2001-09-28 Tor Lillqvist <tml@iki.fi> * gthread-win32.c: Use an extra level of indirection for GMutex. It is now a pointer either to a pointer to a CRITICAL_SECTION struct, or to a mutex HANDLE. This is needed in case the user defines G_ERRORCHECK_MUTEXES. G_MUTEX_SIZE must correctly reflect the size of *GMutex, but this used to vary depending on whether we at run-time chose to use CRITICAL_SECTIONs or mutexes. (g_mutex_free_win32_cs_impl, g_cond_free_win32_impl): Call DeleteCriticalSection() when done with it. * gthread-impl.c (g_thread_init_with_errorcheck_mutexes): Call g_thread_impl_init() before accessing g_thread_functions_for_glib_use_default, as the g_thread_impl_init() function might modify it. po: 2001-09-28 Tor Lillqvist <tml@iki.fi> * POTFILES.in: Add iochannel.c and giowin32.c. * sv.po: Remove a bogus fuzziness indicator.
This commit is contained in:
committed by
Tor Lillqvist
parent
ad813a42f0
commit
34462896a0
@@ -43,7 +43,7 @@
|
||||
#undef STRICT
|
||||
|
||||
#include <process.h>
|
||||
#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#define win32_check_for_error(what) G_STMT_START{ \
|
||||
if (!(what)) \
|
||||
@@ -52,7 +52,7 @@
|
||||
g_win32_error_message (GetLastError ()), #what); \
|
||||
}G_STMT_END
|
||||
|
||||
#define G_MUTEX_SIZE (sizeof (HANDLE))
|
||||
#define G_MUTEX_SIZE (sizeof (gpointer))
|
||||
|
||||
#define PRIORITY_LOW_VALUE THREAD_PRIORITY_BELOW_NORMAL
|
||||
#define PRIORITY_NORMAL_VALUE THREAD_PRIORITY_NORMAL
|
||||
@@ -94,14 +94,22 @@ struct _GCond
|
||||
static GMutex *
|
||||
g_mutex_new_win32_cs_impl (void)
|
||||
{
|
||||
CRITICAL_SECTION *retval = g_new (CRITICAL_SECTION, 1);
|
||||
InitializeCriticalSection (retval);
|
||||
CRITICAL_SECTION *cs = g_new (CRITICAL_SECTION, 1);
|
||||
gpointer *retval = g_new (gpointer, 1);
|
||||
|
||||
InitializeCriticalSection (cs);
|
||||
*retval = cs;
|
||||
return (GMutex *) retval;
|
||||
}
|
||||
|
||||
static void
|
||||
g_mutex_free_win32_cs_impl (GMutex *mutex)
|
||||
{
|
||||
gpointer *ptr = (gpointer *) mutex;
|
||||
CRITICAL_SECTION *cs = (CRITICAL_SECTION *) *ptr;
|
||||
|
||||
DeleteCriticalSection (cs);
|
||||
g_free (cs);
|
||||
g_free (mutex);
|
||||
}
|
||||
|
||||
@@ -111,33 +119,37 @@ g_mutex_free_win32_cs_impl (GMutex *mutex)
|
||||
static void
|
||||
g_mutex_lock_win32_cs_impl (GMutex *mutex)
|
||||
{
|
||||
EnterCriticalSection ((CRITICAL_SECTION *)mutex);
|
||||
EnterCriticalSection (*(CRITICAL_SECTION **)mutex);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
g_mutex_trylock_win32_cs_impl (GMutex * mutex)
|
||||
{
|
||||
return try_enter_critical_section ((CRITICAL_SECTION *)mutex);
|
||||
return try_enter_critical_section (*(CRITICAL_SECTION **)mutex);
|
||||
}
|
||||
|
||||
static void
|
||||
g_mutex_unlock_win32_cs_impl (GMutex *mutex)
|
||||
{
|
||||
LeaveCriticalSection ((CRITICAL_SECTION *)mutex);
|
||||
LeaveCriticalSection (*(CRITICAL_SECTION **)mutex);
|
||||
}
|
||||
|
||||
static GMutex *
|
||||
g_mutex_new_win32_impl (void)
|
||||
{
|
||||
HANDLE handle;
|
||||
HANDLE *retval;
|
||||
win32_check_for_error (handle = CreateMutex (NULL, FALSE, NULL));
|
||||
return (GMutex *) handle;
|
||||
retval = g_new (HANDLE, 1);
|
||||
*retval = handle;
|
||||
return (GMutex *) retval;
|
||||
}
|
||||
|
||||
static void
|
||||
g_mutex_free_win32_impl (GMutex *mutex)
|
||||
{
|
||||
win32_check_for_error (CloseHandle ((HANDLE) mutex));
|
||||
win32_check_for_error (CloseHandle (*(HANDLE *) mutex));
|
||||
g_free (mutex);
|
||||
}
|
||||
|
||||
/* NOTE: the functions g_mutex_lock and g_mutex_unlock may not use
|
||||
@@ -146,7 +158,7 @@ g_mutex_free_win32_impl (GMutex *mutex)
|
||||
static void
|
||||
g_mutex_lock_win32_impl (GMutex *mutex)
|
||||
{
|
||||
WaitForSingleObject ((HANDLE) mutex, INFINITE);
|
||||
WaitForSingleObject (*(HANDLE *) mutex, INFINITE);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -154,14 +166,14 @@ g_mutex_trylock_win32_impl (GMutex * mutex)
|
||||
{
|
||||
DWORD result;
|
||||
win32_check_for_error (WAIT_FAILED !=
|
||||
(result = WaitForSingleObject ((HANDLE)mutex, 0)));
|
||||
(result = WaitForSingleObject (*(HANDLE *)mutex, 0)));
|
||||
return result != WAIT_TIMEOUT;
|
||||
}
|
||||
|
||||
static void
|
||||
g_mutex_unlock_win32_impl (GMutex *mutex)
|
||||
{
|
||||
ReleaseMutex ((HANDLE) mutex);
|
||||
ReleaseMutex (*(HANDLE *) mutex);
|
||||
}
|
||||
|
||||
static GCond *
|
||||
@@ -289,6 +301,7 @@ g_cond_timed_wait_win32_impl (GCond *cond,
|
||||
static void
|
||||
g_cond_free_win32_impl (GCond * cond)
|
||||
{
|
||||
DeleteCriticalSection (&cond->lock);
|
||||
g_ptr_array_free (cond->array, TRUE);
|
||||
g_free (cond);
|
||||
}
|
||||
@@ -529,8 +542,14 @@ static GThreadFunctions g_thread_functions_for_glib_use_default =
|
||||
static void
|
||||
g_thread_impl_init ()
|
||||
{
|
||||
static gboolean beenhere = FALSE;
|
||||
HMODULE kernel32;
|
||||
|
||||
if (beenhere)
|
||||
return;
|
||||
|
||||
beenhere = TRUE;
|
||||
|
||||
win32_check_for_error (TLS_OUT_OF_INDEXES !=
|
||||
(g_thread_self_tls = TlsAlloc ()));
|
||||
win32_check_for_error (TLS_OUT_OF_INDEXES !=
|
||||
@@ -570,4 +589,3 @@ g_thread_impl_init ()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user