]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
win32: tweak fix some warning
authorAlain Spineux <alain@baculasystems.com>
Wed, 7 Jun 2023 10:05:54 +0000 (12:05 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
Z:w
ScsiDeviceList.h:100:22: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has type ‘long unsigned int’ [-Wformat=]
  100 |                   _T("%d:%d:%d:%d"),
      |                      ^~~~~~~~~~~~~
In file included from scsilist.cpp:48:
ScsiDeviceList.h:100:24: note: format string is defined here
  100 |                   _T("%d:%d:%d:%d"),
      |                       ~^
      |                        |
      |                        int
      |                       %ld

home/bac/workspace/bee/bacula/src/tools/fstype.c: In function ‘void print_mtab_item(void*, stat*, const char*, const char*, const char*, const char*)’:
/home/bac/workspace/bee/bacula/src/tools/fstype.c:66:8: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
   66 |       ((void *)st->st_dev), fstype, mountpoint, mntopts);
      |        ^~~~~~~~~~~~~~~~~~
/home/bac/workspace/bee/bacula/src/tools/fstype.c: In function ‘int main(int, char* const*)’:
/home/bac/workspace/bee/bacula/src/tools/fstype.c:138:39: warning: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 3 has type ‘u_int64_t’ {aka ‘long long unsigned int’} [-Wformat=]
  138 |          fprintf(stderr, "Found dev=%lx fstype=%s\n", item->dev, item->fstype);
      |                                     ~~^               ~~~~~~~~~
      |                                       |                     |
      |                                       long unsigned int     u_int64_t {aka long long unsigned int}
      |                                     %llx

bacula/src/tools/fstype.c
bacula/src/win32/tools/ScsiDeviceList.h

index 7c9a7c330a338ffe2a4b9cf9c4590d60b602dd94..47a548da081e9af90ab83ecafcfa4fa730dc3119 100644 (file)
@@ -64,8 +64,8 @@ void print_mtab_item(void *user_ctx, struct stat *st, const char *fstype,
                       const char *mountpoint, const char *mntopts,
                       const char *fsname)
 {
-   fprintf(stderr, "dev=%p fstype=%s mountpoint=%s mntopts=%s\n",
-      ((void *)st->st_dev), fstype, mountpoint, mntopts);
+   fprintf(stderr, "dev=%llx fstype=%s mountpoint=%s mntopts=%s\n",
+      (unsigned long long)st->st_dev, fstype, mountpoint, mntopts);
 }
 
 static void add_mtab_item(void *user_ctx, struct stat *st, const char *fstype,
@@ -137,7 +137,7 @@ int main (int argc, char *const *argv)
       read_mtab(add_mtab_item, mtab_list);
       fprintf(stderr, "Size of mtab=%d\n", mtab_list->size());
       foreach_rblist(item, mtab_list) {
-         fprintf(stderr, "Found dev=%lx fstype=%s\n", item->dev, item->fstype);
+         fprintf(stderr, "Found dev=%llx fstype=%s\n", (unsigned long long)item->dev, item->fstype);
       }
       delete mtab_list;
       goto get_out;
index ce88981ae022fe1f437b3fd6478f357cd7b1f2b2..73f58f599099710fad8c2eb88624384000b7696a 100644 (file)
@@ -108,7 +108,7 @@ CScsiDeviceListEntry::GetDevicePath()
    if (m_szDevicePath[0] == _T('\0'))
    {
       _sntprintf( m_szDevicePath, c_MaxDevicePathLength, 
-                  _T("%d:%d:%d:%d"), 
+                  _T("%ld:%ld:%ld:%ld"),
                   (m_dwDeviceId >> 24) & 0xFF,
                   (m_dwDeviceId >> 16) & 0xFF,
                   (m_dwDeviceId >>  8) & 0xFF,