[Spice-devel] [PATCH 03/14] streaming_requested is really a bool

Christophe Fergeau cfergeau at redhat.com
Mon Feb 19 12:03:49 UTC 2018


On Wed, Feb 14, 2018 at 06:52:11PM +0100, Christophe de Dinechin wrote:
> From: Christophe de Dinechin <dinechin at redhat.com>
> 
> Signed-off-by: Christophe de Dinechin <dinechin at redhat.com>
> ---
>  src/spice-streaming-agent.cpp | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> index c4c52ef..760c211 100644
> --- a/src/spice-streaming-agent.cpp
> +++ b/src/spice-streaming-agent.cpp
> @@ -52,7 +52,7 @@ struct SpiceStreamDataMessage
>      StreamMsgData msg;
>  };
>  
> -static int streaming_requested;
> +static bool streaming_requested = false;
>  static std::set<SpiceVideoCodecType> client_codecs;
>  static bool quit;
>  static int streamfd = -1;
> @@ -97,9 +97,9 @@ static int read_command_from_stdin(void)
>      if (strcmp(cmd, "quit") == 0) {
>          quit = true;
>      } else if (strcmp(cmd, "start") == 0) {
> -        streaming_requested = 1;
> +        streaming_requested = true;
>      } else if (strcmp(cmd, "stop") == 0) {
> -        streaming_requested = 0;
> +        streaming_requested = false;
>      } else {
>          syslog(LOG_WARNING, "unknown command %s\n", cmd);
>      }
> @@ -142,7 +142,7 @@ static int read_command_from_device(void)
>                 n, hdr.size);
>          return -1;
>      }
> -    streaming_requested = msg[0]; /* num_codecs */
> +    streaming_requested = msg[0] != 0; /* num_codecs */

For what it's worth, I find
    streaming_requested = (msg[0] != 0); /* num_codecs */
much easier to read.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180219/3504fe0f/attachment.sig>


More information about the Spice-devel mailing list