2011-06-21 Paul Eggert <eggert@cs.ucla.edu>
+ * xfns.c: Don't assume strlen fits in int.
+ (xic_create_fontsetname, x_window): Use ptrdiff_t, not int.
+
* xdisp.c (message_log_check_duplicate): Return intmax_t,
not unsigned long, as we prefer signed integers. All callers changed.
Detect integer overflow in repeat count.
/* Make a fontset name from the base font name. */
if (xic_defaut_fontset == base_fontname)
{ /* There is no base font name, use the default. */
- int len = strlen (base_fontname) + 2;
+ ptrdiff_t len = strlen (base_fontname) + 2;
fontsetname = xmalloc (len);
memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname);
- the base font where the charset spec is replaced by -*-*.
- the same but with the family also replaced with -*-*-. */
const char *p = base_fontname;
- int i;
+ ptrdiff_t i;
for (i = 0; *p; p++)
if (*p == '-') i++;
{ /* As the font name doesn't conform to XLFD, we can't
modify it to generalize it to allcs and allfamilies.
Use the specified font plus the default. */
- int len = strlen (base_fontname) + strlen (xic_defaut_fontset) + 3;
+ ptrdiff_t len =
+ strlen (base_fontname) + strlen (xic_defaut_fontset) + 3;
fontsetname = xmalloc (len);
memset (fontsetname, 0, len);
strcpy (fontsetname, base_fontname);
}
else
{
- int len;
+ ptrdiff_t len;
const char *p1 = NULL, *p2 = NULL, *p3 = NULL;
char *font_allcs = NULL;
char *font_allfamilies = NULL;
wildcard. */
if (*p3 != '*')
{
- int diff = (p2 - p3) - 2;
+ ptrdiff_t diff = (p2 - p3) - 2;
base = alloca (strlen (base_fontname) + 1);
memcpy (base, base_fontname, p3 - base_fontname);
/* Do some needed geometry management. */
{
- int len;
+ ptrdiff_t len;
char *tem, shell_position[32];
Arg gal[10];
int gac = 0;