[cairo-commit] src/cairo-tor-scan-converter.c

M. Joonas Pihlaja joonas at kemper.freedesktop.org
Mon Feb 9 16:10:58 PST 2009


 src/cairo-tor-scan-converter.c |    5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

New commits:
commit dd9fc47418b86610d7896fcf585037c96beaa66f
Author: Jeff Muizelaar <jeff at infidigm.net>
Date:   Mon Feb 9 16:31:08 2009 -0500

    Remove zero size data array for compilation with MSVC
    
    MSVC doesn't support zero sized arrays very well. For example, zero
    sized arrays in arrays.

diff --git a/src/cairo-tor-scan-converter.c b/src/cairo-tor-scan-converter.c
index 087f010..4abafc4 100644
--- a/src/cairo-tor-scan-converter.c
+++ b/src/cairo-tor-scan-converter.c
@@ -320,7 +320,6 @@ struct _pool_chunk {
     struct _pool_chunk *prev_chunk;
 
     /* Actual data starts here.	 Well aligned for pointers. */
-    unsigned char data[0];
 };
 
 /* A memory pool.  This is supposed to be embedded on the stack or
@@ -623,7 +622,7 @@ _pool_alloc_from_new_chunk(
     }
     pool->current = chunk;
 
-    obj = &chunk->data[chunk->size];
+    obj = ((unsigned char*)chunk + sizeof(*chunk) + chunk->size);
     chunk->size += size;
     return obj;
 }
@@ -642,7 +641,7 @@ pool_alloc(
     struct _pool_chunk *chunk = pool->current;
 
     if (size <= chunk->capacity - chunk->size) {
-	void *obj = &chunk->data[chunk->size];
+	void *obj = ((unsigned char*)chunk + sizeof(*chunk) + chunk->size);
 	chunk->size += size;
 	return obj;
     }


More information about the cairo-commit mailing list