Skip to content

Commit

Permalink
Use span references
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Sep 7, 2023
1 parent 58f460a commit 60777b3
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cpp/devices/ctapdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,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<uint8_t> data) {
uint32_t CTapDriver::Crc32(const span<uint8_t>& data) {
uint32_t crc = 0xffffffff;
for (const auto d: data) {
crc ^= d;
Expand Down
2 changes: 1 addition & 1 deletion cpp/devices/ctapdriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t>);
static uint32_t Crc32(const span<uint8_t>&);

private:
array<byte, 6> m_MacAddr; // MAC Address
Expand Down
2 changes: 1 addition & 1 deletion cpp/devices/primary_device.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ vector<byte> PrimaryDevice::HandleRequestSense() const
return buf;
}

bool PrimaryDevice::WriteByteSequence(const span<uint8_t>)
bool PrimaryDevice::WriteByteSequence(const span<uint8_t>&)
{
GetLogger().Error("Writing bytes is not supported by this device");

Expand Down
2 changes: 1 addition & 1 deletion cpp/devices/primary_device.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class PrimaryDevice: private ScsiPrimaryCommands, public Device

void SetController(shared_ptr<AbstractController>);

virtual bool WriteByteSequence(const span<uint8_t>);
virtual bool WriteByteSequence(const span<uint8_t>&);

int GetSendDelay() const { return send_delay; }

Expand Down
2 changes: 1 addition & 1 deletion cpp/devices/scsi_printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void SCSIPrinter::SynchronizeBuffer()
EnterStatusPhase();
}

bool SCSIPrinter::WriteByteSequence(const span<uint8_t> buf)
bool SCSIPrinter::WriteByteSequence(const span<uint8_t>& buf)
{
if (!out.is_open()) {
vector<char> f(file_template.begin(), file_template.end());
Expand Down
2 changes: 1 addition & 1 deletion cpp/devices/scsi_printer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class SCSIPrinter : public PrimaryDevice, private ScsiPrinterCommands

vector<uint8_t> InquiryInternal() const override;

bool WriteByteSequence(const span<uint8_t>) override;
bool WriteByteSequence(const span<uint8_t>&) override;

private:

Expand Down

0 comments on commit 60777b3

Please sign in to comment.