]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
dokan: cast variable to the expected type before comparison 47470/head
authorKefu Chai <tchaikov@gmail.com>
Fri, 5 Aug 2022 00:17:45 +0000 (08:17 +0800)
committerKefu Chai <tchaikov@gmail.com>
Fri, 5 Aug 2022 00:31:27 +0000 (08:31 +0800)
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 <tchaikov@gmail.com>
src/dokan/ceph_dokan.cc
src/dokan/dbg.cc

index 35c82a2715c9e4b137447c88326f224db0763f8a..91f37cc8911e237fd5cb3fdb4912ff4d226f7e19 100644 (file)
@@ -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<int>(status)) {
   case DOKAN_SUCCESS:
     dout(2) << "Dokan has returned successfully" << dendl;
     break;
index 6860ff35cd7810268856825543989d4b721438b1..1448fa9bbef74b8000e63efd7b228e7304618c24 100644 (file)
@@ -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<bool>(DokanFileInfo->IsDirectory);
 
   o << "\n\tCreateOptions: " << hex << CreateOptions << " ";
   check_flag(o, CreateOptions, FILE_DIRECTORY_FILE);