[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [virt-tools-list] [PATCH virt-viewer 07/19] Run-time check values before doing bad computation



On Tue, Jul 17, 2012 at 01:03:57PM +0200, Marc-André Lureau wrote:
> Hi
> 
> On Tue, Jul 17, 2012 at 11:10 AM, Christophe Fergeau
> <cfergeau redhat com> wrote:
> >> +    if (priv->desktopWidth == 0 ||
> >> +        priv->desktopHeight == 0)
> >> +        goto end;
> >
> > Why can this happen?
> 
> It the spice display doesn't know, for example, we don't yet have
> monitor geometry.
> 
> >> +    g_return_if_fail(fullscreen.height > 128);
> >> +    g_return_if_fail(fullscreen.width > 128);
> >> +    g_return_if_fail(desktopWidth > 0);
> >> +    g_return_if_fail(desktopHeight > 0);
> >
> > In size_allocate 0 width/height are silently ignored, here you return with
> > a warning, is it on purpose?
> 
> This is the following code:
> 
>     desktopAspect = (double)desktopWidth / (double)desktopHeight;
>     screenAspect = (double)(fullscreen.width - 128) /
> (double)(fullscreen.height - 128);
> 
>     if ((desktopWidth > (fullscreen.width - 128)) ||
>         (desktopHeight > (fullscreen.height - 128))) {
> 
> I wanted a bit of run-time check, in practice we don't seem to hit
> these condition, but you can see it would be nice to have a warning if
> it happens.

Yes I've seen why you wanted these checks, I was just curious about the
difference between the first hunk and this one.

> 
> -- 
> Marc-André Lureau
> 
> _______________________________________________
> virt-tools-list mailing list
> virt-tools-list redhat com
> https://www.redhat.com/mailman/listinfo/virt-tools-list

Attachment: pgpSkGX3Yifj5.pgp
Description: PGP signature


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]