summaryrefslogtreecommitdiff
path: root/x11-fonts/ttmkfdir/files/patch-encoding.l
blob: 574cdbb3f1beb8ce48bbdef89e5922fca02a981b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
--- encoding.l.orig	Wed Jul 19 11:39:18 2006
+++ encoding.l	Wed Jul 19 11:39:22 2006
@@ -8,7 +8,7 @@
 #include "ttmkfdir.h"    
 #include "encoding.h"    
 
-#define DEFAULT_SIZE 0x100 /* 8 bit encoding */
+#define DEFAULT_SIZE 0xFFFF /* 8 bit encoding */
 #define YY_DECL int yylex (char *current_file, Encodings_t &dest)
 
 static unsigned int line_number = 1;
@@ -43,6 +43,7 @@
 STARTENCODING{WHITESPACES}{STRING} {
     cur_enc = new Encoding;
     cur_enc->names.push_back (strip_first (yytext));
+    cur_enc->size = DEFAULT_SIZE;
     BEGIN(INSIDE_ENC_BLOCK);
 }
 
@@ -97,6 +98,7 @@
 <INSIDE_MAP_BLOCK>UNDEFINE{WHITESPACES}{NUMBER}({WHITESPACES}{NUMBER})? {
     char *startptr = strip_first (yytext);
     char *endptr;
+    long msize = cur_map->size();
 
     int i1 = std::strtol (startptr, &endptr, 0);
     startptr = endptr;
@@ -108,13 +110,14 @@
     }
     
     /* now mark all the unassigned codes */
-    for (long i = i1; i <= i2; i++) {
+    for (long i = i1; i <= i2 && i < msize; i++) {
 	(*cur_map)[i] = -1;
     }
 }
 
 <INSIDE_MAP_BLOCK>{NUMBER}({WHITESPACES}{NUMBER}){0,2} {
-    int numbers[3], i = 0, start_range, end_range, target, res;
+    int numbers[3], target, res;
+    unsigned int i = 0, start_range, end_range;
     char *startptr;
     char *endptr = yytext;