Fix to make clang happy POSIX states that 'd_name' in 'struct dirent' is char[], so it cannot be NULL. This will result in the compiler complainting about an expression which always evaluates to true ... for this compiler (clang). But in some implementations 'd_name' is a 'char*' that's why it's better to keep the check for possible NULL.
Nable 80 nable.maininbox@googlemail.com
1 files changed,
5 insertions(+),
3 deletions(-)
jump to
M
src/FbTk/FileUtil.cc
→
src/FbTk/FileUtil.cc
@@ -112,9 +112,11 @@ }
std::string Directory::readFilename() { dirent *ent = read(); - if (ent == 0) - return ""; - return (ent->d_name ? ent->d_name : ""); + const char* name = 0; + if (ent) { + name = ent->d_name; + } + return (name ? name : ""); } void Directory::close() {