From 833e389516b5e5b2271ed84c7b2036801c3100f1 Mon Sep 17 00:00:00 2001 From: Ryan Lortie Date: Mon, 4 Oct 2010 02:57:06 -0400 Subject: [PATCH] schema compiler: Don't store zero-valued flags Don't store the "none" value for flags into the compiled schema file. "none" should never appear as a value -- no flags set is indicated by an empty array. --- gio/glib-compile-schemas.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c index 2c97261a2..f5e8d1c36 100644 --- a/gio/glib-compile-schemas.c +++ b/gio/glib-compile-schemas.c @@ -107,6 +107,12 @@ enum_state_add_value (EnumState *state, return; } + /* Silently drop the null case if it is mentioned. + * It is properly denoted with an empty array. + */ + if (state->is_flags && value == 0) + return; + if (state->is_flags && (value & (value - 1))) { g_set_error (error, G_MARKUP_ERROR, @@ -121,7 +127,6 @@ enum_state_add_value (EnumState *state, * If we loosen the one-bit-set restriction we need an overlap check. */ - strinfo_builder_append_item (state->strinfo, nick, value); }