[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replace XChar2b with unsigned in all font backends

From: Andy Moreton
Subject: Re: Replace XChar2b with unsigned in all font backends
Date: Mon, 20 May 2019 19:29:34 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt)

On Mon 20 May 2019, Alex Gramiak wrote:

> Andy Moreton <address@hidden> writes:
>> Confirmed. This patch replaces use of XChar2b (a 16bit type) with
>> unsigned (usually 32bit) which seems wrong.
>>     AndyM
> I originally used unsigned short for this patch, but Eli[1] nudged me
> towards unsigned. Unsigned fits better with other parts of the font
> system, e.g., *encode_char returns unsigned, and *text_extents takes a
> pointer to unsigned.
> [1] https://lists.gnu.org/archive/html/emacs-devel/2019-05/msg00457.html

Yes, but Eli was concerned with efficiency, but correctness comes first.
If you are calling APIs that expect a pointer to an array of 16bit
values, then an array of 32bit values will not suffice.

Many of the comments around this code talk of 2-byte values, so
changing the code to use 4-byte values is surprising to the reader.

The changes also removed the explicit packing/unpacking of 16bit values,
which may give rise to endianness issues on some systems.

Please revert this patch to fix the build on master, and then revisit
these changes after that.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]