]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccharset.c
Charset hashing depended on uniqueness of leaves.
[fontconfig.git] / src / fccharset.c
index 3dac4ce6a378d627187245e36959c209778e2283..5da131283d07f17991fbe361c239511282dd9a61 100644 (file)
@@ -43,9 +43,6 @@ FcCharSetCreate (void)
     return fcs;
 }
 
-FcCharSet *
-FcCharSetNew (void);
-    
 FcCharSet *
 FcCharSetNew (void)
 {
@@ -58,7 +55,10 @@ FcCharSetDestroy (FcCharSet *fcs)
     int i;
     
     if (fcs->ref == FC_REF_CONSTANT)
+    {
+       FcCacheObjectDereference (fcs);
        return;
+    }
     if (--fcs->ref > 0)
        return;
     for (i = 0; i < fcs->num; i++)
@@ -309,6 +309,8 @@ FcCharSetCopy (FcCharSet *src)
 {
     if (src->ref != FC_REF_CONSTANT)
        src->ref++;
+    else
+       FcCacheObjectReference (src);
     return src;
 }
 
@@ -693,8 +695,6 @@ FcCharSetFirstPage (const FcCharSet *a,
 /*
  * old coverage API, rather hard to use correctly
  */
-FcChar32
-FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result);
     
 FcChar32
 FcCharSetCoverage (const FcCharSet *a, FcChar32 page, FcChar32 *result)
@@ -1064,8 +1064,8 @@ FcCharSetHash (FcCharSet *fcs)
     int                i;
 
     /* hash in leaves */
-    for (i = 0; i < fcs->num * (int) (sizeof (FcCharLeaf *) / sizeof (FcChar32)); i++)
-       hash = ((hash << 1) | (hash >> 31)) ^ (FcChar32)(FcCharSetLeaf(fcs, i)->map);
+    for (i = 0; i < fcs->num; i++)
+       hash = ((hash << 1) | (hash >> 31)) ^ FcCharLeafHash (FcCharSetLeaf(fcs,i));
     /* hash in numbers */
     for (i = 0; i < fcs->num; i++)
        hash = ((hash << 1) | (hash >> 31)) ^ *FcCharSetNumbers(fcs);
@@ -1358,3 +1358,6 @@ FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs)
     
     return cs_serialized;
 }
+#define __fccharset__
+#include "fcaliastail.h"
+#undef __fccharset__