Code cleanup, especially casts, lambdas, data types, encapsulation (#952)

* Unit test updates

* Lambda syntax cleanup

* Use new-style casts

* Use std::none_of when saving the cache

* Use to_integer instead of casts

* Use accessors for getting CDB data

* Made ctrl_t private

* Improved encapsulation

* Replaced pointers by references

* Removed all remaining occurrences of DWORD and BYTE, making os.h obsolete
This commit is contained in:
Uwe Seimet
2022-11-02 07:36:25 +01:00
committed by GitHub
parent 85edd50047
commit 621cc7d5a2
88 changed files with 1059 additions and 1054 deletions
+3 -3
View File
@@ -91,7 +91,7 @@ TEST(ScsiPrinterTest, Print)
cmd[3] = 0xff;
cmd[4] = 0xff;
EXPECT_THAT([&printer]() { printer->Dispatch(scsi_command::eCmdPrint); }, Throws<scsi_exception>(AllOf(
EXPECT_THAT([&] { printer->Dispatch(scsi_command::eCmdPrint); }, Throws<scsi_exception>(AllOf(
Property(&scsi_exception::get_sense_key, sense_key::ILLEGAL_REQUEST),
Property(&scsi_exception::get_asc, asc::INVALID_FIELD_IN_CDB))))
<< "Buffer overflow was not reported";
@@ -112,7 +112,7 @@ TEST(ScsiPrinterTest, SynchronizeBuffer)
NiceMock<MockAbstractController> controller(make_shared<MockBus>(), 0);
auto printer = CreateDevice(SCLP, controller);
EXPECT_THAT([&printer]() { printer->Dispatch(scsi_command::eCmdSynchronizeBuffer); }, Throws<scsi_exception>(AllOf(
EXPECT_THAT([&] { printer->Dispatch(scsi_command::eCmdSynchronizeBuffer); }, Throws<scsi_exception>(AllOf(
Property(&scsi_exception::get_sense_key, sense_key::ABORTED_COMMAND),
Property(&scsi_exception::get_asc, asc::NO_ADDITIONAL_SENSE_INFORMATION))))
<< "Nothing to print";
@@ -125,7 +125,7 @@ TEST(ScsiPrinterTest, WriteByteSequence)
NiceMock<MockAbstractController> controller(make_shared<MockBus>(), 0);
auto printer = dynamic_pointer_cast<SCSIPrinter>(CreateDevice(SCLP, controller));
vector<BYTE> buf(1);
vector<uint8_t> buf(1);
EXPECT_TRUE(printer->WriteByteSequence(buf, buf.size()));
printer->Cleanup();
}