diff --git a/cpp/controllers/abstract_controller.h b/cpp/controllers/abstract_controller.h index ec054840..18f6f8cf 100644 --- a/cpp/controllers/abstract_controller.h +++ b/cpp/controllers/abstract_controller.h @@ -143,20 +143,16 @@ class AbstractController : public PhaseHandler private: - array cdb = { }; + array cdb = { }; // Shared transfer data buffer, dynamically resized inline static auto buffer = vector(512); - // Transfer offset int offset = 0; - // Total remaining bytes to be transferred, updated during the transfer int remaining_length = 0; - // Remaining bytes to be transferred in a single handshake cycle int current_length = 0; - // The number of bytes to be transferred with the current handshake cycle int chunk_size = 0; diff --git a/cpp/devices/host_services.cpp b/cpp/devices/host_services.cpp index 97dc16fe..5794c52a 100644 --- a/cpp/devices/host_services.cpp +++ b/cpp/devices/host_services.cpp @@ -215,7 +215,7 @@ int HostServices::ModeSense6(cdb_t cdb, data_in_t buf) const throw ScsiException(SenseKey::ILLEGAL_REQUEST, Asc::INVALID_FIELD_IN_CDB); } - const int length = min(static_cast(buf.size()), static_cast(cdb[4])); + const int length = min(static_cast(buf.size()), cdb[4]); fill_n(buf.begin(), length, 0); const int size = page_handler->AddModePages(cdb, buf, 4, length, 255); diff --git a/cpp/devices/storage_device.cpp b/cpp/devices/storage_device.cpp index 23f2b91e..7f269a0d 100644 --- a/cpp/devices/storage_device.cpp +++ b/cpp/devices/storage_device.cpp @@ -379,7 +379,7 @@ int StorageDevice::ModeSense6(cdb_t cdb, data_in_t buf) const throw ScsiException(SenseKey::ILLEGAL_REQUEST, Asc::INVALID_FIELD_IN_CDB); } - const int length = min(static_cast(buf.size()), static_cast(cdb[4])); + const int length = min(static_cast(buf.size()), cdb[4]); fill_n(buf.begin(), length, 0); int size = 0; diff --git a/cpp/shared/s2p_defs.h b/cpp/shared/s2p_defs.h index b3dd5bec..1be38ab6 100644 --- a/cpp/shared/s2p_defs.h +++ b/cpp/shared/s2p_defs.h @@ -29,7 +29,7 @@ enum class ProtobufFormat }; // Command Descriptor Block -using cdb_t = span; +using cdb_t = span; using data_in_t = span; using data_out_t = span; diff --git a/cpp/test/disk_test.cpp b/cpp/test/disk_test.cpp index 98fd657c..fd46aa68 100644 --- a/cpp/test/disk_test.cpp +++ b/cpp/test/disk_test.cpp @@ -661,7 +661,7 @@ TEST(DiskTest, WriteData) { MockDisk disk; - EXPECT_THAT([&] {disk.WriteData( vector {static_cast(ScsiCommand::WRITE_6)}, {}, 0, 0);}, Throws(AllOf( + EXPECT_THAT([&] {disk.WriteData( vector {static_cast(ScsiCommand::WRITE_6)}, {}, 0, 0);}, Throws(AllOf( Property(&ScsiException::get_sense_key, SenseKey::NOT_READY), Property(&ScsiException::get_asc, Asc::MEDIUM_NOT_PRESENT)))) << "Disk is not ready"; } diff --git a/cpp/test/test_shared.cpp b/cpp/test/test_shared.cpp index 776fda06..5a2b9155 100644 --- a/cpp/test/test_shared.cpp +++ b/cpp/test/test_shared.cpp @@ -32,11 +32,11 @@ pair, shared_ptr> testing::Cre return {controller, device}; } -vector testing::CreateCdb(ScsiCommand cmd, const string &hex) +vector testing::CreateCdb(ScsiCommand cmd, const string &hex) { - vector cdb; - cdb.emplace_back(static_cast(cmd)); - ranges::transform(HexToBytes(hex), back_inserter(cdb), [](const byte b) {return static_cast(b);}); + vector cdb; + cdb.emplace_back(static_cast(cmd)); + ranges::transform(HexToBytes(hex), back_inserter(cdb), [](const byte b) {return static_cast(b);}); if (CommandMetaData::Instance().GetByteCount(cmd)) { cdb.resize(CommandMetaData::Instance().GetByteCount(cmd)); } diff --git a/cpp/test/test_shared.h b/cpp/test/test_shared.h index 1f338bd0..4e805cba 100644 --- a/cpp/test/test_shared.h +++ b/cpp/test/test_shared.h @@ -26,7 +26,7 @@ namespace testing pair, shared_ptr> CreateDevice(PbDeviceType, int lun = 0, const string& = ""); -vector CreateCdb(ScsiCommand, const string& = ""); +vector CreateCdb(ScsiCommand, const string& = ""); vector CreateParameters(const string&); string CreateImageFile(StorageDevice&, size_t = 4096, const string& = "");