Fix warnings.

GitOrigin-RevId: 1b76215c3fdfd5a05581ab0122704b4e422de410
This commit is contained in:
levlam 2018-09-11 22:28:10 +03:00
parent 2f90c47d03
commit 31333b5b7f
3 changed files with 30 additions and 26 deletions

View File

@ -98,25 +98,27 @@ Status scan_fs(CallbackT &&callback) {
continue; continue;
} }
auto files_dir = get_files_dir(file_type); auto files_dir = get_files_dir(file_type);
td::walk_path(files_dir, [&](CSlice path, bool is_dir) { td::walk_path(files_dir,
if (is_dir) { [&](CSlice path, bool is_dir) {
// TODO: skip subdirs if (is_dir) {
return; // TODO: skip subdirs
} return;
auto r_stat = stat(path); }
if (r_stat.is_error()) { auto r_stat = stat(path);
LOG(WARNING) << "Stat in files gc failed: " << r_stat.error(); if (r_stat.is_error()) {
return; LOG(WARNING) << "Stat in files gc failed: " << r_stat.error();
} return;
auto stat = r_stat.move_as_ok(); }
FsFileInfo info; auto stat = r_stat.move_as_ok();
info.path = path.str(); FsFileInfo info;
info.size = stat.size_; info.path = path.str();
info.file_type = file_type; info.size = stat.size_;
info.atime_nsec = stat.atime_nsec_; info.file_type = file_type;
info.mtime_nsec = stat.mtime_nsec_; info.atime_nsec = stat.atime_nsec_;
callback(info); info.mtime_nsec = stat.mtime_nsec_;
}); callback(info);
})
.ignore();
} }
return Status::OK(); return Status::OK();
} }

View File

@ -438,7 +438,7 @@ TEST(BigNum, from_decimal) {
static void test_get_ipv4(uint32 ip) { static void test_get_ipv4(uint32 ip) {
td::IPAddress ip_address; td::IPAddress ip_address;
ip_address.init_ipv4_port(td::IPAddress::ipv4_to_str(ip), 80); ip_address.init_ipv4_port(td::IPAddress::ipv4_to_str(ip), 80).ensure();
ASSERT_EQ(ip_address.get_ipv4(), ip); ASSERT_EQ(ip_address.get_ipv4(), ip);
} }

View File

@ -29,12 +29,14 @@ TEST(Port, files) {
int cnt = 0; int cnt = 0;
const int ITER_COUNT = 1000; const int ITER_COUNT = 1000;
for (int i = 0; i < ITER_COUNT; i++) { for (int i = 0; i < ITER_COUNT; i++) {
walk_path(main_dir, [&](CSlice name, bool is_directory) { walk_path(main_dir,
if (!is_directory) { [&](CSlice name, bool is_directory) {
ASSERT_EQ(fd_path, name); if (!is_directory) {
} ASSERT_EQ(fd_path, name);
cnt++; }
}); cnt++;
})
.ensure();
} }
ASSERT_EQ(4 * ITER_COUNT, cnt); ASSERT_EQ(4 * ITER_COUNT, cnt);