mirror of
https://github.com/irssi/irssi.git
synced 2026-08-09 20:00:23 +02:00
toupper(), tolower(), isspace(), is..etc..() aren't safe with chars in some
systems, use our own is_...() functions now instead. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2348 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
820c9d3d82
commit
f4897860b5
35 changed files with 112 additions and 95 deletions
|
|
@ -393,7 +393,7 @@ static GList *completion_nicks_nonstrict(CHANNEL_REC *channel,
|
|||
/* remove non alnum chars from nick */
|
||||
in = rec->nick; out = str;
|
||||
while (*in != '\0') {
|
||||
if (isalnum(*in))
|
||||
if (i_isalnum(*in))
|
||||
*out++ = *in;
|
||||
in++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ static int last_want_space, last_line_pos;
|
|||
((c) == ',')
|
||||
|
||||
#define isseparator(c) \
|
||||
(isspace((int) (c)) || isseparator_notspace(c))
|
||||
(i_isspace(c) || isseparator_notspace(c))
|
||||
|
||||
void chat_completion_init(void);
|
||||
void chat_completion_deinit(void);
|
||||
|
|
@ -489,7 +489,7 @@ static char *line_get_command(const char *line, char **args, int aliases)
|
|||
} else {
|
||||
checkcmd = g_strndup(line, (int) (ptr-line));
|
||||
|
||||
while (isspace(*ptr)) ptr++;
|
||||
while (i_isspace(*ptr)) ptr++;
|
||||
cmdargs = ptr;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@
|
|||
#include "hilight-text.h"
|
||||
#include "printtext.h"
|
||||
|
||||
#define ishighalnum(c) ((unsigned char) (c) >= 128 || isalnum(c))
|
||||
#define ishighalnum(c) ((unsigned char) (c) >= 128 || i_isalnum(c))
|
||||
|
||||
static GHashTable *printnicks;
|
||||
|
||||
|
|
@ -67,7 +67,7 @@ char *expand_emphasis(WI_ITEM_REC *item, const char *text)
|
|||
|
||||
/* check that the beginning marker starts a word, and
|
||||
that the matching end marker ends a word */
|
||||
if ((pos > 0 && !isspace(bgn[-1])) || !ishighalnum(bgn[1]))
|
||||
if ((pos > 0 && !i_isspace(bgn[-1])) || !ishighalnum(bgn[1]))
|
||||
continue;
|
||||
if ((end = strchr(bgn+1, *bgn)) == NULL)
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ static void settings_save_fe(const char *fname)
|
|||
|
||||
static void settings_save_confirm(const char *line, char *fname)
|
||||
{
|
||||
if (toupper(line[0]) == 'Y')
|
||||
if (i_toupper(line[0]) == 'Y')
|
||||
settings_save_fe(fname);
|
||||
g_free(fname);
|
||||
}
|
||||
|
|
@ -304,7 +304,7 @@ static void cmd_save(const char *data)
|
|||
|
||||
static void settings_clean_confirm(const char *line)
|
||||
{
|
||||
if (toupper(line[0]) == 'Y')
|
||||
if (i_toupper(line[0]) == 'Y')
|
||||
settings_clean_invalid();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -699,7 +699,7 @@ static const char *get_ansi_color(THEME_REC *theme, const char *str,
|
|||
for (;; str++) {
|
||||
if (*str == '\0') return start;
|
||||
|
||||
if (isdigit((int) *str)) {
|
||||
if (i_isdigit(*str)) {
|
||||
num = num*10 + (*str-'0');
|
||||
continue;
|
||||
}
|
||||
|
|
@ -758,7 +758,7 @@ static void get_mirc_color(const char **str, int *fg_ret, int *bg_ret)
|
|||
fg = fg_ret == NULL ? -1 : *fg_ret;
|
||||
bg = bg_ret == NULL ? -1 : *bg_ret;
|
||||
|
||||
if (!isdigit((int) **str) && **str != ',') {
|
||||
if (!i_isdigit(**str) && **str != ',') {
|
||||
fg = -1;
|
||||
bg = -1;
|
||||
} else {
|
||||
|
|
@ -766,7 +766,7 @@ static void get_mirc_color(const char **str, int *fg_ret, int *bg_ret)
|
|||
if (**str != ',') {
|
||||
fg = **str-'0';
|
||||
(*str)++;
|
||||
if (isdigit((int) **str)) {
|
||||
if (i_isdigit(**str)) {
|
||||
fg = fg*10 + (**str-'0');
|
||||
(*str)++;
|
||||
}
|
||||
|
|
@ -774,12 +774,12 @@ static void get_mirc_color(const char **str, int *fg_ret, int *bg_ret)
|
|||
if (**str == ',') {
|
||||
/* background color */
|
||||
(*str)++;
|
||||
if (!isdigit((int) **str))
|
||||
if (!i_isdigit(**str))
|
||||
bg = -1;
|
||||
else {
|
||||
bg = **str-'0';
|
||||
(*str)++;
|
||||
if (isdigit((int) **str)) {
|
||||
if (i_isdigit(**str)) {
|
||||
bg = bg*10 + (**str-'0');
|
||||
(*str)++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ static int expand_key(const char *key, GSList **out)
|
|||
start = NULL; last_hyphen = TRUE;
|
||||
for (; *key != '\0'; key++) {
|
||||
if (start != NULL) {
|
||||
if (isalnum(*key) || *key == '_') {
|
||||
if (i_isalnum(*key) || *key == '_') {
|
||||
/* key combo continues */
|
||||
continue;
|
||||
}
|
||||
|
|
@ -291,7 +291,7 @@ static int expand_key(const char *key, GSList **out)
|
|||
expand_out_char(*out, *key);
|
||||
expand_out_char(*out, '-');
|
||||
last_hyphen = FALSE; /* optional */
|
||||
} else if (last_hyphen && isalnum(*key) && !isdigit(*key)) {
|
||||
} else if (last_hyphen && i_isalnum(*key) && !i_isdigit(*key)) {
|
||||
/* possibly beginning of keycombo */
|
||||
start = key;
|
||||
last_hyphen = FALSE;
|
||||
|
|
|
|||
|
|
@ -332,7 +332,7 @@ static char *theme_format_expand_abstract(THEME_REC *theme,
|
|||
NULL, NULL, flags);
|
||||
len = strlen(data);
|
||||
|
||||
if (len > 1 && isdigit(data[len-1]) && data[len-2] == '$') {
|
||||
if (len > 1 && i_isdigit(data[len-1]) && data[len-2] == '$') {
|
||||
/* ends with $<digit> .. this breaks things if next
|
||||
character is digit or '-' */
|
||||
char digit, *tmp;
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ void translate_output(char *text)
|
|||
}
|
||||
|
||||
#define gethex(a) \
|
||||
(isdigit(a) ? ((a)-'0') : (toupper(a)-'A'+10))
|
||||
(i_isdigit(a) ? ((a)-'0') : (i_toupper(a)-'A'+10))
|
||||
|
||||
void translation_parse_line(const char *str, int *pos)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue