mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 12:32:40 +03:00
Use UTF8_CHAR_LEN instead of a magic number
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
74d4efe871
commit
a3b8a2f005
@ -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;
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user