diff options
author | Nable 80 <nable.maininbox@googlemail.com> | 2015-01-03 20:47:51 (GMT) |
---|---|---|
committer | Mathias Gumz <akira@fluxbox.org> | 2015-01-03 20:47:51 (GMT) |
commit | ad968e32b30ee6262574bc3e02b20d5b117f5b88 (patch) | |
tree | 723a33fd5e22ae3aae3ffd2b1eb526abf17e3269 | |
parent | 90f2fcf031554577ce811e7f7151f2a78ea7a265 (diff) | |
download | fluxbox-ad968e32b30ee6262574bc3e02b20d5b117f5b88.zip fluxbox-ad968e32b30ee6262574bc3e02b20d5b117f5b88.tar.bz2 |
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.
-rw-r--r-- | src/FbTk/FileUtil.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/FbTk/FileUtil.cc b/src/FbTk/FileUtil.cc index c92b336..5ae2bc0 100644 --- a/src/FbTk/FileUtil.cc +++ b/src/FbTk/FileUtil.cc | |||
@@ -112,9 +112,11 @@ struct dirent *Directory::read() { | |||
112 | 112 | ||
113 | std::string Directory::readFilename() { | 113 | std::string Directory::readFilename() { |
114 | dirent *ent = read(); | 114 | dirent *ent = read(); |
115 | if (ent == 0) | 115 | const char* name = 0; |
116 | return ""; | 116 | if (ent) { |
117 | return (ent->d_name ? ent->d_name : ""); | 117 | name = ent->d_name; |
118 | } | ||
119 | return (name ? name : ""); | ||
118 | } | 120 | } |
119 | 121 | ||
120 | void Directory::close() { | 122 | void Directory::close() { |