[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Google
  Web www.spinics.net

fontconfig: Branch 'master' - 9 commits



 fc-cat/fc-cat.c         |    2 +-
 fc-list/fc-list.c       |   20 ++++++++++----------
 fc-match/fc-match.c     |   22 +++++++++++-----------
 fontconfig/fontconfig.h |    4 ++--
 src/fcarch.h            |    5 ++---
 src/fccache.c           |   10 ++++------
 src/fcdir.c             |   17 -----------------
 src/fcformat.c          |    5 ++---
 src/fcfreetype.c        |    3 ---
 src/fcint.h             |    2 +-
 src/fcname.c            |    8 +++-----
 src/fcstr.c             |    8 +++++---
 src/makealias           |   18 ++++++++++++++----
 13 files changed, 55 insertions(+), 69 deletions(-)

New commits:
commit 3abf981542788310104bc96b9c9cf70dd39b361b
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Tue Nov 8 14:19:57 2011 -0500

    makealias: handle missing funcs better
    
    When adding new functions, if the actual definition doesn't match the
    header (say due to a typo), the regeneration of the internal headers
    get confused and output bad cpp logic.  This causes gcc to barf due
    to mismatched #ifdef/#endif.  Which is a pain to figure out due to
    the sheer voulme of generated code.
    
    So tweak the makealias script to detect this case and error out.
    While we're here, improve the cpp output a bit to indent, include
    comments, and merge similar ifdef blocks.
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

diff --git a/src/makealias b/src/makealias
index fd9c3fd..fca94d4 100755
--- a/src/makealias
+++ b/src/makealias
@@ -17,12 +17,22 @@ while read name; do
 		hattr='__attribute((visibility("hidden")))'
 		echo "extern __typeof ($name) $alias $hattr;" >> $HEAD
 		echo "#define $name $alias" >> $HEAD
-		grep -l '^'$name'[ (]' "$SRCDIR"/*.c | sed -n 1p | sed -e 's/^.*\/\([^.]*\)\.c/#ifdef __\1__/' >> $TAIL
-		echo "#undef $name" >> $TAIL
+		ifdef=$(grep -l '^'$name'[ (]' "$SRCDIR"/*.c | sed -n 1p | sed -e 's/^.*\/\([^.]*\)\.c/__\1__/')
+		if [ -z "$ifdef" ] ; then
+			echo "error: could not locate $name in src/*.c" 1>&2
+			exit 1
+		fi
+		if [ "$ifdef" != "$last" ] ; then
+			[ -n "$last" ] && echo "#endif /* $last */" >> $TAIL
+			echo "#ifdef $ifdef" >> $TAIL
+			last=$ifdef
+		fi
+		echo "# undef $name" >> $TAIL
 		cattr='__attribute((alias("'$alias'"), visibility("default")))'
 		echo "extern __typeof ($name) $name $cattr;" >> $TAIL
-		echo "#endif" >> $TAIL
 		;;
 	esac
 done
-echo "#endif" >> $TAIL
+[ $? -ne 0 ] && exit 1
+echo "#endif /* $ifdef */" >> $TAIL
+echo "#endif /* HAVE_GNUC_ATTRIBUTE */" >> $TAIL
commit d9c4462778a3d97b38e267dcdf68dfe22210ed8c
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Mon Nov 7 20:09:10 2011 -0500

    FcObjectValidType: tweak -1 checking
    
    Newer gcc doesn't like when you switch on an enum and use a value
    that isn't declared:
    
    fcname.c: In function 'FcObjectValidType':
    fcname.c:299:2: warning: case value '4294967295'
    	not in enumerated type 'FcType' [-Wswitch]
    
    So tweak the logic to avoid this warning.
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

diff --git a/src/fcname.c b/src/fcname.c
index 864ad40..1b32b0f 100644
--- a/src/fcname.c
+++ b/src/fcname.c
@@ -296,8 +296,6 @@ FcObjectValidType (FcObject object, FcType type)
 
     if (t) {
 	switch (t->type) {
-	case -1:
-	    return FcTrue;
 	case FcTypeDouble:
 	case FcTypeInteger:
 	    if (type == FcTypeDouble || type == FcTypeInteger)
@@ -308,7 +306,7 @@ FcObjectValidType (FcObject object, FcType type)
 		return FcTrue;
 	    break;
 	default:
-	    if (type == t->type)
+	    if (t->type == -1 || type == t->type)
 		return FcTrue;
 	    break;
 	}
commit 97c9506e4d0abe5e6a7d61c1a909741d2605507b
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Mon Nov 7 19:29:57 2011 -0500

    fix build warnings when using --with-arch
    
    Latest configure code will setup FC_ARCHITECTURE directly rather than
    going through ARCHITECTURE, so update fcarch.h accordingly.
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

diff --git a/src/fcarch.h b/src/fcarch.h
index 0c8cd05..9cabf04 100644
--- a/src/fcarch.h
+++ b/src/fcarch.h
@@ -62,9 +62,8 @@
 # define FC_ARCH_SIZE_ALIGN "64"
 #endif
 
-#ifdef ARCHITECTURE
-# define ARCHITECTURE FC_ARCHITECTURE
-#else
+/* config.h might override this */
+#ifndef FC_ARCHITECTURE
 # define FC_ARCHITECTURE FC_ARCH_ENDIAN FC_ARCH_SIZE_ALIGN
 #endif
 
commit 01c833379e19d8f8752ac7cec15b179c71242e2c
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Mon Nov 7 15:33:12 2011 -0500

    fc-{list,match}: constify format string
    
    We don't free this string anywhere, so mark it const to avoid gcc warnings
    and possible bugs in the future (if people did try freeing it).
    
    fc-list.c: In function 'main':
    fc-list.c:161:16: warning: pointer targets in assignment
    	differ in signedness [-Wpointer-sign]
    
    fc-match.c: In function 'main':
    fc-match.c:201:13: warning: pointer targets in assignment
    	differ in signedness [-Wpointer-sign]
    fc-match.c:203:13: warning: pointer targets in assignment
    	differ in signedness [-Wpointer-sign]
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

diff --git a/fc-list/fc-list.c b/fc-list/fc-list.c
index ad38332..0149b0c 100644
--- a/fc-list/fc-list.c
+++ b/fc-list/fc-list.c
@@ -94,16 +94,16 @@ usage (char *program, int error)
 int
 main (int argc, char **argv)
 {
-    int		verbose = 0;
-    int		quiet = 0;
-    FcChar8     *format = NULL;
-    int		nfont = 0;
-    int		i;
-    FcObjectSet *os = 0;
-    FcFontSet	*fs;
-    FcPattern   *pat;
+    int			verbose = 0;
+    int			quiet = 0;
+    const FcChar8	*format = NULL;
+    int			nfont = 0;
+    int			i;
+    FcObjectSet		*os = 0;
+    FcFontSet		*fs;
+    FcPattern		*pat;
 #if HAVE_GETOPT_LONG || HAVE_GETOPT
-    int		c;
+    int			c;
 
 #if HAVE_GETOPT_LONG
     while ((c = getopt_long (argc, argv, "vf:qVh", longopts, NULL)) != -1)
@@ -158,7 +158,7 @@ main (int argc, char **argv)
     if (!verbose && !format && !os)
 	os = FcObjectSetBuild (FC_FAMILY, FC_STYLE, FC_FILE, (char *) 0);
     if (!format)
-        format = "%{=fclist}\n";
+        format = (const FcChar8 *) "%{=fclist}\n";
     fs = FcFontList (0, pat, os);
     if (os)
 	FcObjectSetDestroy (os);
diff --git a/fc-match/fc-match.c b/fc-match/fc-match.c
index 095dd4e..4642c8d 100644
--- a/fc-match/fc-match.c
+++ b/fc-match/fc-match.c
@@ -98,16 +98,16 @@ usage (char *program, int error)
 int
 main (int argc, char **argv)
 {
-    int		verbose = 0;
-    int		sort = 0, all = 0;
-    FcChar8     *format = NULL;
-    int		i;
-    FcObjectSet *os = 0;
-    FcFontSet	*fs;
-    FcPattern   *pat;
-    FcResult	result;
+    int			verbose = 0;
+    int			sort = 0, all = 0;
+    const FcChar8	*format = NULL;
+    int			i;
+    FcObjectSet		*os = 0;
+    FcFontSet		*fs;
+    FcPattern		*pat;
+    FcResult		result;
 #if HAVE_GETOPT_LONG || HAVE_GETOPT
-    int		c;
+    int			c;
 
 #if HAVE_GETOPT_LONG
     while ((c = getopt_long (argc, argv, "asvf:Vh", longopts, NULL)) != -1)
@@ -203,9 +203,9 @@ main (int argc, char **argv)
     if (!format)
     {
 	if (os)
-	    format = "%{=unparse}\n";
+	    format = (const FcChar8 *) "%{=unparse}\n";
 	else
-	    format = "%{=fcmatch}\n";
+	    format = (const FcChar8 *) "%{=fcmatch}\n";
     }
 
     if (fs)
commit 123d344f4590c45c5ccced8c46d157edb2b9efd2
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Mon Nov 7 15:26:52 2011 -0500

    FcName{,Get}Constant: constify string input
    
    These funcs don't modify the incoming string, so add const markings.
    This is the "right thing", shouldn't change the ABI, and fixes some
    gcc warnings:
    
    fccfg.c: In function 'FcConfigEvaluate':
    fccfg.c:916:2: warning: passing argument 1 of 'IA__FcNameConstant'
    	discards 'const' qualifier from pointer target type [enabled by default]
    fcalias.h:253:34: note: expected 'FcChar8 *' but
    	argument is of type 'const FcChar8 *'
    
    fcxml.c: In function 'FcTypecheckExpr':
    fcxml.c:604:2: warning: passing argument 1 of 'IA__FcNameGetConstant'
    	discards 'const' qualifier from pointer target type [enabled by default]
    fcalias.h:251:37: note: expected 'FcChar8 *' but
    	argument is of type 'const FcChar8 *'
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h
index db26b97..23ea222 100644
--- a/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig.h
@@ -739,10 +739,10 @@ FcPublic FcBool
 FcNameUnregisterConstants (const FcConstant *consts, int nconsts);
     
 FcPublic const FcConstant *
-FcNameGetConstant (FcChar8 *string);
+FcNameGetConstant (const FcChar8 *string);
 
 FcPublic FcBool
-FcNameConstant (FcChar8 *string, int *result);
+FcNameConstant (const FcChar8 *string, int *result);
 
 FcPublic FcPattern *
 FcNameParse (const FcChar8 *name);
diff --git a/src/fcname.c b/src/fcname.c
index d77eff6..864ad40 100644
--- a/src/fcname.c
+++ b/src/fcname.c
@@ -511,7 +511,7 @@ FcNameUnregisterConstants (const FcConstant *consts, int nconsts)
 }
 
 const FcConstant *
-FcNameGetConstant (FcChar8 *string)
+FcNameGetConstant (const FcChar8 *string)
 {
     const FcConstantList    *l;
     int			    i;
@@ -526,7 +526,7 @@ FcNameGetConstant (FcChar8 *string)
 }
 
 FcBool
-FcNameConstant (FcChar8 *string, int *result)
+FcNameConstant (const FcChar8 *string, int *result)
 {
     const FcConstant	*c;
 
commit da763aa77dbaefd9be10ff5ad04ab5da39327b2e
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Mon Nov 7 15:24:53 2011 -0500

    fc-cat: fix pointer warning
    
    Add a cast to avoid a gcc warning:
    
    fc-cat.c: In function 'cache_print_set':
    fc-cat.c:230:2: warning: pointer targets in passing argument 2
    	of 'FcPatternFormat' differ in signedness [-Wpointer-sign]
    ../fontconfig/fontconfig.h:860:1: note:
    	expected 'const FcChar8 *' but argument is of type 'char *'
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

diff --git a/fc-cat/fc-cat.c b/fc-cat/fc-cat.c
index 5ee947e..c3d6829 100644
--- a/fc-cat/fc-cat.c
+++ b/fc-cat/fc-cat.c
@@ -227,7 +227,7 @@ cache_print_set (FcFontSet *set, FcStrSet *dirs, const FcChar8 *base_name, FcBoo
 	FcPattern   *font = set->fonts[n];
 	FcChar8 *s;
 
-	s = FcPatternFormat (font, "%{=fccat}\n");
+	s = FcPatternFormat (font, (const FcChar8 *) "%{=fccat}\n");
 	if (s)
 	{
 	    printf ("%s", s);
commit 647569d029d0c01ce36ae7d94095ea83f40728de
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Mon Nov 7 15:21:51 2011 -0500

    FcStat: change to FcChar8 for first arg
    
    This shouldn't affect the ABI, makes FcStat more like the rest of the
    fontconfig API, and fixes warnings where we pass FcChar8* pointers in
    to this func from other places.
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

diff --git a/src/fccache.c b/src/fccache.c
index 2fd7454..c38a705 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -87,7 +87,7 @@ typedef __int64 INT64;
  */
 
 int
-FcStat (const char *file, struct stat *statb)
+FcStat (const FcChar8 *file, struct stat *statb)
 {
     WIN32_FILE_ATTRIBUTE_DATA wfad;
     char full_path_name[MAX_PATH];
@@ -136,7 +136,7 @@ FcStat (const char *file, struct stat *statb)
 #else
 
 int
-FcStat (const char *file, struct stat *statb)
+FcStat (const FcChar8 *file, struct stat *statb)
 {
   return stat ((char *) file, statb);
 }
diff --git a/src/fcint.h b/src/fcint.h
index 83a7a43..8179195 100644
--- a/src/fcint.h
+++ b/src/fcint.h
@@ -545,7 +545,7 @@ FcPrivate void
 FcDirCacheReference (FcCache *cache, int nref);
 
 FcPrivate int
-FcStat (const char *file, struct stat *statb);
+FcStat (const FcChar8 *file, struct stat *statb);
 
 /* fccfg.c */
 
commit e3a66c2937c3bd5c45f5170cf7720b4023b8ae3f
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Mon Nov 7 15:18:26 2011 -0500

    delete unused variables
    
    Newer gcc is better at detecting set-but-unused variables.
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

diff --git a/src/fccache.c b/src/fccache.c
index 2d4a437..2fd7454 100644
--- a/src/fccache.c
+++ b/src/fccache.c
@@ -727,8 +727,6 @@ FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcSt
     FcSerialize	*serialize = FcSerializeCreate ();
     FcCache *cache;
     int i;
-    intptr_t	cache_offset;
-    intptr_t	dirs_offset;
     FcChar8	*dir_serialize;
     intptr_t	*dirs_serialize;
     FcFontSet	*set_serialize;
@@ -738,7 +736,7 @@ FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcSt
     /*
      * Space for cache structure
      */
-    cache_offset = FcSerializeReserve (serialize, sizeof (FcCache));
+    FcSerializeReserve (serialize, sizeof (FcCache));
     /*
      * Directory name
      */
@@ -747,7 +745,7 @@ FcDirCacheBuild (FcFontSet *set, const FcChar8 *dir, struct stat *dir_stat, FcSt
     /*
      * Subdirs
      */
-    dirs_offset = FcSerializeAlloc (serialize, dirs, dirs->num * sizeof (FcChar8 *));
+    FcSerializeAlloc (serialize, dirs, dirs->num * sizeof (FcChar8 *));
     for (i = 0; i < dirs->num; i++)
 	if (!FcStrSerializeAlloc (serialize, dirs->strs[i]))
 	    goto bail1;
diff --git a/src/fcdir.c b/src/fcdir.c
index 8a2b976..d8b094f 100644
--- a/src/fcdir.c
+++ b/src/fcdir.c
@@ -235,7 +235,6 @@ FcCache *
 FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
 {
     FcStrSet		*dirs;
-    FcBool		ret = FcTrue;
     FcFontSet		*set;
     FcCache		*cache = NULL;
     struct stat		dir_stat;
@@ -244,44 +243,28 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config)
 	printf ("cache scan dir %s\n", dir);
 
     if (FcStat (dir, &dir_stat) < 0)
-    {
-	if (errno != ENOENT)
-	    ret = FcFalse;
 	goto bail;
-    }
 
     set = FcFontSetCreate();
     if (!set)
-    {
-	ret = FcFalse;
 	goto bail;
-    }
 
     dirs = FcStrSetCreate ();
     if (!dirs)
-    {
-	ret = FcFalse;
 	goto bail1;
-    }
 
     /*
      * Scan the dir
      */
     if (!FcDirScanConfig (set, dirs, NULL, dir, FcTrue, config))
-    {
-	ret = FcFalse;
 	goto bail2;
-    }
 
     /*
      * Build the cache object
      */
     cache = FcDirCacheBuild (set, dir, &dir_stat, dirs);
     if (!cache)
-    {
-	ret = FcFalse;
 	goto bail2;
-    }
 
     /*
      * Write out the cache file, ignoring any troubles
diff --git a/src/fcformat.c b/src/fcformat.c
index d8518f4..0e63d5d 100644
--- a/src/fcformat.c
+++ b/src/fcformat.c
@@ -353,13 +353,12 @@ skip_subexpr (FcFormatContext *c);
 static FcBool
 skip_percent (FcFormatContext *c)
 {
-    int width;
-
     if (!expect_char (c, '%'))
 	return FcFalse;
 
     /* skip an optional width specifier */
-    width = strtol ((const char *) c->format, (char **) &c->format, 10);
+    if (strtol ((const char *) c->format, (char **) &c->format, 10))
+	/* don't care */;
 
     if (!expect_char (c, '{'))
 	return FcFalse;
diff --git a/src/fcfreetype.c b/src/fcfreetype.c
index f2d0642..e322e8c 100644
--- a/src/fcfreetype.c
+++ b/src/fcfreetype.c
@@ -2609,14 +2609,11 @@ GetScriptTags(FT_Face face, FT_ULong tabletag, FT_ULong **stags)
     FT_Stream  stream = face->stream;
     FT_Error   error;
     FT_UShort  n, p;
-    FT_Memory  memory;
     int        script_count;
 
     if (!stream)
         return 0;
 
-    memory = stream->memory;
-
     if (( error = ftglue_face_goto_table( face, tabletag, stream ) ))
 	return 0;
 
commit 6f020161e8628546158766ce7a5f5e0ce1f7d95a
Author: Mike Frysinger <vapier@xxxxxxxxxx>
Date:   Mon Nov 7 14:25:51 2011 -0500

    FcStrPlus: optimize a little
    
    We've already calculated the lengths of these strings, so re-use those
    values to avoid having to rescan the strings multiple times.
    
    Signed-off-by: Mike Frysinger <vapier@xxxxxxxxxx>

diff --git a/src/fcstr.c b/src/fcstr.c
index 8b94ecb..b712e5d 100644
--- a/src/fcstr.c
+++ b/src/fcstr.c
@@ -50,14 +50,16 @@ FcStrCopy (const FcChar8 *s)
 FcChar8 *
 FcStrPlus (const FcChar8 *s1, const FcChar8 *s2)
 {
-    int	    l = strlen ((char *)s1) + strlen ((char *) s2) + 1;
+    int	    s1l = strlen ((char *) s1);
+    int	    s2l = strlen ((char *) s2);
+    int	    l = s1l + s2l + 1;
     FcChar8 *s = malloc (l);
 
     if (!s)
 	return 0;
     FcMemAlloc (FC_MEM_STRING, l);
-    strcpy ((char *) s, (char *) s1);
-    strcat ((char *) s, (char *) s2);
+    memcpy (s, s1, s1l);
+    memcpy (s + s1l, s2, s2l + 1);
     return s;
 }
 
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/fontconfig


[Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Legacy]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Red Hat 9]     [Gimp]     [Yosemite News]

  Powered by Linux