[Spice-devel] [PATCH spice-gtk v2] widget: Avoid combining ternary with another operators

Pavel Grunt pgrunt at redhat.com
Tue Mar 29 15:54:35 UTC 2016


Hi,
On Tue, 2016-03-29 at 17:23 +0200, Victor Toso wrote:
> Hi,
> 
> On Tue, Mar 29, 2016 at 05:08:28PM +0200, Pavel Grunt wrote:
> > 
> > Logical operators like "&&" has higher precedency than "?:".
> > Readiness of SpiceDisplay was wrongly determined due to missing
> > parentheses around the ternary operator.
> > 
> > Fixes:
> > https://bugs.freedesktop.org/show_bug.cgi?id=94738
> Acked-by: Victor Toso <victortoso at redhat.com>
> 
Thanks, pushed

Pavel

> > 
> > ---
> >  src/spice-widget.c | 11 ++++++-----
> >  1 file changed, 6 insertions(+), 5 deletions(-)
> > 
> > diff --git a/src/spice-widget.c b/src/spice-widget.c
> > index 21b1c14..f605439 100644
> > --- a/src/spice-widget.c
> > +++ b/src/spice-widget.c
> > @@ -230,14 +230,15 @@ static gint get_display_id(SpiceDisplay
> > *display)
> >  static void update_ready(SpiceDisplay *display)
> >  {
> >      SpiceDisplayPrivate *d = display->priv;
> > -    gboolean ready;
> > +    gboolean ready = FALSE;
> >  
> > -    ready = d->monitor_ready &&
> > +    if (d->monitor_ready) {
> >  #ifndef G_OS_WIN32
> > -        d->egl.enabled ? d->egl.image != NULL :
> > +        ready = d->egl.enabled ? d->egl.image != NULL : d->mark !=
> > 0;
> > +#else
> > +        ready = d->mark != 0;
> >  #endif
> > -        d->mark;
> > -
> > +    }
> >      /* If the 'resize-guest' property is set, the application
> > expects spice-gtk
> >       * to manage the size and state of the displays, so update the
> > 'enabled'
> >       * state here. If 'resize-guest' is false, we can assume that
> > the


More information about the Spice-devel mailing list