Ignore:
Timestamp:
Sep 13, 1999, 2:36:35 PM (26 years ago)
Author:
phaller
Message:

Fix: updated to current wine 19990913

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/shell32/new/shellpath.cpp

    r873 r918  
    433433}
    434434/*************************************************************************
     435 * PathMatchSingleMask
     436 *
     437 * NOTES
     438 *     internal (used by PathMatchSpec)
     439 */
     440static BOOL PathMatchSingleMaskA(LPCSTR name, LPCSTR mask)
     441{
     442  while (*name && *mask && *mask!=';') {
     443    if (*mask=='*') {
     444      do {
     445        if (PathMatchSingleMaskA(name,mask+1)) return 1;  /* try substrings */
     446      } while (*name++);
     447      return 0;
     448    }
     449    if (toupper(*mask)!=toupper(*name) && *mask!='?') return 0;
     450    name++;
     451    mask++;
     452  }
     453  if (!*name) {
     454    while (*mask=='*') mask++;
     455    if (!*mask || *mask==';') return 1;
     456  }
     457  return 0;
     458}
     459static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask)
     460{
     461  while (*name && *mask && *mask!=';') {
     462    if (*mask=='*') {
     463      do {
     464        if (PathMatchSingleMaskW(name,mask+1)) return 1;  /* try substrings */
     465      } while (*name++);
     466      return 0;
     467    }
     468    if (towupper(*mask)!=towupper(*name) && *mask!='?') return 0;
     469    name++;
     470    mask++;
     471  }
     472  if (!*name) {
     473    while (*mask=='*') mask++;
     474    if (!*mask || *mask==';') return 1;
     475  }
     476  return 0;
     477}
     478/*************************************************************************
    435479 * PathMatchSpec [SHELL32.46]
    436480 *
     
    438482 *     used from COMDLG32
    439483 */
    440 
    441484BOOL WINAPI PathMatchSpecA(LPCSTR name, LPCSTR mask)
    442 {       LPCSTR _name;
    443 
    444         TRACE("%s %s stub\n",name,mask);
    445 
    446         _name = name;
    447         while (*_name && *mask)
    448         { if (*mask ==';')
    449           { mask++;
    450             _name = name;
     485{
     486  TRACE("%s %s\n",name,mask);
     487
     488  if (!lstrcmpA( mask, "*.*" )) return 1;   /* we don't require a period */
     489
     490  while (*mask) {
     491    if (PathMatchSingleMaskA(name,mask)) return 1;    /* helper function */
     492    while (*mask && *mask!=';') mask++;
     493    if (*mask==';') {
     494      mask++;
     495      while (*mask==' ') mask++;      /*  masks may be separated by "; " */
    451496          }
    452           else if (*mask == '*')
    453           { mask++;
    454             while (*mask == '*') mask++;                /* Skip consecutive '*' */
    455             if (!*mask || *mask==';') return TRUE;      /* '*' matches everything */
    456             while (*_name && (toupper(*_name) != toupper(*mask))) _name++;
    457             if (!*_name)
    458             { while ( *mask && *mask != ';') mask++;
    459               _name = name;
    460             }
    461           }
    462           else if ( (*mask == '?') || (toupper(*mask) == toupper(*_name)) )
    463           { mask++;
    464             _name++;
    465           }
    466           else
    467           { while ( *mask && *mask != ';') mask++;
    468           }
    469         }
    470         return (!*_name && (!*mask || *mask==';'));
     497        }
     498  return 0;
    471499}
    472500BOOL WINAPI PathMatchSpecW(LPCWSTR name, LPCWSTR mask)
    473501{       WCHAR stemp[4];
    474         LPCWSTR _name;
    475        
    476         TRACE("%s %s stub\n",debugstr_w(name),debugstr_w(mask));
    477 
     502  TRACE("%ls %ls\n",name,mask);
    478503        lstrcpyAtoW(stemp,"*.*");       
    479         if (!lstrcmpW( mask, stemp )) return 1;
    480 
    481         _name = name;
    482         while (*_name && *mask)
    483         { if (*mask ==';')
    484           { mask++;
    485             _name = name;
     504  if (!lstrcmpW( mask, stemp )) return 1;   /* we don't require a period */
     505
     506  while (*mask) {
     507    if (PathMatchSingleMaskW(name,mask)) return 1;    /* helper function */
     508    while (*mask && *mask!=';') mask++;
     509    if (*mask==';') {
     510      mask++;
     511      while (*mask==' ') mask++;       /* masks may be separated by "; " */
    486512          }
    487           else if (*mask == '*')
    488           { mask++;
    489             while (*mask == '*') mask++;                /* Skip consecutive '*' */
    490             if (!*mask || *mask==';') return TRUE;      /* '*' matches everything */
    491             while (*_name && (towupper(*_name) != towupper(*mask))) _name++;
    492             if (!*_name)
    493             { while ( *mask && *mask != ';') mask++;
    494               _name = name;
    495             }
    496           }
    497           else if ( (*mask == '?') || (towupper(*mask) == towupper(*_name)) )
    498           { mask++;
    499             _name++;
    500           }
    501           else
    502           { while ( *mask && *mask != ';') mask++;
    503           }
    504         }
    505         return (!*_name && (!*mask || *mask==';'));
     513        }
     514  return 0;
    506515}
    507516BOOL WINAPI PathMatchSpecAW(LPVOID name, LPVOID mask)
Note: See TracChangeset for help on using the changeset viewer.