Re: [PATCH] Initialize interval in grob_stencil_extent().

2010-05-23 Thread Patrick McCarty
On Sun, May 23, 2010 at 3:39 PM, Han-Wen Nienhuys  wrote:
> On Mon, May 24, 2010 at 12:30 AM, Patrick McCarty  wrote:
>> Hello,
>>
>> Is this patch correct?
>
> Interval has a default constructor, so in general addinig
> initialization is not necessary.  You can check the constructor to
> undersand why your patch is not correct.

Oops, thanks for the correction.  Sorry for the noise.

-Patrck

___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: [PATCH] Initialize interval in grob_stencil_extent().

2010-05-23 Thread Boris Shingarov



There is a chance of returning garbage values from grob_stencil_extent()
due to this uninitialized variable issue.
   

No there is not: because this is C++, not C.
The existing code is guaranteed to initialize e to the empty interval 
(i.e., the special interval [+inf, -inf]); your code initializes it to a 
different interval -- the single-point interval [0,0] -- which is not a 
difference in "uninitialized garbage" but a question of semantics.



___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


Re: [PATCH] Initialize interval in grob_stencil_extent().

2010-05-23 Thread Han-Wen Nienhuys
On Mon, May 24, 2010 at 12:30 AM, Patrick McCarty  wrote:
> Hello,
>
> Is this patch correct?

Interval has a default constructor, so in general addinig
initialization is not necessary.  You can check the constructor to
undersand why your patch is not correct.

-- 
Han-Wen Nienhuys - han...@xs4all.nl - http://www.xs4all.nl/~hanwen

___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel


[PATCH] Initialize interval in grob_stencil_extent().

2010-05-23 Thread Patrick McCarty
Hello,

Is this patch correct?

The reason I ask is because, after applying this patch, the results of
`make check' show many spacing changes, and I don't know if those
changes occur because the patch is incorrect or if there are
spacing-related workarounds in the codebase that need to be adjusted.

Also, the new regtest `stem-length-estimation.ly' will need to be
reworked to fit all systems on one page again, and I'll take of that
if this patch is okay.

One example of the spacing changes is attached.

Thanks,
Patrick
>From e45c647771360e6809c437c98ca6ea7bd54a99fe Mon Sep 17 00:00:00 2001
From: Patrick McCarty 
Date: Sun, 23 May 2010 13:30:06 -0700
Subject: [PATCH] Initialize interval in grob_stencil_extent().

There is a chance of returning garbage values from grob_stencil_extent()
due to this uninitialized variable issue.
---
 lily/grob.cc |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lily/grob.cc b/lily/grob.cc
index 911243b..d5d5309 100644
--- a/lily/grob.cc
+++ b/lily/grob.cc
@@ -682,7 +682,7 @@ static SCM
 grob_stencil_extent (Grob *me, Axis a)
 {
   Stencil *m = me->get_stencil ();
-  Interval e;
+  Interval e (0, 0);
   if (m)
 e = m->extent (a);
   return ly_interval2scm (e);
-- 
1.7.1

<><>___
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel