ch: Fix printf format strings wrt size_t argument

In a few places, when a size_t typed argument is passed to a
printf-like function the corresponding specifier is %ld instead
of %zu. Fix those places.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Michal Privoznik committed 2025-04-04 15:30:26 +02:00
1 parent b065df3d04
commit 008ccd3518
2 files changed
+4 -4

No files matched your search

+2 -2
View File
@@ -156,7 +156,7 @@ virCHMonitorBuildPayloadJson(virJSONValue *content, virDomainDef *vmdef)
buf = g_base64_decode(vmdef->sec->data.sev_snp.host_data, &len);
if (len != host_data_len) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("Invalid host_data provided. Expected '%1$ld' bytes"),
_("Invalid host_data provided. Expected '%1$zu' bytes"),
host_data_len);
return -1;
}
@@ -1139,7 +1139,7 @@ virCHMonitorBuildRestoreJson(virDomainDef *vmdef,
g_autoptr(virJSONValue) nets = virJSONValueNewArray();
for (i = 0; i < vmdef->nnets; i++) {
g_autoptr(virJSONValue) net_json = virJSONValueNewObject();
g_autofree char *id = g_strdup_printf("%s_%ld", CH_NET_ID_PREFIX, i);
g_autofree char *id = g_strdup_printf("%s_%zu", CH_NET_ID_PREFIX, i);
if (virJSONValueObjectAppendString(net_json, "id", id) < 0)
return -1;
if (virJSONValueObjectAppendNumberInt(net_json, "num_fds", vmdef->nets[i]->driver.virtio.queues))
+2 -2
View File
@@ -701,7 +701,7 @@ chProcessAddNetworkDevices(virCHDriver *driver,
VIR_DEBUG("payload sent with net-add request to CH = %s", payload);
virBufferAsprintf(&buf, "%s", virBufferCurrentContent(&http_headers));
virBufferAsprintf(&buf, "Content-Length: %ld\r\n\r\n", strlen(payload));
virBufferAsprintf(&buf, "Content-Length: %zu\r\n\r\n", strlen(payload));
virBufferAsprintf(&buf, "%s", payload);
payload_len = virBufferUse(&buf);
payload = virBufferContentAndReset(&buf);
@@ -1130,7 +1130,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDomainObj *vm, const char *from
virBufferAddLit(&http_headers, "Host: localhost\r\n");
virBufferAddLit(&http_headers, "Content-Type: application/json\r\n");
virBufferAsprintf(&buf, "%s", virBufferCurrentContent(&http_headers));
virBufferAsprintf(&buf, "Content-Length: %ld\r\n\r\n", strlen(payload));
virBufferAsprintf(&buf, "Content-Length: %zu\r\n\r\n", strlen(payload));
virBufferAsprintf(&buf, "%s", payload);
payload_len = virBufferUse(&buf);
payload = virBufferContentAndReset(&buf);