change is_* return to bool

This commit is contained in:
Philippe Teuwen 2019-09-21 20:22:17 +02:00
parent d395bda489
commit d46edd9a53

View file

@ -74,15 +74,15 @@ int fileExists(const char *filename) {
* @param filename * @param filename
* @return * @return
*/ */
int is_regular_file(const char *filename) { bool is_regular_file(const char *filename) {
#ifdef _WIN32 #ifdef _WIN32
struct _stat st; struct _stat st;
_stat(filename, &st); _stat(filename, &st);
return S_ISREG(st.st_mode); return S_ISREG(st.st_mode) != 0;
#else #else
struct stat st; struct stat st;
stat(filename, &st); stat(filename, &st);
return S_ISREG(st.st_mode); return S_ISREG(st.st_mode) != 0;
#endif #endif
} }
/** /**
@ -90,15 +90,15 @@ int is_regular_file(const char *filename) {
* @param filename * @param filename
* @return * @return
*/ */
int is_directory(const char *filename) { bool is_directory(const char *filename) {
#ifdef _WIN32 #ifdef _WIN32
struct _stat st; struct _stat st;
_stat(filename, &st); _stat(filename, &st);
return S_ISDIR(st.st_mode); return S_ISDIR(st.st_mode) != 0;
#else #else
struct stat st; struct stat st;
stat(filename, &st); stat(filename, &st);
return S_ISDIR(st.st_mode); return S_ISDIR(st.st_mode) != 0;
#endif #endif
} }
@ -1053,7 +1053,7 @@ int searchFile(char **foundpath, const char *pm3dir, const char *searchname, con
if (searchname == NULL || strlen(searchname) == 0) if (searchname == NULL || strlen(searchname) == 0)
return PM3_EINVARG; return PM3_EINVARG;
if (is_directory(searchname) != 0) if (is_directory(searchname))
return PM3_EINVARG; return PM3_EINVARG;