[lazarus] New Bug Entered

andrew johnson acjgenius at earthlink.net
Sun Nov 3 16:40:53 EST 2002


FYI, while I have since fixed it, the result WAS uninitialized. But this
was not a problem, since ERROR is defined as 0, aka to have done what
was suggested , ala result := 0 would have ensured that the procedure
wasn't ever run at all. This came up in another bug report, so I figure
I should make sure its known and clarified. Region results should NOT BE
ZERO, as in windows a result of zero indicates that an error has
occurred. It doesn't matter what the result is to start of with so long
as it is not zero. Standard practice when using such routines is to
initialize the result to SIMPLEREGION, as I have since done, though
COMPLEXREGION or NULLREGION would have sufficed as well since the result
will be changed to the real value later on, or ERROR if it fails.

Andrew

On Sun, 2002-11-03 at 15:48, Mattias Gaertner wrote:
> On Sun, 3 Nov 2002 15:28:37 -0500
> bugtracker at miraclec.com wrote:
> 
> > 
> > Title: Uninitialized vars part 2
> > 
> > Entered by: Jeroen van Iddekinge
> > 
> > In the following method\'s:
> > TGtkObject.GetClipBox
> > TGtkObject.ExtSelectClipRgn
> > TGtkObject.ExcludeClipRect
> > TGtkObject.GetClipRgn
> > TGtkObject.IntersectClipRect
> > 
> > The First lines are:
> > begin
> >   if not ValidDc(DC) then
> >      Result := Error
> > 
> > This shoud be
> > 
> > begin
> >      Result := 0;
> >      if not ValidDC(DC) then
> >               Result := Error
> 
> All 5 functions starts with:
> 
> begin
>   Result := SIMPLEREGION;
>   If not IsValidDC(DC) then
>     Result := ERROR;
> 
> Looks correct to me.
> 
> 
> Mattias







More information about the Lazarus mailing list