1
0
mirror of https://github.com/mpv-player/mpv synced 2024-12-25 08:12:17 +00:00

struct stat.st_blocks is not available on MinGW

This commit is contained in:
wm4 2012-02-28 23:01:13 +01:00
parent e00f4992b8
commit 4b553cd676

View File

@ -39,7 +39,7 @@
struct find_entry { struct find_entry {
char *name; char *name;
int matchlen; int matchlen;
blkcnt_t size; off_t size;
}; };
static int cmp_entry(const void *pa, const void *pb) static int cmp_entry(const void *pa, const void *pb)
@ -50,7 +50,7 @@ static int cmp_entry(const void *pa, const void *pb)
if (matchdiff) if (matchdiff)
return FFSIGN(matchdiff); return FFSIGN(matchdiff);
// check small files first // check small files first
blkcnt_t sizediff = a->size - b->size; off_t sizediff = a->size - b->size;
if (sizediff) if (sizediff)
return FFSIGN(sizediff); return FFSIGN(sizediff);
return 0; return 0;
@ -92,11 +92,11 @@ static char **find_files(const char *original_file, const char *suffix)
struct stat statbuf; struct stat statbuf;
if (stat(name, &statbuf) != 0) if (stat(name, &statbuf) != 0)
continue; continue;
blkcnt_t bsize = statbuf.st_blocks; off_t size = statbuf.st_size;
entries = talloc_realloc(entries, entries, struct find_entry, entries = talloc_realloc(entries, entries, struct find_entry,
num_results + 1); num_results + 1);
entries[num_results] = (struct find_entry) { name, matchlen, bsize }; entries[num_results] = (struct find_entry) { name, matchlen, size };
num_results++; num_results++;
} }
closedir(dp); closedir(dp);