server: Use PRI macros in printf for 32/64 bit compatibility

Some integer type definitions are different between 32 and 64 bit
systems which causes problems in printf. The PRI macros automatically
provide the printf format appropriate for the system.

Signed-off-by: Francois Gouget <fgouget@codeweavers.com>
Acked-by: Jonathon Jongsma <jjongsma@redhat.com>
This commit is contained in:
Francois Gouget 2015-12-15 17:43:44 +00:00 committed by Frediano Ziglio
parent b953a4e35f
commit 110c31439b
4 changed files with 11 additions and 10 deletions

View File

@ -21,6 +21,7 @@
#include <config.h>
#include <inttypes.h>
#include "char-device.h"
#include "red-channel.h"
#include "reds.h"
@ -830,7 +831,7 @@ void spice_char_device_client_remove(SpiceCharDeviceState *dev,
}
if (dev->num_clients == 0) {
spice_debug("client removed, memory pool will be freed (%lu bytes)", dev->cur_pool_size);
spice_debug("client removed, memory pool will be freed (%"PRIu64" bytes)", dev->cur_pool_size);
write_buffers_queue_free(&dev->write_bufs_pool);
dev->cur_pool_size = 0;
}

View File

@ -255,7 +255,7 @@ static void red_record_image(FILE *fd, RedMemSlotInfo *slots, int group_id,
qxl = (QXLImage *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
&error);
fprintf(fd, "descriptor.id %ld\n", qxl->descriptor.id);
fprintf(fd, "descriptor.id %"PRIu64"\n", qxl->descriptor.id);
fprintf(fd, "descriptor.type %d\n", qxl->descriptor.type);
fprintf(fd, "descriptor.flags %d\n", qxl->descriptor.flags);
fprintf(fd, "descriptor.width %d\n", qxl->descriptor.width);
@ -280,7 +280,7 @@ static void red_record_image(FILE *fd, RedMemSlotInfo *slots, int group_id,
memslot_validate_virt(slots, (intptr_t)qp->ents,
memslot_get_id(slots, qxl->bitmap.palette),
num_ents * sizeof(qp->ents[0]), group_id);
fprintf(fd, "unique %ld\n", qp->unique);
fprintf(fd, "unique %"PRIu64"\n", qp->unique);
for (i = 0; i < num_ents; i++) {
fprintf(fd, "ents %d\n", qp->ents[i]);
}
@ -742,7 +742,7 @@ static void red_record_cursor(FILE *fd, RedMemSlotInfo *slots, int group_id,
qxl = (QXLCursor *)memslot_get_virt(slots, addr, sizeof(*qxl), group_id,
&error);
fprintf(fd, "header.unique %ld\n", qxl->header.unique);
fprintf(fd, "header.unique %"PRIu64"\n", qxl->header.unique);
fprintf(fd, "header.type %d\n", qxl->header.type);
fprintf(fd, "header.width %d\n", qxl->header.width);
fprintf(fd, "header.height %d\n", qxl->header.height);

View File

@ -370,7 +370,7 @@ static QXLImage *red_replay_image(SpiceReplay *replay, uint32_t flags)
}
qxl = (QXLImage*)malloc(sizeof(QXLImage));
replay_fscanf(replay, "descriptor.id %ld\n", &qxl->descriptor.id);
replay_fscanf(replay, "descriptor.id %"PRIu64"\n", &qxl->descriptor.id);
replay_fscanf(replay, "descriptor.type %d\n", &temp); qxl->descriptor.type = temp;
replay_fscanf(replay, "descriptor.flags %d\n", &temp); qxl->descriptor.flags = temp;
replay_fscanf(replay, "descriptor.width %d\n", &qxl->descriptor.width);
@ -393,7 +393,7 @@ static QXLImage *red_replay_image(SpiceReplay *replay, uint32_t flags)
qp = malloc(sizeof(QXLPalette) + num_ents * sizeof(qp->ents[0]));
qp->num_ents = num_ents;
qxl->bitmap.palette = (QXLPHYSICAL)qp;
replay_fscanf(replay, "unique %ld\n", &qp->unique);
replay_fscanf(replay, "unique %"PRIu64"\n", &qp->unique);
for (i = 0; i < num_ents; i++) {
replay_fscanf(replay, "ents %d\n", &qp->ents[i]);
}
@ -1121,7 +1121,7 @@ SPICE_GNUC_VISIBLE QXLCommandExt* spice_replay_next_cmd(SpiceReplay *replay,
int counter;
while (what != 0) {
replay_fscanf(replay, "event %d %d %d %ld\n", &counter,
replay_fscanf(replay, "event %d %d %d %"PRIu64"\n", &counter,
&what, &type, &timestamp);
if (replay->eof) {
return NULL;
@ -1133,7 +1133,7 @@ SPICE_GNUC_VISIBLE QXLCommandExt* spice_replay_next_cmd(SpiceReplay *replay,
cmd = g_slice_new(QXLCommandExt);
cmd->cmd.type = type;
cmd->group_id = 0;
spice_debug("command %ld, %d\r", timestamp, cmd->cmd.type);
spice_debug("command %"PRIu64", %d\r", timestamp, cmd->cmd.type);
switch (cmd->cmd.type) {
case QXL_CMD_DRAW:
cmd->flags = 0;

View File

@ -38,8 +38,8 @@ void stream_agent_stats_print(StreamAgent *agent)
mjpeg_encoder_get_stats(agent->mjpeg_encoder, &encoder_stats);
}
spice_debug("stream=%p dim=(%dx%d) #in-frames=%lu #in-avg-fps=%.2f #out-frames=%lu "
"out/in=%.2f #drops=%lu (#pipe=%lu #fps=%lu) out-avg-fps=%.2f "
spice_debug("stream=%p dim=(%dx%d) #in-frames=%"PRIu64" #in-avg-fps=%.2f #out-frames=%"PRIu64" "
"out/in=%.2f #drops=%"PRIu64" (#pipe=%"PRIu64" #fps=%"PRIu64") out-avg-fps=%.2f "
"passed-mm-time(sec)=%.2f size-total(MB)=%.2f size-per-sec(Mbps)=%.2f "
"size-per-frame(KBpf)=%.2f avg-quality=%.2f "
"start-bit-rate(Mbps)=%.2f end-bit-rate(Mbps)=%.2f",