Merge pull request #4550 from linkmauve/no-readdir_r
Common: Replace deprecated readdir_r with readdir
This commit is contained in:
commit
40e36ebd1e
|
@ -462,14 +462,12 @@ FSTEntry ScanDirectoryTree(const std::string& directory, bool recursive)
|
||||||
{
|
{
|
||||||
const std::string virtual_name(TStrToUTF8(ffd.cFileName));
|
const std::string virtual_name(TStrToUTF8(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 parent_entry;
|
return parent_entry;
|
||||||
|
|
||||||
// non Windows loop
|
// non Windows loop
|
||||||
while (!readdir_r(dirp, &dirent, &result) && result)
|
while (dirent* result = readdir(dirp))
|
||||||
{
|
{
|
||||||
const std::string virtual_name(result->d_name);
|
const std::string virtual_name(result->d_name);
|
||||||
#endif
|
#endif
|
||||||
|
@ -529,13 +527,12 @@ bool DeleteDirRecursively(const std::string& directory)
|
||||||
{
|
{
|
||||||
const std::string virtualName(TStrToUTF8(ffd.cFileName));
|
const std::string virtualName(TStrToUTF8(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 (dirent* result = readdir(dirp))
|
||||||
{
|
{
|
||||||
const std::string virtualName = result->d_name;
|
const std::string virtualName = result->d_name;
|
||||||
#endif
|
#endif
|
||||||
|
@ -600,12 +597,11 @@ void CopyDir(const std::string& source_path, const std::string& dest_path)
|
||||||
{
|
{
|
||||||
const std::string virtualName(TStrToUTF8(ffd.cFileName));
|
const std::string virtualName(TStrToUTF8(ffd.cFileName));
|
||||||
#else
|
#else
|
||||||
struct dirent dirent, *result = nullptr;
|
|
||||||
DIR* dirp = opendir(source_path.c_str());
|
DIR* dirp = opendir(source_path.c_str());
|
||||||
if (!dirp)
|
if (!dirp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
while (!readdir_r(dirp, &dirent, &result) && result)
|
while (dirent* result = readdir(dirp))
|
||||||
{
|
{
|
||||||
const std::string virtualName(result->d_name);
|
const std::string virtualName(result->d_name);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue