Browse Source

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

git-svn-id: trunk@16951 -
joost 14 years ago
parent
commit
e3885089c6
1 changed files with 16 additions and 16 deletions
  1. 16 16
      rtl/objpas/fmtbcd.pp

+ 16 - 16
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