build/win: fix warnings

../src/nvim/os/fs.c: In function 'os_can_exe':
  ../src/nvim/os/fs.c:247:27: warning: passing argument 1 of 'is_executable_ext' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
    247 |     if (is_executable_ext(name, abspath)) {
        |                           ^~~~
  In file included from ../src/nvim/os/fs.c:36:
  src/nvim/auto/os/fs.c.generated.h:7:38: note: expected 'char *' but argument is of type 'const char *'
      7 | static _Bool is_executable_ext(char *name, char **abspath) FUNC_ATTR_NONNULL_ARG(1);
        |                                ~~~~~~^~~~
  ../src/nvim/os/fs.c: In function 'os_resolve_shortcut':
  ../src/nvim/os/fs.c:1183:56: warning: conversion from 'size_t' {aka 'const long long unsigned int'} to 'int' may change value [-Wconversion]
   1183 |     const int conversion_result = utf8_to_utf16(fname, len, &p);
        |                                                        ^~~
  ../src/nvim/os/fs.c:1211:19: warning: declaration of 'conversion_result' shadows a previous local [-Wshadow]
   1211 |         const int conversion_result = utf16_to_utf8(wsz, -1, &rfname);
        |                   ^~~~~~~~~~~~~~~~~
  ../src/nvim/os/fs.c:1183:15: note: shadowed declaration is here
   1183 |     const int conversion_result = utf8_to_utf16(fname, len, &p);
        |               ^~~~~~~~~~~~~~~~~
This commit is contained in:
Justin M. Keyes
2019-08-14 09:48:21 +02:00
parent c9a0875ea8
commit 975be7e5dc

View File

@@ -293,7 +293,7 @@ static bool is_executable(const char *name, char **abspath)
/// Checks if file `name` is executable under any of these conditions: /// Checks if file `name` is executable under any of these conditions:
/// - extension is in $PATHEXT and `name` is executable /// - extension is in $PATHEXT and `name` is executable
/// - result of any $PATHEXT extension appended to `name` is executable /// - result of any $PATHEXT extension appended to `name` is executable
static bool is_executable_ext(char *name, char **abspath) static bool is_executable_ext(const char *name, char **abspath)
FUNC_ATTR_NONNULL_ARG(1) FUNC_ATTR_NONNULL_ARG(1)
{ {
const bool is_unix_shell = strstr((char *)path_tail(p_sh), "sh") != NULL; const bool is_unix_shell = strstr((char *)path_tail(p_sh), "sh") != NULL;
@@ -1180,9 +1180,9 @@ char *os_resolve_shortcut(const char *fname)
&IID_IShellLinkW, (void **)&pslw); &IID_IShellLinkW, (void **)&pslw);
if (hr == S_OK) { if (hr == S_OK) {
wchar_t *p; wchar_t *p;
const int conversion_result = utf8_to_utf16(fname, len, &p); const int r = utf8_to_utf16(fname, -1, &p);
if (conversion_result != 0) { if (r != 0) {
EMSG2("utf8_to_utf16 failed: %d", conversion_result); EMSG2("utf8_to_utf16 failed: %d", r);
} else if (p != NULL) { } else if (p != NULL) {
// Get a pointer to the IPersistFile interface. // Get a pointer to the IPersistFile interface.
hr = pslw->lpVtbl->QueryInterface( hr = pslw->lpVtbl->QueryInterface(
@@ -1208,9 +1208,9 @@ char *os_resolve_shortcut(const char *fname)
ZeroMemory(wsz, MAX_PATH * sizeof(wchar_t)); ZeroMemory(wsz, MAX_PATH * sizeof(wchar_t));
hr = pslw->lpVtbl->GetPath(pslw, wsz, MAX_PATH, &ffdw, 0); hr = pslw->lpVtbl->GetPath(pslw, wsz, MAX_PATH, &ffdw, 0);
if (hr == S_OK && wsz[0] != NUL) { if (hr == S_OK && wsz[0] != NUL) {
const int conversion_result = utf16_to_utf8(wsz, -1, &rfname); const int r2 = utf16_to_utf8(wsz, -1, &rfname);
if (conversion_result != 0) { if (r2 != 0) {
EMSG2("utf16_to_utf8 failed: %d", conversion_result); EMSG2("utf16_to_utf8 failed: %d", r2);
} }
} }