* regex/regcomp.c (wgetnext): Use size_t as type for n2 since that's
what's returned by mbrtowc. * regex/regexec.c (xmbrtowc): Ditto.
This commit is contained in:
parent
492f1c3431
commit
6b3f923fe2
|
@ -1,3 +1,9 @@
|
||||||
|
2010-02-12 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* regex/regcomp.c (wgetnext): Use size_t as type for n2 since that's
|
||||||
|
what's returned by mbrtowc.
|
||||||
|
* regex/regexec.c (xmbrtowc): Ditto.
|
||||||
|
|
||||||
2010-02-12 Christopher Faylor <me+cygwin@cgf.cx>
|
2010-02-12 Christopher Faylor <me+cygwin@cgf.cx>
|
||||||
|
|
||||||
* pthread.cc (pthread_mutex_init): Explicitly fill out third arg to
|
* pthread.cc (pthread_mutex_init): Explicitly fill out third arg to
|
||||||
|
|
|
@ -1152,7 +1152,8 @@ wgetnext(struct parse *p)
|
||||||
else if (sizeof (wchar_t) == 2 && wc >= 0xd800 && wc <= 0xdbff) {
|
else if (sizeof (wchar_t) == 2 && wc >= 0xd800 && wc <= 0xdbff) {
|
||||||
/* UTF-16 surrogate pair. Fetch second half and
|
/* UTF-16 surrogate pair. Fetch second half and
|
||||||
compute UTF-32 value */
|
compute UTF-32 value */
|
||||||
int n2 = mbrtowc(&wc, p->next + n, p->end - p->next - n, &mbs);
|
size_t n2 = mbrtowc(&wc, p->next + n,
|
||||||
|
p->end - p->next - n, &mbs);
|
||||||
if (n2 == 0 || n2 == (size_t)-1 || n2 == (size_t)-2) {
|
if (n2 == 0 || n2 == (size_t)-1 || n2 == (size_t)-2) {
|
||||||
SETERROR(REG_ILLSEQ);
|
SETERROR(REG_ILLSEQ);
|
||||||
return (0);
|
return (0);
|
||||||
|
|
|
@ -88,7 +88,7 @@ xmbrtowc(wint_t *wi, const char *s, size_t n, mbstate_t *mbs, wint_t dummy)
|
||||||
if (sizeof (wchar_t) == 2 && wc >= 0xd800 && wc <= 0xdbff) {
|
if (sizeof (wchar_t) == 2 && wc >= 0xd800 && wc <= 0xdbff) {
|
||||||
/* UTF-16 surrogate pair. Fetch second half and
|
/* UTF-16 surrogate pair. Fetch second half and
|
||||||
compute UTF-32 value */
|
compute UTF-32 value */
|
||||||
int n2 = mbrtowc(&wc, s + nr, n - nr, mbs);
|
size_t n2 = mbrtowc(&wc, s + nr, n - nr, mbs);
|
||||||
if (n2 == 0 || n2 == (size_t)-1 || n2 == (size_t)-2) {
|
if (n2 == 0 || n2 == (size_t)-1 || n2 == (size_t)-2) {
|
||||||
memset(mbs, 0, sizeof(*mbs));
|
memset(mbs, 0, sizeof(*mbs));
|
||||||
if (wi != NULL)
|
if (wi != NULL)
|
||||||
|
|
Loading…
Reference in New Issue