aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-04-09 12:14:12 -0700
committerPaul Eggert2011-04-09 12:14:12 -0700
commitdae0cd48d84709e8f3662b7bbf14d22cc46038de (patch)
treee2c533e5050fd79766b825ebb9b08d2a11b290df /src
parent76032d70ca341d94996b968a3e1b522b3070196c (diff)
downloademacs-dae0cd48d84709e8f3662b7bbf14d22cc46038de.tar.gz
emacs-dae0cd48d84709e8f3662b7bbf14d22cc46038de.zip
* ftfont.c: Distingish more carefully between FcChar8 and char.
The previous code passed unsigned char * to a functions like strlen and xstrcasecmp that expect char *, which does not conform to the C standard. (get_adstyle_property, ftfont_pattern_entity): Use FcChar8 for arguments to FcPatternGetString, and explicitly cast FcChar8 * to char * when the C standard requires it.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/ftfont.c29
2 files changed, 27 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 27dbdd7cb11..c8811f7708b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,13 @@
12011-04-09 Paul Eggert <eggert@cs.ucla.edu> 12011-04-09 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * ftfont.c: Distingish more carefully between FcChar8 and char.
4 The previous code passed unsigned char * to a functions like
5 strlen and xstrcasecmp that expect char *, which does not
6 conform to the C standard.
7 (get_adstyle_property, ftfont_pattern_entity): Use FcChar8 for
8 arguments to FcPatternGetString, and explicitly cast FcChar8 * to
9 char * when the C standard requires it.
10
3 * keyboard.c (read_char): Remove unused var. 11 * keyboard.c (read_char): Remove unused var.
4 12
5 * eval.c: Port to Windows vsnprintf (Bug#8435). 13 * eval.c: Port to Windows vsnprintf (Bug#8435).
diff --git a/src/ftfont.c b/src/ftfont.c
index 06ba6d7fe25..2e66222d268 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -160,11 +160,13 @@ static struct
160static Lisp_Object 160static Lisp_Object
161get_adstyle_property (FcPattern *p) 161get_adstyle_property (FcPattern *p)
162{ 162{
163 unsigned char *str, *end; 163 FcChar8 *fcstr;
164 char *str, *end;
164 Lisp_Object adstyle; 165 Lisp_Object adstyle;
165 166
166 if (FcPatternGetString (p, FC_STYLE, 0, (FcChar8 **) &str) != FcResultMatch) 167 if (FcPatternGetString (p, FC_STYLE, 0, &fcstr) != FcResultMatch)
167 return Qnil; 168 return Qnil;
169 str = (char *) fcstr;
168 for (end = str; *end && *end != ' '; end++); 170 for (end = str; *end && *end != ' '; end++);
169 if (*end) 171 if (*end)
170 { 172 {
@@ -189,19 +191,20 @@ static Lisp_Object
189ftfont_pattern_entity (FcPattern *p, Lisp_Object extra) 191ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
190{ 192{
191 Lisp_Object key, cache, entity; 193 Lisp_Object key, cache, entity;
192 unsigned char *file, *str; 194 FcChar8 *str;
195 char *file;
193 int idx; 196 int idx;
194 int numeric; 197 int numeric;
195 double dbl; 198 double dbl;
196 FcBool b; 199 FcBool b;
197 200
198 if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch) 201 if (FcPatternGetString (p, FC_FILE, 0, &str) != FcResultMatch)
199 return Qnil; 202 return Qnil;
200 if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch) 203 if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch)
201 return Qnil; 204 return Qnil;
202 205
203 key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)), 206 file = (char *) str;
204 make_number (idx)); 207 key = Fcons (make_unibyte_string (file, strlen (file)), make_number (idx));
205 cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY); 208 cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY);
206 entity = XCAR (cache); 209 entity = XCAR (cache);
207 if (! NILP (entity)) 210 if (! NILP (entity))
@@ -219,10 +222,16 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
219 ASET (entity, FONT_TYPE_INDEX, Qfreetype); 222 ASET (entity, FONT_TYPE_INDEX, Qfreetype);
220 ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1); 223 ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1);
221 224
222 if (FcPatternGetString (p, FC_FOUNDRY, 0, (FcChar8 **) &str) == FcResultMatch) 225 if (FcPatternGetString (p, FC_FOUNDRY, 0, &str) == FcResultMatch)
223 ASET (entity, FONT_FOUNDRY_INDEX, font_intern_prop (str, strlen (str), 1)); 226 {
224 if (FcPatternGetString (p, FC_FAMILY, 0, (FcChar8 **) &str) == FcResultMatch) 227 char *s = (char *) str;
225 ASET (entity, FONT_FAMILY_INDEX, font_intern_prop (str, strlen (str), 1)); 228 ASET (entity, FONT_FOUNDRY_INDEX, font_intern_prop (s, strlen (s), 1));
229 }
230 if (FcPatternGetString (p, FC_FAMILY, 0, &str) == FcResultMatch)
231 {
232 char *s = (char *) str;
233 ASET (entity, FONT_FAMILY_INDEX, font_intern_prop (s, strlen (s), 1));
234 }
226 if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch) 235 if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch)
227 { 236 {
228 if (numeric >= FC_WEIGHT_REGULAR && numeric < FC_WEIGHT_MEDIUM) 237 if (numeric >= FC_WEIGHT_REGULAR && numeric < FC_WEIGHT_MEDIUM)