Browse Source

* several fixes

michael 26 years ago
parent
commit
49bda42c6c
2 changed files with 29 additions and 6 deletions
  1. 15 2
      rtl/objpas/dati.inc
  2. 14 4
      rtl/objpas/fina.inc

+ 15 - 2
rtl/objpas/dati.inc

@@ -44,7 +44,13 @@ end ;
 
 
 function DoEncodeTime(Hour, Minute, Second, MilliSecond: word): longint;
 function DoEncodeTime(Hour, Minute, Second, MilliSecond: word): longint;
 begin
 begin
-result := (Hour * 3600000 + Minute * 60000 + Second * 1000 + MilliSecond) { div MSecsPerDay} ;
+If ((hour>=0) and (Hour<24)) and 
+   ((Minute>=0) and (Minute<60)) and
+   ((Second>=0) and (Second<60)) and
+   ((MilliSecond>=0) and (Millisecond<1000)) then
+  Result := (Hour * 3600000 + Minute * 60000 + Second * 1000 + MilliSecond)
+else
+  Result:=0;
 end ;
 end ;
 
 
 {==============================================================================}
 {==============================================================================}
@@ -381,12 +387,16 @@ begin
 Current := 0;
 Current := 0;
 Len := length(s);
 Len := length(s);
 PM := False;
 PM := False;
+for i:=0 to 4 do 
+  timevalues[i]:=0;
 i := 0;
 i := 0;
 TimeValues[i] := GetElement;
 TimeValues[i] := GetElement;
 while (i < 5) and (TimeValues[i] <> -1) do begin
 while (i < 5) and (TimeValues[i] <> -1) do begin
    i := i + 1;
    i := i + 1;
    TimeValues[i] := GetElement;
    TimeValues[i] := GetElement;
    end ;
    end ;
+If (i<5) and (TimeValues[I]=-1) then 
+  TimeValues[I]:=0;
 if PM then Inc(TimeValues[0], 12);
 if PM then Inc(TimeValues[0], 12);
 result := EncodeTime(TimeValues[0], TimeValues[1], TimeValues[2], TimeValues[3]);
 result := EncodeTime(TimeValues[0], TimeValues[1], TimeValues[2], TimeValues[3]);
 end ;
 end ;
@@ -622,7 +632,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.11  1999-05-11 09:05:13  michael
+  Revision 1.12  1999-05-13 21:51:41  michael
+  * several fixes
+
+  Revision 1.11  1999/05/11 09:05:13  michael
   * SMall fixes to date/time routines
   * SMall fixes to date/time routines
 
 
   Revision 1.10  1999/04/18 19:03:03  michael
   Revision 1.10  1999/04/18 19:03:03  michael

+ 14 - 4
rtl/objpas/fina.inc

@@ -35,7 +35,10 @@ var i: longint;
 begin
 begin
 i := Length(FileName);
 i := Length(FileName);
 while (i > 0) and not (FileName[i] in ['/', '\', ':']) do Dec(i);
 while (i > 0) and not (FileName[i] in ['/', '\', ':']) do Dec(i);
-Result := Copy(FileName, 1, i);
+If I>0 then
+  Result := Copy(FileName, 1, i)
+else
+  Result:='';
 end;
 end;
 
 
 function ExtractFileDir(const FileName: string): string;
 function ExtractFileDir(const FileName: string): string;
@@ -85,11 +88,15 @@ end;
 
 
 function ExpandFileName (Const FileName : string): String;
 function ExpandFileName (Const FileName : string): String;
 
 
+Var S : String;
+
 Begin
 Begin
+ S:=FileName;
+ DoDirSeparators(S);
 {$ifdef linux}
 {$ifdef linux}
-  Result:=Linux.fexpand(FileName);
+  Result:=Linux.fexpand(S);
 {$else}
 {$else}
-  Result:=Dos.Fexpand(FileName);
+  Result:=Dos.Fexpand(S);
 {$endif}
 {$endif}
 end;
 end;
 
 
@@ -181,7 +188,10 @@ end;
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.5  1998-12-19 14:52:28  peter
+  Revision 1.6  1999-05-13 21:51:42  michael
+  * several fixes
+
+  Revision 1.5  1998/12/19 14:52:28  peter
     * removed temp define
     * removed temp define
 
 
   Revision 1.4  1998/10/05 21:35:41  peter
   Revision 1.4  1998/10/05 21:35:41  peter