Mark character mapping data tables as const

This commit is contained in:
Alan Coopersmith
2006-10-04 19:31:23 -07:00
parent 2daccee698
commit 2de626b538
3 changed files with 19 additions and 16 deletions

View File

@@ -609,22 +609,25 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
goto error; goto error;
sm->row_size = encoding->row_size; sm->row_size = encoding->row_size;
if(first <= last) { if(first <= last) {
unsigned short *newmap;
sm->first = first; sm->first = first;
sm->len=last-first+1; sm->len=last-first+1;
sm->map = newmap =
(unsigned short*)xalloc(sm->len * sizeof(unsigned short)); (unsigned short*)xalloc(sm->len * sizeof(unsigned short));
if(sm->map == NULL) { if(newmap == NULL) {
xfree(sm); xfree(sm);
mapping->client_data = sm = NULL; mapping->client_data = sm = NULL;
goto error; goto error;
} }
for(i=0; i < sm->len; i++)
newmap[i] = enc[first+i];
sm->map = newmap;
} else { } else {
sm->first = 0; sm->first = 0;
sm->len = 0; sm->len = 0;
sm->map = NULL; sm->map = NULL;
} }
for(i=0; i < sm->len; i++)
sm -> map[i] = enc[first+i];
install_mapping(encoding, mapping); install_mapping(encoding, mapping);
mapping = NULL; mapping = NULL;
first = 0xFFFF; last=0; first = 0xFFFF; last=0;

View File

