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
+5 -5
View File
@@ -65,8 +65,8 @@ TEST(ScsiMoTest, TestAddVendorPage)
EXPECT_EQ(1, pages.size()) << "Unexpected number of mode pages";
vector<byte>& page_32 = pages[32];
EXPECT_EQ(12, page_32.size());
EXPECT_EQ(0, (int)page_32[2]) << "Wrong format mode";
EXPECT_EQ(0, (int)page_32[3]) << "Wrong format type";
EXPECT_EQ(0, to_integer<int>(page_32[2])) << "Wrong format mode";
EXPECT_EQ(0, to_integer<int>(page_32[3])) << "Wrong format type";
EXPECT_EQ(0x12345678, GetInt32(page_32, 4)) << "Wrong number of blocks";
EXPECT_EQ(0, GetInt16(page_32, 8)) << "Wrong number of spare blocks";
EXPECT_EQ(0, GetInt16(page_32, 10));
@@ -116,8 +116,8 @@ TEST(ScsiMoTest, TestAddVendorPage)
// Changeable page
mo.SetUpModePages(pages, 0x20, true);
EXPECT_EQ(0, (int)page_32[2]);
EXPECT_EQ(0, (int)page_32[3]);
EXPECT_EQ(0, to_integer<int>(page_32[2]));
EXPECT_EQ(0, to_integer<int>(page_32[3]));
EXPECT_EQ(0, GetInt32(page_32, 4));
EXPECT_EQ(0, GetInt16(page_32, 8));
EXPECT_EQ(0, GetInt16(page_32, 10));
@@ -128,7 +128,7 @@ TEST(ScsiMoTest, ModeSelect)
const unordered_set<uint32_t> sector_sizes = { 1024, 2048 };
MockSCSIMO mo(0, sector_sizes);
vector<int> cmd(10);
vector<BYTE> buf(255);
vector<uint8_t> buf(255);
mo.SetSectorSizeInBytes(2048);