|
|
724863 |
--- ttmkfdir-3.0.9.orig/encoding.l 2003-01-08 14:25:25.000000000 +0900
|
|
|
724863 |
+++ ttmkfdir-3.0.9/encoding.l 2005-08-03 19:24:22.000000000 +0900
|
|
|
724863 |
@@ -21,6 +21,19 @@
|
|
|
724863 |
|
|
|
724863 |
static Encoding *cur_enc;
|
|
|
724863 |
static NumericMapping *cur_map;
|
|
|
724863 |
+static int is_created_map = 0;
|
|
|
724863 |
+
|
|
|
724863 |
+static void
|
|
|
724863 |
+create_mapping(void)
|
|
|
724863 |
+{
|
|
|
724863 |
+ cur_map = new NumericMapping (cur_enc->size,
|
|
|
724863 |
+ TT_PLATFORM_MICROSOFT,
|
|
|
724863 |
+ TT_MS_ID_UNICODE_CS);
|
|
|
724863 |
+
|
|
|
724863 |
+ cur_enc->enc_size = 0;
|
|
|
724863 |
+ cur_enc->start_code = 0xffff;
|
|
|
724863 |
+ is_created_map = 1;
|
|
|
724863 |
+}
|
|
|
724863 |
|
|
|
724863 |
%}
|
|
|
724863 |
|
|
|
724863 |
@@ -67,12 +80,6 @@
|
|
|
724863 |
}
|
|
|
724863 |
|
|
|
724863 |
<INSIDE_ENC_BLOCK>STARTMAPPING{WHITESPACES}unicode {
|
|
|
724863 |
- cur_map = new NumericMapping (cur_enc->size,
|
|
|
724863 |
- TT_PLATFORM_MICROSOFT,
|
|
|
724863 |
- TT_MS_ID_UNICODE_CS);
|
|
|
724863 |
-
|
|
|
724863 |
- cur_enc->enc_size = 0;
|
|
|
724863 |
- cur_enc->start_code = 0xffff;
|
|
|
724863 |
BEGIN(INSIDE_MAP_BLOCK);
|
|
|
724863 |
}
|
|
|
724863 |
|
|
|
724863 |
@@ -107,6 +114,12 @@
|
|
|
724863 |
i2 = i1;
|
|
|
724863 |
}
|
|
|
724863 |
|
|
|
724863 |
+ /* avoid a crash issue */
|
|
|
724863 |
+ if (cur_enc->size < i2)
|
|
|
724863 |
+ cur_enc->size = i2;
|
|
|
724863 |
+ if (!is_created_map)
|
|
|
724863 |
+ create_mapping();
|
|
|
724863 |
+
|
|
|
724863 |
/* now mark all the unassigned codes */
|
|
|
724863 |
for (long i = i1; i <= i2; i++) {
|
|
|
724863 |
(*cur_map)[i] = -1;
|
|
|
724863 |
@@ -114,10 +127,14 @@
|
|
|
724863 |
}
|
|
|
724863 |
|
|
|
724863 |
<INSIDE_MAP_BLOCK>{NUMBER}({WHITESPACES}{NUMBER}){0,2} {
|
|
|
724863 |
- int numbers[3], i = 0, start_range, end_range, target, res;
|
|
|
724863 |
+ unsigned int start_range;
|
|
|
724863 |
+ int numbers[3], i = 0, end_range, target, res;
|
|
|
724863 |
char *startptr;
|
|
|
724863 |
char *endptr = yytext;
|
|
|
724863 |
|
|
|
724863 |
+ if (!is_created_map)
|
|
|
724863 |
+ create_mapping();
|
|
|
724863 |
+
|
|
|
724863 |
for (i = 0;;i++) {
|
|
|
724863 |
startptr = endptr;
|
|
|
724863 |
res = std::strtol (startptr, &endptr, 0);
|
|
|
724863 |
@@ -150,9 +167,14 @@
|
|
|
724863 |
|
|
|
724863 |
|
|
|
724863 |
<INSIDE_MAP_BLOCK>ENDMAPPING {
|
|
|
724863 |
+ /* it may not happens but to be safe */
|
|
|
724863 |
+ if (!is_created_map)
|
|
|
724863 |
+ create_mapping();
|
|
|
724863 |
+
|
|
|
724863 |
cur_enc->AddMapping (cur_map);
|
|
|
724863 |
dest.insert (std::make_pair(cur_map->cmapkey(), cur_enc));;
|
|
|
724863 |
BEGIN(INSIDE_ENC_BLOCK);
|
|
|
724863 |
+ is_created_map = 0;
|
|
|
724863 |
}
|
|
|
724863 |
|
|
|
724863 |
<INSIDE_UNKNOWN_MAP>ENDMAPPING {
|