Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 109744
Collapse All | Expand All

(-)xchat-2.4.5uno/src/common/outbound.c (-7 / +7 lines)
Lines 1498-1504 Link Here
1498
					k = 0;
1498
					k = 0;
1499
				} else
1499
				} else
1500
				{
1500
				{
1501
					if (isdigit (buf[i]) && k < (sizeof (numb) - 1))
1501
					if (isdigit ((unsigned char) buf[i]) && k < (sizeof (numb) - 1))
1502
					{
1502
					{
1503
						numb[k] = buf[i];
1503
						numb[k] = buf[i];
1504
						k++;
1504
						k++;
Lines 1899-1905 Link Here
1899
	p = name;
1899
	p = name;
1900
	while (*p)
1900
	while (*p)
1901
	{
1901
	{
1902
		hl->buf[len] = toupper (*p);
1902
		hl->buf[len] = toupper ((unsigned char) *p);
1903
		len++;
1903
		len++;
1904
		p++;
1904
		p++;
1905
	}
1905
	}
Lines 2136-2142 Link Here
2136
2136
2137
		user = find_name (sess, nick);
2137
		user = find_name (sess, nick);
2138
2138
2139
		if (isdigit (reason[0]) && reason[1] == 0)
2139
		if (isdigit ((unsigned char) reason[0]) && reason[1] == 0)
2140
		{
2140
		{
2141
			ban (sess, tbuf, nick, reason, (user && user->op));
2141
			ban (sess, tbuf, nick, reason, (user && user->op));
2142
			reason[0] = 0;
2142
			reason[0] = 0;
Lines 3287-3295 Link Here
3287
	{
3287
	{
3288
		if (src[0] == '%' || src[0] == '&')
3288
		if (src[0] == '%' || src[0] == '&')
3289
		{
3289
		{
3290
			if (isdigit (src[1]))
3290
			if (isdigit ((unsigned char) src[1]))
3291
			{
3291
			{
3292
				if (isdigit (src[2]) && isdigit (src[3]))
3292
				if (isdigit ((unsigned char) src[2]) && isdigit ((unsigned char) src[3]))
3293
				{
3293
				{
3294
					buf[0] = src[1];
3294
					buf[0] = src[1];
3295
					buf[1] = src[2];
3295
					buf[1] = src[2];
Lines 3442-3449 Link Here
3442
				occur++;
3442
				occur++;
3443
				if (	do_ascii &&
3443
				if (	do_ascii &&
3444
						j + 3 < len &&
3444
						j + 3 < len &&
3445
						(isdigit (cmd[j + 1]) && isdigit (cmd[j + 2]) &&
3445
						(isdigit ((unsigned char) cmd[j + 1]) && isdigit ((unsigned char) cmd[j + 2]) &&
3446
						isdigit (cmd[j + 3])))
3446
						isdigit ((unsigned char) cmd[j + 3])))
3447
				{
3447
				{
3448
					tbuf[0] = cmd[j + 1];
3448
					tbuf[0] = cmd[j + 1];
3449
					tbuf[1] = cmd[j + 2];
3449
					tbuf[1] = cmd[j + 2];
(-)xchat-2.4.5uno/src/common/proto-irc.c (-3 / +11 lines)
Lines 761-768 Link Here
761
761
762
	if (len == 4)
762
	if (len == 4)
763
	{
763
	{
764
		guint32 t;
765
  	 
766
		t = WORDL((guint8)type[0], (guint8)type[1], (guint8)type[2],
767
 (guint8)type[3]);
764
		/* this should compile to a bunch of: CMP.L, JE ... nice & fast */
768
		/* this should compile to a bunch of: CMP.L, JE ... nice & fast */
765
		switch (*((guint32 *)type))
769
		switch (t)
766
		{
770
		{
767
		case WORDL('J','O','I','N'):
771
		case WORDL('J','O','I','N'):
768
			{
772
			{
Lines 838-845 Link Here
838
842
839
	else if (len >= 5)
843
	else if (len >= 5)
840
	{
844
	{
845
		guint32 t;
846
  	 
847
		t = WORDL((guint8)type[0], (guint8)type[1], (guint8)type[2],
848
 (guint8)type[3]);
841
		/* this should compile to a bunch of: CMP.L, JE ... nice & fast */
849
		/* this should compile to a bunch of: CMP.L, JE ... nice & fast */
842
		switch (*((guint32 *)type))
850
		switch (t)
843
		{
851
		{
844
		case WORDL('I','N','V','I'):
852
		case WORDL('I','N','V','I'):
845
			if (ignore_check (word[1], IG_INVI))
853
			if (ignore_check (word[1], IG_INVI))
Lines 1022-1028 Link Here
1022
	}
1030
	}
1023
1031
1024
	/* see if the second word is a numeric */
1032
	/* see if the second word is a numeric */
1025
	if (isdigit (word[2][0]))
1033
	if (isdigit ((unsigned char) word[2][0]))
1026
	{
1034
	{
1027
		text = word_eol[4];
1035
		text = word_eol[4];
1028
		if (*text == ':')
1036
		if (*text == ':')
(-)xchat-2.4.5uno/src/common/url.c (-73 / +62 lines)
Lines 124-188 Link Here
124
int
124
int
125
url_check_word (char *word, int len)
125
url_check_word (char *word, int len)
126
{
126
{
127
	char *at, *dot;
127
#define D(x) (x), ((sizeof (x)) - 1)
128
	static const struct {
129
		const char *s;
130
		int len;
131
	}
132
	prefix[] = {
133
		{ D("irc.") },
134
		{ D("ftp.") },
135
		{ D("www.") },
136
		{ D("irc://") },
137
		{ D("ftp://") },
138
		{ D("http://") },
139
		{ D("https://") },
140
		{ D("file://") },
141
		{ D("rtsp://") },
142
		{ D("gopher://") },
143
	},
144
	suffix[] = {
145
		{ D(".org") },
146
		{ D(".net") },
147
		{ D(".com") },
148
		{ D(".edu") },
149
		{ D(".html") },
150
		{ D(".info") },
151
		{ D(".name") },
152
	};
153
#undef D
154
	const char *at, *dot;
128
	int i, dots;
155
	int i, dots;
129
	char temp[4];
130
	guint32 pre;
131
156
132
	if ((word[0] == '@' || word[0] == '+' || word[0] == '^' || word[0] == '%' || word[0] == '*' ) && word[1] == '#')
157
	if (len > 1 && word[1] == '#' && strchr("@+^%*#", word[0]))
133
		return WORD_CHANNEL;
158
		return WORD_CHANNEL;
134
159
135
	if ((word[0] == '#' || word[0] == '&') && word[1] != '#' && word[1] != 0)
160
	if ((word[0] == '#' || word[0] == '&') && word[1] != '#' && word[1] != 0)
136
		return WORD_CHANNEL;
161
		return WORD_CHANNEL;
137
162
138
	if (len > 4 && word[4] != '.')
163
	for (i = 0; i < G_N_ELEMENTS(prefix); i++)
139
	{
164
	{
140
		temp[0] = tolower (word[0]);
165
		int l;
141
		temp[1] = tolower (word[1]);
142
		temp[2] = tolower (word[2]);
143
		temp[3] = tolower (word[3]);
144
145
		pre = *((guint32 *)temp);
146
147
		if (CMPL (pre, 'i','r','c','.'))
148
			return WORD_URL;
149
		if (CMPL (pre, 'f','t','p','.'))
150
			return WORD_URL;
151
		if (CMPL (pre, 'w','w','w','.'))
152
			return WORD_URL;
153
166
154
		if (len > 7 && word[4] == '/' && word[5] == '/')
167
		l = prefix[i].len;
168
		if (len > l)
155
		{
169
		{
156
			if (CMPL (pre, 'i','r','c',':'))	/* irc:// */
170
			int j;
157
				return WORD_URL;
158
			if (CMPL (pre, 'f','t','p',':'))	/* ftp:// */
159
				return WORD_URL;
160
		}
161
171
162
		/* check for ABCD://... */
172
			/* This is pretty much strncasecmp(). */
163
		if (len > 8 && word[4] == ':' && word[5] == '/' && word[6] == '/')
173
			for (j = 0; j < l; j++)
164
		{
174
			{
165
			if (CMPL (pre, 'h','t','t','p'))		/* http:// */
175
				unsigned char c = word[j];
166
				return WORD_URL;
176
				if (tolower(c) != prefix[i].s[j])
167
			if (CMPL (pre, 'f','i','l','e'))		/* file:// */
177
					break;
168
				return WORD_URL;
178
			}
169
			if (CMPL (pre, 'r','t','s','p'))		/* rtsp:// */
179
			if (j == l)
170
				return WORD_URL;
180
				return WORD_URL;		
171
		}
172
173
		/* check for https:// */
174
		if (len > 9 && word[5] == ':' && word[6] == '/' && word[7] == '/')
175
		{
176
			if (CMPL (pre, 'h','t','t','p') && (word[4] == 's' || word[4] == 'S'))
177
				return WORD_URL;
178
		}
179
180
		/* check for gopher:// */
181
		if (len > 10 && word[6] == ':' && word[7] == '/' && word[8] == '/')
182
		{
183
			if (CMPL (pre, 'g','o','p','h'))
184
				if (CMPW (word + 4, 'e','r') || CMPW (word + 4, 'E','R'))
185
					return WORD_URL;
186
		}
181
		}
187
	}
182
	}
188
183
Lines 205-211 Link Here
205
	{
200
	{
206
		if (word[i] == '.' && i > 1)
201
		if (word[i] == '.' && i > 1)
207
			dots++;	/* allow 127.0.0.1:80 */
202
			dots++;	/* allow 127.0.0.1:80 */
208
		else if (!isdigit (word[i]) && word[i] != ':')
203
		else if (!isdigit ((unsigned char) word[i]) && word[i] != ':')
209
		{
204
		{
210
			dots = 0;
205
			dots = 0;
211
			break;
206
			break;
Lines 216-250 Link Here
216
211
217
	if (len > 5)
212
	if (len > 5)
218
	{
213
	{
219
		/* create a lowercase version of the last 4 letters */
214
		for (i = 0; i < G_N_ELEMENTS(suffix); i++)
220
		temp[0] = tolower (word[len - 4]);
215
		{
221
		temp[1] = tolower (word[len - 3]);
216
			int l;
222
		temp[2] = tolower (word[len - 2]);
223
		temp[3] = tolower (word[len - 1]);
224
217
225
		pre = *((guint32 *)temp);
218
			l = suffix[i].len;
219
			if (len > l)
220
			{
221
				const unsigned char *p = &word[len - l];
222
				int j;
226
223
227
		if (word[len - 5] == '.')
224
				/* This is pretty much strncasecmp(). */
228
		{
225
				for (j = 0; j < l; j++)
229
			if (CMPL (pre, 'h','t','m','l'))
226
				{
230
				return WORD_HOST;
227
					if (tolower(p[j]) != suffix[i].s[j])
231
			if (CMPL (pre, 'i','n','f','o'))
228
						break;
232
				return WORD_HOST;
229
				}
233
			if (CMPL (pre, 'n','a','m','e'))
230
				if (j == l)			
234
				return WORD_HOST;
231
					return WORD_HOST;
232
			}
235
		}
233
		}
236
234
237
		if (CMPL (pre, '.','o','r','g'))
238
			return WORD_HOST;
239
		if (CMPL (pre, '.','n','e','t'))
240
			return WORD_HOST;
241
		if (CMPL (pre, '.','c','o','m'))
242
			return WORD_HOST;
243
		if (CMPL (pre, '.','e','d','u'))
244
			return WORD_HOST;
245
246
		if (word[len - 3] == '.' &&
235
		if (word[len - 3] == '.' &&
247
			 isalpha (word[len - 2]) && isalpha (word[len - 1]))
236
			 isalpha ((unsigned char) word[len - 2]) && isalpha ((unsigned char) word[len - 1]))
248
			return WORD_HOST;
237
			return WORD_HOST;
249
	}
238
	}
250
239
(-)xchat-2.4.5uno/src/common/util.c (-4 / +4 lines)
Lines 435-442 Link Here
435
435
436
	while (len > 0)
436
	while (len > 0)
437
	{
437
	{
438
		if ((col && isdigit (*text) && nc < 2) ||
438
		if ((col && isdigit ((unsigned char) *text) && nc < 2) ||
439
			 (col && *text == ',' && isdigit (*(text+1)) && nc < 3))
439
			 (col && *text == ',' && isdigit ((unsigned char) *(text+1)) && nc < 3))
440
		{
440
		{
441
			nc++;
441
			nc++;
442
			if (*text == ',')
442
			if (*text == ',')
Lines 1084-1090 Link Here
1084
	char *p;
1084
	char *p;
1085
	domain_t *dom;
1085
	domain_t *dom;
1086
1086
1087
	if (!hostname || !*hostname || isdigit (hostname[strlen (hostname) - 1]))
1087
	if (!hostname || !*hostname || isdigit ((unsigned char) hostname[strlen (hostname) - 1]))
1088
		return _("Unknown");
1088
		return _("Unknown");
1089
	if ((p = strrchr (hostname, '.')))
1089
	if ((p = strrchr (hostname, '.')))
1090
		p++;
1090
		p++;
Lines 1156-1162 Link Here
1156
		if (*src != quote) *buf++ = '\\';
1156
		if (*src != quote) *buf++ = '\\';
1157
	    }
1157
	    }
1158
	    *buf++ = *src;
1158
	    *buf++ = *src;
1159
	} else if (isspace(*src)) {
1159
	} else if (isspace((unsigned char) *src)) {
1160
	    if (*argv[argc]) {
1160
	    if (*argv[argc]) {
1161
		buf++, argc++;
1161
		buf++, argc++;
1162
		if (argc == argvAlloced) {
1162
		if (argc == argvAlloced) {
(-)xchat-2.4.5uno/src/fe-gtk/maingui.c (-1 / +1 lines)
Lines 1608-1614 Link Here
1608
		return;
1608
		return;
1609
1609
1610
	sess = current_sess;
1610
	sess = current_sess;
1611
	mode = tolower (flag[0]);
1611
	mode = tolower ((unsigned char) flag[0]);
1612
1612
1613
	switch (mode)
1613
	switch (mode)
1614
	{
1614
	{

Return to bug 109744