From 31990f844a481c777fab055ba86686744ca400f3 Mon Sep 17 00:00:00 2001 From: Frederic Marchal Date: Thu, 5 Mar 2015 15:35:03 +0100 Subject: [PATCH] Get the file size with the available stat member On MinGW, the stat structure doesn't have all the member variables used to compute the size of a file. --- index.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/index.c b/index.c index 675d167..bed6f5b 100644 --- a/index.c +++ b/index.c @@ -107,6 +107,7 @@ void make_index(void) */ static long long int get_file_size(struct stat *statb) { +#ifdef __linux__ long long int blocks; //return(statb->st_size);//the size of the file content @@ -114,6 +115,9 @@ static long long int get_file_size(struct stat *statb) if (statb->st_blksize==0) return(statb->st_size); blocks=(statb->st_size+statb->st_blksize-1)/statb->st_blksize; return(blocks*statb->st_blksize);//how many bytes occupied on disk +#else + return(statb->st_size); +#endif } /*! -- 2.47.3