Browse Source

* Fixed 13762 and compilation on windows

git-svn-id: trunk@13931 -
michael 16 years ago
parent
commit
613d88e38d
1 changed files with 7 additions and 5 deletions
  1. 7 5
      packages/fcl-db/src/paradox/paradox.pp

+ 7 - 5
packages/fcl-db/src/paradox/paradox.pp

@@ -633,7 +633,7 @@ var
   No,pft,flen : integer;
   No,pft,flen : integer;
   pxf          : PPx_field;
   pxf          : PPx_field;
   Value        : Pchar;
   Value        : Pchar;
-  Y,M,D        : cint;
+  D            : clong;
   longv        : Clong;
   longv        : Clong;
   R            : Double;
   R            : Double;
   c            : Char;
   c            : Char;
@@ -656,7 +656,9 @@ begin
         If result then
         If result then
           begin
           begin
           Move(Value^,Buffer^,flen);
           Move(Value^,Buffer^,flen);
-          doc^.free(doc,value);
+          If (Flen<=Field.DataSize) then
+            Pchar(Buffer)[flen]:=#0;
+          FDoc^.free(FDoc,value);
           end;
           end;
         end;
         end;
       pxfDate:
       pxfDate:
@@ -695,7 +697,7 @@ begin
         begin
         begin
         Result:=(PX_get_data_byte(FDoc,Buf,flen,@C)>0);
         Result:=(PX_get_data_byte(FDoc,Buf,flen,@C)>0);
         If result then
         If result then
-          PBoolean(Buffer)^:=(C<>#0);
+          PWordBool(Buffer)^:=(C<>#0);
         end;
         end;
       pxfBytes:
       pxfBytes:
         begin
         begin
@@ -728,9 +730,9 @@ begin
           begin
           begin
           R:=R/1000.0;
           R:=R/1000.0;
           longv:=trunc(R /86400);
           longv:=trunc(R /86400);
-          PX_SdnToGregorian(longv+1721425,@Y,@M,@D);
+          D:=Longv+1721425-2415019;
           longv:=(Trunc(r) mod 86400);
           longv:=(Trunc(r) mod 86400);
-          PDateTime(Buffer)^:=EncodeDate(Y,M,d)+(Longv/MSecsPerday);
+          PDateTime(Buffer)^:=D+(Longv/MSecsPerday);
           end;
           end;
         end;
         end;
       pxfBCD:
       pxfBCD: