mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-20 19:42:53 -08:00
* 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.
This commit is contained in:
parent
76032d70ca
commit
dae0cd48d8
2 changed files with 27 additions and 10 deletions
|
|
@ -1,5 +1,13 @@
|
|||
2011-04-09 Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
* 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.
|
||||
|
||||
* keyboard.c (read_char): Remove unused var.
|
||||
|
||||
* eval.c: Port to Windows vsnprintf (Bug#8435).
|
||||
|
|
|
|||
29
src/ftfont.c
29
src/ftfont.c
|
|
@ -160,11 +160,13 @@ static struct
|
|||
static Lisp_Object
|
||||
get_adstyle_property (FcPattern *p)
|
||||
{
|
||||
unsigned char *str, *end;
|
||||
FcChar8 *fcstr;
|
||||
char *str, *end;
|
||||
Lisp_Object adstyle;
|
||||
|
||||
if (FcPatternGetString (p, FC_STYLE, 0, (FcChar8 **) &str) != FcResultMatch)
|
||||
if (FcPatternGetString (p, FC_STYLE, 0, &fcstr) != FcResultMatch)
|
||||
return Qnil;
|
||||
str = (char *) fcstr;
|
||||
for (end = str; *end && *end != ' '; end++);
|
||||
if (*end)
|
||||
{
|
||||
|
|
@ -189,19 +191,20 @@ static Lisp_Object
|
|||
ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
|
||||
{
|
||||
Lisp_Object key, cache, entity;
|
||||
unsigned char *file, *str;
|
||||
FcChar8 *str;
|
||||
char *file;
|
||||
int idx;
|
||||
int numeric;
|
||||
double dbl;
|
||||
FcBool b;
|
||||
|
||||
if (FcPatternGetString (p, FC_FILE, 0, (FcChar8 **) &file) != FcResultMatch)
|
||||
if (FcPatternGetString (p, FC_FILE, 0, &str) != FcResultMatch)
|
||||
return Qnil;
|
||||
if (FcPatternGetInteger (p, FC_INDEX, 0, &idx) != FcResultMatch)
|
||||
return Qnil;
|
||||
|
||||
key = Fcons (make_unibyte_string ((char *) file, strlen ((char *) file)),
|
||||
make_number (idx));
|
||||
file = (char *) str;
|
||||
key = Fcons (make_unibyte_string (file, strlen (file)), make_number (idx));
|
||||
cache = ftfont_lookup_cache (key, FTFONT_CACHE_FOR_ENTITY);
|
||||
entity = XCAR (cache);
|
||||
if (! NILP (entity))
|
||||
|
|
@ -219,10 +222,16 @@ ftfont_pattern_entity (FcPattern *p, Lisp_Object extra)
|
|||
ASET (entity, FONT_TYPE_INDEX, Qfreetype);
|
||||
ASET (entity, FONT_REGISTRY_INDEX, Qiso10646_1);
|
||||
|
||||
if (FcPatternGetString (p, FC_FOUNDRY, 0, (FcChar8 **) &str) == FcResultMatch)
|
||||
ASET (entity, FONT_FOUNDRY_INDEX, font_intern_prop (str, strlen (str), 1));
|
||||
if (FcPatternGetString (p, FC_FAMILY, 0, (FcChar8 **) &str) == FcResultMatch)
|
||||
ASET (entity, FONT_FAMILY_INDEX, font_intern_prop (str, strlen (str), 1));
|
||||
if (FcPatternGetString (p, FC_FOUNDRY, 0, &str) == FcResultMatch)
|
||||
{
|
||||
char *s = (char *) str;
|
||||
ASET (entity, FONT_FOUNDRY_INDEX, font_intern_prop (s, strlen (s), 1));
|
||||
}
|
||||
if (FcPatternGetString (p, FC_FAMILY, 0, &str) == FcResultMatch)
|
||||
{
|
||||
char *s = (char *) str;
|
||||
ASET (entity, FONT_FAMILY_INDEX, font_intern_prop (s, strlen (s), 1));
|
||||
}
|
||||
if (FcPatternGetInteger (p, FC_WEIGHT, 0, &numeric) == FcResultMatch)
|
||||
{
|
||||
if (numeric >= FC_WEIGHT_REGULAR && numeric < FC_WEIGHT_MEDIUM)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue