]> git.saurik.com Git - apple/libc.git/blob - gen/FreeBSD/unvis.c.patch
5f139ef67e80404cdd581f773a115739c3d5e507
[apple/libc.git] / gen / FreeBSD / unvis.c.patch
1 --- unvis.c.orig 2009-11-07 14:51:38.000000000 -0800
2 +++ unvis.c 2009-11-07 14:51:40.000000000 -0800
3 @@ -33,6 +33,8 @@ static char sccsid[] = "@(#)unvis.c 8.1
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/gen/unvis.c,v 1.10 2007/01/09 00:27:56 imp Exp $");
6
7 +#include "xlocale_private.h"
8 +
9 #include <sys/types.h>
10 #include <ctype.h>
11 #include <vis.h>
12 @@ -60,6 +62,7 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/unv
13 int
14 unvis(char *cp, int c, int *astate, int flag)
15 {
16 + locale_t loc = __current_locale();
17
18 if (flag & UNVIS_END) {
19 if (*astate == S_OCTAL2 || *astate == S_OCTAL3) {
20 @@ -86,8 +89,8 @@ unvis(char *cp, int c, int *astate, int
21
22 case S_START:
23 if (*astate & S_HTTP) {
24 - if (ishex(tolower(c))) {
25 - *cp = isdigit(c) ? (c - '0') : (tolower(c) - 'a');
26 + if (ishex(tolower_l(c, loc))) {
27 + *cp = isdigit_l(c, loc) ? (c - '0') : (tolower_l(c, loc) - 'a');
28 *astate = S_HEX2;
29 return (0);
30 }
31 @@ -212,8 +215,8 @@ unvis(char *cp, int c, int *astate, int
32 return (UNVIS_VALIDPUSH);
33
34 case S_HEX2: /* second mandatory hex digit */
35 - if (ishex(tolower(c))) {
36 - *cp = (isdigit(c) ? (*cp << 4) + (c - '0') : (*cp << 4) + (tolower(c) - 'a' + 10));
37 + if (ishex(tolower_l(c, loc))) {
38 + *cp = (isdigit_l(c, loc) ? (*cp << 4) + (c - '0') : (*cp << 4) + (tolower_l(c, loc) - 'a' + 10));
39 }
40 *astate = S_GROUND;
41 return (UNVIS_VALID);