mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[isspace] Some implementations of isspace require unsigned char
This commit is contained in:
parent
d25d85d781
commit
7ea04c7f0f
@ -601,9 +601,9 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
|||||||
int cdata_len = strlen(widget_data->cdata);
|
int cdata_len = strlen(widget_data->cdata);
|
||||||
int start = widget_data->info.field.cpos;
|
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;
|
--start;
|
||||||
while (start > 0 && !isspace(widget_data->cdata[start - 1]))
|
while (start > 0 && !isspace((unsigned char)widget_data->cdata[start - 1]))
|
||||||
--start;
|
--start;
|
||||||
|
|
||||||
memmove(widget_data->cdata + start,
|
memmove(widget_data->cdata + start,
|
||||||
@ -616,19 +616,19 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case ACT_EDIT_MOVE_BACKWARD_WORD:
|
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;
|
--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;
|
--widget_data->info.field.cpos;
|
||||||
|
|
||||||
goto display_field;
|
goto display_field;
|
||||||
|
|
||||||
case ACT_EDIT_MOVE_FORWARD_WORD:
|
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;
|
++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;
|
++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;
|
++widget_data->info.field.cpos;
|
||||||
|
|
||||||
goto display_field;
|
goto display_field;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "util/color.h"
|
#include "util/color.h"
|
||||||
|
|
||||||
/* FIXME: For UTF-8 strings we need better function than isspace. */
|
/* 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
|
void
|
||||||
add_dlg_text(struct dialog *dlg, char *text,
|
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;
|
int cells = 0;
|
||||||
|
|
||||||
/* Skip first leading \n or space. */
|
/* Skip first leading \n or space. */
|
||||||
if (isspace(*text)) text++;
|
if (isspace((unsigned char)*text)) text++;
|
||||||
if (!*text) break;
|
if (!*text) break;
|
||||||
|
|
||||||
#ifdef CONFIG_UTF8
|
#ifdef CONFIG_UTF8
|
||||||
@ -230,7 +230,7 @@ dlg_format_text_do_node(struct dialog_data *dlg_data,
|
|||||||
int cells = 0;
|
int cells = 0;
|
||||||
|
|
||||||
/* Skip first leading \n or space. */
|
/* Skip first leading \n or space. */
|
||||||
if (!firstline && isspace(*text))
|
if (!firstline && isspace((unsigned char)*text))
|
||||||
text++;
|
text++;
|
||||||
else
|
else
|
||||||
firstline = 0;
|
firstline = 0;
|
||||||
|
@ -316,7 +316,7 @@ delete_whites(const char *s)
|
|||||||
* in section 2.3 of XML 1.1. U+0085 and U+2028 need
|
* in section 2.3 of XML 1.1. U+0085 and U+2028 need
|
||||||
* not be recognized here because section 2.11 says
|
* not be recognized here because section 2.11 says
|
||||||
* the XML processor must translate them to U+000A.
|
* the XML processor must translate them to U+000A.
|
||||||
* Do not use isspace() because the string is in UTF-8
|
* Do not use isspace((unsigned char)) because the string is in UTF-8
|
||||||
* and individual bytes might not be characters at
|
* and individual bytes might not be characters at
|
||||||
* all. */
|
* all. */
|
||||||
switch (s[i]) {
|
switch (s[i]) {
|
||||||
|
@ -224,7 +224,7 @@ lookup_cmd(struct option *o, char ***argv, int *argc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#define skipback_whitespace(start, S) \
|
#define skipback_whitespace(start, S) \
|
||||||
while ((start) < (S) && isspace((S)[-1])) (S)--;
|
while ((start) < (S) && isspace((unsigned char)(S)[-1])) (S)--;
|
||||||
|
|
||||||
enum remote_method_enum {
|
enum remote_method_enum {
|
||||||
REMOTE_METHOD_OPENURL,
|
REMOTE_METHOD_OPENURL,
|
||||||
|
@ -114,7 +114,7 @@ skip_white(struct conf_parsing_pos *pos)
|
|||||||
char *start = pos->look;
|
char *start = pos->look;
|
||||||
|
|
||||||
while (*start) {
|
while (*start) {
|
||||||
while (isspace(*start)) {
|
while (isspace((unsigned char)*start)) {
|
||||||
if (*start == '\n') {
|
if (*start == '\n') {
|
||||||
pos->line++;
|
pos->line++;
|
||||||
}
|
}
|
||||||
@ -652,7 +652,7 @@ parse_config_command(struct option *options, struct conf_parsing_state *state,
|
|||||||
int cmdlen = strlen(handler->command);
|
int cmdlen = strlen(handler->command);
|
||||||
|
|
||||||
if (!strncmp(state->pos.look, handler->command, cmdlen)
|
if (!strncmp(state->pos.look, handler->command, cmdlen)
|
||||||
&& isspace(state->pos.look[cmdlen])) {
|
&& isspace((unsigned char)state->pos.look[cmdlen])) {
|
||||||
enum parse_error err;
|
enum parse_error err;
|
||||||
|
|
||||||
state->pos.look += cmdlen;
|
state->pos.look += cmdlen;
|
||||||
|
@ -97,7 +97,7 @@ check_caption(char *caption)
|
|||||||
if (!len) return;
|
if (!len) return;
|
||||||
|
|
||||||
c = caption[len - 1];
|
c = caption[len - 1];
|
||||||
if (isspace(c) || bad_punct(c))
|
if (isspace((unsigned char)c) || bad_punct(c))
|
||||||
DBG("bad char at end of caption [%s]", caption);
|
DBG("bad char at end of caption [%s]", caption);
|
||||||
|
|
||||||
#ifdef CONFIG_NLS
|
#ifdef CONFIG_NLS
|
||||||
@ -106,7 +106,7 @@ check_caption(char *caption)
|
|||||||
if (!len) return;
|
if (!len) return;
|
||||||
|
|
||||||
c = caption[len - 1];
|
c = caption[len - 1];
|
||||||
if (isspace(c) || bad_punct(c))
|
if (isspace((unsigned char)c) || bad_punct(c))
|
||||||
DBG("bad char at end of i18n caption [%s]", caption);
|
DBG("bad char at end of i18n caption [%s]", caption);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -125,7 +125,7 @@ check_description(char *desc)
|
|||||||
if (!len) return;
|
if (!len) return;
|
||||||
|
|
||||||
c = desc[len - 1];
|
c = desc[len - 1];
|
||||||
if (isspace(c))
|
if (isspace((unsigned char)c))
|
||||||
DBG("bad char at end of description [%s]", desc);
|
DBG("bad char at end of description [%s]", desc);
|
||||||
|
|
||||||
#ifdef CONFIG_NLS
|
#ifdef CONFIG_NLS
|
||||||
@ -137,7 +137,7 @@ check_description(char *desc)
|
|||||||
DBG("punctuation char possibly missing at end of i18n description [%s]", desc);
|
DBG("punctuation char possibly missing at end of i18n description [%s]", desc);
|
||||||
|
|
||||||
c = desc[len - 1];
|
c = desc[len - 1];
|
||||||
if (isspace(c))
|
if (isspace((unsigned char)c))
|
||||||
DBG("bad char at end of i18n description [%s]", desc);
|
DBG("bad char at end of i18n description [%s]", desc);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -213,7 +213,7 @@ num_rd(struct option *opt, char **file, int *line)
|
|||||||
|
|
||||||
/* Another trap for unwary - we need to check *end, not **file - reason
|
/* Another trap for unwary - we need to check *end, not **file - reason
|
||||||
* is left as an exercise to the reader. */
|
* is left as an exercise to the reader. */
|
||||||
if ((*end != 0 && (commandline || (!isspace(*end) && *end != '#')))
|
if ((*end != 0 && (commandline || (!isspace((unsigned char)*end) && *end != '#')))
|
||||||
|| (*value < opt->min || *value > opt->max)) {
|
|| (*value < opt->min || *value > opt->max)) {
|
||||||
mem_free(value);
|
mem_free(value);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -45,7 +45,7 @@ parse_cookie_str(struct cookie_str *cstr, char *str)
|
|||||||
cstr->str = str;
|
cstr->str = str;
|
||||||
|
|
||||||
/* Parse name token */
|
/* Parse name token */
|
||||||
while (*str != ';' && *str != '=' && !isspace(*str) && *str)
|
while (*str != ';' && *str != '=' && !isspace((unsigned char)*str) && *str)
|
||||||
str++;
|
str++;
|
||||||
|
|
||||||
/* Bail out if name token is empty */
|
/* Bail out if name token is empty */
|
||||||
@ -83,7 +83,7 @@ parse_cookie_str(struct cookie_str *cstr, char *str)
|
|||||||
|
|
||||||
for (; *str != ';' && *str; str++) {
|
for (; *str != ';' && *str; str++) {
|
||||||
/* Allow spaces in the value but leave out ending spaces */
|
/* Allow spaces in the value but leave out ending spaces */
|
||||||
if (!isspace(*str))
|
if (!isspace((unsigned char)*str))
|
||||||
cstr->val_end = str + 1;
|
cstr->val_end = str + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void
|
|||||||
* is at the start of the value string. */
|
* is at the start of the value string. */
|
||||||
for (skips = 0; skips < valuelen; skips++) {
|
for (skips = 0; skips < valuelen; skips++) {
|
||||||
if ((quoted && skips == 0)
|
if ((quoted && skips == 0)
|
||||||
|| isspace(value[skips])
|
|| isspace((unsigned char)value[skips])
|
||||||
|| (unsigned char)value[skips] < ' ')
|
|| (unsigned char)value[skips] < ' ')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -276,7 +276,7 @@ render_dom_attribute_source(struct dom_stack *stack, struct dom_node *node, void
|
|||||||
* link text. */
|
* link text. */
|
||||||
for (skips = 0; skips < valuelen; skips++) {
|
for (skips = 0; skips < valuelen; skips++) {
|
||||||
if ((quoted && skips == 0)
|
if ((quoted && skips == 0)
|
||||||
|| isspace(value[valuelen - skips - 1])
|
|| isspace((unsigned char)value[valuelen - skips - 1])
|
||||||
|| (unsigned char)value[valuelen - skips - 1] < ' ')
|
|| (unsigned char)value[valuelen - skips - 1] < ' ')
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ put_chrs(struct html_context *html_context, const char *start, int len)
|
|||||||
|
|
||||||
case HTML_SPACE_SUPPRESS:
|
case HTML_SPACE_SUPPRESS:
|
||||||
html_context->putsp = HTML_SPACE_NORMAL;
|
html_context->putsp = HTML_SPACE_NORMAL;
|
||||||
if (isspace(start[0])) {
|
if (isspace((unsigned char)start[0])) {
|
||||||
start++, len--;
|
start++, len--;
|
||||||
|
|
||||||
if (!len) {
|
if (!len) {
|
||||||
@ -162,7 +162,7 @@ put_chrs(struct html_context *html_context, const char *start, int len)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isspace(start[len - 1]) && !html_is_preformatted()) {
|
if (isspace((unsigned char)start[len - 1]) && !html_is_preformatted()) {
|
||||||
html_context->putsp = HTML_SPACE_SUPPRESS;
|
html_context->putsp = HTML_SPACE_SUPPRESS;
|
||||||
}
|
}
|
||||||
html_context->was_br = 0;
|
html_context->was_br = 0;
|
||||||
|
@ -386,8 +386,8 @@ abort:
|
|||||||
char *q, *s = en;
|
char *q, *s = en;
|
||||||
int l = html - en;
|
int l = html - en;
|
||||||
|
|
||||||
while (l && isspace(s[0])) s++, l--;
|
while (l && isspace((unsigned char)s[0])) s++, l--;
|
||||||
while (l && isspace(s[l-1])) l--;
|
while (l && isspace((unsigned char)s[l-1])) l--;
|
||||||
q = convert_string(ct, s, l,
|
q = convert_string(ct, s, l,
|
||||||
html_context->options->cp,
|
html_context->options->cp,
|
||||||
CSM_DEFAULT, NULL, NULL, NULL);
|
CSM_DEFAULT, NULL, NULL, NULL);
|
||||||
@ -574,8 +574,8 @@ html_option(struct html_context *html_context, char *a,
|
|||||||
}
|
}
|
||||||
|
|
||||||
se:
|
se:
|
||||||
while (p < html_context->eoff && isspace(*p)) p++;
|
while (p < html_context->eoff && isspace((unsigned char)*p)) p++;
|
||||||
while (p < html_context->eoff && !isspace(*p) && *p != '<') {
|
while (p < html_context->eoff && !isspace((unsigned char)*p) && *p != '<') {
|
||||||
|
|
||||||
sp:
|
sp:
|
||||||
add_char_to_string(&str, *p ? *p : ' '), p++;
|
add_char_to_string(&str, *p ? *p : ' '), p++;
|
||||||
@ -584,7 +584,7 @@ sp:
|
|||||||
r = p;
|
r = p;
|
||||||
val = str.source; /* Has to be before the possible 'goto end_parse' */
|
val = str.source; /* Has to be before the possible 'goto end_parse' */
|
||||||
|
|
||||||
while (r < html_context->eoff && isspace(*r)) r++;
|
while (r < html_context->eoff && isspace((unsigned char)*r)) r++;
|
||||||
if (r >= html_context->eoff) goto end_parse;
|
if (r >= html_context->eoff) goto end_parse;
|
||||||
if (r - 2 <= html_context->eoff && (r[1] == '!' || r[1] == '?')) {
|
if (r - 2 <= html_context->eoff && (r[1] == '!' || r[1] == '?')) {
|
||||||
p = skip_comment(r, html_context->eoff);
|
p = skip_comment(r, html_context->eoff);
|
||||||
|
@ -70,28 +70,28 @@ parse_element(char *e, char *eof,
|
|||||||
|
|
||||||
while (isident(*e)) next_char();
|
while (isident(*e)) next_char();
|
||||||
|
|
||||||
if (!isspace(*e) && !end_of_tag(*e) && *e != '/' && *e != ':' && *e != '=')
|
if (!isspace((unsigned char)*e) && !end_of_tag(*e) && *e != '/' && *e != ':' && *e != '=')
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (name && namelen) *namelen = e - *name;
|
if (name && namelen) *namelen = e - *name;
|
||||||
|
|
||||||
while (isspace(*e) || *e == '/' || *e == ':') next_char();
|
while (isspace((unsigned char)*e) || *e == '/' || *e == ':') next_char();
|
||||||
|
|
||||||
/* Skip bad attribute */
|
/* Skip bad attribute */
|
||||||
while (!atchr(*e) && !end_of_tag(*e) && !isspace(*e)) next_char();
|
while (!atchr(*e) && !end_of_tag(*e) && !isspace((unsigned char)*e)) next_char();
|
||||||
|
|
||||||
if (attr) *attr = e;
|
if (attr) *attr = e;
|
||||||
|
|
||||||
next_attr:
|
next_attr:
|
||||||
while (isspace(*e)) next_char();
|
while (isspace((unsigned char)*e)) next_char();
|
||||||
|
|
||||||
/* Skip bad attribute */
|
/* Skip bad attribute */
|
||||||
while (!atchr(*e) && !end_of_tag(*e) && !isspace(*e)) next_char();
|
while (!atchr(*e) && !end_of_tag(*e) && !isspace((unsigned char)*e)) next_char();
|
||||||
|
|
||||||
if (end_of_tag(*e)) goto end;
|
if (end_of_tag(*e)) goto end;
|
||||||
|
|
||||||
while (atchr(*e)) next_char();
|
while (atchr(*e)) next_char();
|
||||||
while (isspace(*e)) next_char();
|
while (isspace((unsigned char)*e)) next_char();
|
||||||
|
|
||||||
if (*e != '=') {
|
if (*e != '=') {
|
||||||
if (end_of_tag(*e)) goto end;
|
if (end_of_tag(*e)) goto end;
|
||||||
@ -99,7 +99,7 @@ next_attr:
|
|||||||
}
|
}
|
||||||
next_char();
|
next_char();
|
||||||
|
|
||||||
while (isspace(*e)) next_char();
|
while (isspace((unsigned char)*e)) next_char();
|
||||||
|
|
||||||
if (isquote(*e)) {
|
if (isquote(*e)) {
|
||||||
unsigned char quote = *e;
|
unsigned char quote = *e;
|
||||||
@ -115,10 +115,10 @@ next_attr:
|
|||||||
* long as this is commented out. --pasky */
|
* long as this is commented out. --pasky */
|
||||||
/* if (*e == quote) goto quoted_value; */
|
/* if (*e == quote) goto quoted_value; */
|
||||||
} else {
|
} else {
|
||||||
while (!isspace(*e) && !end_of_tag(*e)) next_char();
|
while (!isspace((unsigned char)*e) && !end_of_tag(*e)) next_char();
|
||||||
}
|
}
|
||||||
|
|
||||||
while (isspace(*e)) next_char();
|
while (isspace((unsigned char)*e)) next_char();
|
||||||
|
|
||||||
if (!end_of_tag(*e)) goto next_attr;
|
if (!end_of_tag(*e)) goto next_attr;
|
||||||
|
|
||||||
@ -169,7 +169,7 @@ next_attr:
|
|||||||
|
|
||||||
if (found) {
|
if (found) {
|
||||||
if (!isquote(*e)) {
|
if (!isquote(*e)) {
|
||||||
while (!isspace(*e) && !end_of_tag(*e)) {
|
while (!isspace((unsigned char)*e) && !end_of_tag(*e)) {
|
||||||
if (!*e) goto parse_error;
|
if (!*e) goto parse_error;
|
||||||
add_chr(attr, attrlen, *e);
|
add_chr(attr, attrlen, *e);
|
||||||
e++;
|
e++;
|
||||||
@ -221,7 +221,7 @@ found_endattr:
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (!isquote(*e)) {
|
if (!isquote(*e)) {
|
||||||
while (!isspace(*e) && !end_of_tag(*e)) {
|
while (!isspace((unsigned char)*e) && !end_of_tag(*e)) {
|
||||||
if (!*e) goto parse_error;
|
if (!*e) goto parse_error;
|
||||||
e++;
|
e++;
|
||||||
}
|
}
|
||||||
@ -323,14 +323,14 @@ get_width2(char *value, int limited, struct html_context *html_context)
|
|||||||
for (len = 0; str[len] && str[len] != ','; len++);
|
for (len = 0; str[len] && str[len] != ','; len++);
|
||||||
|
|
||||||
/* Go back, and skip spaces after width if any. */
|
/* Go back, and skip spaces after width if any. */
|
||||||
while (len && isspace(str[len - 1])) len--;
|
while (len && isspace((unsigned char)str[len - 1])) len--;
|
||||||
if (!len) { return -1; } /* Nothing to parse. */
|
if (!len) { return -1; } /* Nothing to parse. */
|
||||||
|
|
||||||
/* Is this a percentage ? */
|
/* Is this a percentage ? */
|
||||||
if (str[len - 1] == '%') len--, percentage = 1;
|
if (str[len - 1] == '%') len--, percentage = 1;
|
||||||
|
|
||||||
/* Skip spaces between width number and percentage if any. */
|
/* Skip spaces between width number and percentage if any. */
|
||||||
while (len && isspace(str[len - 1])) len--;
|
while (len && isspace((unsigned char)str[len - 1])) len--;
|
||||||
if (!len) { return -1; } /* Nothing to parse. */
|
if (!len) { return -1; } /* Nothing to parse. */
|
||||||
|
|
||||||
/* Shorten the string a bit, so strtoul() will work on useful
|
/* Shorten the string a bit, so strtoul() will work on useful
|
||||||
@ -394,7 +394,7 @@ skip_comment(char *html, char *eof)
|
|||||||
if (html + 2 <= eof && html[0] == '-' && html[1] == '-') {
|
if (html + 2 <= eof && html[0] == '-' && html[1] == '-') {
|
||||||
html += 2;
|
html += 2;
|
||||||
while (html < eof && *html == '-') html++;
|
while (html < eof && *html == '-') html++;
|
||||||
while (html < eof && isspace(*html)) html++;
|
while (html < eof && isspace((unsigned char)*html)) html++;
|
||||||
if (html >= eof) return eof;
|
if (html >= eof) return eof;
|
||||||
if (*html == '>') return html + 1;
|
if (*html == '>') return html + 1;
|
||||||
continue;
|
continue;
|
||||||
@ -693,10 +693,10 @@ main_loop:
|
|||||||
noupdate = 0;
|
noupdate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isspace(*html) && !html_is_preformatted()) {
|
if (isspace((unsigned char)*html) && !html_is_preformatted()) {
|
||||||
char *h = html;
|
char *h = html;
|
||||||
|
|
||||||
while (h < eof && isspace(*h))
|
while (h < eof && isspace((unsigned char)*h))
|
||||||
h++;
|
h++;
|
||||||
if (h + 1 < eof && h[0] == '<' && h[1] == '/') {
|
if (h + 1 < eof && h[0] == '<' && h[1] == '/') {
|
||||||
if (!parse_element(h, eof, &name, &namelen, &attr, &end)) {
|
if (!parse_element(h, eof, &name, &namelen, &attr, &end)) {
|
||||||
@ -709,9 +709,9 @@ main_loop:
|
|||||||
html++;
|
html++;
|
||||||
if (!(html_context->position + (html - base_pos - 1)))
|
if (!(html_context->position + (html - base_pos - 1)))
|
||||||
goto skip_w; /* ??? */
|
goto skip_w; /* ??? */
|
||||||
if (*(html - 1) == ' ') { /* Do not replace with isspace() ! --Zas */
|
if (*(html - 1) == ' ') { /* Do not replace with isspace((unsigned char)) ! --Zas */
|
||||||
/* BIG performance win; not sure if it doesn't cause any bug */
|
/* BIG performance win; not sure if it doesn't cause any bug */
|
||||||
if (html < eof && !isspace(*html)) {
|
if (html < eof && !isspace((unsigned char)*html)) {
|
||||||
noupdate = 1;
|
noupdate = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -722,7 +722,7 @@ main_loop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
skip_w:
|
skip_w:
|
||||||
while (html < eof && isspace(*html))
|
while (html < eof && isspace((unsigned char)*html))
|
||||||
html++;
|
html++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -778,7 +778,7 @@ next_break:
|
|||||||
|
|
||||||
dotcounter++;
|
dotcounter++;
|
||||||
base_pos = ++html;
|
base_pos = ++html;
|
||||||
if (*html >= ' ' || isspace(*html) || html >= eof) {
|
if (*html >= ' ' || isspace((unsigned char)*html) || html >= eof) {
|
||||||
char *dots = (char *)fmem_alloc(dotcounter);
|
char *dots = (char *)fmem_alloc(dotcounter);
|
||||||
|
|
||||||
if (dots) {
|
if (dots) {
|
||||||
@ -815,7 +815,7 @@ element:
|
|||||||
while (!parse_element(ee, eof, &nm, NULL, NULL, &ee))
|
while (!parse_element(ee, eof, &nm, NULL, NULL, &ee))
|
||||||
if (*nm == '/')
|
if (*nm == '/')
|
||||||
goto ng;
|
goto ng;
|
||||||
if (ee < eof && isspace(*ee)) {
|
if (ee < eof && isspace((unsigned char)*ee)) {
|
||||||
put_chrs(html_context, " ", 1);
|
put_chrs(html_context, " ", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1833,7 +1833,7 @@ html_has_non_space_chars(const char *chars, int charslen)
|
|||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
while (pos < charslen)
|
while (pos < charslen)
|
||||||
if (!isspace(chars[pos++]))
|
if (!isspace((unsigned char)chars[pos++]))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -714,10 +714,10 @@ get_table_caption_height(struct html_context *html_context, struct table *table)
|
|||||||
|
|
||||||
if (!start || !end) return 0;
|
if (!start || !end) return 0;
|
||||||
|
|
||||||
while (start < end && isspace(*start))
|
while (start < end && isspace((unsigned char)*start))
|
||||||
start++;
|
start++;
|
||||||
|
|
||||||
while (start < end && isspace(end[-1]))
|
while (start < end && isspace((unsigned char)end[-1]))
|
||||||
end--;
|
end--;
|
||||||
|
|
||||||
if (start >= end) return 0;
|
if (start >= end) return 0;
|
||||||
@ -1212,10 +1212,10 @@ draw_table_caption(struct html_context *html_context, struct table *table,
|
|||||||
|
|
||||||
if (!start || !end) return;
|
if (!start || !end) return;
|
||||||
|
|
||||||
while (start < end && isspace(*start))
|
while (start < end && isspace((unsigned char)*start))
|
||||||
start++;
|
start++;
|
||||||
|
|
||||||
while (start < end && isspace(end[-1]))
|
while (start < end && isspace((unsigned char)end[-1]))
|
||||||
end--;
|
end--;
|
||||||
|
|
||||||
if (start >= end) return;
|
if (start >= end) return;
|
||||||
@ -1252,10 +1252,10 @@ draw_table_bad_html(struct html_context *html_context, struct table *table)
|
|||||||
char *start = html->start;
|
char *start = html->start;
|
||||||
char *end = html->end;
|
char *end = html->end;
|
||||||
|
|
||||||
while (start < end && isspace(*start))
|
while (start < end && isspace((unsigned char)*start))
|
||||||
start++;
|
start++;
|
||||||
|
|
||||||
while (start < end && isspace(end[-1]))
|
while (start < end && isspace((unsigned char)end[-1]))
|
||||||
end--;
|
end--;
|
||||||
|
|
||||||
if (start >= end) continue;
|
if (start >= end) continue;
|
||||||
|
@ -760,7 +760,7 @@ add_document_lines(struct plain_renderer *renderer)
|
|||||||
step++;
|
step++;
|
||||||
if (step) break;
|
if (step) break;
|
||||||
|
|
||||||
if (isspace(source[width])) {
|
if (isspace((unsigned char)source[width])) {
|
||||||
last_space = width;
|
last_space = width;
|
||||||
if (only_spaces)
|
if (only_spaces)
|
||||||
spaces++;
|
spaces++;
|
||||||
|
@ -78,10 +78,10 @@ main_loop:
|
|||||||
noupdate = 0;
|
noupdate = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isspace(*html) && !html_is_preformatted()) {
|
if (isspace((unsigned char)*html) && !html_is_preformatted()) {
|
||||||
char *h = html;
|
char *h = html;
|
||||||
|
|
||||||
while (h < eof && isspace(*h))
|
while (h < eof && isspace((unsigned char)*h))
|
||||||
h++;
|
h++;
|
||||||
if (h + 1 < eof && h[0] == '<' && h[1] == '/') {
|
if (h + 1 < eof && h[0] == '<' && h[1] == '/') {
|
||||||
if (!parse_element(h, eof, &name, &namelen, &attr, &end)) {
|
if (!parse_element(h, eof, &name, &namelen, &attr, &end)) {
|
||||||
@ -94,9 +94,9 @@ main_loop:
|
|||||||
html++;
|
html++;
|
||||||
if (!(html_context->position + (html - base_pos - 1)))
|
if (!(html_context->position + (html - base_pos - 1)))
|
||||||
goto skip_w; /* ??? */
|
goto skip_w; /* ??? */
|
||||||
if (*(html - 1) == ' ') { /* Do not replace with isspace() ! --Zas */
|
if (*(html - 1) == ' ') { /* Do not replace with isspace((unsigned char)) ! --Zas */
|
||||||
/* BIG performance win; not sure if it doesn't cause any bug */
|
/* BIG performance win; not sure if it doesn't cause any bug */
|
||||||
if (html < eof && !isspace(*html)) {
|
if (html < eof && !isspace((unsigned char)*html)) {
|
||||||
noupdate = 1;
|
noupdate = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -107,7 +107,7 @@ main_loop:
|
|||||||
}
|
}
|
||||||
|
|
||||||
skip_w:
|
skip_w:
|
||||||
while (html < eof && isspace(*html))
|
while (html < eof && isspace((unsigned char)*html))
|
||||||
html++;
|
html++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -163,7 +163,7 @@ next_break:
|
|||||||
|
|
||||||
dotcounter++;
|
dotcounter++;
|
||||||
base_pos = ++html;
|
base_pos = ++html;
|
||||||
if (*html >= ' ' || isspace(*html) || html >= eof) {
|
if (*html >= ' ' || isspace((unsigned char)*html) || html >= eof) {
|
||||||
char *dots = (char *)fmem_alloc(dotcounter);
|
char *dots = (char *)fmem_alloc(dotcounter);
|
||||||
|
|
||||||
if (dots) {
|
if (dots) {
|
||||||
@ -200,7 +200,7 @@ element:
|
|||||||
/// while (!parse_element(ee, eof, &nm, NULL, NULL, &ee))
|
/// while (!parse_element(ee, eof, &nm, NULL, NULL, &ee))
|
||||||
/// if (*nm == '/')
|
/// if (*nm == '/')
|
||||||
/// goto ng;
|
/// goto ng;
|
||||||
if (ee < eof && isspace(*ee)) {
|
if (ee < eof && isspace((unsigned char)*ee)) {
|
||||||
put_chrs(html_context, " ", 1);
|
put_chrs(html_context, " ", 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ normalize_text_node_whitespace(struct dom_node *node)
|
|||||||
for (j = 0; j < sizeof(buf) && i < node->string.length; i++) {
|
for (j = 0; j < sizeof(buf) && i < node->string.length; i++) {
|
||||||
char data = text[i];
|
char data = text[i];
|
||||||
|
|
||||||
if (isspace(data)) {
|
if (isspace((unsigned char)data)) {
|
||||||
if (count == 1)
|
if (count == 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ match_attribute_value(struct dom_select_node *selector, struct dom_node *node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (isspace(str.string[str.length]))
|
if (isspace((unsigned char)str.string[str.length]))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -704,7 +704,7 @@ match_attribute_value(struct dom_select_node *selector, struct dom_node *node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
do_compare = isspace(str.string[0]);
|
do_compare = isspace((unsigned char)str.string[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
str.length--, str.string++;
|
str.length--, str.string++;
|
||||||
|
@ -247,7 +247,7 @@ get_mailcap_field(char **next)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Remove trailing whitespace */
|
/* Remove trailing whitespace */
|
||||||
while (field <= fieldend && isspace(*fieldend))
|
while (field <= fieldend && isspace((unsigned char)*fieldend))
|
||||||
*fieldend-- = '\0';
|
*fieldend-- = '\0';
|
||||||
|
|
||||||
return field;
|
return field;
|
||||||
|
@ -152,7 +152,7 @@ http_negotiate_parse_data(char *data, int type,
|
|||||||
else
|
else
|
||||||
data += HTTPNEG_NEG_STRLEN;
|
data += HTTPNEG_NEG_STRLEN;
|
||||||
|
|
||||||
while (*data && isspace((int) *data))
|
while (*data && isspace((unsigned char)(int) *data))
|
||||||
data++;
|
data++;
|
||||||
|
|
||||||
if (*data == '\0' || *data == ASCII_CR || *data == ASCII_LF)
|
if (*data == '\0' || *data == ASCII_CR || *data == ASCII_LF)
|
||||||
|
@ -801,7 +801,7 @@ get_esc_code(unsigned char *str, int len, char *final_byte,
|
|||||||
|
|
||||||
#ifdef DEBUG_ITRM_QUEUE
|
#ifdef DEBUG_ITRM_QUEUE
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <ctype.h> /* isprint() isspace() */
|
#include <ctype.h> /* isprint() isspace((unsigned char)) */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int ui_double_esc;
|
int ui_double_esc;
|
||||||
@ -1144,7 +1144,7 @@ process_queue(struct itrm *itrm)
|
|||||||
for (i = 0; i < itrm->in.queue.len; i++)
|
for (i = 0; i < itrm->in.queue.len; i++)
|
||||||
if (itrm->in.queue.data[i] == ASCII_ESC)
|
if (itrm->in.queue.data[i] == ASCII_ESC)
|
||||||
fprintf(stderr, "ESC ");
|
fprintf(stderr, "ESC ");
|
||||||
else if (isprint(itrm->in.queue.data[i]) && !isspace(itrm->in.queue.data[i]))
|
else if (isprint(itrm->in.queue.data[i]) && !isspace((unsigned char)itrm->in.queue.data[i]))
|
||||||
fprintf(stderr, "%c ", itrm->in.queue.data[i]);
|
fprintf(stderr, "%c ", itrm->in.queue.data[i]);
|
||||||
else
|
else
|
||||||
fprintf(stderr, "0x%02x ", itrm->in.queue.data[i]);
|
fprintf(stderr, "0x%02x ", itrm->in.queue.data[i]);
|
||||||
|
@ -225,7 +225,7 @@ file_read_line(char *line, size_t *size, FILE *file, int *lineno)
|
|||||||
* the line is 'continued'. */
|
* the line is 'continued'. */
|
||||||
(*lineno)++;
|
(*lineno)++;
|
||||||
|
|
||||||
while (line < linepos && isspace(*linepos))
|
while (line < linepos && isspace((unsigned char)*linepos))
|
||||||
linepos--;
|
linepos--;
|
||||||
|
|
||||||
if (*linepos != '\\') {
|
if (*linepos != '\\') {
|
||||||
|
@ -126,10 +126,10 @@ char * c_strcasestr(const char *haystack, const char *needle);
|
|||||||
|
|
||||||
|
|
||||||
#define skip_space(S) \
|
#define skip_space(S) \
|
||||||
do { while (isspace(*(S))) (S)++; } while (0)
|
do { while (isspace((unsigned char)*(S))) (S)++; } while (0)
|
||||||
|
|
||||||
#define skip_nonspace(S) \
|
#define skip_nonspace(S) \
|
||||||
do { while (*(S) && !isspace(*(S))) (S)++; } while (0)
|
do { while (*(S) && !isspace((unsigned char)*(S))) (S)++; } while (0)
|
||||||
|
|
||||||
#undef isdigit
|
#undef isdigit
|
||||||
#define isdigit(c) ((c) >= '0' && (c) <= '9')
|
#define isdigit(c) ((c) >= '0' && (c) <= '9')
|
||||||
|
@ -1816,9 +1816,9 @@ field_op(struct session *ses, struct document_view *doc_view,
|
|||||||
}
|
}
|
||||||
|
|
||||||
text = &fs->value[fs->state];
|
text = &fs->value[fs->state];
|
||||||
while (text > fs->value && isspace(*(text - 1)))
|
while (text > fs->value && isspace((unsigned char)*(text - 1)))
|
||||||
--text;
|
--text;
|
||||||
while (text > fs->value && !isspace(*(text - 1)))
|
while (text > fs->value && !isspace((unsigned char)*(text - 1)))
|
||||||
--text;
|
--text;
|
||||||
if (*text == ASCII_LF
|
if (*text == ASCII_LF
|
||||||
&& text != &fs->value[fs->state - 1])
|
&& text != &fs->value[fs->state - 1])
|
||||||
@ -1832,20 +1832,20 @@ field_op(struct session *ses, struct document_view *doc_view,
|
|||||||
|
|
||||||
case ACT_EDIT_MOVE_BACKWARD_WORD:
|
case ACT_EDIT_MOVE_BACKWARD_WORD:
|
||||||
while (fs->state > 0
|
while (fs->state > 0
|
||||||
&& isspace(fs->value[fs->state - 1]))
|
&& isspace((unsigned char)fs->value[fs->state - 1]))
|
||||||
--fs->state;
|
--fs->state;
|
||||||
while (fs->state > 0
|
while (fs->state > 0
|
||||||
&& !isspace(fs->value[fs->state - 1]))
|
&& !isspace((unsigned char)fs->value[fs->state - 1]))
|
||||||
--fs->state;
|
--fs->state;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ACT_EDIT_MOVE_FORWARD_WORD:
|
case ACT_EDIT_MOVE_FORWARD_WORD:
|
||||||
while (isspace(fs->value[fs->state]))
|
while (isspace((unsigned char)fs->value[fs->state]))
|
||||||
++fs->state;
|
++fs->state;
|
||||||
while (fs->value[fs->state]
|
while (fs->value[fs->state]
|
||||||
&& !isspace(fs->value[fs->state]))
|
&& !isspace((unsigned char)fs->value[fs->state]))
|
||||||
++fs->state;
|
++fs->state;
|
||||||
while (isspace(fs->value[fs->state]))
|
while (isspace((unsigned char)fs->value[fs->state]))
|
||||||
++fs->state;
|
++fs->state;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user