2011-06-20 Paul Eggert <eggert@cs.ucla.edu>
+ * font.c: Don't assume string length fits in int.
+ (font_parse_xlfd, font_parse_fcname, font_unparse_fcname):
+ Use ptrdiff_t, not int.
+
* filelock.c: Fix some buffer overrun and integer overflow issues.
(get_boot_time): Don't assume that gzip command string fits in 100 bytes.
Reformulate so as not to need the command string.
int
font_parse_xlfd (char *name, Lisp_Object font)
{
- int len = strlen (name);
+ ptrdiff_t len = strlen (name);
int i, j, n;
char *f[XLFD_LAST_INDEX + 1];
Lisp_Object val;
char *p, *q;
char *size_beg = NULL, *size_end = NULL;
char *props_beg = NULL, *family_end = NULL;
- int len = strlen (name);
+ ptrdiff_t len = strlen (name);
if (len == 0)
return -1;
if (*q != '=')
{
/* Must be an enumerated value. */
- int word_len;
+ ptrdiff_t word_len;
p = p + 1;
word_len = q - p;
val = font_intern_prop (p, q - p, 1);
Lisp_Object weight = Qnil, slant = Qnil;
Lisp_Object width = Qnil, size = Qnil;
char *word_start;
- int word_len;
+ ptrdiff_t word_len;
/* Scan backwards from the end, looking for a size. */
for (p = name + len - 1; p >= name; p--)
Lisp_Object family, foundry;
Lisp_Object tail, val;
int point_size;
- int i, len = 1;
+ int i;
+ ptrdiff_t len = 1;
char *p;
Lisp_Object styles[3];
const char *style_names[3] = { "weight", "slant", "width" };