Fix walk_path.

GitOrigin-RevId: a75c5a6314e3c5312cd94a5844d276710ec9944c
This commit is contained in:
levlam 2019-06-05 03:59:37 +03:00
parent 01a1538570
commit 6ffd4ce1f4
2 changed files with 7 additions and 8 deletions

View File

@ -225,7 +225,7 @@ if (NOT MSVC)
# add_cxx_compiler_flag("-Wzero-as-null-pointer-constant") # add_cxx_compiler_flag("-Wzero-as-null-pointer-constant")
endif() 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 add_cxx_compiler_flag("-Wno-maybe-uninitialized") # too much false positives
endif() endif()
if (GCC AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0)) if (GCC AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.0))

View File

@ -283,7 +283,7 @@ Result<bool> walk_path_subdir(string &path, DIR *dir, const WalkFunction &func)
SCOPE_EXIT { SCOPE_EXIT {
path.resize(size); path.resize(size);
}; };
Result<bool> status; Result<bool> status = true;
#ifdef DT_DIR #ifdef DT_DIR
if (entry->d_type == DT_UNKNOWN) { if (entry->d_type == DT_UNKNOWN) {
status = walk_path(path, func); status = walk_path(path, func);
@ -296,9 +296,8 @@ Result<bool> walk_path_subdir(string &path, DIR *dir, const WalkFunction &func)
#warning "Slow walk_path" #warning "Slow walk_path"
status = walk_path(path, func); status = walk_path(path, func);
#endif #endif
TRY_RESULT(is_ok, std::move(status)); if (status.is_error() || !status.ok()) {
if (!is_ok) { return status;
return false;
} }
} }
} }
@ -315,9 +314,9 @@ Result<bool> walk_path_dir(string &path, DIR *subdir, const WalkFunction &func)
case WalkPath::Action::Continue: case WalkPath::Action::Continue:
break; break;
} }
TRY_RESULT(is_ok, walk_path_subdir(path, subdir, func)); auto status = walk_path_subdir(path, subdir, func);
if (!is_ok) { if (status.is_error() || !status.ok()) {
return false; return status;
} }
switch (func(path, WalkPath::Type::ExitDir)) { switch (func(path, WalkPath::Type::ExitDir)) {
case WalkPath::Action::Abort: case WalkPath::Action::Abort: