diff options
author | rubidium <rubidium@openttd.org> | 2008-12-05 18:02:04 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-12-05 18:02:04 +0000 |
commit | 9bd1435fcfc6ae02396a46079396e788bf20993f (patch) | |
tree | 99f8e7488b3857635aa25f629ba172220363dbe5 /src | |
parent | ce333328e2740576c54a1bdd2f653f37d570f653 (diff) | |
download | openttd-9bd1435fcfc6ae02396a46079396e788bf20993f.tar.xz |
(svn r14656) -Change: replace instances of x & S_IFREG with S_ISREG(x) as S_IFREG can be 0 on some platforms.
Diffstat (limited to 'src')
-rw-r--r-- | src/fileio.cpp | 4 | ||||
-rw-r--r-- | src/fios.cpp | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp index 0e2d4d895..f4daaaa59 100644 --- a/src/fileio.cpp +++ b/src/fileio.cpp @@ -711,12 +711,12 @@ static int ScanPathForTarFiles(const char *path, size_t basepath_length) snprintf(filename, lengthof(filename), "%s%s", path, d_name); - if (sb.st_mode & S_IFDIR) { + if (S_ISDIR(sb.st_mode)) { /* Directory */ if (strcmp(d_name, ".") == 0 || strcmp(d_name, "..") == 0) continue; AppendPathSeparator(filename, lengthof(filename)); num += ScanPathForTarFiles(filename, basepath_length); - } else if (sb.st_mode & S_IFREG) { + } else if (S_ISREG(sb.st_mode)) { /* File */ char *ext = strrchr(filename, '.'); diff --git a/src/fios.cpp b/src/fios.cpp index 6827f37aa..f5185464c 100644 --- a/src/fios.cpp +++ b/src/fios.cpp @@ -226,7 +226,7 @@ static FiosItem *FiosGetFileList(SaveLoadDialogMode mode, fios_getlist_callback_ strecpy(d_name, FS2OTTD(dirent->d_name), lastof(d_name)); /* found file must be directory, but not '.' or '..' */ - if (FiosIsValidFile(_fios_path, dirent, &sb) && (sb.st_mode & S_IFDIR) && + if (FiosIsValidFile(_fios_path, dirent, &sb) && S_ISDIR(sb.st_mode) && (!FiosIsHiddenFile(dirent) || strncasecmp(d_name, PERSONAL_DIR, strlen(d_name)) == 0) && strcmp(d_name, ".") != 0 && strcmp(d_name, "..") != 0) { fios = _fios_items.Append(); @@ -259,7 +259,7 @@ static FiosItem *FiosGetFileList(SaveLoadDialogMode mode, fios_getlist_callback_ char *t; strecpy(d_name, FS2OTTD(dirent->d_name), lastof(d_name)); - if (!FiosIsValidFile(_fios_path, dirent, &sb) || !(sb.st_mode & S_IFREG) || FiosIsHiddenFile(dirent)) continue; + if (!FiosIsValidFile(_fios_path, dirent, &sb) || !S_ISREG(sb.st_mode) || FiosIsHiddenFile(dirent)) continue; /* File has no extension, skip it */ if ((t = strrchr(d_name, '.')) == NULL) continue; |