mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-12-22 16:30:57 +01:00
Merge pull request #2064 from linkmauve/remove-readdir_r
Switch to readdir() from readdir_r()
This commit is contained in:
commit
81bb315839
1 changed files with 2 additions and 6 deletions
|
@ -457,14 +457,12 @@ bool ForeachDirectoryEntry(unsigned* num_entries_out, const std::string &directo
|
||||||
do {
|
do {
|
||||||
const std::string virtual_name(Common::UTF16ToUTF8(ffd.cFileName));
|
const std::string virtual_name(Common::UTF16ToUTF8(ffd.cFileName));
|
||||||
#else
|
#else
|
||||||
struct dirent dirent, *result = nullptr;
|
|
||||||
|
|
||||||
DIR *dirp = opendir(directory.c_str());
|
DIR *dirp = opendir(directory.c_str());
|
||||||
if (!dirp)
|
if (!dirp)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// non windows loop
|
// non windows loop
|
||||||
while (!readdir_r(dirp, &dirent, &result) && result) {
|
while (struct dirent* result = readdir(dirp)) {
|
||||||
const std::string virtual_name(result->d_name);
|
const std::string virtual_name(result->d_name);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -560,12 +558,10 @@ void CopyDir(const std::string &source_path, const std::string &dest_path)
|
||||||
if (!FileUtil::Exists(source_path)) return;
|
if (!FileUtil::Exists(source_path)) return;
|
||||||
if (!FileUtil::Exists(dest_path)) FileUtil::CreateFullPath(dest_path);
|
if (!FileUtil::Exists(dest_path)) FileUtil::CreateFullPath(dest_path);
|
||||||
|
|
||||||
struct dirent dirent, *result = nullptr;
|
|
||||||
DIR *dirp = opendir(source_path.c_str());
|
DIR *dirp = opendir(source_path.c_str());
|
||||||
if (!dirp) return;
|
if (!dirp) return;
|
||||||
|
|
||||||
while (!readdir_r(dirp, &dirent, &result) && result)
|
while (struct dirent* result = readdir(dirp)) {
|
||||||
{
|
|
||||||
const std::string virtualName(result->d_name);
|
const std::string virtualName(result->d_name);
|
||||||
// check for "." and ".."
|
// check for "." and ".."
|
||||||
if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
|
if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
|
||||||
|
|
Loading…
Reference in a new issue