summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2006-10-04 19:31:23 -0700
committerAlan Coopersmith <alan.coopersmith@sun.com>2006-10-04 19:31:23 -0700
commit2de626b53827fa1365c149c3fd2e1e280f8691e2 (patch)
treeba4d3bdf6844d18a78032437fcf6792476765f85
parent2daccee698507b27113e89b07af371905aa2bcd4 (diff)
Mark character mapping data tables as const
-rw-r--r--src/encparse.c11
-rw-r--r--src/fontenc.c22
-rw-r--r--src/fontencI.h2
3 files changed, 19 insertions, 16 deletions
diff --git a/src/encparse.c b/src/encparse.c
index 28e0181..217bf78 100644
--- a/src/encparse.c
+++ b/src/encparse.c
@@ -609,22 +609,25 @@ parseEncodingFile(FontFilePtr f, int headerOnly)
goto error;
sm->row_size = encoding->row_size;
if(first <= last) {
+ unsigned short *newmap;
+
sm->first = first;
sm->len=last-first+1;
- sm->map =
+ newmap =
(unsigned short*)xalloc(sm->len * sizeof(unsigned short));
- if(sm->map == NULL) {
+ if(newmap == NULL) {
xfree(sm);
mapping->client_data = sm = NULL;
goto error;
}
+ for(i=0; i < sm->len; i++)
+ newmap[i] = enc[first+i];
+ sm->map = newmap;
} else {
sm->first = 0;
sm->len = 0;
sm->map = NULL;
}
- for(i=0; i < sm->len; i++)
- sm -> map[i] = enc[first+i];
install_mapping(encoding, mapping);
mapping = NULL;
first = 0xFFFF; last=0;
diff --git a/src/fontenc.c b/src/fontenc.c
index e92e1b2..955e481 100644
--- a/src/fontenc.c
+++ b/src/fontenc.c
@@ -73,7 +73,7 @@ static FontMapRec iso10646[]=
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). */
-static unsigned short
+static const unsigned short
iso8859_1_apple_roman[]=
{ 0xCA, 0xC1, 0xA2, 0xA3, 0xDB, 0xB4, 0x00, 0xA4,
0xAC, 0xA9, 0xBB, 0xC7, 0xC2, 0x00, 0xA8, 0xF8,
@@ -108,7 +108,7 @@ static FontMapRec iso8859_1[]=
{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,
0x00A8, 0x0160, 0x015E, 0x0164, 0x0179, 0x00AD, 0x017D, 0x017B,
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=
{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,
0xAC, 0xE1, 0x00, 0xE8, 0x8F, 0x00, 0xEB, 0xFB,
0xA1, 0x88, 0x00, 0xB8, 0x00, 0xBC, 0xE6, 0xFF,
@@ -159,7 +159,7 @@ static FontMapRec iso8859_2[]=
{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,
0x00A8, 0x0130, 0x015E, 0x011E, 0x0134, 0x00AD, 0x0000, 0x017B,
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,
0x00A8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00AD, 0x017D, 0x00AF,
0x00B0, 0x0105, 0x02DB, 0x0157, 0x00B4, 0x0129, 0x013C, 0x02C7,
@@ -209,7 +209,7 @@ static FontMapRec iso8859_4[]=
{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,
0x0408, 0x0409, 0x040A, 0x040B, 0x040C, 0x00AD, 0x040E, 0x040F,
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=
{ 0x60, 0, 0xA0, iso8859_5_tophalf };
-static unsigned short
+static const unsigned short
iso8859_5_apple_cyrillic[]=
{ 0xCA, 0xDD, 0xAB, 0xAE, 0xB8, 0xC1, 0xA7, 0xBA,
0xB7, 0xBC, 0xBE, 0xCB, 0xCD, 0x00, 0xD8, 0xDA,
@@ -349,7 +349,7 @@ static FontMapRec iso8859_9[]=
{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,
0x013B, 0x0110, 0x0160, 0x0166, 0x017D, 0x00AD, 0x016A, 0x014A,
0x00B0, 0x0105, 0x0113, 0x0123, 0x012B, 0x0129, 0x0137, 0x00B7,
@@ -395,7 +395,7 @@ static FontMapRec iso8859_15[]=
{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,
0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
0x2591, 0x2592, 0x2593, 0x2320, 0x25A0, 0x2022, 0x221A, 0x2248,
@@ -459,7 +459,7 @@ static FontMapRec koi8_ru[]=
/* 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,
0x0458, 0x0459, 0x045A, 0x045B, 0x045C, 0x00AD, 0x045E, 0x045F,
0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407,
@@ -484,7 +484,7 @@ static FontMapRec koi8_e[]=
/* 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,
0x252C, 0x2534, 0x253C, 0x2580, 0x2584, 0x2588, 0x258C, 0x2590,
0x2591, 0x2018, 0x2019, 0x201C, 0x201D, 0x2022, 0x2013, 0x2014,
diff --git a/src/fontencI.h b/src/fontencI.h
index bd35a1f..741193a 100644
--- a/src/fontencI.h
+++ b/src/fontencI.h
@@ -29,7 +29,7 @@ typedef struct _FontEncSimpleMap {
unsigned len; /* might be 0x10000 */
unsigned short row_size;
unsigned short first;
- unsigned short *map;
+ const unsigned short *map;
} FontEncSimpleMapRec, *FontEncSimpleMapPtr;
typedef struct _FontEncSimpleName {