]> git.saurik.com Git - apple/libc.git/blame_incremental - gen/FreeBSD/unvis.c.patch
Libc-498.1.5.tar.gz
[apple/libc.git] / gen / FreeBSD / unvis.c.patch
... / ...
CommitLineData
1--- unvis.c.orig 2004-11-25 11:38:02.000000000 -0800
2+++ unvis.c 2005-02-27 01:14:02.000000000 -0800
3@@ -37,6 +37,8 @@
4 #include <sys/cdefs.h>
5 __FBSDID("$FreeBSD: src/lib/libc/gen/unvis.c,v 1.9 2004/08/02 08:46:23 stefanf Exp $");
6
7+#include "xlocale_private.h"
8+
9 #include <sys/types.h>
10 #include <ctype.h>
11 #include <vis.h>
12@@ -64,6 +66,7 @@
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@@ -90,8 +93,8 @@
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@@ -216,8 +219,8 @@
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);