Skip to content

Commit

Permalink
fix(test_helpers): don't memset simplestat
Browse files Browse the repository at this point in the history
  • Loading branch information
mhx committed Aug 15, 2024
1 parent 3ced13a commit 1984775
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
4 changes: 0 additions & 4 deletions test/test_helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ void os_access_mock::add(fs::path const& path, simplestat const& st,

void os_access_mock::add_dir(fs::path const& path) {
simplestat st;
std::memset(&st, 0, sizeof(st));
st.ino = ino_++;
st.mode = posix_file_type::directory | 0755;
st.uid = 1000;
Expand All @@ -273,7 +272,6 @@ void os_access_mock::add_dir(fs::path const& path) {

void os_access_mock::add_file(fs::path const& path, size_t size, bool random) {
simplestat st;
std::memset(&st, 0, sizeof(st));
st.ino = ino_++;
st.mode = posix_file_type::regular | 0644;
st.uid = 1000;
Expand Down Expand Up @@ -302,7 +300,6 @@ void os_access_mock::add_file(fs::path const& path, size_t size, bool random) {
void os_access_mock::add_file(fs::path const& path,
std::string const& contents) {
simplestat st;
std::memset(&st, 0, sizeof(st));
st.ino = ino_++;
st.mode = posix_file_type::regular | 0644;
st.uid = 1000;
Expand All @@ -318,7 +315,6 @@ void os_access_mock::add_local_files(fs::path const& base_path) {
} else if (p.is_regular_file()) {
auto relpath = fs::relative(p.path(), base_path);
simplestat st;
std::memset(&st, 0, sizeof(st));
st.ino = ino_++;
st.mode = posix_file_type::regular | 0644;
st.uid = 1000;
Expand Down
4 changes: 2 additions & 2 deletions test/test_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@
namespace dwarfs::test {

struct simplestat {
file_stat::ino_type ino;
file_stat::mode_type mode;
file_stat::ino_type ino{0};
file_stat::mode_type mode{0};
file_stat::nlink_type nlink{1};
file_stat::uid_type uid{0};
file_stat::gid_type gid{0};
Expand Down

0 comments on commit 1984775

Please sign in to comment.