@@ -73,7 +73,7 @@ static FontMapRec iso10646[]=
There's not much more we can do with fonts without a Unicode cmap There's not much more we can do with fonts without a Unicode cmap
unless we are willing to combine cmaps (which we are not). */ unless we are willing to combine cmaps (which we are not). */
static unsigned short static const unsigned short
iso8859_1_apple_roman[]= iso8859_1_apple_roman[]=
{ 0xCA, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, 0x00, 0xA4, { 0xCA, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, 0x00, 0xA4,
0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0x00, 0xA8, 0xF8, 0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0x00, 0xA8, 0xF8,
@@ -108,7 +108,7 @@ static FontMapRec iso8859_1[]=
{0,0,0,NULL,NULL,NULL,NULL,NULL} {0,0,0,NULL,NULL,NULL,NULL,NULL}
}; };
static unsigned short iso8859_2_tophalf[]= static const unsigned short iso8859_2_tophalf[]=
{ 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7, { 0x00A0, 0x0104, 0x02D8, 0x0141, 0x00A4, 0x013D, 0x015A, 0x00A7,
0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B, 0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B,
0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7, 0x00B0, 0x0105, 0x02DB, 0x0142, 0x00B4, 0x013E, 0x015B, 0x02C7,
@@ -125,7 +125,7 @@ static unsigned short iso8859_2_tophalf[]=
static FontEncSimpleMapRec iso8859_2_to_unicode_map= static FontEncSimpleMapRec iso8859_2_to_unicode_map=
{0x60, 0, 0xA0, iso8859_2_tophalf }; {0x60, 0, 0xA0, iso8859_2_tophalf };
static unsigned short iso8859_2_apple_centeuro[]= static const unsigned short iso8859_2_apple_centeuro[]=
{ 0xCA, 0x84, 0x00, 0xFC, 0x00, 0xBB, 0xE5, 0xA4, { 0xCA, 0x84, 0x00, 0xFC, 0x00, 0xBB, 0xE5, 0xA4,
0xAC, 0xE1, 0x00, 0xE8, 0x8F, 0x00, 0xEB, 0xFB, 0xAC, 0xE1, 0x00, 0xE8, 0x8F, 0x00, 0xEB, 0xFB,
0xA1, 0x88, 0x00, 0xB8, 0x00, 0xBC, 0xE6, 0xFF, 0xA1, 0x88, 0x00, 0xB8, 0x00, 0xBC, 0xE6, 0xFF,
@@ -159,7 +159,7 @@ static FontMapRec iso8859_2[]=
{0,0,0,NULL,NULL,NULL,NULL,NULL} {0,0,0,NULL,NULL,NULL,NULL,NULL}
}; };
static unsigned short iso8859_3_tophalf[]= static const unsigned short iso8859_3_tophalf[]=
{ 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0x0000, 0x0124, 0x00A7, { 0x00A0, 0x0126, 0x02D8, 0x00A3, 0x00A4, 0x0000, 0x0124, 0x00A7,
0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B, 0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B,
0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7, 0x00B0, 0x0127, 0x00B2, 0x00B3, 0x00B4, 0x00B5, 0x0125, 0x00B7,
@@ -184,7 +184,7 @@ static FontMapRec iso8859_3[]=
}; };
static unsigned short iso8859_4_tophalf[]= static const unsigned short iso8859_4_tophalf[]=
{ 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7, { 0x00A0, 0x0104, 0x0138, 0x0156, 0x00A4, 0x0128, 0x013B, 0x00A7,
0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF, 0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF,
0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7, 0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7,
@@ -209,7 +209,7 @@ static FontMapRec iso8859_4[]=
{0,0,0,NULL,NULL,NULL,NULL,NULL} {0,0,0,NULL,NULL,NULL,NULL,NULL}
}; };
static unsigned short iso8859_5_tophalf[]= static const unsigned short iso8859_5_tophalf[]=
{ 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, { 0x00A0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407,
0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F, 0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F,
0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417,
@@ -226,7 +226,7 @@ static unsigned short iso8859_5_tophalf[]=
static FontEncSimpleMapRec iso8859_5_to_unicode_map= static FontEncSimpleMapRec iso8859_5_to_unicode_map=
{ 0x60, 0, 0xA0, iso8859_5_tophalf }; { 0x60, 0, 0xA0, iso8859_5_tophalf };
static unsigned short static const unsigned short
iso8859_5_apple_cyrillic[]= iso8859_5_apple_cyrillic[]=
{ 0xCA, 0xDD, 0xAB, 0xAE, 0xB8, 0xC1, 0xA7, 0xBA, { 0xCA, 0xDD, 0xAB, 0xAE, 0xB8, 0xC1, 0xA7, 0xBA,
0xB7, 0xBC, 0xBE, 0xCB, 0xCD, 0x00, 0xD8, 0xDA, 0xB7, 0xBC, 0xBE, 0xCB, 0xCD, 0x00, 0xD8, 0xDA,
@@ -349,7 +349,7 @@ static FontMapRec iso8859_9[]=
{0,0,0,NULL,NULL,NULL,NULL,NULL} {0,0,0,NULL,NULL,NULL,NULL,NULL}
}; };
static unsigned short iso8859_10_tophalf[]= static const unsigned short iso8859_10_tophalf[]=
{ 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7, { 0x00A0, 0x0104, 0x0112, 0x0122, 0x012A, 0x0128, 0x0136, 0x00A7,
0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A, 0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A,
0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7, 0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7,
@@ -395,7 +395,7 @@ static FontMapRec iso8859_15[]=
{0,0,0,NULL,NULL,NULL,NULL,NULL} {0,0,0,NULL,NULL,NULL,NULL,NULL}
}; };
static unsigned short koi8_r_tophalf[]= static const unsigned short koi8_r_tophalf[]=
{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2022, 0x221A, 0x2248, 0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2022, 0x221A, 0x2248,
@@ -459,7 +459,7 @@ static FontMapRec koi8_ru[]=
/* koi8-e, ISO-IR-111 or ECMA-Cyrillic */ /* koi8-e, ISO-IR-111 or ECMA-Cyrillic */
static unsigned short koi8_e_A0_BF[]= static const unsigned short koi8_e_A0_BF[]=
{ 0x00A0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, { 0x00A0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457,
0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00AD, 0x045E, 0x045F, 0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00AD, 0x045E, 0x045F,
0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407,
@@ -484,7 +484,7 @@ static FontMapRec koi8_e[]=
/* Koi8 unified */ /* Koi8 unified */
static unsigned short koi8_uni_80_BF[]= static const unsigned short koi8_uni_80_BF[]=
{ 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524, { 0x2500, 0x2502, 0x250C, 0x2510, 0x2514, 0x2518, 0x251C, 0x2524,
0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590, 0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
0x2591, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014, 0x2591, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,

View File

@@ -29,7 +29,7 @@ typedef struct _FontEncSimpleMap {
unsigned len; /* might be 0x10000 */ unsigned len; /* might be 0x10000 */
unsigned short row_size; unsigned short row_size;
unsigned short first; unsigned short first;
unsigned short *map; const unsigned short *map;
} FontEncSimpleMapRec, *FontEncSimpleMapPtr; } FontEncSimpleMapRec, *FontEncSimpleMapPtr;
typedef struct _FontEncSimpleName { typedef struct _FontEncSimpleName {