[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] FreeType 2.1.5 has writable globals
From: |
Graham Asher |
Subject: |
[Devel] FreeType 2.1.5 has writable globals |
Date: |
Wed, 15 Oct 2003 15:58:40 +0100 |
I have found that, as I suspected, the new version of FreeType, version
2.1.5, has writable global variables. I found this when compiling a native
ARM version using GCC for Symbian OS 7.0. Writable globals are not allowed
for DLLs in the Symbian OS, so this needs to be fixed; this is a regression,
since earlier versions of FreeType had no writable globals.
The patches are:
1. In ahglobal.c, change
static const char* blue_chars[AH_BLUE_MAX] =
to
static const char* const blue_chars[AH_BLUE_MAX] =
2. In bdflib.c, change
static unsigned long _num_bdf_properties = sizeof ( _bdf_properties ) /
sizeof ( _bdf_properties[0] );
to
static const unsigned long _num_bdf_properties = sizeof ( _bdf_properties )
/ sizeof ( _bdf_properties[0] );
and
static char empty[1] = { 0 }
to
static const char empty[1] = { 0 }
(which causes a warning, but that will have to be fixed by a more radical
reform of this module).
3. In inflate_util.c, change
local uInt inflate_mask[17] = {
to
local const uInt inflate_mask[17] = {
4. In winfnt.c, change
static FT_CMap_ClassRec fnt_cmap_class_rec =
{
sizeof ( FNT_CMapRec ),
(FT_CMap_InitFunc) fnt_cmap_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)fnt_cmap_char_index,
(FT_CMap_CharNextFunc) fnt_cmap_char_next
};
static FT_CMap_Class fnt_cmap_class = &fnt_cmap_class_rec;
to
static FT_CMap_ClassRec fnt_cmap_class_rec =
{
sizeof ( FNT_CMapRec ),
(FT_CMap_InitFunc) fnt_cmap_init,
(FT_CMap_DoneFunc) NULL,
(FT_CMap_CharIndexFunc)fnt_cmap_char_index,
(FT_CMap_CharNextFunc) fnt_cmap_char_next
};
static FT_CMap_Class fnt_cmap_class = &fnt_cmap_class_rec;
5. In inffixed.h, change
local uInt fixed_bl = 9;
local uInt fixed_bd = 5;
local inflate_huft fixed_tl[] = {
...
local inflate_huft fixed_td[] = {
to
local const uInt fixed_bl = 9;
local const uInt fixed_bd = 5;
local const inflate_huft fixed_tl[] = {
...
local const inflate_huft fixed_td[] = {
6. In inftrees.h, add two 'const's to the declation of inflate_trees_fixed,
giving
local int inflate_trees_fixed OF((
uIntf *, /* literal desired/actual bit depth */
uIntf *, /* distance desired/actual bit depth */
const inflate_huft * FAR *, /* literal/length tree result */
const inflate_huft * FAR *, /* distance tree result */
z_streamp)); /* for memory allocation */
and make the same change to the definition of the function in inftrees.c.
(To avoid warnings, the 'const' needs to propagate to a few other places).
Graham Asher
- [Devel] FreeType 2.1.5 has writable globals,
Graham Asher <=