diff --git a/lib/charsets.c b/lib/charsets.c index 3fee23ab2..3bbf9a273 100644 --- a/lib/charsets.c +++ b/lib/charsets.c @@ -432,7 +432,7 @@ str_nconvert_to_input (char *str, int len) unsigned char convert_from_utf_to_current (const char *str) { - unsigned char buf_ch[6 + 1]; + unsigned char buf_ch[UTF8_CHAR_LEN + 1]; unsigned char ch = '.'; GIConv conv; const char *cp_to; @@ -467,8 +467,8 @@ convert_from_utf_to_current (const char *str) unsigned char convert_from_utf_to_current_c (const int input_char, GIConv conv) { - unsigned char str[6 + 1]; - unsigned char buf_ch[6 + 1]; + unsigned char str[UTF8_CHAR_LEN + 1]; + unsigned char buf_ch[UTF8_CHAR_LEN + 1]; unsigned char ch = '.'; int res = 0; @@ -499,7 +499,7 @@ int convert_from_8bit_to_utf_c (const char input_char, GIConv conv) { unsigned char str[2]; - unsigned char buf_ch[6 + 1]; + unsigned char buf_ch[UTF8_CHAR_LEN + 1]; int ch = '.'; int res = 0; @@ -533,7 +533,7 @@ int convert_from_8bit_to_utf_c2 (const char input_char) { unsigned char str[2]; - unsigned char buf_ch[6 + 1]; + unsigned char buf_ch[UTF8_CHAR_LEN + 1]; int ch = '.'; int res = 0; GIConv conv; diff --git a/lib/tty/tty-ncurses.c b/lib/tty/tty-ncurses.c index a48897e53..9599aca8a 100644 --- a/lib/tty/tty-ncurses.c +++ b/lib/tty/tty-ncurses.c @@ -528,7 +528,7 @@ tty_print_char (int c) void tty_print_anychar (int c) { - unsigned char str[6 + 1]; + unsigned char str[UTF8_CHAR_LEN + 1]; if (mc_global.utf8_display || c > 255) { diff --git a/lib/tty/tty-slang.c b/lib/tty/tty-slang.c index e03637d00..8b830a4c4 100644 --- a/lib/tty/tty-slang.c +++ b/lib/tty/tty-slang.c @@ -672,7 +672,7 @@ tty_print_alt_char (int c, gboolean single) void tty_print_anychar (int c) { - char str[6 + 1]; + char str[UTF8_CHAR_LEN + 1]; if (c > 255) { diff --git a/src/editor/edit.c b/src/editor/edit.c index 4e9fb2ded..6bb50fb45 100644 --- a/src/editor/edit.c +++ b/src/editor/edit.c @@ -3297,7 +3297,7 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion) #ifdef HAVE_CHARSET if (char_for_insertion > 255 && !mc_global.utf8_display) { - unsigned char str[6 + 1]; + unsigned char str[UTF8_CHAR_LEN + 1]; size_t i = 0; int res; @@ -3311,7 +3311,7 @@ edit_execute_cmd (WEdit * edit, unsigned long command, int char_for_insertion) { str[res] = '\0'; } - while (str[i] != 0 && i <= 6) + while (i <= UTF8_CHAR_LEN && str[i] != 0) { char_for_insertion = str[i]; edit_insert (edit, char_for_insertion); diff --git a/src/viewer/hex.c b/src/viewer/hex.c index 104422cbb..b126d7ce6 100644 --- a/src/viewer/hex.c +++ b/src/viewer/hex.c @@ -173,7 +173,7 @@ mcview_display_hex (mcview_t * view) #ifdef HAVE_CHARSET if (view->utf8) { - char corr_buf[6 + 1]; + char corr_buf[UTF8_CHAR_LEN + 1]; int cnt, cw = 1; gboolean read_res = TRUE; ch = mcview_get_utf (view, from, &cw, &read_res);