]> git.saurik.com Git - apple/libc.git/blame - locale/FreeBSD/big5.c.patch
Libc-320.tar.gz
[apple/libc.git] / locale / FreeBSD / big5.c.patch
CommitLineData
9385eb3d
A
1--- big5.c.orig Tue May 20 15:21:44 2003
2+++ big5.c Wed Jun 18 12:02:34 2003
3@@ -45,6 +45,7 @@
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <sys/types.h>
7+#include <ctype.h>
8
9 rune_t _BIG5_sgetrune(const char *, size_t, char const **);
10 int _BIG5_sputrune(rune_t, char *, size_t, char **);
11@@ -77,13 +78,17 @@
12 rune_t rune = 0;
13 int len;
14
15- if (n < 1 || (len = _big5_check(*string)) > n) {
16- if (result)
17- *result = string;
18+ if (result)
19+ *result = string;
20+ if (n < 1 || (len = _big5_check(*string)) > n)
21 return (_INVALID_RUNE);
22- }
23 while (--len >= 0)
24 rune = (rune << 8) | ((u_int)(*string++) & 0xff);
25+ if (!isrune(rune)) {
26+ if (result)
27+ (*result)++;
28+ return (_INVALID_RUNE);
29+ }
30 if (result)
31 *result = string;
32 return rune;