configure.in | 1 fc-arch/fc-arch.c | 6 ++- fc-arch/fcarch.tmpl.h | 16 +++++----- fontconfig/fontconfig.h | 2 - src/fcfreetype.c | 3 - src/fcint.h | 28 +++++++----------- src/fclang.c | 74 ++++++++++++++++++++++++++++++++++++------------ src/fcmatch.c | 10 +++--- src/fcpat.c | 14 ++++----- src/fcserialize.c | 8 ----- src/fcxml.c | 12 ------- 11 files changed, 95 insertions(+), 79 deletions(-) New commits: commit a3b2426819836ab2454c6a7bad27c382f4a245bf Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 18:29:26 2009 -0500 [lang] Fix serializing LangSet from older versions diff --git a/src/fclang.c b/src/fclang.c index 61c4da6..1d62c4e 100644 --- a/src/fclang.c +++ b/src/fclang.c @@ -537,9 +537,10 @@ FcChar32 FcLangSetHash (const FcLangSet *ls) { FcChar32 h = 0; - int i; + int i, count; - for (i = 0; i < ls->map_size; i++) + count = FC_MIN (ls->map_size, NUM_LANG_SET_MAP); + for (i = 0; i < count; i++) h ^= ls->map[i]; if (ls->extra) h ^= ls->extra->num; @@ -777,7 +778,9 @@ FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l) if (!l_serialize) return NULL; - *l_serialize = *l; + memset (l_serialize->map, '\0', sizeof (l_serialize->map)); + memcpy (l_serialize->map, l->map, FC_MIN (sizeof (l_serialize->map), l->map_size * sizeof (l->map[0]))); + l_serialize->map_size = NUM_LANG_SET_MAP; l_serialize->extra = NULL; /* We don't serialize ls->extra */ return l_serialize; } commit 8480c6f86327877fce729ebb01b52bd7a40ddfc5 Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 17:38:40 2009 -0500 [arch] Try to ensure proper FcLangSet alignment in arch diff --git a/fc-arch/fc-arch.c b/fc-arch/fc-arch.c index d0f5192..09a9d82 100644 --- a/fc-arch/fc-arch.c +++ b/fc-arch/fc-arch.c @@ -25,7 +25,7 @@ #include <ctype.h> #define ENDIAN_TEST 0x12345678 -#define MACHINE_SIGNATURE_SIZE (9*22 + 1) +#define MACHINE_SIGNATURE_SIZE (9*23 + 1) static char * FcCacheMachineSignature (void) @@ -36,7 +36,7 @@ FcCacheMachineSignature (void) sprintf (buf, "%2x%2x%2x%2x_" "%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_" - "%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x", + "%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x", m[0], m[1], m[2], m[3], (unsigned int)sizeof (FcAlign), (unsigned int)sizeof (char), @@ -52,6 +52,7 @@ FcCacheMachineSignature (void) (unsigned int)sizeof (FcValue), (unsigned int)sizeof (FcValueBinding), (unsigned int)sizeof (struct FcValueList *), + (unsigned int)sizeof (FcStrSet *), /* For FcLangSet */ (unsigned int)sizeof (FcCharSet), (unsigned int)sizeof (FcCharLeaf **), (unsigned int)sizeof (FcChar16 *), diff --git a/fc-arch/fcarch.tmpl.h b/fc-arch/fcarch.tmpl.h index aac3bcf..09eccdc 100644 --- a/fc-arch/fcarch.tmpl.h +++ b/fc-arch/fcarch.tmpl.h @@ -28,11 +28,11 @@ @@@ name. Architecture names are used to construct file names, so @@@ use something reasonable and don't include any spaces @@@ -@@@ name endian FcAlign char char* int intptr_t Pattern EltPtr Elt * Elt ObjPtr VLPtr Value Binding VL * CharSet Leaf** Char16 * Char16 Leaf Char32 Cache -x86 78563412_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_0000000c_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 -x86-64 78563412_00000008_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 -ppc 12345678_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_00000010_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 -ppc64 12345678_00000008_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 -m68k 12345678_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_0000000c_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 -mipsel 78563412_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_00000010_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 -sparc64 12345678_00000008_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 +@@@ name endian FcAlign char char* int intptr_t Pattern EltPtr Elt * Elt ObjPtr VLPtr Value Binding VL * StrSet * CharSet Leaf** Char16 * Char16 Leaf Char32 Cache +x86 78563412_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_0000000c_00000004_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 +x86-64 78563412_00000008_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 +ppc 12345678_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_00000010_00000004_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 +ppc64 12345678_00000008_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 +m68k 12345678_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_0000000c_00000004_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 +mipsel 78563412_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_00000010_00000004_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 +sparc64 12345678_00000008_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 diff --git a/src/fclang.c b/src/fclang.c index 0f2f963..61c4da6 100644 --- a/src/fclang.c +++ b/src/fclang.c @@ -39,7 +39,7 @@ typedef struct { struct _FcLangSet { FcStrSet *extra; - int map_size; + FcChar32 map_size; FcChar32 map[NUM_LANG_SET_MAP]; }; commit dffcb2a083bc5f959ed96dbdf0f365ebc0e710cc Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 17:00:50 2009 -0500 [xml] Remove unused code diff --git a/src/fcxml.c b/src/fcxml.c index 840bdca..9428468 100644 --- a/src/fcxml.c +++ b/src/fcxml.c @@ -134,18 +134,6 @@ FcExprCreateBool (FcConfig *config, FcBool b) } static FcExpr * -FcExprCreateNil (FcConfig *config) -{ - FcExpr *e = FcConfigAllocExpr (config); - if (e) - { - FcMemAlloc (FC_MEM_EXPR, sizeof (FcExpr)); - e->op = FcOpNil; - } - return e; -} - -static FcExpr * FcExprCreateField (FcConfig *config, const char *field) { FcExpr *e = FcConfigAllocExpr (config); commit b2d910123008115813a5cd623389189a2d66880b Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 16:57:53 2009 -0500 [int] Remove more unused macros diff --git a/src/fcint.h b/src/fcint.h index c91df8c..233b4c3 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -107,10 +107,6 @@ #define FC_MEM_NUM 30 -#define FC_BANK_DYNAMIC 0 -#define FC_BANK_FIRST 1 -#define FC_BANK_LANGS 0xfcfcfcfc - #define FC_MIN(a,b) ((a) < (b) ? (a) : (b)) #define FC_MAX(a,b) ((a) > (b) ? (a) : (b)) #define FC_ABS(a) ((a) < 0 ? -(a) : (a)) commit 247c4f3df21582260c4799bdbda2be1c13cc8901 Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 15:48:20 2009 -0500 Enable automake silent rules diff --git a/configure.in b/configure.in index 2b0c182..b804064 100644 --- a/configure.in +++ b/configure.in @@ -34,6 +34,7 @@ dnl version. This same version number must appear in fontconfig/fontconfig.h dnl Yes, it is a pain to synchronize version numbers. Unfortunately, it's dnl not possible to extract the version number here from fontconfig.h AM_INIT_AUTOMAKE(fontconfig, 2.7.3) +m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) AM_MAINTAINER_MODE dnl libtool versioning commit 963820fcbfdb537fd956f8863f8793cf22093c5d Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 15:46:46 2009 -0500 [int] Remove fc_value_* macros that did nothing other than renaming diff --git a/src/fcint.h b/src/fcint.h index 78591c1..c91df8c 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -421,12 +421,6 @@ typedef struct _FcCaseFold { #define FC_MAX_FILE_LEN 4096 -/* XXX remove these when we're ready */ - -#define fc_value_string(v) FcValueString(v) -#define fc_value_charset(v) FcValueCharSet(v) -#define fc_value_langset(v) FcValueLangSet(v) - #define FC_CACHE_MAGIC_MMAP 0xFC02FC04 #define FC_CACHE_MAGIC_ALLOC 0xFC02FC05 #define FC_CACHE_CONTENT_VERSION 3 /* also check FC_CACHE_VERSION */ diff --git a/src/fcmatch.c b/src/fcmatch.c index ecb5aa9..aa84eda 100644 --- a/src/fcmatch.c +++ b/src/fcmatch.c @@ -61,7 +61,7 @@ FcCompareNumber (FcValue *value1, FcValue *value2) static double FcCompareString (FcValue *v1, FcValue *v2) { - return (double) FcStrCmpIgnoreCase (fc_value_string(v1), fc_value_string(v2)) != 0; + return (double) FcStrCmpIgnoreCase (FcValueString(v1), FcValueString(v2)) != 0; } static double @@ -69,8 +69,8 @@ FcCompareFamily (FcValue *v1, FcValue *v2) { /* rely on the guarantee in FcPatternAddWithBinding that * families are always FcTypeString. */ - const FcChar8* v1_string = fc_value_string(v1); - const FcChar8* v2_string = fc_value_string(v2); + const FcChar8* v1_string = FcValueString(v1); + const FcChar8* v2_string = FcValueString(v2); if (FcToLower(*v1_string) != FcToLower(*v2_string) && *v1_string != ' ' && *v2_string != ' ') @@ -137,7 +137,7 @@ FcCompareBool (FcValue *v1, FcValue *v2) static double FcCompareCharSet (FcValue *v1, FcValue *v2) { - return (double) FcCharSetSubtractCount (fc_value_charset(v1), fc_value_charset(v2)); + return (double) FcCharSetSubtractCount (FcValueCharSet(v1), FcValueCharSet(v2)); } static double diff --git a/src/fcpat.c b/src/fcpat.c index 90d42ca..76263b6 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -75,15 +75,15 @@ FcValueCanonicalize (const FcValue *v) switch (v->type) { case FcTypeString: - new.u.s = fc_value_string(v); + new.u.s = FcValueString(v); new.type = FcTypeString; break; case FcTypeCharSet: - new.u.c = fc_value_charset(v); + new.u.c = FcValueCharSet(v); new.type = FcTypeCharSet; break; case FcTypeLangSet: - new.u.l = fc_value_langset(v); + new.u.l = FcValueLangSet(v); new.type = FcTypeLangSet; break; default: @@ -228,7 +228,7 @@ FcValueHash (const FcValue *v) case FcTypeDouble: return FcDoubleHash (v->u.d); case FcTypeString: - return FcStringHash (fc_value_string(v)); + return FcStringHash (FcValueString(v)); case FcTypeBool: return (FcChar32) v->u.b; case FcTypeMatrix: @@ -237,12 +237,12 @@ FcValueHash (const FcValue *v) FcDoubleHash (v->u.m->yx) ^ FcDoubleHash (v->u.m->yy)); case FcTypeCharSet: - return (FcChar32) fc_value_charset(v)->num; + return (FcChar32) FcValueCharSet(v)->num; case FcTypeFTFace: return FcStringHash ((const FcChar8 *) ((FT_Face) v->u.f)->family_name) ^ FcStringHash ((const FcChar8 *) ((FT_Face) v->u.f)->style_name); case FcTypeLangSet: - return FcLangSetHash (fc_value_langset(v)); + return FcLangSetHash (FcValueLangSet(v)); } return FcFalse; } commit 888f9427ae84195104855d2bb2fbb6d44067a998 Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 15:43:08 2009 -0500 [int] Remove fc_storage_type() in favor of direct access to v->type diff --git a/src/fcint.h b/src/fcint.h index 14008a3..78591c1 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -426,7 +426,6 @@ typedef struct _FcCaseFold { #define fc_value_string(v) FcValueString(v) #define fc_value_charset(v) FcValueCharSet(v) #define fc_value_langset(v) FcValueLangSet(v) -#define fc_storage_type(v) ((v)->type) #define FC_CACHE_MAGIC_MMAP 0xFC02FC04 #define FC_CACHE_MAGIC_ALLOC 0xFC02FC05 diff --git a/src/fcmatch.c b/src/fcmatch.c index 0d84704..ecb5aa9 100644 --- a/src/fcmatch.c +++ b/src/fcmatch.c @@ -129,7 +129,7 @@ FcCompareLang (FcValue *v1, FcValue *v2) static double FcCompareBool (FcValue *v1, FcValue *v2) { - if (fc_storage_type(v2) != FcTypeBool || fc_storage_type(v1) != FcTypeBool) + if (v2->type != FcTypeBool || v1->type != FcTypeBool) return -1.0; return (double) v2->u.b != v1->u.b; } diff --git a/src/fcpat.c b/src/fcpat.c index 792a164..90d42ca 100644 --- a/src/fcpat.c +++ b/src/fcpat.c @@ -220,7 +220,7 @@ FcStringHash (const FcChar8 *s) static FcChar32 FcValueHash (const FcValue *v) { - switch (fc_storage_type(v)) { + switch (v->type) { case FcTypeVoid: return 0; case FcTypeInteger: commit 486fa46893d070485738de6e2c0d418650662d63 Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 15:41:58 2009 -0500 Remove unused macros diff --git a/src/fcint.h b/src/fcint.h index 4371158..14008a3 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -428,8 +428,6 @@ typedef struct _FcCaseFold { #define fc_value_langset(v) FcValueLangSet(v) #define fc_storage_type(v) ((v)->type) -#define fc_alignof(type) offsetof (struct { char c; type member; }, member) - #define FC_CACHE_MAGIC_MMAP 0xFC02FC04 #define FC_CACHE_MAGIC_ALLOC 0xFC02FC05 #define FC_CACHE_CONTENT_VERSION 3 /* also check FC_CACHE_VERSION */ @@ -520,9 +518,6 @@ typedef struct _FcFileTime { typedef struct _FcCharMap FcCharMap; -/* watch out; assumes that v is void * -PL */ -#define ALIGN(v,type) ((void *)(((uintptr_t)(v) + fc_alignof(type) - 1) & ~(fc_alignof(type) - 1))) - /* fcblanks.c */ /* fccache.c */ commit 1f4e6fecde22fd4ce8336b01a5c32c533fcb8bac Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 15:39:16 2009 -0500 Bump cache version up from 2 to 3 and fix FcLangSet caching/crash Protect cache against future expansions of FcLangSet (adding new orth files). Previously, doing so could change the size of that struct. Indeed, that happened between 2.6.0 and 2.7.3, causing crashes. Unfortunately, sizeof(FcLangSet) was not checked in fcarch.c. This changes FcLangSet code to be able to cope with struct size changes. And change cache format, hence bumping from 2 to 3. diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h index a0f8de5..7b36056 100644 --- a/fontconfig/fontconfig.h +++ b/fontconfig/fontconfig.h @@ -67,7 +67,7 @@ typedef int FcBool; * it means multiple copies of the font information. */ -#define FC_CACHE_VERSION "2" +#define FC_CACHE_VERSION "3" #define FcTrue 1 #define FcFalse 0 diff --git a/src/fcint.h b/src/fcint.h index 81cde21..4371158 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -432,7 +432,7 @@ typedef struct _FcCaseFold { #define FC_CACHE_MAGIC_MMAP 0xFC02FC04 #define FC_CACHE_MAGIC_ALLOC 0xFC02FC05 -#define FC_CACHE_CONTENT_VERSION 2 +#define FC_CACHE_CONTENT_VERSION 3 /* also check FC_CACHE_VERSION */ struct _FcAtomic { FcChar8 *file; /* original file name */ diff --git a/src/fclang.c b/src/fclang.c index ab7ae53..0f2f963 100644 --- a/src/fclang.c +++ b/src/fclang.c @@ -38,12 +38,38 @@ typedef struct { #include "../fc-lang/fclang.h" struct _FcLangSet { - FcChar32 map[NUM_LANG_SET_MAP]; FcStrSet *extra; + int map_size; + FcChar32 map[NUM_LANG_SET_MAP]; }; -#define FcLangSetBitSet(ls, id) ((ls)->map[(fcLangCharSetIndices[id])>>5] |= ((FcChar32) 1 << ((fcLangCharSetIndices[id]) & 0x1f))) -#define FcLangSetBitGet(ls, id) (((ls)->map[(fcLangCharSetIndices[id])>>5] >> ((fcLangCharSetIndices[id]) & 0x1f)) & 1) +static void +FcLangSetBitSet (FcLangSet *ls, + unsigned int id) +{ + int bucket; + + id = fcLangCharSetIndices[id]; + bucket = id >> 5; + if (bucket >= ls->map_size) + return; /* shouldn't happen really */ + + ls->map[bucket] |= ((FcChar32) 1 << (id & 0x1f)); +} + +static FcBool +FcLangSetBitGet (const FcLangSet *ls, + unsigned int id) +{ + int bucket; + + id = fcLangCharSetIndices[id]; + bucket = id >> 5; + if (bucket >= ls->map_size) + return FcFalse; + + return ((ls->map[bucket] >> (id & 0x1f)) & 1) ? FcTrue : FcFalse; +} FcLangSet * FcFreeTypeLangSet (const FcCharSet *charset, @@ -210,6 +236,7 @@ FcLangGetCharSet (const FcChar8 *lang) case FcLangDifferentTerritory: if (country == -1) country = i; + case FcLangDifferentLang: default: break; } @@ -245,6 +272,7 @@ FcLangSetCreate (void) return 0; FcMemAlloc (FC_MEM_LANGSET, sizeof (FcLangSet)); memset (ls->map, '\0', sizeof (ls->map)); + ls->map_size = NUM_LANG_SET_MAP; ls->extra = 0; return ls; } @@ -266,7 +294,8 @@ FcLangSetCopy (const FcLangSet *ls) new = FcLangSetCreate (); if (!new) goto bail0; - memcpy (new->map, ls->map, sizeof (new->map)); + memset (new->map, '\0', sizeof (new->map)); + memcpy (new->map, ls->map, FC_MIN (sizeof (new->map), ls->map_size * sizeof (ls->map[0]))); if (ls->extra) { FcStrList *list; @@ -442,15 +471,17 @@ FcLangSetCompareStrSet (const FcLangSet *ls, FcStrSet *set) FcLangResult FcLangSetCompare (const FcLangSet *lsa, const FcLangSet *lsb) { - int i, j; + int i, j, count; FcLangResult best, r; - for (i = 0; i < NUM_LANG_SET_MAP; i++) + count = FC_MIN (lsa->map_size, lsb->map_size); + count = FC_MIN (NUM_LANG_SET_MAP, count); + for (i = 0; i < count; i++) if (lsa->map[i] & lsb->map[i]) return FcLangEqual; best = FcLangDifferentLang; for (j = 0; j < NUM_COUNTRY_SET; j++) - for (i = 0; i < NUM_LANG_SET_MAP; i++) + for (i = 0; i < count; i++) if ((lsa->map[i] & fcLangCountrySets[j][i]) && (lsb->map[i] & fcLangCountrySets[j][i])) { @@ -508,7 +539,7 @@ FcLangSetHash (const FcLangSet *ls) FcChar32 h = 0; int i; - for (i = 0; i < NUM_LANG_SET_MAP; i++) + for (i = 0; i < ls->map_size; i++) h ^= ls->map[i]; if (ls->extra) h ^= ls->extra->num; @@ -518,7 +549,7 @@ FcLangSetHash (const FcLangSet *ls) FcLangSet * FcNameParseLangSet (const FcChar8 *string) { - FcChar8 lang[32],c; + FcChar8 lang[32], c = 0; int i; FcLangSet *ls; @@ -551,11 +582,12 @@ bail0: FcBool FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls) { - int i, bit; + int i, bit, count; FcChar32 bits; FcBool first = FcTrue; - for (i = 0; i < NUM_LANG_SET_MAP; i++) + count = FC_MIN (ls->map_size, NUM_LANG_SET_MAP); + for (i = 0; i < count; i++) { if ((bits = ls->map[i])) { @@ -602,9 +634,11 @@ FcNameUnparseLangSet (FcStrBuf *buf, const FcLangSet *ls) FcBool FcLangSetEqual (const FcLangSet *lsa, const FcLangSet *lsb) { - int i; + int i, count; - for (i = 0; i < NUM_LANG_SET_MAP; i++) + count = FC_MIN (lsa->map_size, lsb->map_size); + count = FC_MIN (NUM_LANG_SET_MAP, count); + for (i = 0; i < count; i++) { if (lsa->map[i] != lsb->map[i]) return FcFalse; @@ -672,7 +706,7 @@ FcLangSetContainsLang (const FcLangSet *ls, const FcChar8 *lang) FcBool FcLangSetContains (const FcLangSet *lsa, const FcLangSet *lsb) { - int i, j; + int i, j, count; FcChar32 missing; if (FcDebug() & FC_DBG_MATCHV) @@ -684,7 +718,9 @@ FcLangSetContains (const FcLangSet *lsa, const FcLangSet *lsb) /* * check bitmaps for missing language support */ - for (i = 0; i < NUM_LANG_SET_MAP; i++) + count = FC_MIN (lsa->map_size, lsb->map_size); + count = FC_MIN (NUM_LANG_SET_MAP, count); + for (i = 0; i < count; i++) { missing = lsb->map[i] & ~lsa->map[i]; if (missing) @@ -742,6 +778,7 @@ FcLangSetSerialize(FcSerialize *serialize, const FcLangSet *l) if (!l_serialize) return NULL; *l_serialize = *l; + l_serialize->extra = NULL; /* We don't serialize ls->extra */ return l_serialize; } commit 6b1fc678ca59df3f3f1ffac0e509cf485c9df0c0 Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 16:57:10 2009 -0500 [int] Define MIN/MAX/ABS macros diff --git a/src/fcfreetype.c b/src/fcfreetype.c index b678f26..c30826e 100644 --- a/src/fcfreetype.c +++ b/src/fcfreetype.c @@ -2537,9 +2537,6 @@ FcFreeTypeCheckGlyph (FT_Face face, FcChar32 ucs4, return FcFalse; } -#define FC_MIN(a,b) ((a) < (b) ? (a) : (b)) -#define FC_MAX(a,b) ((a) > (b) ? (a) : (b)) -#define FC_ABS(a) ((a) < 0 ? -(a) : (a)) #define APPROXIMATELY_EQUAL(x,y) (FC_ABS ((x) - (y)) <= FC_MAX (FC_ABS (x), FC_ABS (y)) / 33) static FcCharSet * diff --git a/src/fcint.h b/src/fcint.h index 767a742..81cde21 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -111,6 +111,10 @@ #define FC_BANK_FIRST 1 #define FC_BANK_LANGS 0xfcfcfcfc +#define FC_MIN(a,b) ((a) < (b) ? (a) : (b)) +#define FC_MAX(a,b) ((a) > (b) ? (a) : (b)) +#define FC_ABS(a) ((a) < 0 ? -(a) : (a)) + /* slim_internal.h */ #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)) && defined(__ELF__) && !defined(__sun) #define FcPrivate __attribute__((__visibility__("hidden"))) commit b393846860a390ebe35b19320b5eaf9272084042 Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 15:17:56 2009 -0500 [fc-arch] Add FcAlign to arch signature diff --git a/fc-arch/fc-arch.c b/fc-arch/fc-arch.c index 2fa6b18..d0f5192 100644 --- a/fc-arch/fc-arch.c +++ b/fc-arch/fc-arch.c @@ -25,7 +25,7 @@ #include <ctype.h> #define ENDIAN_TEST 0x12345678 -#define MACHINE_SIGNATURE_SIZE (9*21 + 1) +#define MACHINE_SIGNATURE_SIZE (9*22 + 1) static char * FcCacheMachineSignature (void) @@ -36,8 +36,9 @@ FcCacheMachineSignature (void) sprintf (buf, "%2x%2x%2x%2x_" "%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_" - "%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x", + "%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x_%08x", m[0], m[1], m[2], m[3], + (unsigned int)sizeof (FcAlign), (unsigned int)sizeof (char), (unsigned int)sizeof (char *), (unsigned int)sizeof (int), diff --git a/fc-arch/fcarch.tmpl.h b/fc-arch/fcarch.tmpl.h index 20e5705..aac3bcf 100644 --- a/fc-arch/fcarch.tmpl.h +++ b/fc-arch/fcarch.tmpl.h @@ -28,11 +28,11 @@ @@@ name. Architecture names are used to construct file names, so @@@ use something reasonable and don't include any spaces @@@ -@@@ name endian char char* int intptr_t Pattern EltPtr Elt * Elt ObjPtr VLPtr Value Binding VL * CharSet Leaf** Char16 * Char16 Leaf Char32 Cache -x86 78563412_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_0000000c_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 -x86-64 78563412_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 -ppc 12345678_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_00000010_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 -ppc64 12345678_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 -m68k 12345678_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_0000000c_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 -mipsel 78563412_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_00000010_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 -sparc64 12345678_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 +@@@ name endian FcAlign char char* int intptr_t Pattern EltPtr Elt * Elt ObjPtr VLPtr Value Binding VL * CharSet Leaf** Char16 * Char16 Leaf Char32 Cache +x86 78563412_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_0000000c_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 +x86-64 78563412_00000008_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 +ppc 12345678_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_00000010_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 +ppc64 12345678_00000008_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 +m68k 12345678_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_0000000c_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 +mipsel 78563412_00000008_00000001_00000004_00000004_00000004_00000010_00000004_00000004_00000008_00000004_00000004_00000010_00000004_00000004_00000010_00000004_00000004_00000002_00000020_00000004_00000020 +sparc64 12345678_00000008_00000001_00000008_00000004_00000008_00000018_00000008_00000008_00000010_00000004_00000008_00000010_00000004_00000008_00000018_00000008_00000008_00000002_00000020_00000004_00000038 commit 8009229bc5cd9b540ff56a47ddc32ccada2679b0 Author: Behdad Esfahbod <behdad@xxxxxxxxxx> Date: Mon Nov 16 15:12:52 2009 -0500 Move FcAlign to fcint.h diff --git a/src/fcint.h b/src/fcint.h index 1691dda..767a742 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -351,6 +351,14 @@ struct _FcCache { #define FC_SERIALIZE_HASH_SIZE 8191 +typedef union _FcAlign { + double d; + int i; + intptr_t ip; + FcBool b; + void *p; +} FcAlign; + typedef struct _FcSerializeBucket { struct _FcSerializeBucket *next; const void *object; diff --git a/src/fcserialize.c b/src/fcserialize.c index a66d388..e5ec90b 100644 --- a/src/fcserialize.c +++ b/src/fcserialize.c @@ -22,14 +22,6 @@ #include "fcint.h" -typedef union _FcAlign { - double d; - int i; - intptr_t ip; - FcBool b; - void *p; -} FcAlign; - intptr_t FcAlignSize (intptr_t size) { _______________________________________________ Fontconfig mailing list Fontconfig@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/fontconfig