[Spice-commits] 2 commits - server/red-replay-qxl.c
Frediano Ziglio
fziglio at kemper.freedesktop.org
Wed Sep 21 17:04:40 UTC 2016
server/red-replay-qxl.c | 24 ++++++++++++------------
1 file changed, 12 insertions(+), 12 deletions(-)
New commits:
commit d3357a5a8812af31fd892adbfa5b033ff41c0564
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Fri Jan 22 11:58:14 2016 +0000
replay: Use unsigned in formatting
Avoid negative syntax. Also could prevent some memory problem is number
get too big.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
index 59da5dd..e95cf91 100644
--- a/server/red-replay-qxl.c
+++ b/server/red-replay-qxl.c
@@ -215,7 +215,7 @@ static replay_t read_binary(SpiceReplay *replay, const char *prefix, size_t *siz
{
char template[1024];
int with_zlib = -1;
- int zlib_size;
+ unsigned int zlib_size;
uint8_t *zlib_buffer;
z_stream strm;
@@ -238,7 +238,7 @@ static replay_t read_binary(SpiceReplay *replay, const char *prefix, size_t *siz
if (with_zlib) {
int ret;
- replay_fscanf(replay, "%d:", &zlib_size);
+ replay_fscanf(replay, "%u:", &zlib_size);
if (replay->error) {
return REPLAY_ERROR;
}
@@ -284,11 +284,11 @@ static ssize_t red_replay_data_chunks(SpiceReplay *replay, const char *prefix,
uint8_t **mem, size_t base_size)
{
size_t data_size;
- int count_chunks;
+ unsigned int count_chunks;
size_t next_data_size;
QXLDataChunk *cur, *next;
- replay_fscanf(replay, "data_chunks %d %zu\n", &count_chunks, &data_size);
+ replay_fscanf(replay, "data_chunks %u %zu\n", &count_chunks, &data_size);
if (replay->error) {
return -1;
}
@@ -379,9 +379,9 @@ static void red_replay_path_free(SpiceReplay *replay, QXLPHYSICAL p)
static QXLClipRects *red_replay_clip_rects(SpiceReplay *replay)
{
QXLClipRects *qxl = NULL;
- int num_rects;
+ unsigned int num_rects;
- replay_fscanf(replay, "num_rects %d\n", &num_rects);
+ replay_fscanf(replay, "num_rects %u\n", &num_rects);
if (replay->error) {
return NULL;
}
@@ -444,9 +444,9 @@ static QXLImage *red_replay_image(SpiceReplay *replay, uint32_t flags)
replay_fscanf(replay, "has_palette %d\n", &has_palette);
if (has_palette) {
QXLPalette *qp;
- int i, num_ents;
+ unsigned int i, num_ents;
- replay_fscanf(replay, "qp.num_ents %d\n", &num_ents);
+ replay_fscanf(replay, "qp.num_ents %u\n", &num_ents);
if (replay->error) {
return NULL;
}
commit e211f5dbe1b2cb53988424ffbf02d5dd3776d7f5
Author: Frediano Ziglio <fziglio at redhat.com>
Date: Wed Jun 8 16:11:25 2016 +0100
replay: Use proper formatting for scanf family
Currently on Linux PRIu64 and SCNu64 are the same but just to make
sure in the future use the correct macros.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Jonathon Jongsma <jjongsma at redhat.com>
diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
index 0cf442b..59da5dd 100644
--- a/server/red-replay-qxl.c
+++ b/server/red-replay-qxl.c
@@ -424,7 +424,7 @@ static QXLImage *red_replay_image(SpiceReplay *replay, uint32_t flags)
}
qxl = (QXLImage*)replay_malloc0(replay, sizeof(QXLImage));
- replay_fscanf(replay, "descriptor.id %"PRIu64"\n", &qxl->descriptor.id);
+ replay_fscanf(replay, "descriptor.id %"SCNu64"\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);
@@ -453,7 +453,7 @@ static QXLImage *red_replay_image(SpiceReplay *replay, uint32_t flags)
qp = replay_malloc(replay, sizeof(QXLPalette) + num_ents * sizeof(qp->ents[0]));
qp->num_ents = num_ents;
qxl->bitmap.palette = QXLPHYSICAL_FROM_PTR(qp);
- replay_fscanf(replay, "unique %"PRIu64"\n", &qp->unique);
+ replay_fscanf(replay, "unique %"SCNu64"\n", &qp->unique);
for (i = 0; i < num_ents; i++) {
replay_fscanf(replay, "ents %d\n", &qp->ents[i]);
}
@@ -1296,7 +1296,7 @@ SPICE_GNUC_VISIBLE QXLCommandExt* spice_replay_next_cmd(SpiceReplay *replay,
int counter;
while (what != 0) {
- replay_fscanf(replay, "event %d %d %d %"PRIu64"\n", &counter,
+ replay_fscanf(replay, "event %d %d %d %"SCNu64"\n", &counter,
&what, &type, ×tamp);
if (replay->error) {
goto error;
@@ -1308,7 +1308,7 @@ SPICE_GNUC_VISIBLE QXLCommandExt* spice_replay_next_cmd(SpiceReplay *replay,
cmd = replay_malloc0(replay, sizeof(QXLCommandExt));
cmd->cmd.type = type;
cmd->group_id = 0;
- spice_debug("command %"PRIu64", %d\r", timestamp, cmd->cmd.type);
+ spice_debug("command %"SCNu64", %d\r", timestamp, cmd->cmd.type);
switch (cmd->cmd.type) {
case QXL_CMD_DRAW:
cmd->flags = 0;
More information about the Spice-commits
mailing list