From: Lucian Petrut Date: Fri, 7 Apr 2023 11:48:34 +0000 (+0000) Subject: src/common/win32: add missing casts X-Git-Tag: v19.0.0~575^2~11 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=1df7de2aa4e400b2fb3f67d5098132f8c511e93c;p=ceph.git src/common/win32: add missing casts clang errors out because of a few type mismatches that gcc ignored through "-fpermissive". We'll need to cast a few void pointers to the appropriate type. There's also a function that doesn't have an explicit return type, which was omitted by mistake. Signed-off-by: Lucian Petrut --- diff --git a/src/common/win32/SubProcess.cc b/src/common/win32/SubProcess.cc index ce6b851e029b..3ed3b4f54c71 100644 --- a/src/common/win32/SubProcess.cc +++ b/src/common/win32/SubProcess.cc @@ -145,7 +145,7 @@ int SubProcess::join() { int status = 0; if (WaitForSingleObject(proc_handle, INFINITE) != WAIT_FAILED) { - if (!GetExitCodeProcess(proc_handle, &status)) { + if (!GetExitCodeProcess(proc_handle, (DWORD*)&status)) { errstr << cmd << ": Could not get exit code: " << pid << ". Error code: " << GetLastError(); status = -ECHILD; diff --git a/src/common/win32/dlfcn.cc b/src/common/win32/dlfcn.cc index 329d14677bd9..9b148cd49d34 100644 --- a/src/common/win32/dlfcn.cc +++ b/src/common/win32/dlfcn.cc @@ -25,11 +25,11 @@ void* dlopen(const char *filename, int flags) { int dlclose(void* handle) { //FreeLibrary returns 0 on error, as opposed to dlclose. - return !FreeLibrary(handle); + return !FreeLibrary((HMODULE)handle); } void* dlsym(void* handle, const char* symbol) { - return (void*)GetProcAddress(handle, symbol); + return (void*)GetProcAddress((HMODULE)handle, symbol); } dl_errmsg_t dlerror() { diff --git a/src/common/win32/ifaddrs.cc b/src/common/win32/ifaddrs.cc index d7de4a5ff8ae..60e8d17f9bf9 100644 --- a/src/common/win32/ifaddrs.cc +++ b/src/common/win32/ifaddrs.cc @@ -46,7 +46,7 @@ int getifaddrs(struct ifaddrs **ifap) if (unicast_sockaddr->sa_family != AF_INET && unicast_sockaddr->sa_family != AF_INET6) continue; - out_list_curr = calloc(sizeof(*out_list_curr), 1); + out_list_curr = (struct ifaddrs*)calloc(sizeof(*out_list_curr), 1); if (!out_list_curr) { errno = ENOMEM; ret = -1; diff --git a/src/common/win32/registry.h b/src/common/win32/registry.h index fdaf9708a9b6..a5f584211dc0 100644 --- a/src/common/win32/registry.h +++ b/src/common/win32/registry.h @@ -19,7 +19,7 @@ public: RegistryKey(CephContext *cct_, HKEY hRootKey, LPCTSTR strKey, bool create_value); ~RegistryKey(); - static remove(CephContext *cct_, HKEY hRootKey, LPCTSTR strKey); + static int remove(CephContext *cct_, HKEY hRootKey, LPCTSTR strKey); int flush();