mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-03 01:54:24 +03:00
g_utf8_next_char() never returns NULL. Remove redundant checks.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
67f465209b
commit
5cbfc77d2c
@ -586,7 +586,6 @@ dview_get_utf (char *str, int *char_length, gboolean * result)
|
|||||||
{
|
{
|
||||||
int res = -1;
|
int res = -1;
|
||||||
gunichar ch;
|
gunichar ch;
|
||||||
gchar *next_ch = NULL;
|
|
||||||
int ch_len = 0;
|
int ch_len = 0;
|
||||||
|
|
||||||
*result = TRUE;
|
*result = TRUE;
|
||||||
@ -603,6 +602,8 @@ dview_get_utf (char *str, int *char_length, gboolean * result)
|
|||||||
ch = *str;
|
ch = *str;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
gchar *next_ch;
|
||||||
|
|
||||||
ch = res;
|
ch = res;
|
||||||
/* Calculate UTF-8 char length */
|
/* Calculate UTF-8 char length */
|
||||||
next_ch = g_utf8_next_char (str);
|
next_ch = g_utf8_next_char (str);
|
||||||
|
@ -255,13 +255,7 @@ edit_buffer_get_utf (const edit_buffer_t * buf, off_t byte_index, int *char_leng
|
|||||||
ch = res;
|
ch = res;
|
||||||
/* Calculate UTF-8 char length */
|
/* Calculate UTF-8 char length */
|
||||||
next_ch = g_utf8_next_char (str);
|
next_ch = g_utf8_next_char (str);
|
||||||
if (next_ch != NULL)
|
*char_length = next_ch - str;
|
||||||
*char_length = next_ch - str;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ch = 0;
|
|
||||||
*char_length = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) ch;
|
return (int) ch;
|
||||||
|
@ -252,8 +252,7 @@ line_pixel_length (unsigned char *t, off_t b, off_t l, gboolean utf8)
|
|||||||
|
|
||||||
/* Calculate UTF-8 char length */
|
/* Calculate UTF-8 char length */
|
||||||
next_ch = g_utf8_next_char (tb);
|
next_ch = g_utf8_next_char (tb);
|
||||||
if (next_ch != NULL)
|
char_length = next_ch - tb;
|
||||||
char_length = next_ch - tb;
|
|
||||||
|
|
||||||
if (g_unichar_iswide (ch))
|
if (g_unichar_iswide (ch))
|
||||||
x++;
|
x++;
|
||||||
|
@ -213,10 +213,7 @@ mcview_get_utf (mcview_t * view, off_t byte_index, int *char_length, gboolean *
|
|||||||
ch = res;
|
ch = res;
|
||||||
/* Calculate UTF-8 char length */
|
/* Calculate UTF-8 char length */
|
||||||
next_ch = g_utf8_next_char (str);
|
next_ch = g_utf8_next_char (str);
|
||||||
if (next_ch != NULL)
|
*char_length = next_ch - str;
|
||||||
*char_length = next_ch - str;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
*result = TRUE;
|
*result = TRUE;
|
||||||
return ch;
|
return ch;
|
||||||
|
Loading…
Reference in New Issue
Block a user