From 04bc65f91ec8f39476a8ecd30a611fbbbb20221e Mon Sep 17 00:00:00 2001 From: Uwe Seimet Date: Thu, 7 Sep 2023 10:26:37 +0200 Subject: [PATCH] Use span references --- cpp/devices/ctapdriver.cpp | 2 +- cpp/devices/ctapdriver.h | 2 +- cpp/devices/primary_device.cpp | 2 +- cpp/devices/primary_device.h | 2 +- cpp/devices/scsi_printer.cpp | 2 +- cpp/devices/scsi_printer.h | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cpp/devices/ctapdriver.cpp b/cpp/devices/ctapdriver.cpp index e8815bf6f1..31451bc743 100644 --- a/cpp/devices/ctapdriver.cpp +++ b/cpp/devices/ctapdriver.cpp @@ -434,7 +434,7 @@ bool CTapDriver::PendingPackets() const } // See https://stackoverflow.com/questions/21001659/crc32-algorithm-implementation-in-c-without-a-look-up-table-and-with-a-public-li -uint32_t CTapDriver::Crc32(const span data) { +uint32_t CTapDriver::Crc32(const span& data) { uint32_t crc = 0xffffffff; for (const auto d: data) { crc ^= d; diff --git a/cpp/devices/ctapdriver.h b/cpp/devices/ctapdriver.h index bd0554b9b6..c9e10006cf 100644 --- a/cpp/devices/ctapdriver.h +++ b/cpp/devices/ctapdriver.h @@ -42,7 +42,7 @@ class CTapDriver bool Disable() const; // Disable the piscsi0 interface void Flush(); // Purge all of the packets that are waiting to be processed - static uint32_t Crc32(const span); + static uint32_t Crc32(const span&); private: array m_MacAddr; // MAC Address diff --git a/cpp/devices/primary_device.cpp b/cpp/devices/primary_device.cpp index 2ce0e4ca55..cc620d3d66 100644 --- a/cpp/devices/primary_device.cpp +++ b/cpp/devices/primary_device.cpp @@ -262,7 +262,7 @@ vector PrimaryDevice::HandleRequestSense() const return buf; } -bool PrimaryDevice::WriteByteSequence(const span) +bool PrimaryDevice::WriteByteSequence(const span&) { GetLogger().Error("Writing bytes is not supported by this device"); diff --git a/cpp/devices/primary_device.h b/cpp/devices/primary_device.h index 9bbd80316a..f1b8fb05e1 100644 --- a/cpp/devices/primary_device.h +++ b/cpp/devices/primary_device.h @@ -41,7 +41,7 @@ class PrimaryDevice: private ScsiPrimaryCommands, public Device void SetController(shared_ptr); - virtual bool WriteByteSequence(const span); + virtual bool WriteByteSequence(const span&); int GetSendDelay() const { return send_delay; } diff --git a/cpp/devices/scsi_printer.cpp b/cpp/devices/scsi_printer.cpp index f0a6daedf4..e5dfdd25c6 100644 --- a/cpp/devices/scsi_printer.cpp +++ b/cpp/devices/scsi_printer.cpp @@ -134,7 +134,7 @@ void SCSIPrinter::SynchronizeBuffer() EnterStatusPhase(); } -bool SCSIPrinter::WriteByteSequence(const span buf) +bool SCSIPrinter::WriteByteSequence(const span& buf) { if (!out.is_open()) { vector f(file_template.begin(), file_template.end()); diff --git a/cpp/devices/scsi_printer.h b/cpp/devices/scsi_printer.h index ac93ac5932..5cf68dbf20 100644 --- a/cpp/devices/scsi_printer.h +++ b/cpp/devices/scsi_printer.h @@ -34,7 +34,7 @@ class SCSIPrinter : public PrimaryDevice, private ScsiPrinterCommands vector InquiryInternal() const override; - bool WriteByteSequence(const span) override; + bool WriteByteSequence(const span&) override; private: