summaryrefslogtreecommitdiff
blob: 30f0170f4b3bbf86fc57171cd1dae8ac84787c71 (plain)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
diff -urN ttmkfdir-3.0.9.orig/directory.cpp ttmkfdir-3.0.9/directory.cpp
--- ttmkfdir-3.0.9.orig/directory.cpp	2002-12-09 00:29:11.000000000 -0800
+++ ttmkfdir-3.0.9/directory.cpp	2004-09-02 23:42:16.000000000 -0700
@@ -9,10 +9,12 @@
 {
 }
 
-void
+int
 directory::scan (const std::string &dir)
 {
     DIR *ttfdir = opendir(dir.c_str ());
+    if(!ttfdir)
+    	return -1;
 
     this->clear ();
     dirpath = dir;
@@ -26,6 +28,7 @@
     }
 
     closedir (ttfdir);
+    return 0;
 }
 
 bool
diff -urN ttmkfdir-3.0.9.orig/directory.h ttmkfdir-3.0.9/directory.h
--- ttmkfdir-3.0.9.orig/directory.h	2002-12-09 00:29:11.000000000 -0800
+++ ttmkfdir-3.0.9/directory.h	2004-09-02 23:42:16.000000000 -0700
@@ -11,7 +11,7 @@
 	if (path != "") scan (path);
     };
     virtual ~directory (void);
-    void scan (const std::string &path = ".");
+    int scan (const std::string &path = ".");
     virtual bool select (const char *name) const;
     const std::string &path (void) const {
 	return dirpath;
diff -urN ttmkfdir-3.0.9.orig/encoding.l ttmkfdir-3.0.9/encoding.l
--- ttmkfdir-3.0.9.orig/encoding.l	2003-01-07 21:25:25.000000000 -0800
+++ ttmkfdir-3.0.9/encoding.l	2004-09-02 23:42:51.000000000 -0700
@@ -108,7 +108,7 @@
     }
     
     /* now mark all the unassigned codes */
-    for (long i = i1; i <= i2; i++) {
+    for (long i = i1; i <= i2 && i < cur_enc->size; i++) {
 	(*cur_map)[i] = -1;
     }
 }
@@ -140,7 +140,7 @@
 	break;
     }
 
-    for (i = start_range; i <= end_range; i++, target++) {
+    for (i = start_range; i <= end_range && i < cur_enc->size; i++, target++) {
 	(*cur_map)[i] = target;
     }
     cur_enc->enc_size = cur_enc->enc_size + end_range - start_range + 1;   
diff -urN ttmkfdir-3.0.9.orig/ttmkfdir.cpp ttmkfdir-3.0.9/ttmkfdir.cpp
--- ttmkfdir-3.0.9.orig/ttmkfdir.cpp	2003-01-19 15:33:11.000000000 -0800
+++ ttmkfdir-3.0.9/ttmkfdir.cpp	2004-09-02 23:42:16.000000000 -0700
@@ -60,7 +60,10 @@
 	return 0;
     }
     
-    dir::instance()->scan (cmdline::instance()->option ("font-dir"));
+    if(dir::instance()->scan (cmdline::instance()->option ("font-dir")) == -1) {
+    	printf("No such directory...\n");
+	return -1;
+    }
     
     for (directory::iterator i = dir::instance()->begin (); i != dir::instance()->end(); i++) {
 	const ttf::Face face (dir::instance()->path() + '/' + *i);