+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.
+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.
+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.
+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.
+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.
+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.
}
}
}
+
+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
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))
if (!warned)
{
warned = TRUE;
+ ensure_stderr_valid ();
_g_fprintf (stderr, "GLib: Cannot convert message: %s\n", err->message);
}
g_error_free (err);
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
{
const gchar *charset;
+ ensure_stderr_valid ();
if (g_get_charset (&charset))
fputs (string, stderr); /* charset is UTF-8 already */
else