[vlc-devel] Checking for __STDC_ISO_10646__ in Qt4 module
Steinar H. Gunderson
sgunderson at bigfoot.com
Sat Nov 6 11:51:40 CET 2010
On Wed, Nov 03, 2010 at 10:36:50PM +0200, Juho Vähä-Herttua wrote:
> This means that towlower is only called for qtk values smaller or equal to 255.
This is completely broken. If you want to lower-case a character, call
tolower() and don't try to second-guess it. If you want to lower-case a
_string_ it becomes a lot more complex, depending on how many Unicode
weirdities you want to support.
> #include <stdio.h>
> #include <wctype.h>
>
> #ifndef __STDC_ISO_10646__
> #error FIXME
> #endif
>
> main(i,c) {
> for (i=0; i<256; i++) {
> c = (i >= 'A' && i <= 'Z') ? i+32 : i;
> if (towlower(i) != c) printf("mismatch: %d\n", i);
> }
> }
You've forgotten to call setlocale(). If you've called setlocale() (and I'm
pretty sure VLC does at some point), the behavior will depend on your
currently set locale, and can be almost anything.
/* Steinar */
--
Homepage: http://www.sesse.net/
More information about the vlc-devel
mailing list