bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12823: Invalid font name


From: Kenichi Handa
Subject: bug#12823: Invalid font name
Date: Thu, 15 Nov 2012 22:30:52 +0900

In article <m2390db90y.fsf@igel.home>, Andreas Schwab <schwab@linux-m68k.org> 
writes:

> Kenichi Handa <handa@gnu.org> writes:
> > === modified file 'src/font.c'
> > --- src/font.c      2012-11-03 05:11:34 +0000
> > +++ src/font.c      2012-11-13 11:50:50 +0000
> > @@ -1185,7 +1185,7 @@
> >  font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int 
> > nbytes)
> >  {
> >    char *p;
> > -  const char *f[XLFD_REGISTRY_INDEX + 1];
> > +  char *f[XLFD_REGISTRY_INDEX + 1];

> This will provoke warnings that are turned into errors with
> --enable-gcc-warnings.  There is no need for that, just use a temporary
> variable (there is already one above that is perfectly suitable).

Thank you for the suggesiton.  Do you mean something like
this additional patch?

=== modified file 'src/font.c'
--- src/font.c  2012-11-13 14:24:26 +0000
+++ src/font.c  2012-11-15 13:04:45 +0000
@@ -1185,7 +1185,7 @@
 font_unparse_xlfd (Lisp_Object font, int pixel_size, char *name, int nbytes)
 {
   char *p;
-  char *f[XLFD_REGISTRY_INDEX + 1];
+  const char *f[XLFD_REGISTRY_INDEX + 1];
   Lisp_Object val;
   int i, j, len;
 
@@ -1241,13 +1241,13 @@
          alloc = SBYTES (val) + 1;
          if (nbytes <= alloc)
            return -1;
-         f[j] = alloca (alloc);
+         f[j] = p = alloca (alloc);
          /* Copy the name while excluding '-', '?', ',', and '"'.  */
          for (k = l = 0; k < alloc; k++)
            {
              c = SREF (val, k);
              if (c != '-' && c != '?' && c != ',' && c != '"')
-               f[j][l++] = c;
+               p[l++] = c;
            }
        }
     }


---
Kenichi Handa
handa@gnu.org





reply via email to

[Prev in Thread] Current Thread [Next in Thread]