On Wed, Jan 22, 2014 at 09:41:41 -0800, Keith Packard wrote:

> Knut Petersen <[email protected]> writes:
> 
> > I assume there“s not only a fontsproto patch as this patch alone breaks 
> > libXfont
> > for obvious reasons.
> 
> Indeed, another un-reviewed patch in libXfont.
> 
> From a2e24231571cfc6cce2dbdce91c86203dc68d9bc Mon Sep 17 00:00:00 2001
> From: Keith Packard <[email protected]>
> Date: Fri, 15 Nov 2013 21:46:15 +0900
> Subject: [PATCH] Warning fixes.
> 
> Almost all of these are const char issues.
> 
> Signed-off-by: Keith Packard <[email protected]>

with a couple minor comments below..

Reviewed-by: Julien Cristau <[email protected]>

[...]
> diff --git a/src/fontfile/catalogue.c b/src/fontfile/catalogue.c
> index 09ca2ae..81a1e13 100644
> --- a/src/fontfile/catalogue.c
> +++ b/src/fontfile/catalogue.c
> @@ -40,7 +40,7 @@ static const char CataloguePrefix[] = "catalogue:";
>  static int CatalogueFreeFPE (FontPathElementPtr fpe);
>  
>  static int
> -CatalogueNameCheck (char *name)
> +CatalogueNameCheck (const char *name)
>  {
>      return strncmp(name, CataloguePrefix, sizeof(CataloguePrefix) - 1) == 0;
>  }
> @@ -116,7 +116,7 @@ CatalogueUnrefFPEs (FontPathElementPtr fpe)
>       if (subfpe->refcount == 0)
>       {
>           FontFileFreeFPE (subfpe);
> -         free(subfpe->name);
> +         free((void *) subfpe->name);
>           free(subfpe);
>       }
>      }

that's kind of ick, but I guess no way to avoid it...

> @@ -158,6 +158,7 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
>      CatalogueUnrefFPEs (fpe);
>      while (entry = readdir(dir), entry != NULL)
>      {
> +        char *name;
>       snprintf(link, sizeof link, "%s/%s", path, entry->d_name);
>       len = readlink(link, dest, sizeof dest - 1);
>       if (len < 0)

indent

> @@ -191,15 +192,16 @@ CatalogueRescan (FontPathElementPtr fpe, Bool forceScan)
>        * (which uses font->fpe->type) goes to CatalogueCloseFont. */
>       subfpe->type = fpe->type;
>       subfpe->name_length = len;
> -     subfpe->name = malloc (len + 1);
> -     if (subfpe->name == NULL)
> +     name = malloc (len + 1);
> +     if (name == NULL)
>       {
>           free(subfpe);
>           continue;
>       }
>  
> -     memcpy(subfpe->name, dest, len);
> -     subfpe->name[len] = '\0';
> +     memcpy(name, dest, len);
> +     name[len] = '\0';
> +        subfpe->name = name;

indent

>  
>       /* The X server will manipulate the subfpe ref counts
>        * associated with the font in OpenFont and CloseFont, so we

Cheers,
Julien
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to