[Spice-devel] [spice-gtk v1 4/4] gtk-session: better variable name

Victor Toso victortoso at redhat.com
Thu Dec 6 08:57:40 UTC 2018


Hi,

On Thu, Dec 06, 2018 at 03:47:26AM -0500, Frediano Ziglio wrote:
> >          for (m = 0; m < SPICE_N_ELEMENTS(atom2agent); m++) {
> >              if (atom2agent[m].vdagent == types[n] && !target_selected[m]) {
> >                  found = TRUE;
> > -                g_return_val_if_fail(i < SPICE_N_ELEMENTS(atom2agent),
> > FALSE);
> > -                targets[i].target = (gchar*)atom2agent[m].xatom;
> > -                targets[i].info = m;
> > +                g_return_val_if_fail(num_targets <
> > SPICE_N_ELEMENTS(atom2agent), FALSE);
> > +                targets[num_targets].target = (gchar*)atom2agent[m].xatom;
> > +                targets[num_targets].info = m;
> >                  target_selected[m] = TRUE;
> > -                i += 1;
> > +                num_targets += 1;
> 
> Really minor, why not "num_targets++;" ?

Why not indeed. I'll change it.

> Very OT: sometimes I miss the "with" statement from Pascal!

:)

> >              }
> >          }
> >          if (!found) {
> > @@ -806,8 +806,8 @@ static gboolean clipboard_grab(SpiceMainChannel *main,
> > guint selection,
> >      }
> >  
> >      g_free(s->clip_targets[selection]);
> > -    s->nclip_targets[selection] = i;
> > -    s->clip_targets[selection] = g_memdup(targets, sizeof(GtkTargetEntry) *
> > i);
> > +    s->nclip_targets[selection] = num_targets;
> > +    s->clip_targets[selection] = g_memdup(targets, sizeof(GtkTargetEntry) *
> > num_targets);
> >      /* Receiving a grab implies we've released our own grab */
> >      s->clip_grabbed[selection] = FALSE;
> >  
> > @@ -817,8 +817,12 @@ static gboolean clipboard_grab(SpiceMainChannel *main,
> > guint selection,
> >          return TRUE;
> >      }
> >  
> > -    if (!gtk_clipboard_set_with_owner(cb, targets, i,
> > -                                      clipboard_get, clipboard_clear,
> > G_OBJECT(self))) {
> > +    if (!gtk_clipboard_set_with_owner(cb,
> > +                                      targets,
> > +                                      num_targets,
> > +                                      clipboard_get,
> > +                                      clipboard_clear,
> > +                                      G_OBJECT(self))) {
> >          g_warning("clipboard grab failed");
> >          return FALSE;
> >      }
> 
> Otherwise,
> Acked-by: Frediano Ziglio <fziglio at redhat.com>
> 
> Frediano

Thanks,
Victor
-------------- 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/20181206/50e803c7/attachment.sig>


More information about the Spice-devel mailing list