Re: The current libc/locale/toupper.c is mistaken

看板FB_current作者時間13年前 (2012/06/03 18:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串9/9 (看更多)
----Next_Part(Fri_May_11_10_58_05_2012_127)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hi, I'm sorry. I forgot to attach a file. Regards, Kohji Okuno > Hi David, > > From: David Chisnall <theraven@FreeBSD.org> > >> If you have a test case, I can commit it to the libc++ test suite. >> >> David > > I attached my test source. > This test program shoud output as below. > > towupper_l > 0049, 0049 > 0131, 0049 > 0130, 0130 > 0069, 0049 > > towlower_l > 0049, 0069 > 0131, 0131 > 0130, 0069 > 0069, 0069 > > But, when I use original toupper.c, this proguram output as below. > > towupper_l > 0049, 0049 > 0131, 0131 > 0130, 0069 > 0069, 0049 > > towlower_l > 0049, 0069 > 0131, 0131 > 0130, 0069 > 0069, 0069 > > Regards, > Kohji Okuno > >> >> On 10 May 2012, at 21:42, Kohji Okuno wrote: >> >>> Hi Eric, >>> >>>> I'm left wondering how this was not caught by the libc++ test >>>> suite. The current toupper.c shouldn't pass >>>> http://llvm.org/svn/llvm-project/libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.character/toupper.pass.cpp >>> >>> This test suite checks only popular characters. >>> __mapupper_ext is used in case of special characters. >>> >>> For example, Turkish 'i' (0x0131) should convert 'I' (0x49). >>> >>> Regards, >>> Kohji Okuno >>> >>> >>>> Den 10/05/2012 kl. 12.03 skrev Dimitry Andric: >>>> >>>>> On 2012-05-10 11:02, Kohji Okuno wrote: >>>>>> I think that libc/locale/toupper.c is mistaken. >>>>>> Could you check it? >>>>>> >>>>>> @@ -51,7 +51,7 @@ ___toupper_l(c, l) >>>>>> { >>>>>> size_t lim; >>>>>> FIX_LOCALE(l); >>>>>> - _RuneRange *rr = &XLOCALE_CTYPE(l)->runes->__maplower_ext; >>>>>> + _RuneRange *rr = &XLOCALE_CTYPE(l)->runes->__mapupper_ext; >>>>>> _RuneEntry *base, *re; >>>>>> >>>>>> if (c < 0 || c == EOF) >>>>> >>>>> Yes, this definitely looks like a copy/paste error, introduced here: >>>>> >>>>> http://svnweb.freebsd.org/base/head/lib/libc/locale/toupper.c?r1=165903&r2=227753 >>>>> >>>>> I'll commit the fix tonight (CEST), if David isn't faster than me. :) >>>> >>>> I'm left wondering how this was not caught by the libc++ test suite. The current toupper.c shouldn't pass http://llvm.org/svn/llvm-project/libcxx/trunk/test/localization/locales/locale.convenience/conversions/conversions.character/toupper.pass.cpp >>>> >>>> Thanks, >>>> Erik_______________________________________________ >>>> freebsd-current@freebsd.org mailing list >>>> http://lists.freebsd.org/mailman/listinfo/freebsd-current >>>> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" >> >> _______________________________________________ >> freebsd-current@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-current >> To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" ----Next_Part(Fri_May_11_10_58_05_2012_127)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="test.c" #include <stdlib.h> #include <stdio.h> #include <locale.h> #include <wctype.h> #include <xlocale.h> int main() { int i; wint_t test[] = {0x0049, 0x0131, 0x0130, 0x0069}; wint_t ret; locale_t x; x = newlocale(0x1f, "tr_TR", NULL); printf("towupper_l\n"); for (i = 0; i < sizeof(test)/sizeof(wint_t); i++) { ret = towupper_l(test[i], x); printf("%04x, %04x\n", test[i], ret); } printf("\n"); printf("towlower_l\n"); for (i = 0; i < sizeof(test)/sizeof(wint_t); i++) { ret = towlower_l(test[i], x); printf("%04x, %04x\n", test[i], ret); } exit(0); } ----Next_Part(Fri_May_11_10_58_05_2012_127)-- Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ freebsd-current@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-current To unsubscribe, send any mail to "freebsd-current-unsubscribe@freebsd.org" ----Next_Part(Fri_May_11_10_58_05_2012_127)----
文章代碼(AID): #1FopqhIQ (FB_current)
討論串 (同標題文章)
文章代碼(AID): #1FopqhIQ (FB_current)