[Spice-devel] [PATCH 02/18] Prevent setting invalid image compression values

Pavel Grunt pgrunt at redhat.com
Mon Sep 26 08:29:58 UTC 2016


Hi,

Maybe it is clear from the commit message, but I would prefer an
explicit comment saying that in case of invalid value the original
compression is unchanged.

On Mon, 2016-09-26 at 09:12 +0100, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
Acked-by: Pavel Grunt <pgrunt at redhat.com>

Thanks,
Pavel
> ---
>  server/red-worker.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/server/red-worker.c b/server/red-worker.c
> index e55a939..7c7eafe 100644
> --- a/server/red-worker.c
> +++ b/server/red-worker.c
> @@ -956,9 +956,9 @@ static void handle_dev_set_compression(void
> *opaque, void *payload)
>  {
>      RedWorkerMessageSetCompression *msg = payload;
>      RedWorker *worker = opaque;
> +    SpiceImageCompression image_compression = msg-
> >image_compression;
>  
> -    worker->image_compression = msg->image_compression;
> -    switch (worker->image_compression) {
> +    switch (image_compression) {
>      case SPICE_IMAGE_COMPRESSION_AUTO_LZ:
>          spice_info("ic auto_lz");
>          break;
> @@ -984,7 +984,9 @@ static void handle_dev_set_compression(void
> *opaque, void *payload)
>          break;
>      default:
>          spice_warning("ic invalid");
> +        image_compression = worker->image_compression;
>      }
> +    worker->image_compression = image_compression;
>  
>      display_channel_compress_stats_print(worker->display_channel);
>      display_channel_compress_stats_reset(worker->display_channel);
> 


More information about the Spice-devel mailing list