From ab0d4babe4e037474d8b1595008d3921e47b5c66 Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Sat, 19 Oct 2024 12:10:21 +0200 Subject: [PATCH] Remove obsolete convenience method --- cpp/base/memory_util.cpp | 9 --------- cpp/base/memory_util.h | 1 - cpp/devices/storage_device.cpp | 4 ++-- cpp/devices/tape.cpp | 7 ++----- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/cpp/base/memory_util.cpp b/cpp/base/memory_util.cpp index 0833dacb..1e45c88b 100644 --- a/cpp/base/memory_util.cpp +++ b/cpp/base/memory_util.cpp @@ -32,15 +32,6 @@ void memory_util::SetInt32(vector &buf, int offset, uint32_t value) template void memory_util::SetInt32(vector&, int, uint32_t); template void memory_util::SetInt32(vector&, int, uint32_t); -void memory_util::SetInt24(span buf, int offset, int value) -{ - assert(buf.size() > static_cast(offset) + 2); - - buf[offset] = static_cast(value >> 16); - buf[offset + 1] = static_cast(value >> 8); - buf[offset + 2] = static_cast(value); -} - int memory_util::GetInt24(span buf, int offset) { assert(buf.size() > static_cast(offset) + 2); diff --git a/cpp/base/memory_util.h b/cpp/base/memory_util.h index 30781cfa..65a6faa7 100644 --- a/cpp/base/memory_util.h +++ b/cpp/base/memory_util.h @@ -27,7 +27,6 @@ int GetInt16(const auto &buf, int offset) template void SetInt16(vector&, int, int); template void SetInt32(vector&, int, uint32_t); -void SetInt24(span, int, int); int GetInt24(span, int); int32_t GetSignedInt24(span, int); uint32_t GetInt32(span, int); diff --git a/cpp/devices/storage_device.cpp b/cpp/devices/storage_device.cpp index 11c76ad0..1e4f16ae 100644 --- a/cpp/devices/storage_device.cpp +++ b/cpp/devices/storage_device.cpp @@ -399,7 +399,7 @@ int StorageDevice::ModeSense6(cdb_t cdb, vector &buf) const // Short LBA mode parameter block descriptor (number of blocks and block length) SetInt32(buf, 4, static_cast(blocks <= 0xffffffff ? blocks : 0xffffffff)); - SetInt24(buf, 9, block_size); + SetInt32(buf, 8, block_size); size += 8; } @@ -443,7 +443,7 @@ int StorageDevice::ModeSense10(cdb_t cdb, vector &buf) const // Short LBA mode parameter block descriptor (number of blocks and block length) SetInt32(buf, 8, static_cast(blocks <= 0xffffffff ? blocks : 0xffffffff)); - SetInt24(buf, 13, block_size); + SetInt32(buf, 12, block_size); size += 8; } diff --git a/cpp/devices/tape.cpp b/cpp/devices/tape.cpp index 4b4f2b2d..a1ae2faa 100644 --- a/cpp/devices/tape.cpp +++ b/cpp/devices/tape.cpp @@ -370,13 +370,10 @@ void Tape::Erase6() void Tape::ReadBlockLimits() { - vector &buf = GetController()->GetBuffer(); - buf[0] = 0; - vector sorted_sizes = { GetSupportedBlockSizes().cbegin(), GetSupportedBlockSizes().cend() }; ranges::sort(sorted_sizes); - SetInt24(buf, 1, sorted_sizes.back()); - SetInt16(buf, 4, 4); + SetInt32(GetController()->GetBuffer(), 0, sorted_sizes.back()); + SetInt16(GetController()->GetBuffer(), 4, 4); DataInPhase(6); }