From e3885089c6bbbe561438503974b32a454b27bb0c Mon Sep 17 00:00:00 2001 From: joost Date: Sun, 20 Feb 2011 17:53:18 +0000 Subject: [PATCH] * TryStrToBcd now returns true when it succeeds, and false when it fails, not the other way around git-svn-id: trunk@16951 - --- rtl/objpas/fmtbcd.pp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/rtl/objpas/fmtbcd.pp b/rtl/objpas/fmtbcd.pp index 7dcdf2196a..ef9885c935 100644 --- a/rtl/objpas/fmtbcd.pp +++ b/rtl/objpas/fmtbcd.pp @@ -1418,7 +1418,7 @@ IMPLEMENTATION end; begin - result := False; + result := True; FillChar ( lvars, SizeOf ( lvars ), #0 ); BCD := NullBCD; lav := Length ( aValue ); @@ -1469,31 +1469,31 @@ IMPLEMENTATION '.': if ch = dp then begin if inife <> inint - then result := True + then result := False else inife := infrac; end; 'e', 'E': if inife = inexp - then result := True + then result := False else inife := inexp; '+', '-': if ( inife = inexp ) AND ( fp[inexp] = 0 ) then pse := i - else result := True; + else result := False; else begin - result := True; + result := False; errp := i; end; end; end; - if result + if not result then begin - result := False; + result := True; for i := errp TO lav do if aValue[i] <> ' ' - then result := True; + then result := False; end; - if result + if not result then EXIT; if ps <> 0 @@ -1504,15 +1504,15 @@ IMPLEMENTATION then begin exp := 0; for i := fp[inexp] TO lp[inexp] do - if NOT result + if result then if aValue[i] <> dc then begin exp := exp * 10 + ( Ord ( aValue[i] ) - Ord ( '0' ) ); if exp > 999 - then result := True; + then result := False; end; - if result + if not result then EXIT; if pse <> 0 @@ -1546,16 +1546,16 @@ IMPLEMENTATION Dec ( p ); Singles[p] := Ord ( aValue[i] ) - Ord ( '0' ); end - else result := True; + else result := False; end; - if result + if not result then EXIT; FDig := p; if LDig < 0 then LDig := 0; Plac := LDig; - result := NOT pack_BCD ( bh, BCD ); + result := pack_BCD ( bh, BCD ); end; end; end; @@ -1566,7 +1566,7 @@ IMPLEMENTATION BCD : tBCD; begin - if TryStrToBCD ( aValue, BCD ) + if not TryStrToBCD ( aValue, BCD ) then begin RAISE eBCDOverflowException.create ( 'in StrToBCD' ); end