[Spice-devel] [PATCH v3 8/8] replay: use unsigned in formatting

Jonathon Jongsma jjongsma at redhat.com
Wed Sep 21 08:15:47 UTC 2016


Acked-by: Jonathon Jongsma <jjongsma at redhat.com>


On Fri, 2016-09-16 at 12:33 +0100, Frediano Ziglio wrote:
> Avoid negative syntax. Also could prevent some memory problem is
> number
> get too big.
> 
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
> ---
>  server/red-replay-qxl.c | 16 ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/server/red-replay-qxl.c b/server/red-replay-qxl.c
> index 1442686..69669dc 100644
> --- a/server/red-replay-qxl.c
> +++ b/server/red-replay-qxl.c
> @@ -209,7 +209,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;
>  
> @@ -233,7 +233,7 @@ static replay_t read_binary(SpiceReplay *replay,
> const char *prefix, size_t *siz
>          int ret;
>          GList *elem;
>  
> -        replay_fscanf(replay, "%d:", &zlib_size);
> +        replay_fscanf(replay, "%u:", &zlib_size);
>          if (replay->error) {
>              return REPLAY_ERROR;
>          }
> @@ -281,11 +281,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;
>      }
> @@ -376,9 +376,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;
>      }
> @@ -443,9 +443,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;
>              }


More information about the Spice-devel mailing list