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