FreeBSD Bugzilla – Attachment 170955 Details for
Bug 179721
[libc] [patch] char<->wchar_t mismatch in glob(3), fnmatch(3), regexec(3)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Add __wcollate_range_cmp() and use it
pr-glob.diff (text/plain), 3.10 KB, created by
Pedro F. Giffuni
on 2016-06-02 18:06:59 UTC
(
hide
)
Description:
Add __wcollate_range_cmp() and use it
Filename:
MIME Type:
Creator:
Pedro F. Giffuni
Created:
2016-06-02 18:06:59 UTC
Size:
3.10 KB
patch
obsolete
>Index: lib/libc/gen/fnmatch.c >=================================================================== >--- lib/libc/gen/fnmatch.c (revision 301158) >+++ lib/libc/gen/fnmatch.c (working copy) >@@ -296,8 +296,8 @@ > > if (table->__collate_load_error ? > c <= test && test <= c2 : >- __collate_range_cmp(table, c, test) <= 0 >- && __collate_range_cmp(table, test, c2) <= 0 >+ __wcollate_range_cmp(table, c, test) <= 0 >+ && __wcollate_range_cmp(table, test, c2) <= 0 > ) > ok = 1; > } else if (c == test) >Index: lib/libc/gen/glob.c >=================================================================== >--- lib/libc/gen/glob.c (revision 301158) >+++ lib/libc/gen/glob.c (working copy) >@@ -832,8 +832,8 @@ > if ((*pat & M_MASK) == M_RNG) { > if (table->__collate_load_error ? > CHAR(c) <= CHAR(k) && CHAR(k) <= CHAR(pat[1]) : >- __collate_range_cmp(table, CHAR(c), CHAR(k)) <= 0 >- && __collate_range_cmp(table, CHAR(k), CHAR(pat[1])) <= 0 >+ __wcollate_range_cmp(table, CHAR(c), CHAR(k)) <= 0 >+ && __wcollate_range_cmp(table, CHAR(k), CHAR(pat[1])) <= 0 > ) > ok = 1; > pat += 2; >Index: lib/libc/locale/collate.h >=================================================================== >--- lib/libc/locale/collate.h (revision 301158) >+++ lib/libc/locale/collate.h (working copy) >@@ -129,6 +129,7 @@ > void _collate_lookup(struct xlocale_collate *,const wchar_t *, int *, int *, > int, const int **); > int __collate_range_cmp(struct xlocale_collate *, wchar_t, wchar_t); >+int __wcollate_range_cmp(struct xlocale_collate *, wchar_t, wchar_t); > size_t _collate_wxfrm(struct xlocale_collate *, const wchar_t *, wchar_t *, > size_t); > size_t _collate_sxfrm(struct xlocale_collate *, const wchar_t *, char *, >Index: lib/libc/locale/collcmp.c >=================================================================== >--- lib/libc/locale/collcmp.c (revision 301158) >+++ lib/libc/locale/collcmp.c (working copy) >@@ -53,3 +53,13 @@ > l.components[XLC_COLLATE] = (struct xlocale_component *)table; > return (wcscoll_l(s1, s2, &l)); > } >+int __wcollate_range_cmp(struct xlocale_collate *table, wchar_t c1, wchar_t c2) >+{ >+ static wchar_t s1[2], s2[2]; >+ >+ s1[0] = c1; >+ s2[0] = c2; >+ struct _xlocale l = {{0}}; >+ l.components[XLC_COLLATE] = (struct xlocale_component *)table; >+ return (wcscoll_l(s1, s2, &l)); >+} >Index: lib/libc/regex/regcomp.c >=================================================================== >--- lib/libc/regex/regcomp.c (revision 301158) >+++ lib/libc/regex/regcomp.c (working copy) >@@ -821,10 +821,10 @@ > (void)REQUIRE((uch)start <= (uch)finish, REG_ERANGE); > CHaddrange(p, cs, start, finish); > } else { >- (void)REQUIRE(__collate_range_cmp(table, start, finish) <= 0, REG_ERANGE); >+ (void)REQUIRE(__wcollate_range_cmp(table, start, finish) <= 0, REG_ERANGE); > for (i = 0; i <= UCHAR_MAX; i++) { >- if ( __collate_range_cmp(table, start, i) <= 0 >- && __collate_range_cmp(table, i, finish) <= 0 >+ if ( __wcollate_range_cmp(table, start, i) <= 0 >+ && __wcollate_range_cmp(table, i, finish) <= 0 > ) > CHadd(p, cs, i); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 179721
:
134969
|
170924
|
170955
|
170956
|
171012
|
171025
|
171026
|
171028