From 6b3f923fe237348c594e8271141f6a12c5fb327d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 12 Feb 2010 20:17:22 +0000 Subject: [PATCH] * regex/regcomp.c (wgetnext): Use size_t as type for n2 since that's what's returned by mbrtowc. * regex/regexec.c (xmbrtowc): Ditto. --- winsup/cygwin/ChangeLog | 6 ++++++ winsup/cygwin/regex/regcomp.c | 3 ++- winsup/cygwin/regex/regexec.c | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 02abda230..e2486cf69 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2010-02-12 Corinna Vinschen + + * 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 * pthread.cc (pthread_mutex_init): Explicitly fill out third arg to diff --git a/winsup/cygwin/regex/regcomp.c b/winsup/cygwin/regex/regcomp.c index c5e68a2b5..3556dddd8 100644 --- a/winsup/cygwin/regex/regcomp.c +++ b/winsup/cygwin/regex/regcomp.c @@ -1152,7 +1152,8 @@ wgetnext(struct parse *p) else if (sizeof (wchar_t) == 2 && wc >= 0xd800 && wc <= 0xdbff) { /* UTF-16 surrogate pair. Fetch second half and 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) { SETERROR(REG_ILLSEQ); return (0); diff --git a/winsup/cygwin/regex/regexec.c b/winsup/cygwin/regex/regexec.c index 788ef5eeb..ad12ada41 100644 --- a/winsup/cygwin/regex/regexec.c +++ b/winsup/cygwin/regex/regexec.c @@ -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) { /* UTF-16 surrogate pair. Fetch second half and 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) { memset(mbs, 0, sizeof(*mbs)); if (wi != NULL)