]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcfs.c
Don't add current_arch_start more than once.
[fontconfig.git] / src / fcfs.c
index 0788a6f628769e7eea06aaf5e6a577457b2b929e..83b3e965f75bc42af13adb1a96b5a9502eb16347 100644 (file)
@@ -155,6 +155,7 @@ FcFontSetUnserialize(FcCache metadata, FcFontSet * s, void * block_ptr)
     int nfont;
     int i, n;
 
+    block_ptr = ALIGN (block_ptr, int);
     nfont = *(int *)block_ptr;
     block_ptr = (int *)block_ptr + 1;
 
@@ -174,10 +175,17 @@ FcFontSetUnserialize(FcCache metadata, FcFontSet * s, void * block_ptr)
     if (nfont > 0)
     {
        FcPattern * p = (FcPattern *)block_ptr;
-       block_ptr = FcPatternUnserialize (metadata, block_ptr);
+
+        /* The following line is a bit counterintuitive.  The usual
+         * convention is that FcPatternUnserialize is responsible for
+         * aligning the FcPattern.  However, the FontSet also stores
+         * the FcPatterns in its own array, so we need to align here
+         * too. */
+        p = ALIGN(p, FcPattern);
        for (i = 0; i < nfont; i++)
            s->fonts[n + i] = p+i;
 
+       block_ptr = FcPatternUnserialize (metadata, block_ptr);
        block_ptr = FcObjectUnserialize (metadata, block_ptr);
     }