mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-08 03:45:49 +01:00
New function, parallel to ensure_stdout_valid(). #defined as empty on
2003-01-01 Tor Lillqvist <tml@iki.fi> * glib/gmessages.c (ensure_stderr_valid): New function, parallel to ensure_stdout_valid(). #defined as empty on Unix. (mklevel_prefix): Do use either stderr or stdout on Windows, too. Otherwise g_warning() messages (that are just warnings, by definition) will get mixed with proper stdout output. Noticed in GIMP's gimpconfig-dump. (strdup_convert, mklevel_prefix, g_printerr): Call ensure_stderr_valid() before trying to use stderr. (g_logv): [Win32] Convert message to current codepage before display with MessageBox().
This commit is contained in:
parent
63d6e3e49d
commit
1b68ce7033
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2003-01-01 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
|
||||
to ensure_stdout_valid(). #defined as empty on Unix.
|
||||
(mklevel_prefix): Do use either stderr or stdout on Windows,
|
||||
too. Otherwise g_warning() messages (that are just warnings, by
|
||||
definition) will get mixed with proper stdout output. Noticed in
|
||||
GIMP's gimpconfig-dump.
|
||||
(strdup_convert, mklevel_prefix, g_printerr): Call
|
||||
ensure_stderr_valid() before trying to use stderr.
|
||||
(g_logv): [Win32] Convert message to current codepage before
|
||||
display with MessageBox().
|
||||
|
||||
2002-12-28 Tõivo Leedjärv <toivo@linux.ee>
|
||||
|
||||
* configure.in: Added et to ALL_LINGUAS.
|
||||
|
@ -1,3 +1,16 @@
|
||||
2003-01-01 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
|
||||
to ensure_stdout_valid(). #defined as empty on Unix.
|
||||
(mklevel_prefix): Do use either stderr or stdout on Windows,
|
||||
too. Otherwise g_warning() messages (that are just warnings, by
|
||||
definition) will get mixed with proper stdout output. Noticed in
|
||||
GIMP's gimpconfig-dump.
|
||||
(strdup_convert, mklevel_prefix, g_printerr): Call
|
||||
ensure_stderr_valid() before trying to use stderr.
|
||||
(g_logv): [Win32] Convert message to current codepage before
|
||||
display with MessageBox().
|
||||
|
||||
2002-12-28 Tõivo Leedjärv <toivo@linux.ee>
|
||||
|
||||
* configure.in: Added et to ALL_LINGUAS.
|
||||
|
@ -1,3 +1,16 @@
|
||||
2003-01-01 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
|
||||
to ensure_stdout_valid(). #defined as empty on Unix.
|
||||
(mklevel_prefix): Do use either stderr or stdout on Windows,
|
||||
too. Otherwise g_warning() messages (that are just warnings, by
|
||||
definition) will get mixed with proper stdout output. Noticed in
|
||||
GIMP's gimpconfig-dump.
|
||||
(strdup_convert, mklevel_prefix, g_printerr): Call
|
||||
ensure_stderr_valid() before trying to use stderr.
|
||||
(g_logv): [Win32] Convert message to current codepage before
|
||||
display with MessageBox().
|
||||
|
||||
2002-12-28 Tõivo Leedjärv <toivo@linux.ee>
|
||||
|
||||
* configure.in: Added et to ALL_LINGUAS.
|
||||
|
@ -1,3 +1,16 @@
|
||||
2003-01-01 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
|
||||
to ensure_stdout_valid(). #defined as empty on Unix.
|
||||
(mklevel_prefix): Do use either stderr or stdout on Windows,
|
||||
too. Otherwise g_warning() messages (that are just warnings, by
|
||||
definition) will get mixed with proper stdout output. Noticed in
|
||||
GIMP's gimpconfig-dump.
|
||||
(strdup_convert, mklevel_prefix, g_printerr): Call
|
||||
ensure_stderr_valid() before trying to use stderr.
|
||||
(g_logv): [Win32] Convert message to current codepage before
|
||||
display with MessageBox().
|
||||
|
||||
2002-12-28 Tõivo Leedjärv <toivo@linux.ee>
|
||||
|
||||
* configure.in: Added et to ALL_LINGUAS.
|
||||
|
@ -1,3 +1,16 @@
|
||||
2003-01-01 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
|
||||
to ensure_stdout_valid(). #defined as empty on Unix.
|
||||
(mklevel_prefix): Do use either stderr or stdout on Windows,
|
||||
too. Otherwise g_warning() messages (that are just warnings, by
|
||||
definition) will get mixed with proper stdout output. Noticed in
|
||||
GIMP's gimpconfig-dump.
|
||||
(strdup_convert, mklevel_prefix, g_printerr): Call
|
||||
ensure_stderr_valid() before trying to use stderr.
|
||||
(g_logv): [Win32] Convert message to current codepage before
|
||||
display with MessageBox().
|
||||
|
||||
2002-12-28 Tõivo Leedjärv <toivo@linux.ee>
|
||||
|
||||
* configure.in: Added et to ALL_LINGUAS.
|
||||
|
@ -1,3 +1,16 @@
|
||||
2003-01-01 Tor Lillqvist <tml@iki.fi>
|
||||
|
||||
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
|
||||
to ensure_stdout_valid(). #defined as empty on Unix.
|
||||
(mklevel_prefix): Do use either stderr or stdout on Windows,
|
||||
too. Otherwise g_warning() messages (that are just warnings, by
|
||||
definition) will get mixed with proper stdout output. Noticed in
|
||||
GIMP's gimpconfig-dump.
|
||||
(strdup_convert, mklevel_prefix, g_printerr): Call
|
||||
ensure_stderr_valid() before trying to use stderr.
|
||||
(g_logv): [Win32] Convert message to current codepage before
|
||||
display with MessageBox().
|
||||
|
||||
2002-12-28 Tõivo Leedjärv <toivo@linux.ee>
|
||||
|
||||
* configure.in: Added et to ALL_LINGUAS.
|
||||
|
@ -139,8 +139,31 @@ ensure_stdout_valid (void)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
ensure_stderr_valid (void)
|
||||
{
|
||||
HANDLE handle;
|
||||
|
||||
if (win32_keep_fatal_message)
|
||||
return;
|
||||
|
||||
if (!alloc_console_called)
|
||||
{
|
||||
handle = GetStdHandle (STD_ERROR_HANDLE);
|
||||
|
||||
if (handle == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
AllocConsole ();
|
||||
alloc_console_called = TRUE;
|
||||
freopen ("CONOUT$", "w", stderr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
#define ensure_stdout_valid() /* Define as empty */
|
||||
#define ensure_stderr_valid()
|
||||
#endif
|
||||
|
||||
static void
|
||||
@ -470,7 +493,9 @@ g_logv (const gchar *log_domain,
|
||||
if (test_level & G_LOG_FLAG_FATAL)
|
||||
{
|
||||
#ifdef G_OS_WIN32
|
||||
MessageBox (NULL, fatal_msg_buf, NULL, MB_OK);
|
||||
gchar *locale_msg = g_locale_from_utf8 (fatal_msg_buf, -1, NULL, NULL, NULL);
|
||||
|
||||
MessageBox (NULL, locale_msg, NULL, MB_OK);
|
||||
#endif
|
||||
#if defined (G_ENABLE_DEBUG) && (defined (SIGTRAP) || defined (G_OS_WIN32))
|
||||
if (!(test_level & G_LOG_FLAG_RECURSION))
|
||||
@ -522,6 +547,7 @@ strdup_convert (const gchar *string,
|
||||
if (!warned)
|
||||
{
|
||||
warned = TRUE;
|
||||
ensure_stderr_valid ();
|
||||
_g_fprintf (stderr, "GLib: Cannot convert message: %s\n", err->message);
|
||||
}
|
||||
g_error_free (err);
|
||||
@ -654,11 +680,19 @@ mklevel_prefix (gchar level_prefix[STRING_BUFFER_SIZE],
|
||||
if (log_level & ALERT_LEVELS)
|
||||
strcat (level_prefix, " **");
|
||||
|
||||
ensure_stdout_valid ();
|
||||
#ifdef G_OS_WIN32
|
||||
win32_keep_fatal_message = (log_level & G_LOG_FLAG_FATAL) != 0;
|
||||
/* Use just stdout as stderr is hard to get redirected from the DOS prompt. */
|
||||
return stdout;
|
||||
|
||||
if (to_stdout)
|
||||
{
|
||||
ensure_stdout_valid ();
|
||||
return stdout;
|
||||
}
|
||||
else
|
||||
{
|
||||
ensure_stderr_valid ();
|
||||
return stderr;
|
||||
}
|
||||
#else
|
||||
return to_stdout ? 1 : 2;
|
||||
#endif
|
||||
@ -869,6 +903,7 @@ g_printerr (const gchar *format,
|
||||
{
|
||||
const gchar *charset;
|
||||
|
||||
ensure_stderr_valid ();
|
||||
if (g_get_charset (&charset))
|
||||
fputs (string, stderr); /* charset is UTF-8 already */
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user