* TryStrToBcd now returns true when it succeeds, and false when it fails, not the other way around

git-svn-id: trunk@16951 -
This commit is contained in:
joost 2011-02-20 17:53:18 +00:00
parent 41342ab54f
commit e3885089c6

View File

@ -1418,7 +1418,7 @@ IMPLEMENTATION
end; end;
begin begin
result := False; result := True;
FillChar ( lvars, SizeOf ( lvars ), #0 ); FillChar ( lvars, SizeOf ( lvars ), #0 );
BCD := NullBCD; BCD := NullBCD;
lav := Length ( aValue ); lav := Length ( aValue );
@ -1469,31 +1469,31 @@ IMPLEMENTATION
'.': if ch = dp '.': if ch = dp
then begin then begin
if inife <> inint if inife <> inint
then result := True then result := False
else inife := infrac; else inife := infrac;
end; end;
'e', 'e',
'E': if inife = inexp 'E': if inife = inexp
then result := True then result := False
else inife := inexp; else inife := inexp;
'+', '+',
'-': if ( inife = inexp ) AND ( fp[inexp] = 0 ) '-': if ( inife = inexp ) AND ( fp[inexp] = 0 )
then pse := i then pse := i
else result := True; else result := False;
else begin else begin
result := True; result := False;
errp := i; errp := i;
end; end;
end; end;
end; end;
if result if not result
then begin then begin
result := False; result := True;
for i := errp TO lav do for i := errp TO lav do
if aValue[i] <> ' ' if aValue[i] <> ' '
then result := True; then result := False;
end; end;
if result if not result
then EXIT; then EXIT;
if ps <> 0 if ps <> 0
@ -1504,15 +1504,15 @@ IMPLEMENTATION
then begin then begin
exp := 0; exp := 0;
for i := fp[inexp] TO lp[inexp] do for i := fp[inexp] TO lp[inexp] do
if NOT result if result
then then
if aValue[i] <> dc if aValue[i] <> dc
then begin then begin
exp := exp * 10 + ( Ord ( aValue[i] ) - Ord ( '0' ) ); exp := exp * 10 + ( Ord ( aValue[i] ) - Ord ( '0' ) );
if exp > 999 if exp > 999
then result := True; then result := False;
end; end;
if result if not result
then EXIT; then EXIT;
if pse <> 0 if pse <> 0
@ -1546,16 +1546,16 @@ IMPLEMENTATION
Dec ( p ); Dec ( p );
Singles[p] := Ord ( aValue[i] ) - Ord ( '0' ); Singles[p] := Ord ( aValue[i] ) - Ord ( '0' );
end end
else result := True; else result := False;
end; end;
if result if not result
then EXIT; then EXIT;
FDig := p; FDig := p;
if LDig < 0 if LDig < 0
then LDig := 0; then LDig := 0;
Plac := LDig; Plac := LDig;
result := NOT pack_BCD ( bh, BCD ); result := pack_BCD ( bh, BCD );
end; end;
end; end;
end; end;
@ -1566,7 +1566,7 @@ IMPLEMENTATION
BCD : tBCD; BCD : tBCD;
begin begin
if TryStrToBCD ( aValue, BCD ) if not TryStrToBCD ( aValue, BCD )
then begin then begin
RAISE eBCDOverflowException.create ( 'in StrToBCD' ); RAISE eBCDOverflowException.create ( 'in StrToBCD' );
end end