Code

Use screen_status_printf() to display character conversion errors. Only use
authorKalle Wallin <kaw@linux.se>
Wed, 14 Apr 2004 19:26:25 +0000 (19:26 +0000)
committerKalle Wallin <kaw@linux.se>
Wed, 14 Apr 2004 19:26:25 +0000 (19:26 +0000)
stderr if DEBUG is enabled.

git-svn-id: https://svn.musicpd.org/ncmpc/trunk@758 09075e82-0dd4-0310-85a5-a0d7c8717e4f

support.c

index b55fc0ac79af3b2bf1a27e8e15196deeac584bf7..564fd9b83825d19246d8b53f8d07741062ab6f96 100644 (file)
--- a/support.c
+++ b/support.c
 #include <locale.h>
 #endif
 
+#ifdef DEBUG
+#define D(x) x
+#else 
+#define D(x)
+#endif
+
 #define BUFSIZE 1024
 
+extern void screen_status_printf(char *format, ...);
+
 static const char *charset = NULL;
 static const char *locale = NULL;
 static gboolean noconvert = TRUE;
@@ -148,7 +156,9 @@ utf8_to_locale(char *utf8str)
                         &error);
   if( error )
     {
-      g_printerr("utf8_to_locale(): %s\n", error->message);
+      screen_status_printf("Error: Unable to convert characters to %s",
+                          charset);
+      D(g_printerr("utf8_to_locale(): %s\n", error->message));
       g_error_free(error);
       return g_strdup(utf8str);
     }
@@ -175,7 +185,8 @@ locale_to_utf8(char *localestr)
                       &error);
   if( error )
     {
-      g_printerr("locale_to_utf8: %s\n", error->message);
+      screen_status_printf("Error: Unable to convert characters to UTF-8");
+      D(g_printerr("locale_to_utf8: %s\n", error->message));
       g_error_free(error);
       return g_strdup(localestr);
     }