From: Kalle Wallin Date: Wed, 14 Apr 2004 19:26:25 +0000 (+0000) Subject: Use screen_status_printf() to display character conversion errors. Only use X-Git-Tag: v0.12_alpha1~588 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=3b9684fc2a84b50ec682db84c1c82f6760250806;p=ncmpc.git Use screen_status_printf() to display character conversion errors. Only use stderr if DEBUG is enabled. git-svn-id: https://svn.musicpd.org/ncmpc/trunk@758 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- diff --git a/support.c b/support.c index b55fc0a..564fd9b 100644 --- a/support.c +++ b/support.c @@ -11,8 +11,16 @@ #include #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); }