]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
src/common/win32: add missing casts
authorLucian Petrut <lpetrut@cloudbasesolutions.com>
Fri, 7 Apr 2023 11:48:34 +0000 (11:48 +0000)
committerLucian Petrut <lpetrut@cloudbasesolutions.com>
Wed, 30 Aug 2023 12:59:00 +0000 (12:59 +0000)
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 <lpetrut@cloudbasesolutions.com>
src/common/win32/SubProcess.cc
src/common/win32/dlfcn.cc
src/common/win32/ifaddrs.cc
src/common/win32/registry.h

index ce6b851e029b19713a4e8d48a14f7539a669e2bc..3ed3b4f54c711756c4d6c6d23598a84ff293f46e 100644 (file)
@@ -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;
index 329d14677bd9d52927875a67a72fc3e09e6f4db5..9b148cd49d345aa862f6fa8ea69e680d92785885 100644 (file)
@@ -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() {
index d7de4a5ff8ae2892872a54c88d990aef40fb0540..60e8d17f9bf962faed6dc3a783ae2662659d7098 100644 (file)
@@ -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;
index fdaf9708a9b63fbd9ca974320416756c90bfbc65..a5f584211dc04474be7f0a047308e2af57dc1eb8 100644 (file)
@@ -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();