[Spice-devel,spice-server,06/22] reds: use bool for RedsState::is_client_mouse_allowed

Submitted by Frediano Ziglio on June 16, 2017, 9:13 a.m.

Details

Message ID 20170616091334.31475-7-fziglio@redhat.com
State New
Headers show
Series "reds: Use bool for boolean types" ( rev: 2 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio June 16, 2017, 9:13 a.m.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 server/main-channel-client.c | 4 ++--
 server/main-channel-client.h | 2 +-
 server/main-channel.c        | 2 +-
 server/main-channel.h        | 2 +-
 server/reds-private.h        | 2 +-
 server/reds.c                | 2 +-
 6 files changed, 7 insertions(+), 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/server/main-channel-client.c b/server/main-channel-client.c
index ae8d2d5..f741ed5 100644
--- a/server/main-channel-client.c
+++ b/server/main-channel-client.c
@@ -332,7 +332,7 @@  void main_channel_client_push_agent_data(MainChannelClient *mcc, uint8_t* data,
 static RedPipeItem *main_init_item_new(int connection_id,
                                        int display_channels_hint,
                                        int current_mouse_mode,
-                                       int is_client_mouse_allowed,
+                                       bool is_client_mouse_allowed,
                                        int multi_media_time,
                                        int ram_hint)
 {
@@ -351,7 +351,7 @@  static RedPipeItem *main_init_item_new(int connection_id,
 void main_channel_client_push_init(MainChannelClient *mcc,
                                    int display_channels_hint,
                                    int current_mouse_mode,
-                                   int is_client_mouse_allowed,
+                                   bool is_client_mouse_allowed,
                                    int multi_media_time,
                                    int ram_hint)
 {
diff --git a/server/main-channel-client.h b/server/main-channel-client.h
index cf54f51..e7dd6bc 100644
--- a/server/main-channel-client.h
+++ b/server/main-channel-client.h
@@ -70,7 +70,7 @@  void main_channel_client_start_net_test(MainChannelClient *mcc, int test_rate);
 void main_channel_client_push_init(MainChannelClient *mcc,
                                    int display_channels_hint,
                                    int current_mouse_mode,
-                                   int is_client_mouse_allowed,
+                                   bool is_client_mouse_allowed,
                                    int multi_media_time,
                                    int ram_hint);
 void main_channel_client_push_notify(MainChannelClient *mcc, const char *msg);
diff --git a/server/main-channel.c b/server/main-channel.c
index e9fef7c..ebd7e75 100644
--- a/server/main-channel.c
+++ b/server/main-channel.c
@@ -86,7 +86,7 @@  static void main_channel_push_channels(MainChannelClient *mcc)
 }
 
 void main_channel_push_mouse_mode(MainChannel *main_chan, int current_mode,
-                                  int is_client_mouse_allowed)
+                                  bool is_client_mouse_allowed)
 {
     MainMouseModeItemInfo info = {
         .current_mode=current_mode,
diff --git a/server/main-channel.h b/server/main-channel.h
index 8f886dd..977cff1 100644
--- a/server/main-channel.h
+++ b/server/main-channel.h
@@ -61,7 +61,7 @@  RedClient *main_channel_get_client_by_link_id(MainChannel *main_chan, uint32_t l
 MainChannelClient *main_channel_link(MainChannel *, RedClient *client,
      RedsStream *stream, uint32_t link_id, int migration,
      RedChannelCapabilities *caps);
-void main_channel_push_mouse_mode(MainChannel *main_chan, int current_mode, int is_client_mouse_allowed);
+void main_channel_push_mouse_mode(MainChannel *main_chan, int current_mode, bool is_client_mouse_allowed);
 void main_channel_push_agent_connected(MainChannel *main_chan);
 void main_channel_push_agent_disconnected(MainChannel *main_chan);
 void main_channel_push_multi_media_time(MainChannel *main_chan, int time);
diff --git a/server/reds-private.h b/server/reds-private.h
index 5aebd5c..5cff9a4 100644
--- a/server/reds-private.h
+++ b/server/reds-private.h
@@ -102,7 +102,7 @@  struct RedsState {
 
     GList *channels;
     int mouse_mode;
-    int is_client_mouse_allowed;
+    bool is_client_mouse_allowed;
     bool dispatcher_allows_client_mouse;
     MonitorMode monitor_mode;
     SpiceTimer *mig_timer;
diff --git a/server/reds.c b/server/reds.c
index e1bac2d..f97c48c 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -627,7 +627,7 @@  gboolean reds_config_get_agent_mouse(const RedsState *reds)
 
 static void reds_update_mouse_mode(RedsState *reds)
 {
-    int allowed = 0;
+    bool allowed = false;
     int qxl_count = g_list_length(reds->qxl_instances);
 
     if ((reds->config->agent_mouse && reds->vdagent) ||

Comments

On Fri, Jun 16, 2017 at 10:13:18AM +0100, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> ---
>  server/main-channel-client.c | 4 ++--
>  server/main-channel-client.h | 2 +-
>  server/main-channel.c        | 2 +-
>  server/main-channel.h        | 2 +-
>  server/reds-private.h        | 2 +-
>  server/reds.c                | 2 +-
>  6 files changed, 7 insertions(+), 7 deletions(-)
> 
> diff --git a/server/main-channel-client.c b/server/main-channel-client.c
> index ae8d2d5..f741ed5 100644
> --- a/server/main-channel-client.c
> +++ b/server/main-channel-client.c
> @@ -332,7 +332,7 @@ void main_channel_client_push_agent_data(MainChannelClient *mcc, uint8_t* data,
>  static RedPipeItem *main_init_item_new(int connection_id,
>                                         int display_channels_hint,
>                                         int current_mouse_mode,
> -                                       int is_client_mouse_allowed,
> +                                       bool is_client_mouse_allowed,
>                                         int multi_media_time,
>                                         int ram_hint)

I haven't looked at the rest of the series yet, but this function is
doing
item->is_client_mouse_allowed = is_client_mouse_allowed;
so it might be worth changing the type of
RedInitPipeItem::is_client_mouse_allowed in this patch (or before?).
Not really important if this is split in a subsequent patch.

Christophe
> 
> On Fri, Jun 16, 2017 at 10:13:18AM +0100, Frediano Ziglio wrote:
> > Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> > ---
> >  server/main-channel-client.c | 4 ++--
> >  server/main-channel-client.h | 2 +-
> >  server/main-channel.c        | 2 +-
> >  server/main-channel.h        | 2 +-
> >  server/reds-private.h        | 2 +-
> >  server/reds.c                | 2 +-
> >  6 files changed, 7 insertions(+), 7 deletions(-)
> > 
> > diff --git a/server/main-channel-client.c b/server/main-channel-client.c
> > index ae8d2d5..f741ed5 100644
> > --- a/server/main-channel-client.c
> > +++ b/server/main-channel-client.c
> > @@ -332,7 +332,7 @@ void
> > main_channel_client_push_agent_data(MainChannelClient *mcc, uint8_t* data,
> >  static RedPipeItem *main_init_item_new(int connection_id,
> >                                         int display_channels_hint,
> >                                         int current_mouse_mode,
> > -                                       int is_client_mouse_allowed,
> > +                                       bool is_client_mouse_allowed,
> >                                         int multi_media_time,
> >                                         int ram_hint)
> 
> I haven't looked at the rest of the series yet, but this function is
> doing
> item->is_client_mouse_allowed = is_client_mouse_allowed;
> so it might be worth changing the type of
> RedInitPipeItem::is_client_mouse_allowed in this patch (or before?).
> Not really important if this is split in a subsequent patch.
> 
> Christophe
> 

Sooner or later before is sent to the network has to be converted to an
integral value. I'll extend.

Frediano
On Fri, Jun 16, 2017 at 09:39:35AM -0400, Frediano Ziglio wrote:
> > 
> > On Fri, Jun 16, 2017 at 10:13:18AM +0100, Frediano Ziglio wrote:
> > > Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> > > ---
> > >  server/main-channel-client.c | 4 ++--
> > >  server/main-channel-client.h | 2 +-
> > >  server/main-channel.c        | 2 +-
> > >  server/main-channel.h        | 2 +-
> > >  server/reds-private.h        | 2 +-
> > >  server/reds.c                | 2 +-
> > >  6 files changed, 7 insertions(+), 7 deletions(-)
> > > 
> > > diff --git a/server/main-channel-client.c b/server/main-channel-client.c
> > > index ae8d2d5..f741ed5 100644
> > > --- a/server/main-channel-client.c
> > > +++ b/server/main-channel-client.c
> > > @@ -332,7 +332,7 @@ void
> > > main_channel_client_push_agent_data(MainChannelClient *mcc, uint8_t* data,
> > >  static RedPipeItem *main_init_item_new(int connection_id,
> > >                                         int display_channels_hint,
> > >                                         int current_mouse_mode,
> > > -                                       int is_client_mouse_allowed,
> > > +                                       bool is_client_mouse_allowed,
> > >                                         int multi_media_time,
> > >                                         int ram_hint)
> > 
> > I haven't looked at the rest of the series yet, but this function is
> > doing
> > item->is_client_mouse_allowed = is_client_mouse_allowed;
> > so it might be worth changing the type of
> > RedInitPipeItem::is_client_mouse_allowed in this patch (or before?).
> > Not really important if this is split in a subsequent patch.
> > 
> > Christophe
> > 
> 
> Sooner or later before is sent to the network has to be converted to an
> integral value. I'll extend.

If the goal was to convert to an int value for sending on the network,
I'd expect a sized int to be used (eg uint8_t). The conversion for
network use will be done during marshalling, either in the autogenerated
code or in main_channel_marshall_init, here it's

if (item->is_client_mouse_allowed) {
    init.supported_mouse_modes |= SPICE_MOUSE_MODE_CLIENT;
}

so this really is a bool.

Christophe