[I18n-sig] UCS-4 configuration

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Wed, 27 Jun 2001 08:08:58 +0200


> I have decades of experience with this, so either trust me on it or
> point me at code you think is a problem.

I would never remotely consider questioning your authority, how could I?

The specific code in question is in PyUnicode_DecodeUTF16. It gets a
char*, and converts it to a Py_UCS2* (where Py_UCS is unsigned short).
It then fetches a Py_UCS2 after another, byte-swapping if appropriate,
and advances the Py_UCS2* by one. The intention is that this retrieves
the bytes of the input in pairs.

Is that code correct even if sizeof(unsigned short)>2? If so, I can
just remove the test that it ought to be 2. If not, how should that be
rewritten?

Regards,
Martin