Nit fix: Create and use a std::string object for `const char*`.
PiperOrigin-RevId: 317973144
This commit is contained in:
parent
0c628c3152
commit
acf519a77b
|
@ -1982,24 +1982,26 @@ void CheckDuplicatesRecursively(std::string path) {
|
||||||
break; // We're done.
|
break; // We're done.
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0) {
|
const std::string name = dp->d_name;
|
||||||
|
|
||||||
|
if (name == "." || name == "..") {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ignore a duplicate entry if it isn't the last attempt.
|
// Ignore a duplicate entry if it isn't the last attempt.
|
||||||
if (i == max_attempts - 1) {
|
if (i == max_attempts - 1) {
|
||||||
ASSERT_EQ(children.find(std::string(dp->d_name)), children.end())
|
ASSERT_EQ(children.find(name), children.end())
|
||||||
<< absl::StrCat(path, "/", dp->d_name);
|
<< absl::StrCat(path, "/", name);
|
||||||
} else if (children.find(std::string(dp->d_name)) != children.end()) {
|
} else if (children.find(name) != children.end()) {
|
||||||
std::cerr << "Duplicate entry: " << i << ":"
|
std::cerr << "Duplicate entry: " << i << ":"
|
||||||
<< absl::StrCat(path, "/", dp->d_name) << std::endl;
|
<< absl::StrCat(path, "/", name) << std::endl;
|
||||||
success = false;
|
success = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
children.insert(std::string(dp->d_name));
|
children.insert(name);
|
||||||
|
|
||||||
if (dp->d_type == DT_DIR) {
|
if (dp->d_type == DT_DIR) {
|
||||||
child_dirs.push_back(std::string(dp->d_name));
|
child_dirs.push_back(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (success) {
|
if (success) {
|
||||||
|
|
Loading…
Reference in New Issue