[vlc-devel] [PATCH] qt4: Add OpenBSD to supported platforms of the towlower function.
juhovh at iki.fi
Wed Nov 3 09:15:19 CET 2010
3.11.2010 9:43, Rémi Denis-Courmont kirjoitti:
> On Wed, 03 Nov 2010 09:36:03 +0200, Juho Vähä-Herttua<juhovh at iki.fi>
>> I think it's easier to say VLC has a bug in using a non-portable way of
>> checking the UCS compatibility of towlower.
> Non-portable way defined in the ISO C specification? And I don't know any
> other way.
I guess the problem is that "conditionally defined by the
implementation" mentioned in the C99 standard can be interpreted in
different ways. One can always blame the Japanese and their resistance
to adopt UCS because of rather stupid encoding practices they have
adopted there, but that won't help either.
I don't know any other way to check it either, but let's just see what
the towlower is actually used for here. From what I see the towlower
function in VLC Qt4 implementation simply converts ISO 8859-1 characters
from uppercase to lowercase. Options I see are:
1) Assume that towlower supports UCS (which it should anyway, since it's
supposed to represent a superset of all supported charsets) and risk
breaking on 0x80 <= c <= 0xff characters in the worst case.
2) Add a manual mapping of ISO 8859-1 characters outside of ASCII range,
should work fine for all encodings
3) Continue like before and add exceptions for each platform missing
__STDC_ISO_10646__. Note that in this case it might be left unknown if
the platform _actually_ supports ISO 10646, because many platforms are
closed source. Also the status of UCS support might change depending on
the libc version and checking it compile time doesn't feel right.
4) Simply drop the latin1 support in key events altogether
I would personally lean on either 1) or 2), but the current way to deal
with this seems to be 3).
As a side note, it's just freaking stupid that we have to deal with
issues like this in 2010. It shouldn't be that damn difficult to convert
latin1 from uppercase to lowercase when it's just a 256 byte lookup table.
More information about the vlc-devel