Browse Source

* fix matchmask

peter 20 years ago
parent
commit
faef457ca4
1 changed files with 17 additions and 5 deletions
  1. 17 5
      fv/stddlg.pas

+ 17 - 5
fv/stddlg.pas

@@ -824,9 +824,11 @@ function MatchesMask(What, Mask: string): boolean;
       end;
       end;
     found:=true;
     found:=true;
     repeat
     repeat
-      inc(i2);
       inc(i1);
       inc(i1);
-      if (i1>length(hstr1)) or (i2>length(hstr2)) then
+      if (i1>length(hstr1)) then
+        break;
+      inc(i2);
+      if (i2>length(hstr2)) then
         break;
         break;
       case hstr1[i1] of
       case hstr1[i1] of
         '?' :
         '?' :
@@ -849,9 +851,16 @@ function MatchesMask(What, Mask: string): boolean;
         else
         else
           found:=(hstr1[i1]=hstr2[i2]) or (hstr2[i2]='?');
           found:=(hstr1[i1]=hstr2[i2]) or (hstr2[i2]='?');
       end;
       end;
-    until (not found);
+    until not found;
     if found then
     if found then
-      found:=(i1>=length(hstr1)) and (i2>=length(hstr2));
+      begin
+        found:=(i2>=length(hstr2)) and
+               (
+                (i1>length(hstr1)) or
+                ((i1=length(hstr1)) and
+                 (hstr1[i1]='*'))
+               );
+      end;
     CmpStr:=found;
     CmpStr:=found;
   end;
   end;
 
 
@@ -2722,7 +2731,10 @@ end.
 
 
 {
 {
  $Log$
  $Log$
- Revision 1.19  2005-02-14 17:13:18  peter
+ Revision 1.20  2005-03-07 16:59:42  peter
+   * fix matchmask
+
+ Revision 1.19  2005/02/14 17:13:18  peter
    * truncate log
    * truncate log
 
 
 }
 }