summaryrefslogtreecommitdiff
path: root/src/cairo-types-private.h
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2008-06-24 15:02:14 -0400
committerBehdad Esfahbod <behdad@behdad.org>2008-06-24 15:02:14 -0400
commitace3a98a53ab596c83df5a163e580770b9771bf2 (patch)
tree55f3ae77b4762efc29b6905b876825879b197565 /src/cairo-types-private.h
parentf32090fb34f93d42bd134ee7c007f60dd1cd1c13 (diff)
Make sure cairo_int_status_t values fit in int8_t
It was reported by Liu Yubao that cairo_status_t may be chosen to be an int8_t by the compiler, in that case cairo_int_status_t values assigned to cairo_status_t would overflow. Fix this by allocating the values in int8_t range, and add compile-time sanity checks.
Diffstat (limited to 'src/cairo-types-private.h')
-rw-r--r--src/cairo-types-private.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index 0b66df28..36661e48 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -130,16 +130,19 @@ typedef enum _cairo_paginated_mode {
} cairo_paginated_mode_t;
/* Sure wish C had a real enum type so that this would be distinct
- * from #cairo_status_t. Oh well, without that, I'll use this bogus 1000
- * offset */
+ * from #cairo_status_t. Oh well, without that, I'll use this bogus 100
+ * offset. We want to keep it fit in int8_t as the compiler may choose
+ * that for cairo_status_t */
typedef enum _cairo_int_status {
- CAIRO_INT_STATUS_DEGENERATE = 1000,
- CAIRO_INT_STATUS_UNSUPPORTED,
+ CAIRO_INT_STATUS_UNSUPPORTED = 100,
+ CAIRO_INT_STATUS_DEGENERATE,
CAIRO_INT_STATUS_NOTHING_TO_DO,
CAIRO_INT_STATUS_CACHE_EMPTY,
CAIRO_INT_STATUS_FLATTEN_TRANSPARENCY,
CAIRO_INT_STATUS_IMAGE_FALLBACK,
- CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN
+ CAIRO_INT_STATUS_ANALYZE_META_SURFACE_PATTERN,
+
+ CAIRO_INT_STATUS_LAST_STATUS
} cairo_int_status_t;
typedef enum _cairo_internal_surface_type {