]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccharset.c
Charset hashing depended on uniqueness of leaves.
[fontconfig.git] / src / fccharset.c
index fdff91f810c081280f38b0fd072aa1d21a889b7f..5da131283d07f17991fbe361c239511282dd9a61 100644 (file)
@@ -55,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++)
@@ -306,6 +309,8 @@ FcCharSetCopy (FcCharSet *src)
 {
     if (src->ref != FC_REF_CONSTANT)
        src->ref++;
+    else
+       FcCacheObjectReference (src);
     return src;
 }
 
@@ -1059,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);
@@ -1353,3 +1358,6 @@ FcCharSetSerialize(FcSerialize *serialize, const FcCharSet *cs)
     
     return cs_serialized;
 }
+#define __fccharset__
+#include "fcaliastail.h"
+#undef __fccharset__