diff options
author | Francois Gouget <fgouget@codeweavers.com> | 2015-12-15 17:43:44 +0000 |
---|---|---|
committer | Christophe Fergeau <cfergeau@redhat.com> | 2016-01-13 12:08:17 +0100 |
commit | e8f89571bedced0c70ab49a8fdd3927cfa8851a2 (patch) | |
tree | 80a282256711f29434d7eacf34e271df4be45dd8 | |
parent | 2c6db246d6b3e1d6a3dc0b8f8a830567183e5640 (diff) |
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>
-rw-r--r-- | server/char_device.c | 3 | ||||
-rw-r--r-- | server/red_record_qxl.c | 6 | ||||
-rw-r--r-- | server/red_replay_qxl.c | 8 |
3 files changed, 9 insertions, 8 deletions
diff --git a/server/char_device.c b/server/char_device.c index ae7cb982..916f48ff 100644 --- a/server/char_device.c +++ b/server/char_device.c @@ -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; } diff --git a/server/red_record_qxl.c b/server/red_record_qxl.c index b35b462c..4d508d64 100644 --- a/server/red_record_qxl.c +++ b/server/red_record_qxl.c @@ -255,7 +255,7 @@ static void red_record_image(FILE *fd, RedMemSlotInfo *slots, int group_id, qxl = (QXLImage *)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, validate_virt(slots, (intptr_t)qp->ents, get_memslot_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 *)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); diff --git a/server/red_replay_qxl.c b/server/red_replay_qxl.c index ad1a8fd5..df1fed6d 100644 --- a/server/red_replay_qxl.c +++ b/server/red_replay_qxl.c @@ -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, ×tamp); 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; |