stay = (echogets(Line2, echo) != NULL);
while ( stay && (Line2[0] == '|') )
- { for (p=&Line2[2]; (*p) && (isspace(*p)); p++);
+ { for (p=&Line2[2]; (*p) && (isspace((unsigned char)*p)); p++);
strcat( Reason, ": " );
strcat( Reason, p );
Line2[0] = 0;
ok = 0;
if ( !strncmp(Line, "cfe: ", 5) )
{ p = &Line[5];
- Severity = tolower(*p);
+ Severity = tolower((unsigned char)*p);
p = strchr( &Line[5], ':' );
if (p == NULL)
{ ok = 0;
}
else
{
- for (p=Reason; (*p) && (isspace(*p)); p++);
+ for (p=Reason; (*p) && (isspace((unsigned char)*p)); p++);
if ( BasePath[CWDlen] == 0 )
printf( "%s:%lu:%lu:%c:%s\n", FileName, Row, Col, Severity, p );
else
for (p = regProp; (p - regProp) < numItems; )
{
entry = p;
- while ((*p != 0) && (!isspace(*p)))
+ while ((*p != 0) && (!isspace((unsigned char)*p)))
p++;
if ((*p != 0) && (strcasecmp(name, p + 1) == 0))
{
for (p = regProp; (p - regProp) < numItems; )
{
entry = p;
- while ((*p != 0) && (!isspace(*p)))
+ while ((*p != 0) && (!isspace((unsigned char)*p)))
p++;
if ((*p != 0) && IsSerialName(p + 1)
&& (strncmp(name, p + 1, strlen(name)) == 0))
{
int len = strlen(str);
- return (len > 1 && isdigit(str[len - 1]));
+ return (len > 1 && isdigit((unsigned char)str[len - 1]));
}
buf + off, SPACE_FOR_DIR - off, TRUE);
#ifdef BACKSLASH_IN_FILENAME
// avoid "c:/name" to be reduced to "c"
- if (isalpha(buf[off]) && buf[off + 1] == ':')
+ if (SAFE_isalpha(buf[off]) && buf[off + 1] == ':')
off += 2;
#endif
// remove the file name
&& (s[0] != 'V'
|| STRNCMP(skipwhite(e + 1), "set", 3) == 0)
&& (s[3] == ':'
- || (VIM_VERSION_100 >= vers && isdigit(s[3]))
+ || (VIM_VERSION_100 >= vers && SAFE_isdigit(s[3]))
|| (VIM_VERSION_100 < vers && s[3] == '<')
|| (VIM_VERSION_100 > vers && s[3] == '>')
|| (VIM_VERSION_100 == vers && s[3] == '=')))
if (enc_latin1like)
return (latin1flags[c] & LATIN1LOWER) == LATIN1LOWER;
}
- return islower(c);
+ return SAFE_islower(c);
}
int
if (enc_latin1like)
return (latin1flags[c] & LATIN1UPPER) == LATIN1UPPER;
}
- return isupper(c);
+ return SAFE_isupper(c);
}
int
return;
for ( ; *p; ++p)
- if (STRNCMP(p, "key", 3) == 0 && !isalpha(p[3]))
+ if (STRNCMP(p, "key", 3) == 0 && !SAFE_isalpha(p[3]))
{
p = vim_strchr(p + 3, '=');
if (p == NULL)
// --- file1 2018-03-20 13:23:35.783153140 +0100
// +++ file2 2018-03-20 13:23:41.183156066 +0100
// @@ -1,3 +1,5 @@
- if (isdigit(*line))
+ if (SAFE_isdigit(*line))
diffstyle = DIFF_ED;
else if ((STRNCMP(line, "@@ ", 3) == 0))
diffstyle = DIFF_UNIFIED;
if (diffstyle == DIFF_ED)
{
- if (!isdigit(*line))
+ if (!SAFE_isdigit(*line))
continue; // not the start of a diff block
if (parse_diff_ed(line, hunk) == FAIL)
continue;
rewind(stdin);
if (scanf("%99s", buf) == 1)
{
- if (isdigit(buf[0]))
+ if (isdigit((unsigned char)buf[0]))
{
// Change a choice.
i = atoi(buf);
// was typed after a CTRL-V, and pretend 'textwidth'
// wasn't set. Digits, 'o' and 'x' are special after a
// CTRL-V, don't use it for these.
- if (c < 256 && !isalnum(c))
+ if (c < 256 && !SAFE_isalnum(c))
AppendToRedobuff((char_u *)CTRL_V_STR); // CTRL-V
tw_save = curbuf->b_p_tw;
curbuf->b_p_tw = -1;
return FAIL;
end_leader = *arg;
- if (**arg == '.' && (!isdigit(*(*arg + 1)) || in_old_script(2)))
+ if (**arg == '.' && (!SAFE_isdigit(*(*arg + 1)) || in_old_script(2)))
{
semsg(_(e_invalid_expression_str), *arg);
++*arg;
&& has_patch(atoi(end + 3))))));
}
}
- else if (isdigit(name[5]))
+ else if (SAFE_isdigit(name[5]))
n = has_patch(atoi((char *)name + 5));
}
else if (STRICMP(name, "vim_starting") == 0)
dictitem_T *
find_var_also_in_script(char_u *name, hashtab_T **htp, int no_autoload)
{
- if (STRNCMP(name, "<SNR>", 5) == 0 && isdigit(name[5]))
+ if (STRNCMP(name, "<SNR>", 5) == 0 && SAFE_isdigit(name[5]))
{
char_u *p = name + 5;
int sid = getdigits(&p);
else
{
if (arg->v_type == VAR_STRING && arg->vval.v_string != NULL
- && isdigit(*arg->vval.v_string))
+ && SAFE_isdigit(*arg->vval.v_string))
r = FAIL;
else if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING)
{
static int
check_regexp_delim(int c)
{
- if (isalpha(c))
+ if (SAFE_isalpha(c))
{
emsg(_(e_regular_expressions_cant_be_delimited_by_letters));
return FAIL;
char_u *arg = eap->arg;
char_u *p;
- if (!isdigit(*arg))
+ if (!SAFE_isdigit(*arg))
{
semsg(_(e_invalid_argument_str), arg);
return;
if (*p == NUL)
count = 1;
- else if (isdigit(*p))
+ else if (SAFE_isdigit(*p))
{
count = getdigits(&p);
switch (*p)
arg++;
// Make register empty when not using @A-@Z and the
// command is valid.
- if (*arg == NUL && !isupper(redir_reg))
+ if (*arg == NUL && !SAFE_isupper(redir_reg))
write_reg_contents(redir_reg, (char_u *)"", -1, FALSE);
}
}
#if defined(MSWIN)
// may skip "c:"
- if (isalpha(path[0]) && path[1] == ':')
+ if (SAFE_isalpha(path[0]) && path[1] == ':')
retval = path + 2;
else
retval = path;
if (get_visual_text(NULL, &ptr, &len) == FAIL)
return NULL;
// Only recognize ":123" here
- if (file_lnum != NULL && ptr[len] == ':' && isdigit(ptr[len + 1]))
+ if (file_lnum != NULL && ptr[len] == ':' && SAFE_isdigit(ptr[len + 1]))
{
char_u *p = ptr + len + 1;
p = skipwhite(p);
if (*p != NUL)
{
- if (!isdigit(*p))
+ if (!SAFE_isdigit(*p))
++p; // skip the separator
p = skipwhite(p);
- if (isdigit(*p))
+ if (SAFE_isdigit(*p))
*file_lnum = (int)getdigits(&p);
}
}
{
c = read_redo(FALSE, old_redo);
add_char_buff(&readbuf2, c);
- if (!isdigit(c))
+ if (!SAFE_isdigit(c))
break;
}
c = read_redo(FALSE, old_redo);
// Handle <SID>{sid}; Do up to 20 digits for safety.
last_used_sid = 0;
- for (j = 0; j < 20 && isdigit(c = vgetorpeek(TRUE)); ++j)
+ for (j = 0; j < 20 && SAFE_isdigit(c = vgetorpeek(TRUE)); ++j)
last_used_sid = last_used_sid * 10 + (c - '0');
last_used_map = NULL;
continue;
// avoid putting up a message box with blanks only
for (p = (char_u *)error_ga.ga_data; *p != NUL; ++p)
- if (!isspace(*p))
+ if (!SAFE_isspace(*p))
{
// Truncate a very long message, it will go off-screen.
if (STRLEN(p) > 2000)
// TODO
}
- static int
-hex_digit(int c)
-{
- if (isdigit(c))
- return c - '0';
- c = TOLOWER_ASC(c);
- if (c >= 'a' && c <= 'f')
- return c - 'a' + 10;
- return -1000;
-}
-
/*
* This function has been lifted from gui_w32.c and extended a bit.
*
if (mark != NULL)
{
mark++;
- while (isdigit(*mark))
+ while (SAFE_isdigit(*mark))
mark++;
if (*mark == ')')
if (menu->mnemonic != 0)
{
- PtAddHotkeyHandler(gui.vimWindow, tolower(menu->mnemonic),
+ PtAddHotkeyHandler(gui.vimWindow, SAFE_tolower(menu->mnemonic),
Pk_KM_Alt, 0, menu, gui_ph_handle_pulldown_menu);
}
}
{
while (*mark != NUL && *mark++ == ':')
{
- switch (tolower(*mark++))
+ switch (SAFE_tolower(*mark++))
{
case 'a': *font_flags |= PF_STYLE_ANTIALIAS; break;
case 'b': *font_flags |= PF_STYLE_BOLD; break;
break;
if ((ns = end = strchr(s, ',')) == NULL)
end = s + strlen(s);
- while (isspace(((char_u *)end)[-1]))
+ while (SAFE_isspace(end[-1]))
end--;
*end = NUL;
strcpy(tmp, gui.rsrc_preedit_type_name);
for (s = tmp; s && !found; )
{
- while (*s && isspace((unsigned char)*s))
+ while (*s && SAFE_isspace(*s))
s++;
if (!*s)
break;
ns++;
else
end = s + strlen(s);
- while (isspace((unsigned char)*end))
+ while (SAFE_isspace(*end))
end--;
*end = '\0';
idx = prt_resfile.line_start + offset;
while (idx < prt_resfile.line_end)
{
- if (isspace(prt_resfile.buffer[idx]))
+ if (SAFE_isspace(prt_resfile.buffer[idx]))
return idx - prt_resfile.line_start;
idx++;
}
idx = prt_resfile.line_start + offset;
while (idx < prt_resfile.line_end)
{
- if (!isspace(prt_resfile.buffer[idx]))
+ if (!SAFE_isspace(prt_resfile.buffer[idx]))
return idx - prt_resfile.line_start;
idx++;
}
static int
hex_digit(int c)
{
- if (isdigit(c))
+ if (SAFE_isdigit(c))
return c - '0';
c = TOLOWER_ASC(c);
if (c >= 'a' && c <= 'f')
if (self == NULL)
return NULL;
- if (isdigit(*name))
+ if (isdigit((unsigned char)*name))
{
if (!translated_function_exists(name, FALSE))
{
for (p = regProp; (long_u)(p - regProp) < numItems; p++)
{
entry = p;
- while (*p != 0 && !isspace(*p))
+ while (*p != 0 && !SAFE_isspace(*p))
p++;
if (*p != 0)
{
for (p = regProp; (long_u)(p - regProp) < numItems; )
{
entry = p;
- while (*p != 0 && !isspace(*p))
+ while (*p != 0 && !SAFE_isspace(*p))
p++;
if (*p != 0 && STRICMP(name, p + 1) == 0)
{
for (p = regProp; (long_u)(p - regProp) < numItems; )
{
entry = p;
- while (*p != 0 && !isspace(*p))
+ while (*p != 0 && !SAFE_isspace(*p))
p++;
if (*p != 0 && IsSerialName(p + 1)
&& STRNICMP(name, p + 1, STRLEN(name)) == 0)
*/
#define BUFEMPTY() (curbuf->b_ml.ml_line_count == 1 && *ml_get((linenr_T)1) == NUL)
+// The is*() and to*() functions declared in <ctype.h> have
+// undefined behavior for values other than EOF outside the range of
+// unsigned char. If plain char is signed, a call with a negative
+// value has undefined behavior. These macros cast the argument to
+// unsigned char. (Most implementations behave more or less sanely
+// with negative values, and most character values in practice are
+// positive, but we want to avoid undefined behavior anyway.)
+#define SAFE_isalnum(c) (isalnum ((unsigned char)(c)))
+#define SAFE_isalpha(c) (isalpha ((unsigned char)(c)))
+#define SAFE_isblank(c) (isblank ((unsigned char)(c)))
+#define SAFE_iscntrl(c) (iscntrl ((unsigned char)(c)))
+#define SAFE_isdigit(c) (isdigit ((unsigned char)(c)))
+#define SAFE_isgraph(c) (isgraph ((unsigned char)(c)))
+#define SAFE_islower(c) (islower ((unsigned char)(c)))
+#define SAFE_isprint(c) (isprint ((unsigned char)(c)))
+#define SAFE_ispunct(c) (ispunct ((unsigned char)(c)))
+#define SAFE_isspace(c) (isspace ((unsigned char)(c)))
+#define SAFE_isupper(c) (isupper ((unsigned char)(c)))
+#define SAFE_isxdigit(c) (isxdigit((unsigned char)(c)))
+#define SAFE_tolower(c) (tolower ((unsigned char)(c)))
+#define SAFE_toupper(c) (toupper ((unsigned char)(c)))
+
/*
* toupper() and tolower() that use the current locale.
* On some systems toupper()/tolower() only work on lower/uppercase
# define TOLOWER_LOC(c) tolower_tab[(c) & 255]
#else
# ifdef BROKEN_TOUPPER
-# define TOUPPER_LOC(c) (islower(c) ? toupper(c) : (c))
-# define TOLOWER_LOC(c) (isupper(c) ? tolower(c) : (c))
+# define TOUPPER_LOC(c) (SAFE_islower(c) ? SAFE_toupper(c) : (c))
+# define TOLOWER_LOC(c) (SAFE_isupper(c) ? SAFE_tolower(c) : (c))
# else
-# define TOUPPER_LOC toupper
-# define TOLOWER_LOC tolower
+# define TOUPPER_LOC SAFE_toupper
+# define TOLOWER_LOC SAFE_tolower
# endif
#endif
}
// "iso-8859n" -> "iso-8859-n"
- if (STRNCMP(p, "iso-8859", 8) == 0 && isdigit(p[8]))
+ if (STRNCMP(p, "iso-8859", 8) == 0 && SAFE_isdigit(p[8]))
{
STRMOVE(p + 9, p + 8);
p[8] = '-';
if ((p = (char *)vim_strchr((char_u *)s, '.')) != NULL)
{
if (p > s + 2 && STRNICMP(p + 1, "EUC", 3) == 0
- && !isalnum((int)p[4]) && p[4] != '-' && p[-3] == '_')
+ && !SAFE_isalnum((int)p[4]) && p[4] != '-' && p[-3] == '_')
{
// copy "XY.EUC" to "euc-XY" to buf[10]
STRCPY(buf + 10, "euc-");
{
if (s[i] == '_' || s[i] == '-')
buf[i] = '-';
- else if (isalnum((int)s[i]))
+ else if (SAFE_isalnum(s[i]))
buf[i] = TOLOWER_ASC(s[i]);
else
break;
return;
find_pattern_in_path(ptr, 0, len, TRUE,
- cap->count0 == 0 ? !isupper(cap->nchar) : FALSE,
+ cap->count0 == 0 ? !SAFE_isupper(cap->nchar) : FALSE,
((cap->nchar & 0xf) == ('d' & 0xf)) ? FIND_DEFINE : FIND_ANY,
cap->count1,
- isupper(cap->nchar) ? ACTION_SHOW_ALL :
- islower(cap->nchar) ? ACTION_SHOW : ACTION_GOTO,
+ SAFE_isupper(cap->nchar) ? ACTION_SHOW_ALL :
+ SAFE_islower(cap->nchar) ? ACTION_SHOW : ACTION_GOTO,
cap->cmdchar == ']' ? curwin->w_cursor.lnum + 1 : (linenr_T)1,
(linenr_T)MAXLNUM);
vim_free(ptr);
// Uppercase means linewise, except in block mode, then "D" deletes till
// the end of the line, and "C" replaces till EOL
- if (isupper(cap->cmdchar))
+ if (SAFE_isupper(cap->cmdchar))
{
if (VIsual_mode != Ctrl_V)
{
{
if (CharOrd(firstdigit) < Prenum1)
{
- if (isupper(firstdigit))
+ if (SAFE_isupper(firstdigit))
firstdigit = 'A';
else
firstdigit = 'a';
{
if (26 - CharOrd(firstdigit) - 1 < Prenum1)
{
- if (isupper(firstdigit))
+ if (SAFE_isupper(firstdigit))
firstdigit = 'Z';
else
firstdigit = 'z';
save_pos = curwin->w_cursor;
for (i = 0; i < todel; ++i)
{
- if (c < 0x100 && isalpha(c))
+ if (c < 0x100 && SAFE_isalpha(c))
{
- if (isupper(c))
+ if (SAFE_isupper(c))
hexupper = TRUE;
else
hexupper = FALSE;
{
for (opt_idx = 0; (str = get_termcode(opt_idx)) != NULL; opt_idx++)
{
- if (!isprint(str[0]) || !isprint(str[1]))
+ if (!SAFE_isprint(str[0]) || !SAFE_isprint(str[1]))
continue;
name_buf[0] = 't';
{
// avoid putting up a message box with blanks only
for (p = (char_u *)error_ga.ga_data; *p; ++p)
- if (!isspace(*p))
+ if (!SAFE_isspace(*p))
{
// Only use a dialog when not using --gui-dialog-file:
// write text to a file.
smsg("chdir(%s)", path);
verbose_leave();
}
- if (isalpha(path[0]) && path[1] == ':') // has a drive name
+ if (SAFE_isalpha(path[0]) && path[1] == ':') // has a drive name
{
// If we can change to the drive, skip that part of the path. If we
// can't then the current directory may be invalid, try using chdir()
WCHAR buf[MAX_PATH];
DWORD attr;
- if (isalpha(p[0]) && p[1] == L':' && is_path_sep(p[2]))
+ if (SAFE_isalpha(p[0]) && p[1] == L':' && is_path_sep(p[2]))
p += 3;
else if (is_path_sep(p[0]) && is_path_sep(p[1]))
p += 2;
else if (STRCMP(how, "winch") == 0)
sig = SIGWINCH;
#endif
- else if (isdigit(*how))
+ else if (SAFE_isdigit(*how))
sig = atoi((char *)how);
else
return FAIL;
{
int l = 2;
- if (isdigit(s[l]))
+ if (SAFE_isdigit(s[l]))
l++;
if (s[l] == ' ' && s[l + 1] == 'q')
{
|| is_aff_rule(items, itemcnt, "REPSAL", 2))
{
// Ignore REP/REPSAL count
- if (!isdigit(*items[1]))
+ if (!SAFE_isdigit(*items[1]))
smsg(_("Expected REP(SAL) count in %s line %d"),
fname, lnum);
}
{
// First line contains the count.
found_map = TRUE;
- if (!isdigit(*items[1]))
+ if (!SAFE_isdigit(*items[1]))
smsg(_("Expected MAP count in %s line %d"),
fname, lnum);
}
// Get the line number or the search pattern used to locate
// the tag.
lnum = 0;
- if (isdigit(*tagp.command))
+ if (SAFE_isdigit(*tagp.command))
// Line number is used to locate the tag
lnum = atol((char *)tagp.command);
else
#endif
{
env_colors = mch_getenv((char_u *)"COLORS");
- if (env_colors != NULL && isdigit(*env_colors))
+ if (env_colors != NULL && SAFE_isdigit(*env_colors))
{
int colors = atoi((char *)env_colors);
// characters.
for (i = j + 3; i < len; ++i)
{
- if (i - j == 3 && !isdigit(tp[i]))
+ if (i - j == 3 && !SAFE_isdigit(tp[i]))
break;
if (i - j == 4 && tp[i] != ' ')
break;
// The mouse termcode "ESC [" is also the prefix of
// "ESC [ I" (focus gained) and other keys. Check some
// more bytes to find out.
- if (!isdigit(tp[2]))
+ if (!SAFE_isdigit(tp[2]))
{
// ESC [ without number following: Only use it when
// there is no other match.
// Skip over the digits, the final char must
// follow. URXVT can use a negative value, thus
// also accept '-'.
- for (j = slen - 2; j < len && (isdigit(tp[j])
+ for (j = slen - 2; j < len && (SAFE_isdigit(tp[j])
|| tp[j] == '-' || tp[j] == ';'); ++j)
;
++j;
else
opt.jo_term_api = NULL;
}
- else if (OPTARG_HAS("rows") && ep != NULL && isdigit(ep[1]))
+ else if (OPTARG_HAS("rows") && ep != NULL && SAFE_isdigit(ep[1]))
{
opt.jo_set2 |= JO2_TERM_ROWS;
opt.jo_term_rows = atoi((char *)ep + 1);
p = skiptowhite(cmd);
}
- else if (OPTARG_HAS("cols") && ep != NULL && isdigit(ep[1]))
+ else if (OPTARG_HAS("cols") && ep != NULL && SAFE_isdigit(ep[1]))
{
opt.jo_set2 |= JO2_TERM_COLS;
opt.jo_term_cols = atoi((char *)ep + 1);
// use same attr as previous cell
c = fgetc(fd);
}
- else if (isdigit(c))
+ else if (SAFE_isdigit(c))
{
// get the decimal attribute
attr = 0;
- while (isdigit(c))
+ while (SAFE_isdigit(c))
{
attr = attr * 10 + (c - '0');
c = fgetc(fd);
c = fgetc(fd);
blue = (blue << 4) + hex2nr(c);
c = fgetc(fd);
- if (!isdigit(c))
+ if (!SAFE_isdigit(c))
dump_is_corrupt(&ga_text);
- while (isdigit(c))
+ while (SAFE_isdigit(c))
{
index = index * 10 + (c - '0');
c = fgetc(fd);
for (;;)
{
c = fgetc(fd);
- if (!isdigit(c))
+ if (!SAFE_isdigit(c))
break;
count = count * 10 + (c - '0');
}
if (vim_isxdigit(p[1]))
{
int n, nr;
- int c = toupper(*p);
+ int c = SAFE_toupper(*p);
if (c == 'X')
n = 2;
char answer[10];
fflush(stdout);
- return (scanf(" %c", answer) == 1 && toupper(answer[0]) == 'Y');
+ return (scanf(" %c", answer) == 1 && toupper((unsigned char)answer[0]) == 'Y');
}
static int
while (ASCII_ISALNUM(*p) || *p == '_')
++p;
- if (arg == p || isdigit(*arg)
+ if (arg == p || SAFE_isdigit(*arg)
|| (argtypes == NULL
&& ((p - arg == 9 && STRNCMP(arg, "firstline", 9) == 0)
|| (p - arg == 8 && STRNCMP(arg, "lastline", 8) == 0))))
return ufunc->uf_name[0] != K_SPECIAL
&& (ufunc->uf_flags & FC_LAMBDA) == 0
&& vim_strchr(ufunc->uf_name, AUTOLOAD_CHAR) == NULL
- && !isdigit(ufunc->uf_name[0]);
+ && !SAFE_isdigit(ufunc->uf_name[0]);
}
/*
static int
numbered_function(char_u *name)
{
- return isdigit(*name)
- || (name[0] == 'g' && name[1] == ':' && isdigit(name[2]));
+ return SAFE_isdigit(*name)
+ || (name[0] == 'g' && name[1] == ':' && SAFE_isdigit(name[2]));
}
/*
&& (regmatch == NULL
? !message_filtered(fp->uf_name)
&& !func_name_refcount(fp->uf_name)
- : !isdigit(*fp->uf_name)
+ : !SAFE_isdigit(*fp->uf_name)
&& vim_regexec(regmatch, fp->uf_name, 0)))
{
if (list_func_head(fp, FALSE) == FAIL)
static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 6,
/**/
5,
/**/
if (highest_patch())
{
// Check for 9.9x or 9.9xx, alpha/beta version
- if (isalpha((int)vers[3]))
+ if (SAFE_isalpha((int)vers[3]))
{
- int len = (isalpha((int)vers[4])) ? 5 : 4;
+ int len = (SAFE_isalpha((int)vers[4])) ? 5 : 4;
sprintf((char *)vers + len, ".%d%s", highest_patch(),
mediumVersion + len);
}
// skip over colons and white space
for (p = line; *p == ':' || VIM_ISWHITE(*p); ++p)
;
- if (!isdigit(*p))
+ if (!SAFE_isdigit(*p))
{
// The command or modifiers must be following. Assume a lower case
// character means there is a modifier.
if (p[2] == 'n' && p[3] == 'o' && p[4] == 't')
*len = 5;
i = p[*len];
- if (!isalnum(i) && i != '_')
+ if (!SAFE_isalnum(i) && i != '_')
{
type = *len == 2 ? EXPR_IS : EXPR_ISNOT;
*type_is = TRUE;
}
}
- if (isdigit(*p))
+ if (SAFE_isdigit(*p))
{
value->bv_type = BVAL_NR;
value->bv_nr = getdigits(&p);
str = virp->vir_line + 1;
if (*str <= 127
&& ((*virp->vir_line == '\''
- && (VIM_ISDIGIT(*str) || isupper(*str)))
+ && (VIM_ISDIGIT(*str) || SAFE_isupper(*str)))
|| (*virp->vir_line == '-' && *str == '\'')))
{
if (*str == '\'')
# include <unistd.h>
#endif
#include <stdlib.h>
-#include <string.h> /* for strncmp() */
-#include <ctype.h> /* for isalnum() */
+#include <string.h>
+#include <ctype.h>
#include <limits.h>
#if __MWERKS__ && !defined(BEBOX)
# include <unix.h> /* for fdopen() on MAC */
#define HEX_BITS 3 /* not hex a dump, but bits: 01111001 */
#define HEX_LITTLEENDIAN 4
-#define CONDITIONAL_CAPITALIZE(c) (capitalize ? toupper((int)c) : c)
+#define CONDITIONAL_CAPITALIZE(c) (capitalize ? toupper((unsigned char)(c)) : (c))
#define COLOR_PROLOGUE \
l[c++] = '\033'; \
if (varname != NULL)
{
- FPRINTF_OR_DIE((fpo, "unsigned char %s", isdigit((int)varname[0]) ? "__" : ""));
+ FPRINTF_OR_DIE((fpo, "unsigned char %s", isdigit((unsigned char)varname[0]) ? "__" : ""));
for (e = 0; (c = varname[e]) != 0; e++)
- putc_or_die(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
+ putc_or_die(isalnum((unsigned char)c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
fputs_or_die("[] = {\n", fpo);
}
if (varname != NULL)
{
fputs_or_die("};\n", fpo);
- FPRINTF_OR_DIE((fpo, "unsigned int %s", isdigit((int)varname[0]) ? "__" : ""));
+ FPRINTF_OR_DIE((fpo, "unsigned int %s", isdigit((unsigned char)varname[0]) ? "__" : ""));
for (e = 0; (c = varname[e]) != 0; e++)
- putc_or_die(isalnum(c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
+ putc_or_die(isalnum((unsigned char)c) ? CONDITIONAL_CAPITALIZE(c) : '_', fpo);
FPRINTF_OR_DIE((fpo, "_%s = %d;\n", capitalize ? "LEN" : "len", p));
}