Re: Patch 9.0.0058

2022-07-22 Thread John Marriott


On 23-July-2022 14:05, Bram Moolenaar wrote:

Patch 9.0.0058
Problem:Win32: cannot test low level events.
Solution:   Add "sendevent" to test_gui_event(). (Yegappan Lakshmanan,
 closes #10679)
Files:  runtime/doc/testing.txt, src/errors.h, src/gui_w32.c,
 src/proto/gui_w32.pro, src/testing.c, src/testdir/test_gui.vim



After this patch, mingw64 (gcc 12.1.0) throws this warning:

gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD gui_w32.c -o 
gobjnative/gui_w32.o
gui_w32.c:8552:35: warning: pointer targets in passing argument 2 of 
'dict_get_string' differ in signedness [-Wpointer-sign]

 8552 | event = dict_get_string(args, "event", TRUE);
  |   ^~~
  |   |
  |   char *
In file included from proto.h:75,
 from vim.h:2263,
 from gui_w32.c:26:
proto/dict.pro:32:44: note: expected 'char_u *' {aka 'unsigned char *'} 
but argument is of type 'char *'

   32 | char_u *dict_get_string(dict_T *d, char_u *key, int save);
  |    ^~~
gui_w32.c:8562:44: warning: pointer targets in passing argument 2 of 
'dict_get_number_def' differ in signedness [-Wpointer-sign]

 8562 | vkCode = dict_get_number_def(args, "keycode", 0);
  |    ^
  |    |
  |    char *
proto/dict.pro:34:52: note: expected 'char_u *' {aka 'unsigned char *'} 
but argument is of type 'char *'

   34 | varnumber_T dict_get_number_def(dict_T *d, char_u *key, int def);
  |    ^~~


The attached patch tries to fix it.

Cheers
John

--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups "vim_dev" group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/ea1584af-b2a2-2ac0-6268-2dca5afaa46f%40internode.on.net.
--- gui_w32.c.orig  2022-07-23 16:39:07.751350900 +1000
+++ gui_w32.c   2022-07-23 16:46:55.972852600 +1000
@@ -8549,7 +8549,7 @@
 char_u *event;
 INPUT  inputs[1];
 
-event = dict_get_string(args, "event", TRUE);
+event = dict_get_string(args, (char_u *)"event", TRUE);
 if (event == NULL)
return FALSE;
 
@@ -8559,7 +8559,7 @@
 {
WORDvkCode;
 
-   vkCode = dict_get_number_def(args, "keycode", 0);
+   vkCode = dict_get_number_def(args, (char_u *)"keycode", 0);
if (vkCode <= 0 || vkCode >= 0xFF)
{
semsg(_(e_invalid_argument_nr), (long)vkCode);


Re: Patch 9.0.0058

2022-07-23 Thread Bram Moolenaar

John Marriott wrote:

> On 23-July-2022 14:05, Bram Moolenaar wrote:
> > Patch 9.0.0058
> > Problem:Win32: cannot test low level events.
> > Solution:   Add "sendevent" to test_gui_event(). (Yegappan Lakshmanan,
> >  closes #10679)
> > Files:  runtime/doc/testing.txt, src/errors.h, src/gui_w32.c,
> >  src/proto/gui_w32.pro, src/testing.c, src/testdir/test_gui.vim
> >
> >
> After this patch, mingw64 (gcc 12.1.0) throws this warning:
> 
> gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 
> -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO 
> -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return 
> -fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD gui_w32.c -o 
> gobjnative/gui_w32.o
> gui_w32.c:8552:35: warning: pointer targets in passing argument 2 of 
> 'dict_get_string' differ in signedness [-Wpointer-sign]
>   8552 | event = dict_get_string(args, "event", TRUE);
>    |   ^~~
>    |   |
>    |   char *
> In file included from proto.h:75,
>   from vim.h:2263,
>   from gui_w32.c:26:
> proto/dict.pro:32:44: note: expected 'char_u *' {aka 'unsigned char *'} 
> but argument is of type 'char *'
>     32 | char_u *dict_get_string(dict_T *d, char_u *key, int save);
>    |    ^~~
> gui_w32.c:8562:44: warning: pointer targets in passing argument 2 of 
> 'dict_get_number_def' differ in signedness [-Wpointer-sign]
>   8562 | vkCode = dict_get_number_def(args, "keycode", 0);
>    |    ^
>    |    |
>    |    char *
> proto/dict.pro:34:52: note: expected 'char_u *' {aka 'unsigned char *'} 
> but argument is of type 'char *'
>     34 | varnumber_T dict_get_number_def(dict_T *d, char_u *key, int def);
>    |    ^~~
> 
> 
> The attached patch tries to fix it.

Thanks!

It looks like nearly all of these calls use a string constant, I'll make
the argument "char *" to avoid a lot of type casts.

-- 
Contrary to popular belief, Unix is user friendly.
It just happens to be selective about who it makes friends with.
   -- Dave Parnas

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///  \\\
\\\sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\help me help AIDS victims -- http://ICCF-Holland.org///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220723082414.E901D1C0909%40moolenaar.net.