> ```
> vimode/src/cmds/motion-word.c: In function ‘is_wordchar’:
> vimode/src/cmds/motion-word.c:40:53: warning: comparison is always false 
due to limited range of data type [-Wtype-limits]
>    40 |         return g_ascii_isalnum(c) || c == '_' || (c >= 
192 && c <= 255);
>       |                                                     ^~
> vimode/src/cmds/motion-word.c:40:65: warning: comparison is always true 
due to limited range of data type [-Wtype-limits]
>    40 |         return g_ascii_isalnum(c) || c == '_' || (c >= 
192 && c <= 255);
>       |                                                                 ^~
> ```

This is due to `gchar` being signed on some (most) architectures, and thus 
comparing to anything larger than 0x7f is likely not to yield expected results. 
 Fix this by casting to `guchar` first.

> ```
> vimode/src/cmds/motion-word.c: In function ‘get_word_range’:
> vimode/src/cmds/motion-word.c:327:31: warning: comparison of integer 
expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ 
{aka ‘int’} [-Wsign-compare]
>   327 |                 for (i = 0; i < num; i++)
>       |                               ^
> vimode/src/cmds/motion-word.c:366:31: warning: comparison of integer 
expressions of different signedness: ‘guint’ {aka ‘unsigned int’} and ‘gint’ 
{aka ‘int’} [-Wsign-compare]
>   366 |                 for (i = 0; i < num; i++)
>       |                               ^
> ```

`i` should have the same type as `num`, which is trivial to fix here as `i` is 
merely a loop counter, not used for anything else.
You can view, comment on, or merge this pull request online at:

  https://github.com/geany/geany-plugins/pull/1464

-- Commit Summary --

  * vimode: Fix a couple warnings

-- File Changes --

    M vimode/src/cmds/motion-word.c (4)

-- Patch Links --

https://github.com/geany/geany-plugins/pull/1464.patch
https://github.com/geany/geany-plugins/pull/1464.diff

-- 
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/1464
You are receiving this because you are subscribed to this thread.

Message ID: <geany/geany-plugins/pull/[email protected]>

Reply via email to