diff options
-rw-r--r-- | meta/packages/xorg-lib/libxfont/builtinreaddirectory-no-side-effect.patch | 188 | ||||
-rw-r--r-- | meta/packages/xorg-lib/libxfont_1.3.1.bb (renamed from meta/packages/xorg-lib/libxfont_1.3.0.bb) | 4 |
2 files changed, 1 insertions, 191 deletions
diff --git a/meta/packages/xorg-lib/libxfont/builtinreaddirectory-no-side-effect.patch b/meta/packages/xorg-lib/libxfont/builtinreaddirectory-no-side-effect.patch deleted file mode 100644 index dd307434b9..0000000000 --- a/meta/packages/xorg-lib/libxfont/builtinreaddirectory-no-side-effect.patch +++ /dev/null | |||
@@ -1,188 +0,0 @@ | |||
1 | commit 7670d4a2720c61fbc7b989fed14c676f04ac3ad1 | ||
2 | Author: Dodji Seketeli <dodji@openedhand.com> | ||
3 | Date: Mon Jul 16 12:24:34 2007 +0200 | ||
4 | |||
5 | Remove side effects from BuiltinReadDirectory() | ||
6 | |||
7 | The first time BuiltinReadDirectory() is called, | ||
8 | save the content of builtin_dir and builtin_alias, | ||
9 | before calling FontFileAddFontFile(), because that fonction | ||
10 | will modify those. | ||
11 | |||
12 | Then, in subsequent calls to BuiltinReadDirectory(), restore | ||
13 | builtin_dir and builtin_alias so that the side effect incurred | ||
14 | by the first call disappears. | ||
15 | |||
16 | diff --git a/src/builtins/dir.c b/src/builtins/dir.c | ||
17 | index c272449..97f1e1e 100644 | ||
18 | --- a/src/builtins/dir.c | ||
19 | +++ b/src/builtins/dir.c | ||
20 | @@ -29,6 +29,133 @@ | ||
21 | #endif | ||
22 | #include "builtin.h" | ||
23 | |||
24 | +BuiltinDirPtr | ||
25 | +BuiltinDirsDup (const BuiltinDirPtr a_dirs, | ||
26 | + int a_dirs_len) | ||
27 | +{ | ||
28 | + BuiltinDirPtr dirs=NULL ; | ||
29 | + int i=0 ; | ||
30 | + | ||
31 | + if (!a_dirs) | ||
32 | + return NULL ; | ||
33 | + | ||
34 | + dirs = xcalloc (a_dirs_len, sizeof (BuiltinDirRec)) ; | ||
35 | + if (!dirs) | ||
36 | + return NULL ; | ||
37 | + | ||
38 | + for (i=0; i < a_dirs_len; i++) { | ||
39 | + int len = strlen (a_dirs[i].file_name) ; | ||
40 | + dirs[i].file_name = xcalloc (1, len) ; | ||
41 | + memmove (dirs[i].file_name, a_dirs[i].file_name, len); | ||
42 | + len = strlen (a_dirs[i].font_name) ; | ||
43 | + dirs[i].font_name = xcalloc (1, len) ; | ||
44 | + memmove (dirs[i].font_name, a_dirs[i].font_name, len); | ||
45 | + } | ||
46 | + return dirs ; | ||
47 | +} | ||
48 | + | ||
49 | +/** | ||
50 | + * Copy a_save back into a_cur | ||
51 | + * @param a_cur the instance of BuiltinDir to restore | ||
52 | + * @param a_saved the saved instance of BuiltinDir to copy into a_cur | ||
53 | + * @return 0 if went okay, 1 otherwise. | ||
54 | + */ | ||
55 | +int | ||
56 | +BuiltinDirRestore (BuiltinDirPtr a_cur, | ||
57 | + const BuiltinDirPtr a_saved) | ||
58 | +{ | ||
59 | + if (!a_cur) | ||
60 | + return 1 ; | ||
61 | + if (!a_saved) | ||
62 | + return 0 ; | ||
63 | + | ||
64 | + if (a_saved->font_name) | ||
65 | + memmove (a_cur->font_name, a_saved->font_name, strlen (a_saved->font_name)) ; | ||
66 | + return 0 ; | ||
67 | +} | ||
68 | + | ||
69 | + | ||
70 | +int | ||
71 | +BuiltinDirsRestore (BuiltinDirPtr a_cur_tab, | ||
72 | + const BuiltinDirPtr a_saved_tab, | ||
73 | + int a_tab_len) | ||
74 | +{ | ||
75 | + int i=0 ; | ||
76 | + | ||
77 | + if (!a_cur_tab) | ||
78 | + return 1 ; | ||
79 | + if (!a_saved_tab) | ||
80 | + return 0 ; | ||
81 | + | ||
82 | + for (i=0 ; i < a_tab_len; i++) { | ||
83 | + if (BuiltinDirRestore (&a_cur_tab[i], &a_saved_tab[i])) | ||
84 | + return 1 ; | ||
85 | + } | ||
86 | + return 0 ; | ||
87 | +} | ||
88 | + | ||
89 | +BuiltinAliasPtr | ||
90 | +BuiltinAliasesDup (const BuiltinAliasPtr a_aliases, | ||
91 | + int a_aliases_len) | ||
92 | +{ | ||
93 | + BuiltinAliasPtr aliases=NULL ; | ||
94 | + int i=0 ; | ||
95 | + | ||
96 | + if (!a_aliases) | ||
97 | + return NULL ; | ||
98 | + | ||
99 | + aliases = xcalloc (a_aliases_len, sizeof (BuiltinAliasRec)) ; | ||
100 | + if (!aliases) | ||
101 | + return NULL ; | ||
102 | + | ||
103 | + for (i=0; i < a_aliases_len; i++) { | ||
104 | + int len = strlen (a_aliases[i].font_name) ; | ||
105 | + aliases[i].font_name = xcalloc (1, len) ; | ||
106 | + memmove (aliases[i].font_name, a_aliases[i].font_name, len); | ||
107 | + } | ||
108 | + return aliases ; | ||
109 | +} | ||
110 | + | ||
111 | +/** | ||
112 | + * Copy a_save back into a_cur | ||
113 | + * @param a_cur the instance of BuiltinAlias to restore | ||
114 | + * @param a_saved the saved instance of BuiltinAlias to copy into a_cur | ||
115 | + * @return 0 if went okay, 1 otherwise. | ||
116 | + */ | ||
117 | +int | ||
118 | +BuiltinAliasRestore (BuiltinAliasPtr a_cur, | ||
119 | + const BuiltinAliasPtr a_save) | ||
120 | +{ | ||
121 | + if (!a_cur) | ||
122 | + return 1 ; | ||
123 | + if (!a_save) | ||
124 | + return 0 ; | ||
125 | + if (a_save->alias_name) | ||
126 | + memmove (a_cur->alias_name, a_save->alias_name, strlen (a_save->alias_name)) ; | ||
127 | + if (a_save->font_name) | ||
128 | + memmove (a_cur->font_name, a_save->font_name, strlen (a_save->font_name)) ; | ||
129 | + return 0 ; | ||
130 | +} | ||
131 | + | ||
132 | +int | ||
133 | +BuiltinAliasesRestore (BuiltinAliasPtr a_cur_tab, | ||
134 | + const BuiltinAliasPtr a_saved_tab, | ||
135 | + int a_tab_len) | ||
136 | +{ | ||
137 | + int i=0 ; | ||
138 | + | ||
139 | + if (!a_cur_tab) | ||
140 | + return 1 ; | ||
141 | + if (!a_saved_tab) | ||
142 | + return 0 ; | ||
143 | + | ||
144 | + for (i=0 ; i < a_tab_len; i++) { | ||
145 | + if (BuiltinAliasRestore (&a_cur_tab[i], &a_saved_tab[i])) | ||
146 | + return 1 ; | ||
147 | + } | ||
148 | + return 0 ; | ||
149 | +} | ||
150 | + | ||
151 | int | ||
152 | BuiltinReadDirectory (char *directory, FontDirectoryPtr *pdir) | ||
153 | { | ||
154 | @@ -36,6 +163,34 @@ BuiltinReadDirectory (char *directory, FontDirectoryPtr *pdir) | ||
155 | int i; | ||
156 | |||
157 | dir = FontFileMakeDir ("", builtin_dir_count); | ||
158 | + static BuiltinDirPtr saved_builtin_dir ; | ||
159 | + static BuiltinAliasPtr saved_builtin_alias ; | ||
160 | + | ||
161 | + | ||
162 | + if (saved_builtin_dir) | ||
163 | + { | ||
164 | + BuiltinDirsRestore ((BuiltinDirPtr) builtin_dir, | ||
165 | + saved_builtin_dir, | ||
166 | + builtin_dir_count) ; | ||
167 | + } | ||
168 | + else | ||
169 | + { | ||
170 | + saved_builtin_dir = BuiltinDirsDup ((const BuiltinDirPtr) builtin_dir, | ||
171 | + builtin_dir_count) ; | ||
172 | + } | ||
173 | + | ||
174 | + if (saved_builtin_alias) | ||
175 | + { | ||
176 | + BuiltinAliasesRestore ((BuiltinAliasPtr) builtin_alias, | ||
177 | + saved_builtin_alias, | ||
178 | + builtin_alias_count) ; | ||
179 | + } | ||
180 | + else | ||
181 | + { | ||
182 | + saved_builtin_alias = BuiltinAliasesDup ((const BuiltinAliasPtr) builtin_alias, | ||
183 | + builtin_alias_count) ; | ||
184 | + } | ||
185 | + | ||
186 | for (i = 0; i < builtin_dir_count; i++) | ||
187 | { | ||
188 | if (!FontFileAddFontFile (dir, | ||
diff --git a/meta/packages/xorg-lib/libxfont_1.3.0.bb b/meta/packages/xorg-lib/libxfont_1.3.1.bb index d452d9796d..b65c84f586 100644 --- a/meta/packages/xorg-lib/libxfont_1.3.0.bb +++ b/meta/packages/xorg-lib/libxfont_1.3.1.bb | |||
@@ -4,10 +4,8 @@ DESCRIPTION = "X11 font rasterisation library" | |||
4 | LICENSE= "BSD-X" | 4 | LICENSE= "BSD-X" |
5 | DEPENDS += "freetype fontcacheproto xtrans fontsproto libfontenc" | 5 | DEPENDS += "freetype fontcacheproto xtrans fontsproto libfontenc" |
6 | PROVIDES = "xfont" | 6 | PROVIDES = "xfont" |
7 | PR = "r2" | ||
8 | PE = "1" | 7 | PE = "1" |
9 | 8 | ||
10 | SRC_URI += "file://no-scalable-crash.patch;patch=1 \ | 9 | SRC_URI += "file://no-scalable-crash.patch;patch=1" |
11 | file://builtinreaddirectory-no-side-effect.patch;patch=1" | ||
12 | 10 | ||
13 | XORG_PN = "libXfont" | 11 | XORG_PN = "libXfont" |