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:
Bruno Haible 2001-09-27 22:07:00 +00:00 committed by Tor Lillqvist
parent ad813a42f0
commit 34462896a0
23 changed files with 613 additions and 142 deletions

View File

@ -1,3 +1,41 @@
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.
Thu Sep 27 14:26:57 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstrfuncs.c (g_ascii_strup/down): Use gssize to

View File

@ -1,3 +1,41 @@
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.
Thu Sep 27 14:26:57 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstrfuncs.c (g_ascii_strup/down): Use gssize to

View File

@ -1,3 +1,41 @@
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.
Thu Sep 27 14:26:57 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstrfuncs.c (g_ascii_strup/down): Use gssize to

View File

@ -1,3 +1,41 @@
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.
Thu Sep 27 14:26:57 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstrfuncs.c (g_ascii_strup/down): Use gssize to

View File

@ -1,3 +1,41 @@
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.
Thu Sep 27 14:26:57 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstrfuncs.c (g_ascii_strup/down): Use gssize to

View File

@ -1,3 +1,41 @@
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.
Thu Sep 27 14:26:57 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstrfuncs.c (g_ascii_strup/down): Use gssize to

View File

@ -1,3 +1,41 @@
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.
Thu Sep 27 14:26:57 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstrfuncs.c (g_ascii_strup/down): Use gssize to

View File

@ -1,3 +1,41 @@
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.
Thu Sep 27 14:26:57 2001 Owen Taylor <otaylor@redhat.com>
* glib/gstrfuncs.c (g_ascii_strup/down): Use gssize to

View File

@ -1496,7 +1496,7 @@ read_again:
{
g_set_error (error, G_CONVERT_ERROR,
G_CONVERT_ERROR_PARTIAL_INPUT,
"Leftover unconverted data in read buffer");
_("Leftover unconverted data in read buffer"));
return G_IO_STATUS_ERROR;
}
else
@ -1576,7 +1576,7 @@ read_again:
if (channel->encoding && channel->read_buf->len > 0)
{
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
"Channel terminates in a partial character");
_("Channel terminates in a partial character"));
return G_IO_STATUS_ERROR;
}
line_length = use_buf->len;
@ -1650,7 +1650,7 @@ g_io_channel_read_to_end (GIOChannel *channel,
if (channel->encoding && channel->read_buf->len > 0)
{
g_set_error (error, G_CONVERT_ERROR, G_CONVERT_ERROR_PARTIAL_INPUT,
"Channel terminates in a partial character");
_("Channel terminates in a partial character"));
return G_IO_STATUS_ERROR;
}
@ -1750,7 +1750,7 @@ g_io_channel_read_chars (GIOChannel *channel,
{
g_set_error (error, G_CONVERT_ERROR,
G_CONVERT_ERROR_PARTIAL_INPUT,
"Leftover unconverted data in read buffer");
_("Leftover unconverted data in read buffer"));
status = G_IO_STATUS_ERROR;
}
@ -1836,7 +1836,7 @@ g_io_channel_read_unichar (GIOChannel *channel,
{
g_set_error (error, G_CONVERT_ERROR,
G_CONVERT_ERROR_PARTIAL_INPUT,
"Leftover unconverted data in read buffer");
_("Leftover unconverted data in read buffer"));
status = G_IO_STATUS_ERROR;
}

View File

