From 1042d88f56723cc7c4e372776a3f2da0ceac2cfb Mon Sep 17 00:00:00 2001 From: "Reece H. Dunn" Date: Thu, 10 Dec 2015 22:20:51 +0000 Subject: [PATCH] Use S_ISDIR instead of S_IFMT/S_IFDIR to fix building with gcc in c11 mode. --- src/espeak.c | 2 +- src/libespeak-ng/speak_lib.c | 3 +-- src/speak.c | 3 +-- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/espeak.c b/src/espeak.c index 7a24266e..c371d42e 100644 --- a/src/espeak.c +++ b/src/espeak.c @@ -114,7 +114,7 @@ int GetFileLength(const char *filename) if(stat(filename,&statbuf) != 0) return(0); - if((statbuf.st_mode & S_IFMT) == S_IFDIR) + if(S_ISDIR(statbuf.st_mode)) return(-2); // a directory return(statbuf.st_size); diff --git a/src/libespeak-ng/speak_lib.c b/src/libespeak-ng/speak_lib.c index e0e3fd1e..01d3f1bf 100644 --- a/src/libespeak-ng/speak_lib.c +++ b/src/libespeak-ng/speak_lib.c @@ -298,8 +298,7 @@ int GetFileLength(const char *filename) if(stat(filename,&statbuf) != 0) return(0); - if((statbuf.st_mode & S_IFMT) == S_IFDIR) - // if(S_ISDIR(statbuf.st_mode)) + if(S_ISDIR(statbuf.st_mode)) return(-2); // a directory return(statbuf.st_size); diff --git a/src/speak.c b/src/speak.c index c38cbf32..55667ca3 100644 --- a/src/speak.c +++ b/src/speak.c @@ -138,8 +138,7 @@ int GetFileLength(const char *filename) if(stat(filename,&statbuf) != 0) return(0); - if((statbuf.st_mode & S_IFMT) == S_IFDIR) -// if(S_ISDIR(statbuf.st_mode)) + if(S_ISDIR(statbuf.st_mode)) return(-2); // a directory return(statbuf.st_size);