[Spice-devel] [PATCH] Remove duplicate streaming enumeration

Fabiano Fidencio ffidenci at redhat.com
Fri Jun 12 16:24:32 PDT 2015



----- Original Message -----
> From: "Jonathon Jongsma" <jjongsma at redhat.com>
> To: spice-devel at freedesktop.org
> Sent: Friday, June 12, 2015 5:48:47 PM
> Subject: [Spice-devel] [PATCH] Remove duplicate streaming enumeration
> 
> There is already a enumeration in a public header that defines the
> different streaming options, so there's no need to duplicate that
> enumeration internally. Just use the public enum values.
> ---
>  server/red_common.h     |  7 -------
>  server/red_dispatcher.c |  4 ++--
>  server/red_worker.c     | 14 +++++++-------
>  server/reds.c           |  2 +-
>  4 files changed, 10 insertions(+), 17 deletions(-)
> 
> diff --git a/server/red_common.h b/server/red_common.h
> index b6b643a..2b1c7ae 100644
> --- a/server/red_common.h
> +++ b/server/red_common.h
> @@ -31,13 +31,6 @@
>  
>  #define SPICE_GNUC_VISIBLE __attribute__ ((visibility ("default")))
>  
> -enum {
> -    STREAM_VIDEO_INVALID,
> -    STREAM_VIDEO_OFF,
> -    STREAM_VIDEO_ALL,
> -    STREAM_VIDEO_FILTER
> -};
> -
>  static const LzImageType MAP_BITMAP_FMT_TO_LZ_IMAGE_TYPE[] = {
>      LZ_IMAGE_TYPE_INVALID,
>      LZ_IMAGE_TYPE_PLT1_LE,
> diff --git a/server/red_dispatcher.c b/server/red_dispatcher.c
> index f5f3e52..74adaa2 100644
> --- a/server/red_dispatcher.c
> +++ b/server/red_dispatcher.c
> @@ -743,8 +743,8 @@ static void qxl_worker_loadvm_commands(QXLWorker
> *qxl_worker,
>  
>  static inline int calc_compression_level(void)
>  {
> -    spice_assert(streaming_video != STREAM_VIDEO_INVALID);
> -    if ((streaming_video != STREAM_VIDEO_OFF) ||
> +    spice_assert(streaming_video != SPICE_STREAM_VIDEO_INVALID);
> +    if ((streaming_video != SPICE_STREAM_VIDEO_OFF) ||
>          (image_compression != SPICE_IMAGE_COMPRESS_QUIC)) {
>          return 0;
>      } else {
> diff --git a/server/red_worker.c b/server/red_worker.c
> index 5deb30b..a51b670 100644
> --- a/server/red_worker.c
> +++ b/server/red_worker.c
> @@ -3404,7 +3404,7 @@ static inline void
> red_update_copy_graduality(RedWorker* worker, Drawable *drawa
>      SpiceBitmap *bitmap;
>      spice_assert(drawable->red_drawable->type == QXL_DRAW_COPY);
>  
> -    if (worker->streaming_video != STREAM_VIDEO_FILTER) {
> +    if (worker->streaming_video != SPICE_STREAM_VIDEO_FILTER) {
>          drawable->copy_bitmap_graduality = BITMAP_GRADUAL_INVALID;
>          return;
>      }
> @@ -3883,7 +3883,7 @@ static inline void red_update_streamable(RedWorker
> *worker, Drawable *drawable,
>  {
>      SpiceImage *image;
>  
> -    if (worker->streaming_video == STREAM_VIDEO_OFF) {
> +    if (worker->streaming_video == SPICE_STREAM_VIDEO_OFF) {
>          return;
>      }
>  
> @@ -3903,7 +3903,7 @@ static inline void red_update_streamable(RedWorker
> *worker, Drawable *drawable,
>          return;
>      }
>  
> -    if (worker->streaming_video == STREAM_VIDEO_FILTER) {
> +    if (worker->streaming_video == SPICE_STREAM_VIDEO_FILTER) {
>          SpiceRect* rect;
>          int size;
>  
> @@ -11774,15 +11774,15 @@ void handle_dev_set_streaming_video(void *opaque,
> void *payload)
>      RedWorker *worker = opaque;
>  
>      worker->streaming_video = msg->streaming_video;
> -    spice_assert(worker->streaming_video != STREAM_VIDEO_INVALID);
> +    spice_assert(worker->streaming_video != SPICE_STREAM_VIDEO_INVALID);
>      switch(worker->streaming_video) {
> -        case STREAM_VIDEO_ALL:
> +        case SPICE_STREAM_VIDEO_ALL:
>              spice_info("sv all");
>              break;
> -        case STREAM_VIDEO_FILTER:
> +        case SPICE_STREAM_VIDEO_FILTER:
>              spice_info("sv filter");
>              break;
> -        case STREAM_VIDEO_OFF:
> +        case SPICE_STREAM_VIDEO_OFF:
>              spice_info("sv off");
>              break;
>          default:
> diff --git a/server/reds.c b/server/reds.c
> index 6d70b68..06b1970 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -110,7 +110,7 @@ static uint8_t spice_uuid[16] = { 0, };
>  static int ticketing_enabled = 1; //Ticketing is enabled by default
>  static pthread_mutex_t *lock_cs;
>  static long *lock_count;
> -uint32_t streaming_video = STREAM_VIDEO_FILTER;
> +uint32_t streaming_video = SPICE_STREAM_VIDEO_FILTER;
>  spice_image_compression_t image_compression = SPICE_IMAGE_COMPRESS_AUTO_GLZ;
>  spice_wan_compression_t jpeg_state = SPICE_WAN_COMPRESSION_AUTO;
>  spice_wan_compression_t zlib_glz_state = SPICE_WAN_COMPRESSION_AUTO;
> --
> 2.1.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
> 

ACK!


More information about the Spice-devel mailing list