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.
This commit is contained in:
parent
90f2fcf031
commit
ad968e32b3
1 changed files with 5 additions and 3 deletions
|
@ -112,9 +112,11 @@ struct dirent *Directory::read() {
|
||||||
|
|
||||||
std::string Directory::readFilename() {
|
std::string Directory::readFilename() {
|
||||||
dirent *ent = read();
|
dirent *ent = read();
|
||||||
if (ent == 0)
|
const char* name = 0;
|
||||||
return "";
|
if (ent) {
|
||||||
return (ent->d_name ? ent->d_name : "");
|
name = ent->d_name;
|
||||||
|
}
|
||||||
|
return (name ? name : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Directory::close() {
|
void Directory::close() {
|
||||||
|
|
Loading…
Reference in a new issue