diff --git a/CMakeLists.txt b/CMakeLists.txt index 7f311837..d51bca79 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -225,7 +225,7 @@ if (NOT MSVC) # add_cxx_compiler_flag("-Wzero-as-null-pointer-constant") endif() -if (GCC AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6.0)) +if (GCC AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0)) add_cxx_compiler_flag("-Wno-maybe-uninitialized") # too much false positives endif() if (GCC AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)) diff --git a/tdutils/td/utils/port/path.cpp b/tdutils/td/utils/port/path.cpp index b5d05ebf..6d9d9ee8 100644 --- a/tdutils/td/utils/port/path.cpp +++ b/tdutils/td/utils/port/path.cpp @@ -283,7 +283,7 @@ Result walk_path_subdir(string &path, DIR *dir, const WalkFunction &func) SCOPE_EXIT { path.resize(size); }; - Result status; + Result status = true; #ifdef DT_DIR if (entry->d_type == DT_UNKNOWN) { status = walk_path(path, func); @@ -296,9 +296,8 @@ Result walk_path_subdir(string &path, DIR *dir, const WalkFunction &func) #warning "Slow walk_path" status = walk_path(path, func); #endif - TRY_RESULT(is_ok, std::move(status)); - if (!is_ok) { - return false; + if (status.is_error() || !status.ok()) { + return status; } } } @@ -315,9 +314,9 @@ Result walk_path_dir(string &path, DIR *subdir, const WalkFunction &func) case WalkPath::Action::Continue: break; } - TRY_RESULT(is_ok, walk_path_subdir(path, subdir, func)); - if (!is_ok) { - return false; + auto status = walk_path_subdir(path, subdir, func); + if (status.is_error() || !status.ok()) { + return status; } switch (func(path, WalkPath::Type::ExitDir)) { case WalkPath::Action::Abort: