From: Kefu Chai Date: Fri, 5 Aug 2022 00:17:45 +0000 (+0800) Subject: dokan: cast variable to the expected type before comparison X-Git-Tag: v18.0.0~335^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f27e16ff9494e1d1f36324b64fb24a16fcf929b3;p=ceph.git dokan: cast variable to the expected type before comparison to fix the FTBFS due to following warning: ``` /home/jenkins-build/build/workspace/ceph-windows-pull-requests/ceph/build.deps/src/dokany/dokan/dokan.h:723:22: error: narrowing conversion of '-1' from 'int' to 'long unsigned int' [-Wnarrowing] 723 | #define DOKAN_ERROR -1 | ^ ``` also, clean up the following warning: ``` /home/jenkins-build/build/workspace/ceph-windows-pull-requests/ceph/src/dokan/dbg.cc:142:62: warning: NULL used in arithmetic [-Wpointer-arith] 142 | o << "\n\tIsDirectory: " << (DokanFileInfo->IsDirectory != NULL); | ``` Signed-off-by: Kefu Chai --- diff --git a/src/dokan/ceph_dokan.cc b/src/dokan/ceph_dokan.cc index 35c82a2715c9e..91f37cc8911e2 100644 --- a/src/dokan/ceph_dokan.cc +++ b/src/dokan/ceph_dokan.cc @@ -954,7 +954,7 @@ int do_map() { <<". Mountpoint: " << to_string(g_cfg->mountpoint) << dendl; DWORD status = DokanMain(dokan_options, dokan_operations); - switch (status) { + switch (static_cast(status)) { case DOKAN_SUCCESS: dout(2) << "Dokan has returned successfully" << dendl; break; diff --git a/src/dokan/dbg.cc b/src/dokan/dbg.cc index 6860ff35cd781..1448fa9bbef74 100644 --- a/src/dokan/dbg.cc +++ b/src/dokan/dbg.cc @@ -139,7 +139,7 @@ void print_open_params( check_flag(o, FlagsAndAttributes, SECURITY_EFFECTIVE_ONLY); check_flag(o, FlagsAndAttributes, SECURITY_SQOS_PRESENT); - o << "\n\tIsDirectory: " << (DokanFileInfo->IsDirectory != NULL); + o << "\n\tIsDirectory: " << static_cast(DokanFileInfo->IsDirectory); o << "\n\tCreateOptions: " << hex << CreateOptions << " "; check_flag(o, CreateOptions, FILE_DIRECTORY_FILE);