X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=filematch.c;h=54bd2a5c50f13d86bef459c47ed0816a0bb5d84e;hb=b8ea20d094ae20625ecec6fd9a5353cca88a061b;hp=1f5b1395934eaea0593c4da05ce37d849fe10b70;hpb=7c264b15aec2bfbcf52ea8498bb240c23458a54a;p=xonotic%2Fdarkplaces.git diff --git a/filematch.c b/filematch.c index 1f5b1395..54bd2a5c 100644 --- a/filematch.c +++ b/filematch.c @@ -35,7 +35,7 @@ int matchpattern_with_separator(const char *in, const char *pattern, int caseins if (strchr(separators, *in)) break; // see if pattern matches at this offset - if (matchpattern(in, pattern, caseinsensitive)) + if (matchpattern_with_separator(in, pattern, caseinsensitive, separators, wildcard_least_one)) return 1; // nope, advance to next offset in++; @@ -96,14 +96,14 @@ void stringlistappend(stringlist_t *list, const char *text) { oldstrings = list->strings; list->maxstrings += 4096; - list->strings = Z_Malloc(list->maxstrings * sizeof(*list->strings)); + list->strings = (char **) Z_Malloc(list->maxstrings * sizeof(*list->strings)); if (list->numstrings) memcpy(list->strings, oldstrings, list->numstrings * sizeof(*list->strings)); if (oldstrings) Z_Free(oldstrings); } textlen = strlen(text) + 1; - list->strings[list->numstrings] = Z_Malloc(textlen); + list->strings[list->numstrings] = (char *) Z_Malloc(textlen); memcpy(list->strings[list->numstrings], text, textlen); list->numstrings++; } @@ -138,24 +138,24 @@ static void adddirentry(stringlist_t *list, const char *path, const char *name) } } #ifdef WIN32 -#include +#include void listdirectory(stringlist_t *list, const char *basepath, const char *path) { int i; char pattern[4096], *c; - struct _finddata_t n_file; - long hFile; + WIN32_FIND_DATA n_file; + HANDLE hFile; strlcpy (pattern, basepath, sizeof(pattern)); strlcat (pattern, path, sizeof (pattern)); strlcat (pattern, "*", sizeof (pattern)); // ask for the directory listing handle - hFile = _findfirst(pattern, &n_file); - if(hFile == -1) + hFile = FindFirstFile(pattern, &n_file); + if(hFile == INVALID_HANDLE_VALUE) return; do { - adddirentry(list, path, n_file.name ); - } while (_findnext(hFile, &n_file) == 0); - _findclose(hFile); + adddirentry(list, path, n_file.cFileName); + } while (FindNextFile(hFile, &n_file) != 0); + FindClose(hFile); // convert names to lowercase because windows does not care, but pattern matching code often does for (i = 0;i < list->numstrings;i++)