@ -123,16 +123,59 @@ struct _GIOWin32Watch {
};
static void
g_io_channel_win32_init (GIOWin32Channel *channel)
g_win32_print_access_mode (int flags)
{
g_print ("%s%s%s%s%s%s%s%s%s%s",
((flags & 0x3) == _O_RDWR ? "O_RDWR" :
((flags & 0x3) == _O_RDONLY ? "O_RDONLY" :
((flags & 0x3) == _O_WRONLY ? "O_WRONLY" : "0"))),
(flags & _O_APPEND ? "|O_APPEND" : ""),
(flags & _O_RANDOM ? "|O_RANDOM" : ""),
(flags & _O_SEQUENTIAL ? "|O_SEQUENTIAL" : ""),
(flags & _O_TEMPORARY ? "|O_TEMPORARY" : ""),
(flags & _O_CREAT ? "|O_CREAT" : ""),
(flags & _O_TRUNC ? "|O_TRUNC" : ""),
(flags & _O_EXCL ? "|O_EXCL" : ""),
(flags & _O_TEXT ? "|O_TEXT" : ""),
(flags & _O_BINARY ? "|O_BINARY" : ""));
}
static void
g_win32_print_gioflags (GIOFlags flags)
{
char *bar = "";
if (flags & G_IO_FLAG_APPEND)
bar = "|", g_print ("APPEND");
if (flags & G_IO_FLAG_NONBLOCK)
g_print ("%sNONBLOCK", bar), bar = "|";
if (flags & G_IO_FLAG_IS_READABLE)
g_print ("%sREADABLE", bar), bar = "|";
if (flags & G_IO_FLAG_IS_WRITEABLE)
g_print ("%sWRITEABLE", bar), bar = "|";
if (flags & G_IO_FLAG_IS_WRITEABLE)
g_print ("%sWRITEABLE", bar), bar = "|";
if (flags & G_IO_FLAG_IS_SEEKABLE)
g_print ("%sSEEKABLE", bar), bar = "|";
}
static gboolean
g_io_win32_get_debug_flag (void)
{
#ifdef G_IO_WIN32_DEBUG
channel->debug = TRUE;
return TRUE;
#else
if (getenv ("G_IO_WIN32_DEBUG") != NULL)
channel->debug = TRUE;
return TRUE;
else
channel->debug = FALSE;
return FALSE;
#endif
}
static void
g_io_channel_win32_init (GIOWin32Channel *channel)
{
channel->debug = g_io_win32_get_debug_flag ();
channel->buffer = NULL;
channel->running = FALSE;
channel->needs_close = FALSE;
@ -150,7 +193,7 @@ create_events (GIOWin32Channel *channel)
{
SECURITY_ATTRIBUTES sec_attrs;
sec_attrs.nLength = sizeof(SECURITY_ATTRIBUTES);
sec_attrs.nLength = sizeof (SECURITY_ATTRIBUTES);
sec_attrs.lpSecurityDescriptor = NULL;
sec_attrs.bInheritHandle = FALSE;
@ -161,8 +204,9 @@ create_events (GIOWin32Channel *channel)
|| !(channel->space_avail_event = CreateEvent (&sec_attrs, FALSE, FALSE, NULL))
|| !(channel->data_avail_noticed_event = CreateEvent (&sec_attrs, FALSE, FALSE, NULL)))
{
gchar *msg = g_win32_error_message (GetLastError ());
g_error ("Error creating event: %s", msg);
gchar *emsg = g_win32_error_message (GetLastError ());
g_error ("Error creating event: %s", emsg);
g_free (emsg);
}
}
@ -524,12 +568,11 @@ g_io_win32_prepare (GSource *source,
static gboolean
g_io_win32_check (GSource *source)
{
MSG msg;
MSG msg;
GIOWin32Watch *watch = (GIOWin32Watch *)source;
GIOWin32Channel *channel = (GIOWin32Channel *)watch->channel;
GIOCondition buffer_condition = g_io_channel_get_buffer_condition (watch->channel);
if (channel->debug)
g_print ("g_io_win32_check: for thread %#x:\n"
"\twatch->pollfd.events:%#x, watch->pollfd.revents:%#x, channel->revents:%#x\n",
@ -537,13 +580,13 @@ g_io_win32_check (GSource *source)
watch->pollfd.events, watch->pollfd.revents, channel->revents);
if (channel->type != G_IO_WIN32_WINDOWS_MESSAGES)
{
watch->pollfd.revents = (watch->pollfd.events & channel->revents);
}
else
{
return (PeekMessage (&msg, channel->hwnd, 0, 0, PM_NOREMOVE));
}
{
watch->pollfd.revents = (watch->pollfd.events & channel->revents);
}
else
{
return (PeekMessage (&msg, channel->hwnd, 0, 0, PM_NOREMOVE));
}
if (channel->type == G_IO_WIN32_SOCKET)
{
@ -655,20 +698,20 @@ g_io_win32_msg_read (GIOChannel *channel,
if (count < sizeof (MSG))
{
g_set_error(err, G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_INVAL,
_("Incorrect message size")); /* Correct error message? FIXME */
_("Incorrect message size")); /* Informative enough error message? */
return G_IO_STATUS_ERROR;
}
if (win32_channel->debug)
g_print ("g_io_win32_msg_read: for %#x\n",
win32_channel->hwnd);
(guint) win32_channel->hwnd);
if (!PeekMessage (&msg, win32_channel->hwnd, 0, 0, PM_REMOVE))
return G_IO_STATUS_AGAIN;
memmove (buf, &msg, sizeof (MSG));
*bytes_read = sizeof (MSG);
return (*bytes_read > 0) ? G_IO_STATUS_NORMAL : G_IO_STATUS_EOF;
return G_IO_STATUS_NORMAL;
}
static GIOStatus
@ -684,7 +727,7 @@ g_io_win32_msg_write (GIOChannel *channel,
if (count != sizeof (MSG))
{
g_set_error(err, G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_INVAL,
_("Incorrect message size")); /* Correct error message? FIXME */
_("Incorrect message size")); /* Informative enough error message? */
return G_IO_STATUS_ERROR;
}
@ -692,8 +735,9 @@ g_io_win32_msg_write (GIOChannel *channel,
memmove (&msg, buf, sizeof (MSG));
if (!PostMessage (win32_channel->hwnd, msg.message, msg.wParam, msg.lParam))
{
g_set_error(err, G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED,
_("Unknown error")); /* Correct error message? FIXME */
gchar *emsg = g_win32_error_message (GetLastError ());
g_set_error(err, G_IO_CHANNEL_ERROR, G_IO_CHANNEL_ERROR_FAILED, emsg);
g_free (emsg);
return G_IO_STATUS_ERROR;
}
@ -789,6 +833,9 @@ g_io_win32_fd_read (GIOChannel *channel,
result = read (win32_channel->fd, buf, count);
if (win32_channel->debug)
g_print ("g_io_win32_fd_read: read() = %d\n", result);
if (result < 0)
{
*bytes_read = 0;
@ -809,7 +856,6 @@ g_io_win32_fd_read (GIOChannel *channel,
*bytes_read = result;
return G_IO_STATUS_NORMAL; /* XXX: 0 byte read an error ?? */
return (result > 0) ? G_IO_STATUS_NORMAL : G_IO_STATUS_EOF;
}
@ -948,7 +994,9 @@ g_io_win32_sock_read (GIOChannel *channel,
if (win32_channel->debug)
g_print ("g_io_win32_sock_read: sockfd:%d count:%d\n",
win32_channel->fd, count);
#ifdef WE_NEED_TO_HANDLE_WSAEINTR
repeat:
#endif
result = recv (win32_channel->fd, buf, count, 0);
if (win32_channel->debug)
@ -981,7 +1029,6 @@ repeat:
{
*bytes_read = result;
return G_IO_STATUS_NORMAL; /* XXX: 0 byte read an error ?? */
return (result > 0) ? G_IO_STATUS_NORMAL : G_IO_STATUS_EOF;
}
}
@ -1000,7 +1047,9 @@ g_io_win32_sock_write (GIOChannel *channel,
if (win32_channel->debug)
g_print ("g_io_win32_sock_write: sockfd:%d count:%d\n",
win32_channel->fd, count);
#ifdef WE_NEED_TO_HANDLE_WSAEINTR
repeat:
#endif
result = send (win32_channel->fd, buf, count, 0);
if (win32_channel->debug)
@ -1160,9 +1209,16 @@ g_io_channel_new_file (const gchar *filename,
pmode = 0;
}
/* always open 'untranslated' */
fid = open (filename, flags | _O_BINARY, pmode);
if (g_io_win32_get_debug_flag ())
{
g_print ("g_io_channel_win32_new_file: open(\"%s\", ", filename);
g_win32_print_access_mode (flags|_O_BINARY);
g_print (",%#o)=%d\n", pmode, fid);
}
if (fid < 0)
{
g_set_error (error, G_FILE_ERROR,
@ -1198,9 +1254,6 @@ g_io_channel_new_file (const gchar *filename,
g_assert_not_reached ();
}
if (((GIOWin32Channel *)channel)->debug)
g_print ("g_io_channel_win32_new_file: fd = %ud\n", fid);
return channel;
}
@ -1211,6 +1264,13 @@ g_io_win32_set_flags (GIOChannel *channel,
{
GIOWin32Channel *win32_channel = (GIOWin32Channel *)channel;
if (win32_channel->debug)
{
g_print ("g_io_win32_set_flags: ");
g_win32_print_gioflags (flags);
g_print ("\n");
}
g_set_error (err,
G_IO_CHANNEL_ERROR,
g_file_error_from_errno (EACCES),
@ -1331,7 +1391,7 @@ g_io_channel_win32_new_fd (gint fd)
g_io_channel_init (channel);
g_io_channel_win32_init (win32_channel);
if (win32_channel->debug)
g_print ("g_io_channel_win32_new_fd: fd = %d\n", fd);
g_print ("g_io_channel_win32_new_fd: %u\n", fd);
channel->funcs = &win32_channel_fd_funcs;
win32_channel->type = G_IO_WIN32_FILE_DESC;
win32_channel->fd = fd;
@ -1350,8 +1410,8 @@ g_io_channel_win32_new_fd (gint fd)
{
channel->is_readable = !!(st.st_mode & _S_IREAD);
channel->is_writeable = !!(st.st_mode & _S_IWRITE);
/* XXX: pipes aren't seeakable, are they ? */
channel->is_seekable = !(st.st_mode & _S_IFIFO);
/* XXX What about "device files" (COM1: and the like) */
channel->is_seekable = TRUE;
}
return channel;
@ -1445,10 +1505,12 @@ g_io_channel_win32_make_pollfd (GIOChannel *channel,
fd->events = condition;
if (win32_channel->thread_id == 0)
if ((condition & G_IO_IN) && win32_channel->type == G_IO_WIN32_FILE_DESC)
create_thread (win32_channel, condition, read_thread);
else if (win32_channel->type == G_IO_WIN32_SOCKET)
create_thread (win32_channel, condition, select_thread);
{
if ((condition & G_IO_IN) && win32_channel->type == G_IO_WIN32_FILE_DESC)
create_thread (win32_channel, condition, read_thread);
else if (win32_channel->type == G_IO_WIN32_SOCKET)
create_thread (win32_channel, condition, select_thread);
}
}
/* Binary compatibility */

View File

@ -403,7 +403,7 @@ g_poll (GPollFD *fds,
f->revents |= G_IO_IN;
}
}
#if TEST_WITHOUT_THIS
#if 1 /* TEST_WITHOUT_THIS */
else if (ready >= WAIT_OBJECT_0 && ready < WAIT_OBJECT_0 + nhandles)
for (f = fds; f < &fds[nfds]; ++f)
{

View File

@ -94,6 +94,7 @@ g_rand_new (void)
{
guint32 seed;
GTimeVal now;
#if G_OS_UNIX
static gboolean dev_urandom_exists = TRUE;
if (dev_urandom_exists)
@ -108,6 +109,10 @@ g_rand_new (void)
else
dev_urandom_exists = FALSE;
}
#else
static gboolean dev_urandom_exists = FALSE;
#endif
if (!dev_urandom_exists)
{
g_get_current_time (&now);

View File

@ -225,7 +225,6 @@ WinMain (struct HINSTANCE__ *hInstance,
}
write (child_err_report_fd, &zero, sizeof (zero));
write (child_err_report_fd, &zero, sizeof (zero));
Sleep (10000);
return 0;
}

View File

@ -873,7 +873,6 @@ fork_exec_with_pipes (gboolean dont_wait,
gint stderr_pipe[2] = { -1, -1 };
gint child_err_report_pipe[2] = { -1, -1 };
gint status;
gint bytes;
gint buf[2];
gint n_ints = 0;

View File

@ -225,7 +225,7 @@ g_win32_closedir (DIR *dir)
}
#endif
/* msvc 5.0 headers don't have latest language and sublanguage codes */
/* MSVC 5.0 headers don't have latest language and sublanguage codes */
#ifndef LANG_ARMENIAN
#define LANG_ARMENIAN 0x2b
#endif
@ -344,10 +344,10 @@ g_win32_closedir (DIR *dir)
*
* The setlocale in the Microsoft C library uses locale names of the
* form "English_United States.1252" etc. We want the Unixish standard
* form "en", "zh_TW" etc. This function gets the current thread
* locale from Windows and returns it as a string of the above form
* for use in forming file names etc. The returned string should be
* deallocated with g_free().
* form "en_US", "zh_TW" etc. This function gets the current thread
* locale from Windows - without any encoding info - and returns it as
* a string of the above form for use in forming file names etc. The
* returned string should be deallocated with g_free().
*
* Returns: allocated locale name
*/
@ -356,23 +356,32 @@ gchar *
g_win32_getlocale (void)
{
LCID lcid;
LANGID langid;
gchar *ev;
gint primary, sub;
gchar *l = NULL, *sl = NULL;
gchar bfr[20];
if ((ev = getenv ("LC_ALL")) != NULL
|| (ev = getenv ("LC_CTYPE")) != NULL
|| (ev = getenv ("LANG")) != NULL)
/* Let the user override the system settings through environment
variables, as on POSIX systems. */
if (((ev = getenv ("LC_ALL")) != NULL && ev[0] != '\0')
|| ((ev = getenv ("LC_MESSAGES")) != NULL && ev[0] != '\0')
|| ((ev = getenv ("LANG")) != NULL && ev[0] != '\0'))
return g_strdup (ev);
/* Use native Win32 API locale ID. */
lcid = GetThreadLocale ();
primary = PRIMARYLANGID (LANGIDFROMLCID (lcid));
sub = SUBLANGID (LANGIDFROMLCID (lcid));
/* Strip off the sorting rules, keep only the language part. */
langid = LANGIDFROMLCID (lcid);
/* Split into language and territory part. */
primary = PRIMARYLANGID (langid);
sub = SUBLANGID (langid);
switch (primary)
{
case LANG_AFRIKAANS: l = "af"; break;
case LANG_ALBANIAN: l = "sq"; break;
case LANG_AFRIKAANS: l = "af"; sl = "ZA"; break;
case LANG_ALBANIAN: l = "sq"; sl = "AL"; break;
case LANG_ARABIC:
l = "ar";
switch (sub)
@ -395,20 +404,30 @@ g_win32_getlocale (void)
case SUBLANG_ARABIC_QATAR: sl = "QA"; break;
}
break;
case LANG_ARMENIAN: l = "hy"; break;
case LANG_ASSAMESE: l = "as"; break;
case LANG_AZERI: l = "az"; break;
case LANG_BASQUE: l = "eu"; break;
case LANG_BELARUSIAN: l = "be"; break;
case LANG_BENGALI: l = "bn"; break;
case LANG_BULGARIAN: l = "bg"; break;
case LANG_CATALAN: l = "ca"; break;
case LANG_ARMENIAN: l = "hy"; sl = "AM"; break;
case LANG_ASSAMESE: l = "as"; sl = "IN"; break;
case LANG_AZERI:
l = "az";
switch (sub)
{
/* FIXME: Adjust this when Azerbaijani locales appear on Unix. */
case SUBLANG_AZERI_LATIN: sl = "@latin"; break;
case SUBLANG_AZERI_CYRILLIC: sl = "@cyrillic"; break;
}
break;
case LANG_BASQUE:
l = "eu"; /* sl could be "ES" or "FR". */
break;
case LANG_BELARUSIAN: l = "be"; sl = "BY"; break;
case LANG_BENGALI: l = "bn"; sl = "IN"; break;
case LANG_BULGARIAN: l = "bg"; sl = "BG"; break;
case LANG_CATALAN: l = "ca"; sl = "ES"; break;
case LANG_CHINESE:
l = "zh";
switch (sub)
{
case SUBLANG_CHINESE_TRADITIONAL: sl = "TW"; break;
case SUBLANG_CHINESE_SIMPLIFIED: sl = "CH"; break;
case SUBLANG_CHINESE_SIMPLIFIED: sl = "CN"; break;
case SUBLANG_CHINESE_HONGKONG: sl = "HK"; break;
case SUBLANG_CHINESE_SINGAPORE: sl = "SG"; break;
case SUBLANG_CHINESE_MACAU: sl = "MO"; break;
@ -424,17 +443,19 @@ g_win32_getlocale (void)
*/
switch (sub)
{
case SUBLANG_SERBIAN_LATIN: l = "sp"; break;
case SUBLANG_SERBIAN_CYRILLIC: l = "sr"; break;
default: l = "hr"; /* ??? */
/* FIXME: How to distinguish Croatian and Latin Serbian locales? */
case SUBLANG_SERBIAN_LATIN: l = "sr"; break;
case SUBLANG_SERBIAN_CYRILLIC: l = "sr"; sl = "@cyrillic"; break;
default: l = "hr"; sl = "HR";
}
break;
case LANG_CZECH: l = "cs"; break;
case LANG_DANISH: l = "da"; break;
case LANG_CZECH: l = "cs"; sl = "CZ"; break;
case LANG_DANISH: l = "da"; sl = "DK"; break;
case LANG_DUTCH:
l = "nl";
switch (sub)
{
case SUBLANG_DUTCH: sl = "NL"; break;
case SUBLANG_DUTCH_BELGIAN: sl = "BE"; break;
}
break;
@ -442,10 +463,7 @@ g_win32_getlocale (void)
l = "en";
switch (sub)
{
/* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
* English was the language spoken in England.
* Oh well.
*/
case SUBLANG_ENGLISH_US: sl = "US"; break;
case SUBLANG_ENGLISH_UK: sl = "GB"; break;
case SUBLANG_ENGLISH_AUS: sl = "AU"; break;
case SUBLANG_ENGLISH_CAN: sl = "CA"; break;
@ -453,21 +471,22 @@ g_win32_getlocale (void)
case SUBLANG_ENGLISH_EIRE: sl = "IE"; break;
case SUBLANG_ENGLISH_SOUTH_AFRICA: sl = "ZA"; break;
case SUBLANG_ENGLISH_JAMAICA: sl = "JM"; break;
case SUBLANG_ENGLISH_CARIBBEAN: sl = "@caribbean"; break; /* ??? */
case SUBLANG_ENGLISH_CARIBBEAN: sl = "GD"; break; /* Grenada? */
case SUBLANG_ENGLISH_BELIZE: sl = "BZ"; break;
case SUBLANG_ENGLISH_TRINIDAD: sl = "TT"; break;
case SUBLANG_ENGLISH_ZIMBABWE: sl = "ZW"; break;
case SUBLANG_ENGLISH_PHILIPPINES: sl = "PH"; break;
}
break;
case LANG_ESTONIAN: l = "et"; break;
case LANG_FAEROESE: l = "fo"; break;
case LANG_FARSI: l = "fa"; break;
case LANG_FINNISH: l = "fi"; break;
case LANG_ESTONIAN: l = "et"; sl = "EE"; break;
case LANG_FAEROESE: l = "fo"; sl = "FO"; break;
case LANG_FARSI: l = "fa"; sl = "IR"; break;
case LANG_FINNISH: l = "fi"; sl = "FI"; break;
case LANG_FRENCH:
l = "fr";
switch (sub)
{
case SUBLANG_FRENCH: sl = "FR"; break;
case SUBLANG_FRENCH_BELGIAN: sl = "BE"; break;
case SUBLANG_FRENCH_CANADIAN: sl = "CA"; break;
case SUBLANG_FRENCH_SWISS: sl = "CH"; break;
@ -475,60 +494,71 @@ g_win32_getlocale (void)
case SUBLANG_FRENCH_MONACO: sl = "MC"; break;
}
break;
case LANG_GEORGIAN: l = "ka"; break;
case LANG_GEORGIAN: l = "ka"; sl = "GE"; break;
case LANG_GERMAN:
l = "de";
switch (sub)
{
case SUBLANG_GERMAN: sl = "DE"; break;
case SUBLANG_GERMAN_SWISS: sl = "CH"; break;
case SUBLANG_GERMAN_AUSTRIAN: sl = "AT"; break;
case SUBLANG_GERMAN_LUXEMBOURG: sl = "LU"; break;
case SUBLANG_GERMAN_LIECHTENSTEIN: sl = "LI"; break;
}
break;
case LANG_GREEK: l = "el"; break;
case LANG_GUJARATI: l = "gu"; break;
case LANG_HEBREW: l = "he"; break;
case LANG_HINDI: l = "hi"; break;
case LANG_HUNGARIAN: l = "hu"; break;
case LANG_ICELANDIC: l = "is"; break;
case LANG_INDONESIAN: l = "id"; break;
case LANG_GREEK: l = "el"; sl = "GR"; break;
case LANG_GUJARATI: l = "gu"; sl = "IN"; break;
case LANG_HEBREW: l = "he"; sl = "IL"; break;
case LANG_HINDI: l = "hi"; sl = "IN"; break;
case LANG_HUNGARIAN: l = "hu"; sl = "HU"; break;
case LANG_ICELANDIC: l = "is"; sl = "IS"; break;
case LANG_INDONESIAN: l = "id"; sl = "ID"; break;
case LANG_ITALIAN:
l = "it";
switch (sub)
{
case SUBLANG_ITALIAN: sl = "IT"; break;
case SUBLANG_ITALIAN_SWISS: sl = "CH"; break;
}
break;
case LANG_JAPANESE: l = "ja"; break;
case LANG_KANNADA: l = "kn"; break;
case LANG_JAPANESE: l = "ja"; sl = "JP"; break;
case LANG_KANNADA: l = "kn"; sl = "IN"; break;
case LANG_KASHMIRI:
l = "ks";
switch (sub)
{
case SUBLANG_DEFAULT: sl = "PK"; break;
case SUBLANG_KASHMIRI_INDIA: sl = "IN"; break;
}
break;
case LANG_KAZAK: l = "kk"; break;
case LANG_KONKANI: l = "kok"; break; /* ??? */
case LANG_KOREAN: l = "ko"; break;
case LANG_LATVIAN: l = "lv"; break;
case LANG_LITHUANIAN: l = "lt"; break;
case LANG_MACEDONIAN: l = "mk"; break;
case LANG_KAZAK: l = "kk"; sl = "KZ"; break;
case LANG_KONKANI:
/* FIXME: Adjust this when such locales appear on Unix. */
l = "kok"; sl = "IN";
break;
case LANG_KOREAN: l = "ko"; sl = "KR"; break;
case LANG_LATVIAN: l = "lv"; sl = "LV"; break;
case LANG_LITHUANIAN: l = "lt"; sl = "LT"; break;
case LANG_MACEDONIAN: l = "mk"; sl = "MK"; break;
case LANG_MALAY:
l = "ms";
switch (sub)
{
case SUBLANG_MALAY_MALAYSIA: sl = "MY"; break;
case SUBLANG_MALAY_BRUNEI_DARUSSALAM: sl = "BN"; break;
}
break;
case LANG_MALAYALAM: l = "ml"; break;
case LANG_MANIPURI: l = "mni"; break;
case LANG_MARATHI: l = "mr"; break;
case LANG_MALAYALAM: l = "ml"; sl = "IN"; break;
case LANG_MANIPURI:
/* FIXME: Adjust this when such locales appear on Unix. */
l = "mni"; sl = "IN";
break;
case LANG_MARATHI: l = "mr"; sl = "IN"; break;
case LANG_NEPALI:
l = "ne";
switch (sub)
{
case SUBLANG_DEFAULT: sl = "NP"; break;
case SUBLANG_NEPALI_INDIA: sl = "IN"; break;
}
break;
@ -536,33 +566,43 @@ g_win32_getlocale (void)
l = "no";
switch (sub)
{
/* SUBLANG_NORWEGIAN_BOKMAL == SUBLANG_DEFAULT */
case SUBLANG_NORWEGIAN_NYNORSK: l = "nn"; break;
case SUBLANG_NORWEGIAN_BOKMAL: sl = "NO"; break;
case SUBLANG_NORWEGIAN_NYNORSK: l = "nn"; sl = "NO"; break;
}
break;
case LANG_ORIYA: l = "or"; break;
case LANG_POLISH: l = "pl"; break;
case LANG_ORIYA: l = "or"; sl = "IN"; break;
case LANG_POLISH: l = "pl"; sl = "PL"; break;
case LANG_PORTUGUESE:
l = "pt";
switch (sub)
{
/* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT */
case SUBLANG_PORTUGUESE: sl = "PT"; break;
case SUBLANG_PORTUGUESE_BRAZILIAN: sl = "BR"; break;
}
break;
case LANG_PUNJABI: l = "pa"; break;
case LANG_ROMANIAN: l = "ro"; break;
case LANG_RUSSIAN: l = "ru"; break;
case LANG_SANSKRIT: l = "sa"; break;
case LANG_PUNJABI: l = "pa"; sl = "IN"; break;
case LANG_ROMANIAN: l = "ro"; sl = "RO"; break;
case LANG_RUSSIAN:
l = "ru"; /* sl could be "RU" or "UA". */
break;
case LANG_SANSKRIT: l = "sa"; sl = "IN"; break;
case LANG_SINDHI: l = "sd"; break;
case LANG_SLOVAK: l = "sk"; break;
case LANG_SLOVENIAN: l = "sl"; break;
case LANG_SLOVAK: l = "sk"; sl = "SK"; break;
case LANG_SLOVENIAN: l = "sl"; sl = "SI"; break;
#ifdef LANG_SORBIAN
case LANG_SORBIAN:
/* FIXME: Adjust this when such locales appear on Unix. */
l = "wen"; sl = "DE";
break;
#endif
case LANG_SPANISH:
l = "es";
switch (sub)
{
case SUBLANG_SPANISH: sl = "ES"; break;
case SUBLANG_SPANISH_MEXICAN: sl = "MX"; break;
case SUBLANG_SPANISH_MODERN: sl = "@modern"; break; /* ??? */
case SUBLANG_SPANISH_MODERN:
sl = "ES@modern"; break; /* not seen on Unix */
case SUBLANG_SPANISH_GUATEMALA: sl = "GT"; break;
case SUBLANG_SPANISH_COSTA_RICA: sl = "CR"; break;
case SUBLANG_SPANISH_PANAMA: sl = "PA"; break;
@ -587,15 +627,18 @@ g_win32_getlocale (void)
l = "sv";
switch (sub)
{
case SUBLANG_DEFAULT: sl = "SE"; break;
case SUBLANG_SWEDISH_FINLAND: sl = "FI"; break;
}
break;
case LANG_TAMIL: l = "ta"; break;
case LANG_TAMIL:
l = "ta"; /* sl could be "IN" or "LK". */
break;
case LANG_TATAR: l = "tt"; break;
case LANG_TELUGU: l = "te"; break;
case LANG_THAI: l = "th"; break;
case LANG_TURKISH: l = "tr"; break;
case LANG_UKRAINIAN: l = "uk"; break;
case LANG_TELUGU: l = "te"; sl = "IN"; break;
case LANG_THAI: l = "th"; sl = "TH"; break;
case LANG_TURKISH: l = "tr"; sl = "TR"; break;
case LANG_UKRAINIAN: l = "uk"; sl = "UA"; break;
case LANG_URDU:
l = "ur";
switch (sub)
@ -608,10 +651,12 @@ g_win32_getlocale (void)
l = "uz";
switch (sub)
{
case SUBLANG_UZBEK_CYRILLIC: sl = "@cyrillic"; break;
/* FIXME: Adjust this when Uzbek locales appear on Unix. */
case SUBLANG_UZBEK_LATIN: sl = "UZ@latin"; break;
case SUBLANG_UZBEK_CYRILLIC: sl = "UZ@cyrillic"; break;
}
break;
case LANG_VIETNAMESE: l = "vi"; break;
case LANG_VIETNAMESE: l = "vi"; sl = "VN"; break;
default: l = "xx"; break;
}
strcpy (bfr, l);

View File

@ -65,7 +65,8 @@ glib_OBJECTS = \
guniprop.o \
gutf8.o \
gutils.o \
gwin32.o
gwin32.o \
localcharset.o
../glibconfig.h: ../glibconfig.h.win32
cp $< $@
@ -73,6 +74,9 @@ glib_OBJECTS = \
../config.h: ../config.h.win32
cp $< $@
localcharset.c : libcharset/localcharset.c
cp $< $@
################ The glib DLL
libglib-@GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@.a : $(glib_OBJECTS) glib.def glib-@GLIB_MAJOR_VERSION@.@GLIB_MINOR_VERSION@.rc

View File

@ -57,12 +57,13 @@ glib_OBJECTS = \
gtimer.obj \
gtree.obj \
gunibreak.obj \
gunicollate.obj \
gunicollate.obj \
gunidecomp.obj \
guniprop.obj \
gutf8.obj \
gutils.obj \
gwin32.obj
gwin32.obj \
localcharset.obj
..\glibconfig.h: ..\glibconfig.h.win32
copy ..\glibconfig.h.win32 ..\glibconfig.h
@ -70,6 +71,9 @@ glib_OBJECTS = \
..\config.h: ..\config.h.win32
copy ..\config.h.win32 ..\config.h
localcharset.c : libcharset/localcharset.c
copy libcharset\localcharset.c localcharset.c
################ glib
# create a static libary

View File

@ -1,3 +1,19 @@
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.
2001-09-26 Tor Lillqvist <tml@iki.fi>
* makefile.mingw.in: Fix couple of typos.

View File

@ -274,6 +274,19 @@ g_thread_init_with_errorcheck_mutexes (GThreadFunctions* init)
if (init)
g_error ("Errorcheck mutexes can only be used for native "
"thread implementations. Sorry." );
#ifdef HAVE_G_THREAD_IMPL_INIT
/* This isn't called in g_thread_init, as it doesn't think to get
* the default implementation, so we have to call it on our own.
*
* We must call this before copying
* g_thread_functions_for_glib_use_default as the
* implementation-specific init function might modify the contents
* of g_thread_functions_for_glib_use_default based on operating
* system version, C library version, or whatever. */
g_thread_impl_init();
#endif
errorcheck_functions = g_thread_functions_for_glib_use_default;
errorcheck_functions.mutex_new = g_mutex_new_errorcheck_impl;
errorcheck_functions.mutex_lock =
@ -290,12 +303,6 @@ g_thread_init_with_errorcheck_mutexes (GThreadFunctions* init)
(gboolean (*)(GCond *, GMutex *, GTimeVal *))
g_cond_timed_wait_errorcheck_impl;
#ifdef HAVE_G_THREAD_IMPL_INIT
/* This isn't called in g_thread_init, as it doesn't think to get
* the default implementation, so we have to call it on our own. */
g_thread_impl_init();
#endif
g_thread_init (&errorcheck_functions);
}

View File

@ -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 ()
}
}
}

View File

@ -1,3 +1,9 @@
2001-09-28 Tor Lillqvist <tml@iki.fi>
* POTFILES.in: Add iochannel.c and giowin32.c.
* sv.po: Remove a bogus fuzziness indicator.
2001-09-25 Pablo Saratxaga <pablo@mandrakesoft.com>
* ca.po: Updated Catalan file

View File

@ -1,5 +1,7 @@
glib/gconvert.c
glib/gfileutils.c
glib/giochannel.c
glib/giowin32.c
glib/gmarkup.c
glib/gshell.c
glib/gspawn-win32.c

View File

@ -107,7 +107,7 @@ msgid "Failed to open file '%s': fdopen() failed: %s"
msgstr "Misslyckades med att öppna filen \"%s\": fdopen() misslyckades: %s"
#: glib/gfileutils.c:655
#, fuzzy, c-format
#, c-format
msgid "Template '%s' invalid, should not contain a '%s'"
msgstr "Mallen \"%s\" är ogiltig, den får inte innehålla ett \"%s\""