[xkbcommon] Make C++ happy.

Wander Lairson Costa wander.lairson at gmail.com
Thu Sep 26 05:35:33 PDT 2013


For most functions taking an enum flags parameter, we use 0 value to
indicate that no flags should be applied.

C++ has a stronger type system than C and will not implicitly convert
int's to enum's. Thus, we create valid 0 enum values for enum types
where it makes sense.

Signed-off-by: Wander Lairson Costa <wander.lairson at gmail.com>
---
 xkbcommon/xkbcommon.h | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/xkbcommon/xkbcommon.h b/xkbcommon/xkbcommon.h
index 1480b1b..4627cea 100644
--- a/xkbcommon/xkbcommon.h
+++ b/xkbcommon/xkbcommon.h
@@ -360,6 +360,8 @@ xkb_keysym_get_name(xkb_keysym_t keysym, char *buffer, size_t size);
 
 /** Flags for xkb_keysym_from_name(). */
 enum xkb_keysym_flags {
+    /** Do not apply any flag. */
+    XKB_KEYSYM_NO_FLAG = 0,
     /** Find keysym by case-insensitive search. */
     XKB_KEYSYM_CASE_INSENSITIVE = (1 << 0)
 };
@@ -425,6 +427,8 @@ xkb_keysym_to_utf32(xkb_keysym_t keysym);
 
 /** Flags for context creation. */
 enum xkb_context_flags {
+    /** Do not apply any context flag. */
+    XKB_CONTEXT_NO_FLAG = 0,
     /** Create this context with an empty include path. */
     XKB_CONTEXT_NO_DEFAULT_INCLUDES = (1 << 0),
     /** Don't take RMLVO names from the environment. */
@@ -577,6 +581,7 @@ xkb_context_include_path_get(struct xkb_context *context, unsigned int index);
 
 /** Specifies a logging level. */
 enum xkb_log_level {
+    XKB_LOG_LEVEL_NO_LOG = 0,    /**< No log. */
     XKB_LOG_LEVEL_CRITICAL = 10, /**< Log critical internal errors only. */
     XKB_LOG_LEVEL_ERROR = 20,    /**< Log all errors. */
     XKB_LOG_LEVEL_WARNING = 30,  /**< Log warnings and errors. */
@@ -676,6 +681,8 @@ xkb_context_set_log_fn(struct xkb_context *context,
 
 /** Flags for keymap compilation. */
 enum xkb_keymap_compile_flags {
+    /** Do not apply any flag. */
+    XKB_MAP_COMPILE_NO_FLAG = 0,
     /** Apparently you can't have empty enums.  What a drag. */
     XKB_MAP_COMPILE_PLACEHOLDER = 0
 };
@@ -708,6 +715,8 @@ xkb_keymap_new_from_names(struct xkb_context *context,
 
 /** The possible keymap formats. */
 enum xkb_keymap_format {
+    /** No format. */
+    XKB_KEYMAP_FORMAT_NONE = 0,
     /** The current/classic XKB text format, as generated by xkbcomp -xkb. */
     XKB_KEYMAP_FORMAT_TEXT_V1 = 1
 };
-- 
1.8.1.2



More information about the wayland-devel mailing list