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

Christophe de Dinechin christophe.de.dinechin at gmail.com
Mon Feb 19 13:03:43 UTC 2018



> On 19 Feb 2018, at 13:03, Christophe Fergeau <cfergeau at redhat.com> wrote:
> 
> 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.

Extra parentheses? Well, I don’t mind. Will do.

> 
> Christophe
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel



More information about the Spice-devel mailing list