mirror of
https://github.com/vim/vim.git
synced 2025-11-12 22:44:34 -05:00
patch 9.1.1365: MS-Windows: compile warnings and too many strlen() calls
Problem: MS-Windows: compile warnings and too many strlen() calls in
os_mswin.c
Solution: refactor os_mswin.c and fix the warning (John Marriott)
This change does the following:
- Fix compile warnings (clang 20.1.3) in `mch_libcall()`:
```
os_mswin.c:902:21: warning: cast from 'MYSTRPROCSTR' (aka 'char *(*)(char *)') to 'MYSTRPROCINT' (aka 'int (*)(char *)') converts to incompatible function type [-Wcast-function-type-mismatch]`
902 | retval_int = ((MYSTRPROCINT)ProcAdd)((LPSTR)argstring);`
| ^~~~~~~~~~~~~~~~~~~~~`
os_mswin.c:914:21: warning: cast from 'MYINTPROCSTR' (aka 'char *(*)(int)') to 'MYINTPROCINT' (aka 'int (*)(int)') converts to incompatible function type [-Wcast-function-type-mismatch]`
914 | retval_int = ((MYINTPROCINT)ProcAddI)(argint);`
| ^~~~~~~~~~~~~~~~~~~~~~`
2 warnings generated.
```
- Refactor `stat_impl()` to remove call to `STRLEN()` (via `STRCAT()`).
- Refactor `Messaging_WndProc()`, `enumWindowsGetServer()` and
`serverSendToVim()` to remove calls to `STRLEN()`.
- Use `string_T` to store field `name` in `struct charset_pair` and
`struct quality_pair`. This means we can dispense with some calls to
`STRLEN()`.
- Use `ARRAY_LENGTH()` macro to determine end of array in
`charset_id2name()` and `quality_id2name()` to be consistent with the
rest of the code base.
closes: #17222
Signed-off-by: John Marriott <basilisk@internode.on.net>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
8ac3f5dd3a
commit
51f6a78ce2
@@ -704,6 +704,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1365,
|
||||
/**/
|
||||
1364,
|
||||
/**/
|
||||
|
||||
Reference in New Issue
Block a user