Re: Partial fix for 687029, Different results on Alpha, 2nd installment

Alex Cherepanov <[email protected]>
Newsgroups gmane.comp.printing.ghostscript.patches
Organization Coscript Software
Message-ID <[email protected]>
Igor V. Melichev wrote:

> Also please explain, why the change is needed at all.
The structures in ttfsfnt.h describe the data blocks in TTF file,
assuming that they are tightly packed. The size of types as they
were defined was platform-dependent.
ttfmain.c uses the size of the structure to access the file:
r->Seek(r, this->t_head.nPos + offset_of(sfnt_FontHeader, flags));
On 64-bit platform it seeks to wrong places resulting in a
selection of SEGV's and /rangecheck's.

There may be other places where the structures are read from the
file directly. Using the platform-independent types fixes this
bug and saves from future ones.


>1. in ttfsfnt please keep old names, but map types to GS types with
> typedef.
I'm using standard types C types and they are already used in
Ghostscript elsewhere. Not even need I to include any new .h files.

There are already 3 incompatible definitions of int32 (including one in
ttfsfnt.h). Only 1 of them tries to be portable. They don't conflict
(yet) but I'd expect more trouble with the old type names.

New types are standard and won't conflict with different types of
the same name from another part of the project.
stdpre.h takes care of their proper definition. When the types are
not defined on the target platform, there is already autoconf
macro to define them.

Do you still want to keep old types?

>2. If a problem happens with (1), include more files in ttmisc.h .
I don't expect immediate problems.

>3. In ttfmain.c use explicit 'int' or 'unsigned int'.
OK

>>4. Since ttfsfnt.c is changed, add the Artifex copyright banner over the
>>Apple's one.
OK
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.