Browse Source

--- Merging r30728 into '.':
U rtl/unix/dos.pp
--- Recording mergeinfo for merge of r30728 into '.':
U .
--- Merging r30704 into '.':
U rtl/objpas/sysutils/sysuintf.inc
--- Recording mergeinfo for merge of r30704 into '.':
G .
--- Merging r30652 into '.':
U packages/cdrom/src/cdrom.pp
--- Recording mergeinfo for merge of r30652 into '.':
G .
--- Merging r30642 into '.':
U packages/rtl-objpas/src/inc/strutils.pp
--- Recording mergeinfo for merge of r30642 into '.':
G .

# revisions: 30728,30704,30652,30642

git-svn-id: branches/fixes_3_0@31112 -

marco 10 years ago
parent
commit
7ca1faa6b4

+ 11 - 0
packages/cdrom/src/cdrom.pp

@@ -20,12 +20,23 @@ unit cdrom;
 interface
 
 Type
+  // Frames are 1/75th of a second.
+  // To get the seconds of a track divide the frames by 75.
+  // TrackLen: Double; ...
+  // TrackLen := Frames / 75.
   TTocEntry = Record
     min, sec, frame : Integer;
   end;
   PTocEntry = ^TTocEntry;
 
+// Returns the High value to use in a loop. Each entry is the position of the end
+// of a track. For audio cd's the zero'th entry is not audio data. If an audio cd
+// has 10 songs then ReadCDToc will return 10 but there are 11 entries: 0..10.
+// You still need to use the zero'th entry to get the first track length:
+// Track1Length := TOC[1].frames = TOC[0].frames.
 Function ReadCDTOC(Device : String; Var CDTOC : Array of TTocEntry) : Integer;
+
+// Returns the number of devices placed in 'Devices'
 Function GetCDRomDevices(Var Devices : Array of string) : Integer;
 
 Implementation

+ 43 - 36
packages/rtl-objpas/src/inc/strutils.pp

@@ -1770,39 +1770,10 @@ begin
     end;
 end;
 
-function isWild(inputStr, Wilds: string; ignoreCase: boolean): boolean;
+Function isMatch(inputstr,wilds : string; CWild, CinputWord: integer;MaxInputword,maxwilds : word) : Boolean;
 
-var
-  CWild, CinputWord: integer; { counter for positions }
-  i: integer;
-  MaxinputWord, MaxWilds: integer; { Length of inputStr and Wilds }
 begin
-  Result:=true;
-  if Wilds = inputStr then
-    Exit;
-  { delete '**', because '**' = '*' }
-  i:=Pos('**', Wilds);
-  while i > 0 do
-    begin
-    Delete(Wilds, i, 1);
-    i:=Pos('**', Wilds);
-    end;
-  if Wilds = '*' then { for fast end, if Wilds only '*' }
-    Exit;
-  MaxinputWord:=Length(inputStr);
-  MaxWilds:=Length(Wilds);
-  if (MaxWilds = 0) or (MaxinputWord = 0) then
-    begin
-    Result:=false;
-    Exit;
-    end;
-  if ignoreCase then { upcase all letters }
-    begin
-    inputStr:=AnsiUpperCase(inputStr);
-    Wilds:=AnsiUpperCase(Wilds);
-    end;
-  CinputWord:=1;
-  CWild:=1;
+  Result:=True;
   repeat
     if Wilds[CWild] = '*' then { handling of '*' }
       begin
@@ -1814,9 +1785,13 @@ begin
         inc(CinputWord);
         end;
       { increase until a match }
-      while (inputStr[CinputWord] <> Wilds[CWild]) and 
-        (CinputWord <= MaxinputWord) do
-        inc(CinputWord);
+      Repeat
+        while (inputStr[CinputWord]<>Wilds[CWild]) and (CinputWord <= MaxinputWord) do
+          inc(CinputWord);
+        Result:=isMatch(inputstr,wilds,CWild, CinputWord,MaxInputword,maxwilds);
+        if not Result then
+          Inc(cInputWord);
+      Until Result or (CinputWord>=MaxinputWord);
       Continue;
       end;
     if Wilds[CWild] = '?' then { equal to '?' }
@@ -1837,9 +1812,41 @@ begin
     Exit;
   until (CinputWord > MaxinputWord) or (CWild > MaxWilds);
   { no completed evaluation }
-  if (CinputWord <= MaxinputWord) or 
-     (CWild <= MaxWilds) then
+  if (CinputWord <= MaxinputWord) or (CWild <= MaxWilds) then
+    Result:=false;
+end;
+
+function isWild(inputStr, Wilds: string; ignoreCase: boolean): boolean;
+
+var
+  i: integer;
+  MaxinputWord, MaxWilds: integer; { Length of inputStr and Wilds }
+begin
+  Result:=true;
+  if Wilds = inputStr then
+    Exit;
+  { delete '**', because '**' = '*' }
+  i:=Pos('**', Wilds);
+  while i > 0 do
+    begin
+    Delete(Wilds, i, 1);
+    i:=Pos('**', Wilds);
+    end;
+  if Wilds = '*' then { for fast end, if Wilds only '*' }
+    Exit;
+  MaxinputWord:=Length(inputStr);
+  MaxWilds:=Length(Wilds);
+  if (MaxWilds = 0) or (MaxinputWord = 0) then
+    begin
     Result:=false;
+    Exit;
+    end;
+  if ignoreCase then { upcase all letters }
+    begin
+    inputStr:=AnsiUpperCase(inputStr);
+    Wilds:=AnsiUpperCase(Wilds);
+    end;
+  Result:=isMatch(inputStr,wilds,1,1,MaxinputWord, MaxWilds);  
 end;
 
 

+ 1 - 1
rtl/objpas/sysutils/sysuintf.inc

@@ -157,7 +157,7 @@ begin
   SetLength(Result, 38);
   StrLFmt(PChar(Result), 38,'{%.8x-%.4x-%.4x-%.2x%.2x-%.2x%.2x%.2x%.2x%.2x%.2x}',
     [
-     GUID.D1, GUID.D2, GUID.D3,
+     Longint(GUID.D1), GUID.D2, GUID.D3,
      GUID.D4[0], GUID.D4[1], GUID.D4[2], GUID.D4[3],
      GUID.D4[4], GUID.D4[5], GUID.D4[6], GUID.D4[7]
     ]);

+ 4 - 1
rtl/unix/dos.pp

@@ -245,6 +245,7 @@ var
 begin
   GetDate (Year, Month, Day,dow);
   tv.tv_sec:= LocalToEpoch ( Year, Month, Day, Hour, Minute, Second ) ;
+  tv.tv_usec:= Sec100 * 10000;
   fpSettimeofday(@tv,nil);
 end;
 
@@ -255,6 +256,7 @@ var
 begin
   GetTime ( Hour, Min, Sec, Sec100 );
   tv.tv_sec:= LocalToEpoch ( Year, Month, Day, Hour, Min, Sec ) ;
+  tv.tv_usec:= Sec100 * 10000;
   fpSettimeofday(@tv,nil);
 end;
 
@@ -264,6 +266,7 @@ var
   tv : timeval;
 begin
   tv.tv_sec:= LocalToEpoch ( Year, Month, Day, Hour, Minute, Second ) ;
+  tv.tv_usec:= 0;
   SetDatetime:=fpSettimeofday(@tv,nil)=0;
 end;
 
@@ -319,7 +322,7 @@ Begin
     begin
       doserror:=2;
       exit;
-    end;  
+    end;
   pid:=fpFork;
   if pid=0 then
    begin