1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-14 23:32:27 +00:00

[cast] (unsigned char) for isspace

This commit is contained in:
Witold Filipczyk 2022-10-16 16:04:00 +02:00
parent 828d9e75cf
commit 927fe10c6a
2 changed files with 10 additions and 10 deletions

View File

@ -595,9 +595,9 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
int cdata_len = strlen(widget_data->cdata);
int start = widget_data->info.field.cpos;
while (start > 0 && isspace(widget_data->cdata[start - 1]))
while (start > 0 && isspace((unsigned char)widget_data->cdata[start - 1]))
--start;
while (start > 0 && !isspace(widget_data->cdata[start - 1]))
while (start > 0 && !isspace((unsigned char)widget_data->cdata[start - 1]))
--start;
memmove(widget_data->cdata + start,
@ -610,19 +610,19 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
}
case ACT_EDIT_MOVE_BACKWARD_WORD:
while (widget_data->info.field.cpos > 0 && isspace(widget_data->cdata[widget_data->info.field.cpos - 1]))
while (widget_data->info.field.cpos > 0 && isspace((unsigned char)widget_data->cdata[widget_data->info.field.cpos - 1]))
--widget_data->info.field.cpos;
while (widget_data->info.field.cpos > 0 && !isspace(widget_data->cdata[widget_data->info.field.cpos - 1]))
while (widget_data->info.field.cpos > 0 && !isspace((unsigned char)widget_data->cdata[widget_data->info.field.cpos - 1]))
--widget_data->info.field.cpos;
goto display_field;
case ACT_EDIT_MOVE_FORWARD_WORD:
while (isspace(widget_data->cdata[widget_data->info.field.cpos]))
while (isspace((unsigned char)widget_data->cdata[widget_data->info.field.cpos]))
++widget_data->info.field.cpos;
while (widget_data->cdata[widget_data->info.field.cpos] && !isspace(widget_data->cdata[widget_data->info.field.cpos]))
while (widget_data->cdata[widget_data->info.field.cpos] && !isspace((unsigned char)widget_data->cdata[widget_data->info.field.cpos]))
++widget_data->info.field.cpos;
while (isspace(widget_data->cdata[widget_data->info.field.cpos]))
while (isspace((unsigned char)widget_data->cdata[widget_data->info.field.cpos]))
++widget_data->info.field.cpos;
goto display_field;

View File

@ -20,7 +20,7 @@
#include "util/color.h"
/* FIXME: For UTF-8 strings we need better function than isspace. */
#define is_unsplitable(pos) (*(pos) && *(pos) != '\n' && !isspace(*(pos)))
#define is_unsplitable(pos) (*(pos) && *(pos) != '\n' && !isspace((unsigned char)*(pos)))
void
add_dlg_text(struct dialog *dlg, char *text,
@ -175,7 +175,7 @@ split_lines(struct widget_data *widget_data, int max_width)
int cells = 0;
/* Skip first leading \n or space. */
if (isspace(*text)) text++;
if (isspace((unsigned char)*text)) text++;
if (!*text) break;
#ifdef CONFIG_UTF8
@ -229,7 +229,7 @@ dlg_format_text_do(struct dialog_data *dlg_data,
int cells = 0;
/* Skip first leading \n or space. */
if (!firstline && isspace(*text))
if (!firstline && isspace((unsigned char)*text))
text++;
else
firstline = 0;