From: Alain Spineux Date: Wed, 7 Jun 2023 10:05:54 +0000 (+0200) Subject: win32: tweak fix some warning X-Git-Tag: Beta-15.0.0~174 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=309439ba20d2904151f9b485284d4b181031a64b;p=thirdparty%2Fbacula.git win32: tweak fix some warning 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 --- diff --git a/bacula/src/tools/fstype.c b/bacula/src/tools/fstype.c index 7c9a7c330..47a548da0 100644 --- a/bacula/src/tools/fstype.c +++ b/bacula/src/tools/fstype.c @@ -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; diff --git a/bacula/src/win32/tools/ScsiDeviceList.h b/bacula/src/win32/tools/ScsiDeviceList.h index ce88981ae..73f58f599 100644 --- a/bacula/src/win32/tools/ScsiDeviceList.h +++ b/bacula/src/win32/tools/ScsiDeviceList.h @@ -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,