]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Use (un)signed printf specifiers correctly
authorJán Tomko <jtomko@redhat.com>
Tue, 22 Sep 2020 20:17:03 +0000 (22:17 +0200)
committerJán Tomko <jtomko@redhat.com>
Wed, 23 Sep 2020 11:26:35 +0000 (13:26 +0200)
Various places reported by cppcheck's invalidPrintfArgType_sint
and invalidPrintfArgType_uint.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
examples/c/domain/domtop.c
examples/c/domain/suspend.c
tests/qemusecuritymock.c
tests/virhashtest.c
tests/virpcimock.c

index 15611c586d4503580cff15a001f5fce5ca534c3d..5228445b7c90c6c331a6c7a0eadb403af2eae66c 100644 (file)
@@ -115,7 +115,7 @@ parse_argv(int argc, char *argv[],
             }
             *milliseconds = val;
             if (*milliseconds != val) {
-                ERROR("Integer overflow: %ld", val);
+                ERROR("Integer overflow: %lu", val);
                 exit(EXIT_FAILURE);
             }
             break;
index 980c4584c72c19ccac29c7ab133d28814677376f..3ff24f68614fba151145de4ca0c542f0fd2499b5 100644 (file)
@@ -105,7 +105,7 @@ parse_argv(int argc, char *argv[],
             }
             *seconds = val;
             if (*seconds != val) {
-                ERROR("Integer overflow: %ld", val);
+                ERROR("Integer overflow: %lu", val);
                 return -1;
             }
             break;
index 6da8a91a9e65587537b571f4c21974b6c59cbb23..d544ae56cddcab5088c8039a30713db0981b59cb 100644 (file)
@@ -265,7 +265,7 @@ mock_chown(const char *path,
     int ret = -1;
 
     if (gid >> 16 || uid >> 16) {
-        fprintf(stderr, "Attempt to set too high UID or GID: %lld %lld",
+        fprintf(stderr, "Attempt to set too high UID or GID: %llu %llu",
                (unsigned long long) uid, (unsigned long long) gid);
         abort();
     }
index 4d05cbb0f8145a59f6d651d109a8f9694cbcdca1..af3079124109ba2bbb2ef6dea179786f135e181d 100644 (file)
@@ -34,7 +34,7 @@ testHashInit(int size)
         }
 
         if (virHashTableSize(hash) != oldsize) {
-            VIR_TEST_DEBUG("hash grown from %zd to %zd",
+            VIR_TEST_DEBUG("hash grown from %zu to %zu",
                      (size_t)oldsize, (size_t)virHashTableSize(hash));
         }
     }
@@ -313,7 +313,7 @@ testHashRemoveSet(const void *data G_GNUC_UNUSED)
 
     if (count != rcount) {
         VIR_TEST_VERBOSE("\nvirHashRemoveSet didn't remove expected number of"
-                  " entries, %d != %u",
+                  " entries, %d != %d",
                   rcount, count);
         goto cleanup;
     }
index 787172d24ceac05a7fb266c5ee58cdba1289d1ae..469aa01bb007593af2236e0aca328de058c5f077 100644 (file)
@@ -120,7 +120,7 @@ struct pciDeviceAddress {
     unsigned int device;
     unsigned int function;
 };
-# define ADDR_STR_FMT "%04x:%02x:%02x.%d"
+# define ADDR_STR_FMT "%04x:%02x:%02x.%u"
 
 struct pciDevice {
     struct pciDeviceAddress addr;