Fix warnings.
GitOrigin-RevId: 1b76215c3fdfd5a05581ab0122704b4e422de410
This commit is contained in:
parent
2f90c47d03
commit
31333b5b7f
@ -98,25 +98,27 @@ Status scan_fs(CallbackT &&callback) {
|
||||
continue;
|
||||
}
|
||||
auto files_dir = get_files_dir(file_type);
|
||||
td::walk_path(files_dir, [&](CSlice path, bool is_dir) {
|
||||
if (is_dir) {
|
||||
// TODO: skip subdirs
|
||||
return;
|
||||
}
|
||||
auto r_stat = stat(path);
|
||||
if (r_stat.is_error()) {
|
||||
LOG(WARNING) << "Stat in files gc failed: " << r_stat.error();
|
||||
return;
|
||||
}
|
||||
auto stat = r_stat.move_as_ok();
|
||||
FsFileInfo info;
|
||||
info.path = path.str();
|
||||
info.size = stat.size_;
|
||||
info.file_type = file_type;
|
||||
info.atime_nsec = stat.atime_nsec_;
|
||||
info.mtime_nsec = stat.mtime_nsec_;
|
||||
callback(info);
|
||||
});
|
||||
td::walk_path(files_dir,
|
||||
[&](CSlice path, bool is_dir) {
|
||||
if (is_dir) {
|
||||
// TODO: skip subdirs
|
||||
return;
|
||||
}
|
||||
auto r_stat = stat(path);
|
||||
if (r_stat.is_error()) {
|
||||
LOG(WARNING) << "Stat in files gc failed: " << r_stat.error();
|
||||
return;
|
||||
}
|
||||
auto stat = r_stat.move_as_ok();
|
||||
FsFileInfo info;
|
||||
info.path = path.str();
|
||||
info.size = stat.size_;
|
||||
info.file_type = file_type;
|
||||
info.atime_nsec = stat.atime_nsec_;
|
||||
info.mtime_nsec = stat.mtime_nsec_;
|
||||
callback(info);
|
||||
})
|
||||
.ignore();
|
||||
}
|
||||
return Status::OK();
|
||||
}
|
||||
|
@ -438,7 +438,7 @@ TEST(BigNum, from_decimal) {
|
||||
|
||||
static void test_get_ipv4(uint32 ip) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -29,12 +29,14 @@ TEST(Port, files) {
|
||||
int cnt = 0;
|
||||
const int ITER_COUNT = 1000;
|
||||
for (int i = 0; i < ITER_COUNT; i++) {
|
||||
walk_path(main_dir, [&](CSlice name, bool is_directory) {
|
||||
if (!is_directory) {
|
||||
ASSERT_EQ(fd_path, name);
|
||||
}
|
||||
cnt++;
|
||||
});
|
||||
walk_path(main_dir,
|
||||
[&](CSlice name, bool is_directory) {
|
||||
if (!is_directory) {
|
||||
ASSERT_EQ(fd_path, name);
|
||||
}
|
||||
cnt++;
|
||||
})
|
||||
.ensure();
|
||||
}
|
||||
ASSERT_EQ(4 * ITER_COUNT, cnt);
|
||||
|
||||
|
Reference in New Issue
Block a user