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

2018-02-19 Thread Christophe de Dinechin


> On 19 Feb 2018, at 13:03, Christophe Fergeau  wrote:
> 
> On Wed, Feb 14, 2018 at 06:52:11PM +0100, Christophe de Dinechin wrote:
>> From: Christophe de Dinechin 
>> 
>> Signed-off-by: Christophe de Dinechin 
>> ---
>> 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 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@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/spice-devel

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


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

2018-02-19 Thread Christophe Fergeau
On Wed, Feb 14, 2018 at 06:52:11PM +0100, Christophe de Dinechin wrote:
> From: Christophe de Dinechin 
> 
> Signed-off-by: Christophe de Dinechin 
> ---
>  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 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


signature.asc
Description: PGP signature
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


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

2018-02-14 Thread Frediano Ziglio
> 
> From: Christophe de Dinechin 
> 
> Signed-off-by: Christophe de Dinechin 
> ---
>  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 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 */
>  syslog(LOG_INFO, "GOT START_STOP message -- request to %s streaming\n",
> streaming_requested ? "START" : "STOP");
>  client_codecs.clear();

Acked-by: Frediano Ziglio 

Frediano
___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel


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

2018-02-14 Thread Christophe de Dinechin
From: Christophe de Dinechin 

Signed-off-by: Christophe de Dinechin 
---
 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 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 */
 syslog(LOG_INFO, "GOT START_STOP message -- request to %s streaming\n",
streaming_requested ? "START" : "STOP");
 client_codecs.clear();
-- 
2.13.5 (Apple Git-94)

___
Spice-devel mailing list
Spice-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/spice-devel