diff --git a/include/cli/create_directory.hpp b/include/cli/create_directory.hpp index b1ae71e9..94fda852 100644 --- a/include/cli/create_directory.hpp +++ b/include/cli/create_directory.hpp @@ -46,7 +46,7 @@ create_directory(int argc, char *argv[], const std::string &data_directory, argc, argv, utils::cli::options::create_directory_option, api_path)) == exit_code::success) { lock_data lock(pt, unique_id); - const auto res = lock.grab_lock(1u); + const auto lock_res = lock.grab_lock(1u); /* if (res == lock_result::locked) { */ /* auto port = app_config::default_api_port(pt); */ /* utils::cli::get_api_authentication_data(user, password, port, pt, @@ -57,7 +57,7 @@ create_directory(int argc, char *argv[], const std::string &data_directory, /* std::cout << static_cast(response.response_type) << std::endl; */ /* std::cout << response.data.dump(2) << std::endl; */ /* } else */ - if (res == lock_result::success) { + if (lock_res == lock_result::success) { std::cout << "creating directory: '" << api_path << "'" << std::endl; app_config config(pt, data_directory); s3_comm comm(config); @@ -65,8 +65,8 @@ create_directory(int argc, char *argv[], const std::string &data_directory, std::cout << api_error_to_string(res) << std::endl; ret = exit_code::success; } else { - std::cout << "failed to grab lock: '" << static_cast(res) << "'" - << std::endl; + std::cout << "failed to grab lock: '" << static_cast(lock_res) + << "'" << std::endl; ret = exit_code::lock_failed; } } diff --git a/tests/directory_db_test.cpp b/tests/directory_db_test.cpp index 52baf149..9f94cf91 100644 --- a/tests/directory_db_test.cpp +++ b/tests/directory_db_test.cpp @@ -162,8 +162,8 @@ TEST_F(directory_db_test, get_file) { api_file file{}; EXPECT_EQ(api_error::success, - db_->get_file("/cow.txt", file, [](api_file &file) { - EXPECT_STREQ("/cow.txt", file.api_path.c_str()); + db_->get_file("/cow.txt", file, [](api_file &cur_file) { + EXPECT_STREQ("/cow.txt", cur_file.api_path.c_str()); })); EXPECT_STREQ("/cow.txt", file.api_path.c_str()); } diff --git a/tests/file_manager_open_file_test.cpp b/tests/file_manager_open_file_test.cpp index 42e3d85f..26d911c9 100644 --- a/tests/file_manager_open_file_test.cpp +++ b/tests/file_manager_open_file_test.cpp @@ -89,9 +89,9 @@ TEST(open_file, properly_initializes_state_based_on_chunk_size) { EXPECT_CALL(um, remove_resume) .WillOnce( - [&fsi](const std::string &api_path, const std::string &source_path) { + [&fsi](const std::string &api_path, const std::string &source_path2) { EXPECT_EQ(fsi.api_path, api_path); - EXPECT_EQ(fsi.source_path, source_path); + EXPECT_EQ(fsi.source_path, source_path2); }); file_manager::open_file o(1u, 0U, fsi, mp, um); @@ -143,15 +143,15 @@ TEST(open_file, will_change_source_path_if_file_size_is_greater_than_0) { EXPECT_CALL(um, remove_resume) .WillOnce( - [&fsi](const std::string &api_path, const std::string &source_path) { + [&fsi](const std::string &api_path, const std::string &source_path2) { EXPECT_EQ(fsi.api_path, api_path); - EXPECT_EQ(fsi.source_path, source_path); + EXPECT_EQ(fsi.source_path, source_path2); }); EXPECT_CALL(mp, set_item_meta(fsi.api_path, META_SOURCE, _)) .WillOnce([&fsi](const std::string &, const std::string &, - const std::string &source_path) -> api_error { - EXPECT_STRNE(fsi.source_path.c_str(), source_path.c_str()); + const std::string &source_path2) -> api_error { + EXPECT_STRNE(fsi.source_path.c_str(), source_path2.c_str()); return api_error::success; }); @@ -248,9 +248,9 @@ TEST(open_file, write_with_incomplete_download) { EXPECT_CALL(um, store_resume) .Times(2) - .WillRepeatedly([&fsi](const i_open_file &o) { - EXPECT_EQ(fsi.api_path, o.get_api_path()); - EXPECT_EQ(fsi.source_path, o.get_source_path()); + .WillRepeatedly([&fsi](const i_open_file &cur_file) { + EXPECT_EQ(fsi.api_path, cur_file.get_api_path()); + EXPECT_EQ(fsi.source_path, cur_file.get_source_path()); }); data_buffer data = {10, 9, 8}; @@ -325,9 +325,9 @@ TEST(open_file, write_new_file) { EXPECT_EQ(fsi.api_path, api_path); }); - EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) { - EXPECT_EQ(fsi.api_path, o.get_api_path()); - EXPECT_EQ(fsi.source_path, o.get_source_path()); + EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) { + EXPECT_EQ(fsi.api_path, cur_file.get_api_path()); + EXPECT_EQ(fsi.source_path, cur_file.get_source_path()); }); std::size_t bytes_written{}; @@ -414,9 +414,9 @@ TEST(open_file, write_new_file_multiple_chunks) { EXPECT_EQ(fsi.api_path, api_path); }); - EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) { - EXPECT_EQ(fsi.api_path, o.get_api_path()); - EXPECT_EQ(fsi.source_path, o.get_source_path()); + EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) { + EXPECT_EQ(fsi.api_path, cur_file.get_api_path()); + EXPECT_EQ(fsi.source_path, cur_file.get_source_path()); }); std::size_t bytes_written{}; @@ -478,13 +478,13 @@ TEST(open_file, resize_file_to_0_bytes) { EXPECT_EQ(fsi.api_path, api_path); }); - EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) { - EXPECT_EQ(fsi.api_path, o.get_api_path()); - EXPECT_EQ(fsi.source_path, o.get_source_path()); + EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) { + EXPECT_EQ(fsi.api_path, cur_file.get_api_path()); + EXPECT_EQ(fsi.source_path, cur_file.get_source_path()); }); - EXPECT_CALL(um, store_resume).WillOnce([&fsi](const i_open_file &o) { - EXPECT_EQ(fsi.api_path, o.get_api_path()); - EXPECT_EQ(fsi.source_path, o.get_source_path()); + EXPECT_CALL(um, store_resume).WillOnce([&fsi](const i_open_file &cur_file) { + EXPECT_EQ(fsi.api_path, cur_file.get_api_path()); + EXPECT_EQ(fsi.source_path, cur_file.get_source_path()); }); EXPECT_EQ(api_error::success, o.resize(0u)); @@ -532,9 +532,9 @@ TEST(open_file, resize_file_by_full_chunk) { EXPECT_EQ(fsi.api_path, api_path); }); - EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &o) { - EXPECT_EQ(fsi.api_path, o.get_api_path()); - EXPECT_EQ(fsi.source_path, o.get_source_path()); + EXPECT_CALL(um, queue_upload).WillOnce([&fsi](const i_open_file &cur_file) { + EXPECT_EQ(fsi.api_path, cur_file.get_api_path()); + EXPECT_EQ(fsi.source_path, cur_file.get_source_path()); }); EXPECT_EQ(api_error::success, o.resize(test_chunk_size * 3u)); @@ -583,9 +583,9 @@ TEST(open_file, can_add_handle) { .WillOnce(Return(api_error::success)); EXPECT_CALL(um, remove_resume) .WillOnce( - [&fsi](const std::string &api_path, const std::string &source_path) { + [&fsi](const std::string &api_path, const std::string &source_path2) { EXPECT_EQ(fsi.api_path, api_path); - EXPECT_EQ(fsi.source_path, source_path); + EXPECT_EQ(fsi.source_path, source_path2); }); event_capture capture( @@ -642,9 +642,9 @@ TEST(open_file, can_remove_handle) { EXPECT_CALL(um, remove_resume) .WillOnce( - [&fsi](const std::string &api_path, const std::string &source_path) { + [&fsi](const std::string &api_path, const std::string &source_path2) { EXPECT_EQ(fsi.api_path, api_path); - EXPECT_EQ(fsi.source_path, source_path); + EXPECT_EQ(fsi.source_path, source_path2); }); EXPECT_CALL(mp, set_item_meta(fsi.api_path, META_SOURCE, _)) .WillOnce(Return(api_error::success)); diff --git a/tests/file_manager_test.cpp b/tests/file_manager_test.cpp index 16c2d63b..2bd558b0 100644 --- a/tests/file_manager_test.cpp +++ b/tests/file_manager_test.cpp @@ -461,10 +461,10 @@ TEST(file_manager, download_is_stored_after_write_if_partially_downloaded) { }); EXPECT_CALL(mp, set_item_meta("/test_write_partial_download.txt", _)) .WillOnce( - [](const std::string &, const api_meta_map &meta) -> api_error { - EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_CHANGED).empty())); - EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_MODIFIED).empty())); - EXPECT_NO_THROW(EXPECT_FALSE(meta.at(META_WRITTEN).empty())); + [](const std::string &, const api_meta_map &meta2) -> api_error { + EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_CHANGED).empty())); + EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_MODIFIED).empty())); + EXPECT_NO_THROW(EXPECT_FALSE(meta2.at(META_WRITTEN).empty())); return api_error::success; }); EXPECT_CALL(mp, upload_file).Times(0u); diff --git a/tests/fixtures/s3_provider_file_list_fixture.hpp b/tests/fixtures/s3_provider_file_list_fixture.hpp index 915931e8..df036017 100644 --- a/tests/fixtures/s3_provider_file_list_fixture.hpp +++ b/tests/fixtures/s3_provider_file_list_fixture.hpp @@ -113,8 +113,8 @@ public: const get_name_callback &get_name, const get_token_callback &get_token, api_file &file) { auto f = std::find_if(list.begin(), list.end(), - [&api_path](const auto &file) -> bool { - return file.api_path == api_path; + [&api_path](const auto &cur_file) -> bool { + return cur_file.api_path == api_path; }); if (f == list.end()) { return api_error::item_not_found; diff --git a/tests/lock_data_test.cpp b/tests/lock_data_test.cpp index b57faf77..53036198 100644 --- a/tests/lock_data_test.cpp +++ b/tests/lock_data_test.cpp @@ -30,8 +30,8 @@ TEST(lock_data, lock_and_unlock) { EXPECT_EQ(lock_result::success, l.grab_lock()); std::thread([]() { - lock_data l(provider_type::sia, "1"); - EXPECT_EQ(lock_result::locked, l.grab_lock(10)); + lock_data l2(provider_type::sia, "1"); + EXPECT_EQ(lock_result::locked, l2.grab_lock(10)); }).join(); } diff --git a/tests/packet_test.cpp b/tests/packet_test.cpp index 4c5b311f..6ebcf3da 100644 --- a/tests/packet_test.cpp +++ b/tests/packet_test.cpp @@ -25,16 +25,16 @@ namespace repertory { TEST(packet, encrypt_and_decrypt) { - packet packet; - packet.encode("test"); - packet.encrypt("moose"); + packet test_packet; + test_packet.encode("test"); + test_packet.encrypt("moose"); std::uint32_t size{}; - EXPECT_EQ(0, packet.decode(size)); - EXPECT_EQ(0, packet.decrypt("moose")); + EXPECT_EQ(0, test_packet.decode(size)); + EXPECT_EQ(0, test_packet.decrypt("moose")); std::string data; - EXPECT_EQ(0, packet.decode(data)); + EXPECT_EQ(0, test_packet.decode(data)); EXPECT_STREQ("test", data.c_str()); }