Subject Re: [IBO] Integer Overflows
Author hans@hoogstraat.ca
Discovered another line

if Result = Low( Integer ) then .. in same module, which it will never
be ... Maybe
if Result = InvalidNodeList then


Maybe a GReplace to check ..
--------------------------------

Jason Wharton wrote:
>
> How splendid!
>
> I'll do a sub-release today.
>
> Thanks,
> Jason Wharton
> CPS - Mesa AZ
> http://www.ibobjects.com
>
> ----- Original Message -----
> From: <hans@...>
> To: <IBObjects@yahoogroups.com>
> Sent: Thursday, January 31, 2002 10:26 AM
> Subject: [IBO] Integer Overflows
>
> > Hello Jason,
> >
> > Hope I'm not repeating this messages, but it looked like
> > my messages have gone astray for a few days.
> >
> > I found a small problem in IB_NodeList, which creates pesky
> > Integer Overflow errors in my tests.
> >
> > ===========================
> > procedure TIB_NodeList.SetRefToPos( var ARef: TIB_NodeRef;
> > const APos: longint;
> > AllowFetches: boolean );
> > function GetDif( const A, B: integer ): integer;
> > begin
> > try
> > Result := A - B;
> > except
> > on E: EIntOverflow do
> > Result := low( integer ); <---- -2147483648
> > end;
> > if Result = low( integer ) then
> > Result := high( integer )
> > else
> > if Result < 0 then
> > Result := -Result; <---- Overflow
> > end;
> > var
> > tmpRef: TIB_NodeRef;
> > ===========================
> > InvalidNodeList is declared as -MaxInt = -2147483647 , however
> > Low(Integer) = -2147483648 and their exists no 2147483648, thus
> > Results := -Result; Overflows.
> >
> > I just replaced
> > Result := low( integer );
> > by
> > Result := -high( integer );
> >
> > and pesky Integer OverFlow Messages disappeared.
> >
> > Best Regards
> > Hans
> >
> >
> >
> ___________________________________________________________________________
> > IB Objects - direct, complete, custom connectivity to Firebird or
> InterBase
> > without the need for BDE, ODBC or any other layer.
> >
> ___________________________________________________________________________
> > http://www.ibobjects.com - your IBO community resource for Tech Info
> papers,
> > keyword-searchable FAQ, community code contributions and more !
> >
> > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
> >
> >
> >
>
>
> ___________________________________________________________________________
> IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
> ___________________________________________________________________________
> http://www.ibobjects.com - your IBO community resource for Tech Info papers,
> keyword-searchable FAQ, community code contributions and more !
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/