fontconfig: Branch 'master'

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

 



 src/fccfg.c |   42 ++++++++++++++++++++++++++++++++++++------
 1 file changed, 36 insertions(+), 6 deletions(-)

New commits:
commit 096e8019be595c2224aaabf98da630ee917ee51c
Author: Tom Anderson <thomasanderson@xxxxxxxxxxxx>
Date:   Fri Jun 8 12:31:15 2018 -0700

    Fix CFI builds
    
    CFI [1] is a dynamic analysis tool that checks types at runtime.  It reports an
    error when using a function with signature eg. (void (*)(char*)) as
    (void (*)(void*)).  This change adds some wrapper functions to avoid this issue.
    In optimized builds, the functions should get optimized away.
    
    [1] https://clang.llvm.org/docs/ControlFlowIntegrity.html

diff --git a/src/fccfg.c b/src/fccfg.c
index f9fc99a..3d5c335 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -52,6 +52,36 @@ retry:
     return config;
 }
 
+static FcChar32
+FcHashAsStrIgnoreCase (const void *data)
+{
+    return FcStrHashIgnoreCase (data);
+}
+
+static int
+FcCompareAsStr (const void *v1, const void *v2)
+{
+    return FcStrCmp (v1, v2);
+}
+
+static void
+FcDestroyAsRule (void *data)
+{
+    FcRuleDestroy (data);
+}
+
+static void
+FcDestroyAsRuleSet (void *data)
+{
+    FcRuleSetDestroy (data);
+}
+
+static void
+FcDestroyAsStr (void *data)
+{
+    FcStrFree (data);
+}
+
 FcBool
 FcConfigInit (void)
 {
@@ -113,7 +143,7 @@ FcConfigCreate (void)
 
     for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
     {
-	config->subst[k] = FcPtrListCreate ((FcDestroyFunc) FcRuleSetDestroy);
+	config->subst[k] = FcPtrListCreate (FcDestroyAsRuleSet);
 	if (!config->subst[k])
 	    err = FcTrue;
     }
@@ -131,18 +161,18 @@ FcConfigCreate (void)
 
     config->sysRoot = NULL;
 
-    config->rulesetList = FcPtrListCreate ((FcDestroyFunc) FcRuleSetDestroy);
+    config->rulesetList = FcPtrListCreate (FcDestroyAsRuleSet);
     if (!config->rulesetList)
 	goto bail9;
     config->availConfigFiles = FcStrSetCreate ();
     if (!config->availConfigFiles)
 	goto bail10;
 
-    config->uuid_table = FcHashTableCreate ((FcHashFunc) FcStrHashIgnoreCase,
-					    (FcCompareFunc) FcStrCmp,
+    config->uuid_table = FcHashTableCreate (FcHashAsStrIgnoreCase,
+					    FcCompareAsStr,
 					    FcHashStrCopy,
 					    FcHashUuidCopy,
-					    (FcDestroyFunc) FcStrFree,
+					    FcDestroyAsStr,
 					    FcHashUuidFree);
 
     FcRefInit (&config->ref, 1);
@@ -2491,7 +2521,7 @@ FcRuleSetCreate (const FcChar8 *name)
 	ret->description = NULL;
 	ret->domain = NULL;
 	for (k = FcMatchKindBegin; k < FcMatchKindEnd; k++)
-	    ret->subst[k] = FcPtrListCreate ((FcDestroyFunc) FcRuleDestroy);
+	    ret->subst[k] = FcPtrListCreate (FcDestroyAsRule);
 	FcRefInit (&ret->ref, 1);
     }
 
_______________________________________________
Fontconfig mailing list
Fontconfig@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/fontconfig




[Index of Archives]     [Fedora Fonts]     [Fedora Users]     [Fedora Cloud]     [Kernel]     [Fedora Packaging]     [Fedora Desktop]     [PAM]     [Gimp Graphics Editor]     [Yosemite News]

  Powered by Linux