Re: [Spice-devel] [PATCH 06/14] log_binary is really a boolean

2018-02-14 Thread Frediano Ziglio
> 
> From: Christophe de Dinechin 
> 
> Signed-off-by: Christophe de Dinechin 
> ---
>  src/spice-streaming-agent.cpp | 7 +--
>  1 file changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
> index e345d99..8f25940 100644
> --- a/src/spice-streaming-agent.cpp
> +++ b/src/spice-streaming-agent.cpp
> @@ -55,10 +55,10 @@ struct SpiceStreamDataMessage
>  
>  static bool streaming_requested = false;
>  static bool quit_requested = false;
> +static bool log_binary = false;
>  static std::set client_codecs;
>  static int streamfd = -1;
>  static bool stdin_ok;
> -static int log_binary = 0;
>  static std::mutex stream_mtx;
>  
>  static int have_something_to_read(int *pfd, int timeout)
> @@ -443,7 +443,7 @@ int main(int argc, char* argv[])
>  const char *log_filename = NULL;
>  int logmask = LOG_UPTO(LOG_WARNING);
>  struct option long_options[] = {
> -{ "log-binary", no_argument, _binary, 1},
> +{ "log-binary", no_argument, NULL, 'b'},
>  { "help", no_argument, NULL, 'h'},
>  { 0, 0, 0, 0}
>  };
> @@ -477,6 +477,9 @@ int main(int argc, char* argv[])
>  agent.AddOption(optarg, p);
>  break;
>  }
> +case 'b':
> +log_binary = true;
> +break;
>  case 'l':
>  log_filename = optarg;
>  break;

I like the idea to remove the int ABI.
I would aboid to use 'b' as constant, I would use something like
(not tested)

enum { OPT_LOG_BINARY = UCHAR_MAX+1 };

@@ -443,7 +443,7 @@ int main(int argc, char* argv[])
 const char *log_filename = NULL;
 int logmask = LOG_UPTO(LOG_WARNING);
 struct option long_options[] = {
-{ "log-binary", no_argument, _binary, 1},
+{ "log-binary", no_argument, NULL, OPT_LOG_BINARY},
 { "help", no_argument, NULL, 'h'},
 { 0, 0, 0, 0}
 };
@@ -477,6 +477,9 @@ int main(int argc, char* argv[])
 agent.AddOption(optarg, p);
 break;
 }
+case OPT_LOG_BINARY:
+log_binary = true;
+break;
 case 'l':
 log_filename = optarg;
 break;

The reason is that if we decide to add a -b option won't clash with
this one.

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


[Spice-devel] [PATCH 06/14] log_binary is really a boolean

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

Signed-off-by: Christophe de Dinechin 
---
 src/spice-streaming-agent.cpp | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/spice-streaming-agent.cpp b/src/spice-streaming-agent.cpp
index e345d99..8f25940 100644
--- a/src/spice-streaming-agent.cpp
+++ b/src/spice-streaming-agent.cpp
@@ -55,10 +55,10 @@ struct SpiceStreamDataMessage
 
 static bool streaming_requested = false;
 static bool quit_requested = false;
+static bool log_binary = false;
 static std::set client_codecs;
 static int streamfd = -1;
 static bool stdin_ok;
-static int log_binary = 0;
 static std::mutex stream_mtx;
 
 static int have_something_to_read(int *pfd, int timeout)
@@ -443,7 +443,7 @@ int main(int argc, char* argv[])
 const char *log_filename = NULL;
 int logmask = LOG_UPTO(LOG_WARNING);
 struct option long_options[] = {
-{ "log-binary", no_argument, _binary, 1},
+{ "log-binary", no_argument, NULL, 'b'},
 { "help", no_argument, NULL, 'h'},
 { 0, 0, 0, 0}
 };
@@ -477,6 +477,9 @@ int main(int argc, char* argv[])
 agent.AddOption(optarg, p);
 break;
 }
+case 'b':
+log_binary = true;
+break;
 case 'l':
 log_filename = optarg;
 break;
-- 
2.13.5 (Apple Git-94)

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