Commit b575b4da authored by Rafaël Carré's avatar Rafaël Carré

ncurses: don't use *Locale() conversion functions when compiled with wide characters support

parent 08c70360
...@@ -426,7 +426,9 @@ static void Run( intf_thread_t *p_intf ) ...@@ -426,7 +426,9 @@ static void Run( intf_thread_t *p_intf )
} }
/* following functions are local */ /* following functions are local */
#ifdef HAVE_NCURSESW_CURSES_H
# define KeyToUTF8( i, psz ) psz
#else
static char *KeyToUTF8( int i_key, char *psz_part ) static char *KeyToUTF8( int i_key, char *psz_part )
{ {
char *psz_utf8, *psz; char *psz_utf8, *psz;
...@@ -463,6 +465,7 @@ static char *KeyToUTF8( int i_key, char *psz_part ) ...@@ -463,6 +465,7 @@ static char *KeyToUTF8( int i_key, char *psz_part )
memset( psz_part, 0, 6 ); memset( psz_part, 0, 6 );
return psz_utf8; return psz_utf8;
} }
#endif
static inline int RemoveLastUTF8Entity( char *psz, int len ) static inline int RemoveLastUTF8Entity( char *psz, int len )
{ {
...@@ -1177,18 +1180,23 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... ) ...@@ -1177,18 +1180,23 @@ static void mvnprintw( int y, int x, int w, const char *p_fmt, ... )
p_buf[w/2 ] = '.'; p_buf[w/2 ] = '.';
p_buf[w/2+1] = '.'; p_buf[w/2+1] = '.';
} }
#ifdef HAVE_NCURSESW_CURSES_H
mvprintw( y, x, "%s", p_buf );
#else
psz_local = ToLocale( p_buf ); psz_local = ToLocale( p_buf );
mvprintw( y, x, "%s", psz_local ); mvprintw( y, x, "%s", psz_local );
LocaleFree( p_buf ); LocaleFree( p_buf );
#endif
} }
else else
{ {
char *psz_local = ToLocale( p_buf );
mvprintw( y, x, "%s", psz_local );
LocaleFree( p_buf );
#ifdef HAVE_NCURSESW_CURSES_H #ifdef HAVE_NCURSESW_CURSES_H
mvprintw( y, x, "%s", p_buf );
mvhline( y, x + i_width, ' ', w - i_width ); mvhline( y, x + i_width, ' ', w - i_width );
#else #else
char *psz_local = ToLocale( p_buf );
mvprintw( y, x, "%s", psz_local );
LocaleFree( p_buf );
mvhline( y, x + i_len, ' ', w - i_len ); mvhline( y, x + i_len, ' ', w - i_len );
#endif #endif
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment