]>
Commit | Line | Data |
---|---|---|
37f44e2a | 1 | diff -urN xc.orig/programs/xfs/difs/charinfo.c xc/programs/xfs/difs/charinfo.c |
2 | --- xc.orig/programs/xfs/difs/charinfo.c 2004-08-08 14:23:00.000000000 +0200 | |
3 | +++ xc/programs/xfs/difs/charinfo.c 2004-08-08 14:42:16.342943816 +0200 | |
4 | @@ -499,6 +499,8 @@ | |
5 | #define LSBBitLeft(b,c) ((b) >> (c)) | |
6 | #define LSBBitRight(b,c) ((b) << (c)) | |
7 | ||
8 | + if (srcp) { | |
9 | + | |
10 | if (dst_off == src_off) | |
11 | { | |
12 | if (srcbpr == dstbpr && src_left_bytes == dst_left_bytes) | |
13 | @@ -580,6 +582,7 @@ | |
14 | srcp += src_extra; | |
15 | } | |
16 | } | |
17 | + } | |
18 | /* skip the amount we just filled in */ | |
19 | gd += l->length; | |
20 | } | |
21 | diff -urN xc.orig/programs/xfs/difs/fonts.c xc/programs/xfs/difs/fonts.c | |
22 | --- xc.orig/programs/xfs/difs/fonts.c 2004-08-08 14:23:00.000000000 +0200 | |
23 | +++ xc/programs/xfs/difs/fonts.c 2004-08-08 14:41:58.277690152 +0200 | |
24 | @@ -114,6 +114,113 @@ | |
25 | } | |
26 | ||
27 | /* | |
28 | + * xf86GetPathElem -- | |
29 | + * Extract a single element from the font path string starting at | |
30 | + * pnt. The font path element will be returned, and pnt will be | |
31 | + * updated to point to the start of the next element, or set to | |
32 | + * NULL if there are no more. | |
33 | + */ | |
34 | +char * | |
35 | +xf86GetPathElem(pnt) | |
36 | + char **pnt; | |
37 | +{ | |
38 | + char *p1; | |
39 | + | |
40 | + p1 = *pnt; | |
41 | + *pnt = index(*pnt, ','); | |
42 | + if (*pnt != NULL) { | |
43 | + **pnt = '\0'; | |
44 | + *pnt += 1; | |
45 | + } | |
46 | + return(p1); | |
47 | +} | |
48 | + | |
49 | +/* | |
50 | + * xf86ValidateFontPath -- | |
51 | + * Validates the user-specified font path. Each element that | |
52 | + * begins with a '/' is checked to make sure the directory exists. | |
53 | + * If the directory exists, the existence of a file named 'fonts.dir' | |
54 | + * is checked. If either check fails, an error is printed and the | |
55 | + * element is removed from the font path. | |
56 | + */ | |
57 | +#define DIR_FILE "/fonts.dir" | |
58 | +#define CHECK_TYPE(mode, type) ((S_IFMT & (mode)) == (type)) | |
59 | +static char * | |
60 | +xf86ValidateFontPath(path) | |
61 | + char *path; | |
62 | +{ | |
63 | + char *tmp_path, *out_pnt, *path_elem, *next, *p1, *dir_elem; | |
64 | + struct stat stat_buf; | |
65 | + int flag; | |
66 | + int dirlen; | |
67 | + | |
68 | + tmp_path = (char *)calloc(1,strlen(path)+1); | |
69 | + out_pnt = tmp_path; | |
70 | + path_elem = NULL; | |
71 | + next = path; | |
72 | + while (next != NULL) { | |
73 | + path_elem = xf86GetPathElem(&next); | |
74 | +#ifndef __EMX__ | |
75 | + if (*path_elem == '/') { | |
76 | + dir_elem = (char *)calloc(1, strlen(path_elem) + 1); | |
77 | + if ((p1 = strchr(path_elem, ':')) != 0) | |
78 | +#else | |
79 | + /* OS/2 must prepend X11ROOT */ | |
80 | + if (*path_elem == '/') { | |
81 | + path_elem = (char*)__XOS2RedirRoot(path_elem); | |
82 | + dir_elem = (char*)calloc(1, strlen(path_elem) + 1); | |
83 | + if (p1 = strchr(path_elem+2, ':')) | |
84 | +#endif | |
85 | + dirlen = p1 - path_elem; | |
86 | + else | |
87 | + dirlen = strlen(path_elem); | |
88 | + strncpy(dir_elem, path_elem, dirlen); | |
89 | + dir_elem[dirlen] = '\0'; | |
90 | + flag = stat(dir_elem, &stat_buf); | |
91 | + if (flag == 0) | |
92 | + if (!CHECK_TYPE(stat_buf.st_mode, S_IFDIR)) | |
93 | + flag = -1; | |
94 | + if (flag != 0) { | |
95 | + printf("warning!\n"); | |
96 | + ErrorF("Warning: The directory \"%s\" does not exist.\n", dir_elem); | |
97 | + ErrorF(" Entry deleted from font path.\n"); | |
98 | + continue; | |
99 | + } | |
100 | + else { | |
101 | + p1 = (char *)malloc(strlen(dir_elem)+strlen(DIR_FILE)+1); | |
102 | + strcpy(p1, dir_elem); | |
103 | + strcat(p1, DIR_FILE); | |
104 | + flag = stat(p1, &stat_buf); | |
105 | + if (flag == 0) | |
106 | + if (!CHECK_TYPE(stat_buf.st_mode, S_IFREG)) | |
107 | + flag = -1; | |
108 | +#ifndef __EMX__ | |
109 | + free(p1); | |
110 | +#endif | |
111 | + if (flag != 0) { | |
112 | + ErrorF("Warning: 'fonts.dir' not found (or not valid) in \"%s\".\n", | |
113 | + dir_elem); | |
114 | + ErrorF(" Entry deleted from font path.\n"); | |
115 | + ErrorF(" (Run 'mkfontdir' on \"%s\").\n", dir_elem); | |
116 | + continue; | |
117 | + } | |
118 | + } | |
119 | + free(dir_elem); | |
120 | + } | |
121 | + | |
122 | + /* | |
123 | + * Either an OK directory, or a font server name. So add it to | |
124 | + * the path. | |
125 | + */ | |
126 | + if (out_pnt != tmp_path) | |
127 | + *out_pnt++ = ','; | |
128 | + strcat(out_pnt, path_elem); | |
129 | + out_pnt += strlen(path_elem); | |
130 | + } | |
131 | + return(tmp_path); | |
132 | +} | |
133 | + | |
134 | +/* | |
135 | * note that the font wakeup queue is not refcounted. this is because | |
136 | * an fpe needs to be added when it's inited, and removed when it's finally | |
137 | * freed, in order to handle any data that isn't requested, like FS events. | |
138 | @@ -754,8 +861,12 @@ | |
139 | *end, | |
140 | *p; | |
141 | int err; | |
142 | + char *fixedpath; | |
143 | + | |
144 | + fixedpath = xf86ValidateFontPath(str); | |
145 | ||
146 | - len = strlen(str) + 1; | |
147 | + len = strlen(fixedpath) + 1; | |
148 | + str = fixedpath; | |
149 | paths = p = (char *) ALLOCATE_LOCAL(len); | |
150 | npaths = 0; | |
151 | ||
152 | @@ -775,6 +886,7 @@ | |
153 | ||
154 | err = set_font_path_elements(npaths, paths, badpath); | |
155 | ||
156 | + free(fixedpath); | |
157 | DEALLOCATE_LOCAL(paths); | |
158 | ||
159 | return err; | |
160 | diff -urN xc.orig/programs/xfs/difs/main.c xc/programs/xfs/difs/main.c | |
161 | --- xc.orig/programs/xfs/difs/main.c 2004-08-08 14:23:00.000000000 +0200 | |
162 | +++ xc/programs/xfs/difs/main.c 2004-08-08 14:42:22.082071336 +0200 | |
163 | @@ -63,6 +63,7 @@ | |
164 | #include "dispatch.h" | |
165 | #include "extentst.h" | |
166 | #include "difs.h" | |
167 | +#include "debug.h" | |
168 | ||
169 | char *ConnectionInfo; | |
170 | int ConnInfoLen; | |
171 | @@ -78,6 +79,7 @@ | |
172 | static Bool create_connection_block(void); | |
173 | ||
174 | char *configfilename; | |
175 | +int debug_level; | |
176 | extern Bool drone_server; | |
177 | ||
178 | extern OldListenRec *OldListen; | |
179 | @@ -89,6 +91,7 @@ | |
180 | int i, oldumask; | |
181 | ||
182 | argcGlobal = argc; | |
183 | + debug_level = 0; | |
184 | argvGlobal = argv; | |
185 | ||
186 | configfilename = DEFAULT_CONFIG_FILE; | |
187 | diff -urN xc.orig/programs/xfs/include/debug.h xc/programs/xfs/include/debug.h | |
188 | --- xc.orig/programs/xfs/include/debug.h 1970-01-01 01:00:00.000000000 +0100 | |
189 | +++ xc/programs/xfs/include/debug.h 2004-08-08 14:42:22.082071336 +0200 | |
190 | @@ -0,0 +1 @@ | |
191 | +/* debug.h */ | |
192 |