[xkbcommon] Make C++ happy.

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


2013/9/26 Ran Benita <ran234 at gmail.com>:
> On Thu, Sep 26, 2013 at 09:35:33AM -0300, Wander Lairson Costa wrote:
>> 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.
>
> Thanks!
> I just made a few changes (see below) and applied; I hope you don't
> mind.
>

I don't mind at all. Thanks for applying it.

>>
>> 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,
>
> FLAG -> FLAGS
>
>>      /** 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,
>
> FLAG -> FLAGS
>
>>      /** 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. */
>
> This one's not needed, you can't pass/get that.
>
>>      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,
>
> FLAG -> FLAGS
>
>>      /** 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,
>
> This one's not needed, you can't pass/get that.
>
> Ran
>
>>      /** The current/classic XKB text format, as generated by xkbcomp -xkb. */
>>      XKB_KEYMAP_FORMAT_TEXT_V1 = 1
>>  };
>> --
>> 1.8.1.2
>>



-- 
Best Regards,
Wander Lairson Costa


More information about the wayland-devel mailing list