From f7ec0de834c8a6c2b1212fb8e33509a7d6b574e6 Mon Sep 17 00:00:00 2001 From: Uwe Seimet <48174652+uweseimet@users.noreply.github.com> Date: Sun, 7 Nov 2021 21:30:21 +0100 Subject: [PATCH] Fix clang warnings (#423) * Fixed clang compiler warnings * Removed unused code * Reset compiler --- src/raspberrypi/controllers/scsidev_ctrl.h | 24 ++++++++++---------- src/raspberrypi/devices/disk.h | 18 +++++++-------- src/raspberrypi/devices/sasihd.h | 2 +- src/raspberrypi/devices/scsi_daynaport.h | 2 +- src/raspberrypi/devices/scsi_host_bridge.cpp | 13 ----------- src/raspberrypi/devices/scsicd.h | 4 ++-- src/raspberrypi/devices/scsihd.h | 2 +- src/raspberrypi/devices/scsimo.h | 2 +- 8 files changed, 27 insertions(+), 40 deletions(-) diff --git a/src/raspberrypi/controllers/scsidev_ctrl.h b/src/raspberrypi/controllers/scsidev_ctrl.h index c0ce8db6..70d3f33e 100644 --- a/src/raspberrypi/controllers/scsidev_ctrl.h +++ b/src/raspberrypi/controllers/scsidev_ctrl.h @@ -88,14 +88,14 @@ public: SCSIDEV(); ~SCSIDEV(); - void Reset(); // Device Reset + void Reset() override; // External API - BUS::phase_t Process(); // Run + BUS::phase_t Process() override; // Other - bool IsSASI() const { return false; } // SASI Check - bool IsSCSI() const { return true; } // SCSI check + bool IsSASI() const override { return false; } + bool IsSCSI() const override { return true; } void Error(ERROR_CODES::sense_key sense_key = ERROR_CODES::sense_key::NO_SENSE, ERROR_CODES::asc asc = ERROR_CODES::asc::NO_ADDITIONAL_SENSE_INFORMATION) override; // Common error handling @@ -103,20 +103,20 @@ public: private: // Phase - void BusFree(); // Bus free phase - void Selection(); // Selection phase - void Execute(); // Execution phase + void BusFree() override; // Bus free phase + void Selection() override; // Selection phase + void Execute() override; // Execution phase void MsgOut(); // Message out phase // commands void CmdGetEventStatusNotification(); - void CmdModeSelect10(); // MODE SELECT(10) command - void CmdModeSense10(); // MODE SENSE(10) command + void CmdModeSelect10(); + void CmdModeSense10(); // Data transfer - void Send(); // Send data - void Receive(); // Receive data - bool XferMsg(DWORD msg); // Data transfer message + void Send() override; + void Receive() override; + bool XferMsg(DWORD msg); scsi_t scsi; // Internal data }; diff --git a/src/raspberrypi/devices/disk.h b/src/raspberrypi/devices/disk.h index 47e2a0f0..ccfa9c29 100644 --- a/src/raspberrypi/devices/disk.h +++ b/src/raspberrypi/devices/disk.h @@ -82,18 +82,18 @@ public: virtual void TestUnitReady(SASIDEV *) override; void Inquiry(SASIDEV *) override; void RequestSense(SASIDEV *) override; - void ModeSelect6(SASIDEV *); - void ModeSelect10(SASIDEV *); - void ModeSense6(SASIDEV *); - void ModeSense10(SASIDEV *); + void ModeSelect6(SASIDEV *) override; + void ModeSelect10(SASIDEV *) override; + void ModeSense6(SASIDEV *) override; + void ModeSense10(SASIDEV *) override; void Rezero(SASIDEV *); void FormatUnit(SASIDEV *) override; - void ReassignBlocks(SASIDEV *); - void StartStopUnit(SASIDEV *); - void SendDiagnostic(SASIDEV *); + void ReassignBlocks(SASIDEV *) override; + void StartStopUnit(SASIDEV *) override; + void SendDiagnostic(SASIDEV *) override; void PreventAllowMediumRemoval(SASIDEV *); - void SynchronizeCache10(SASIDEV *); - void SynchronizeCache16(SASIDEV *); + void SynchronizeCache10(SASIDEV *) override; + void SynchronizeCache16(SASIDEV *) override; void ReadDefectData10(SASIDEV *); virtual void Read6(SASIDEV *); void Read10(SASIDEV *) override; diff --git a/src/raspberrypi/devices/sasihd.h b/src/raspberrypi/devices/sasihd.h index 08f163fb..a553fcac 100644 --- a/src/raspberrypi/devices/sasihd.h +++ b/src/raspberrypi/devices/sasihd.h @@ -31,7 +31,7 @@ public: ~SASIHD() {}; void Reset(); - void Open(const Filepath& path); + void Open(const Filepath& path) override; // Commands int RequestSense(const DWORD *cdb, BYTE *buf) override; diff --git a/src/raspberrypi/devices/scsi_daynaport.h b/src/raspberrypi/devices/scsi_daynaport.h index 2c7edaf8..2a658d24 100644 --- a/src/raspberrypi/devices/scsi_daynaport.h +++ b/src/raspberrypi/devices/scsi_daynaport.h @@ -83,7 +83,7 @@ public: void SetMcastAddr(SASIDEV *); void EnableInterface(SASIDEV *); - bool Dispatch(SCSIDEV *); + bool Dispatch(SCSIDEV *) override; const int DAYNAPORT_BUFFER_SIZE = 0x1000000; diff --git a/src/raspberrypi/devices/scsi_host_bridge.cpp b/src/raspberrypi/devices/scsi_host_bridge.cpp index 1bb8b62f..99d56bcc 100644 --- a/src/raspberrypi/devices/scsi_host_bridge.cpp +++ b/src/raspberrypi/devices/scsi_host_bridge.cpp @@ -1066,10 +1066,8 @@ void SCSIBR::FS_GetCapacity(BYTE *buf) ASSERT(fs); ASSERT(buf); - int i = 0; DWORD *dp = (DWORD*)buf; DWORD nUnit = ntohl(*dp); - i += sizeof(DWORD); Human68k::capacity_t cap; fsresult = fs->GetCapacity(nUnit, &cap); @@ -1099,7 +1097,6 @@ void SCSIBR::FS_CtrlDrive(BYTE *buf) i += sizeof(DWORD); Human68k::ctrldrive_t *pCtrlDrive = (Human68k::ctrldrive_t*)&buf[i]; - i += sizeof(Human68k::ctrldrive_t); fsresult = fs->CtrlDrive(nUnit, pCtrlDrive); @@ -1117,10 +1114,8 @@ void SCSIBR::FS_GetDPB(BYTE *buf) ASSERT(fs); ASSERT(buf); - int i = 0; DWORD *dp = (DWORD*)buf; DWORD nUnit = ntohl(*dp); - i += sizeof(DWORD); Human68k::dpb_t dpb; fsresult = fs->GetDPB(nUnit, &dpb); @@ -1173,10 +1168,8 @@ void SCSIBR::FS_DiskWrite(BYTE *buf) ASSERT(fs); ASSERT(buf); - int i = 0; DWORD *dp = (DWORD*)buf; DWORD nUnit = ntohl(*dp); - i += sizeof(DWORD); fsresult = fs->DiskWrite(nUnit); } @@ -1238,10 +1231,8 @@ void SCSIBR::FS_Flush(BYTE *buf) ASSERT(fs); ASSERT(buf); - int i = 0; DWORD *dp = (DWORD*)buf; DWORD nUnit = ntohl(*dp); - i += sizeof(DWORD); fsresult = fs->Flush(nUnit); } @@ -1256,10 +1247,8 @@ void SCSIBR::FS_CheckMedia(BYTE *buf) ASSERT(fs); ASSERT(buf); - int i = 0; DWORD *dp = (DWORD*)buf; DWORD nUnit = ntohl(*dp); - i += sizeof(DWORD); fsresult = fs->CheckMedia(nUnit); } @@ -1274,10 +1263,8 @@ void SCSIBR::FS_Lock(BYTE *buf) ASSERT(fs); ASSERT(buf); - int i = 0; DWORD *dp = (DWORD*)buf; DWORD nUnit = ntohl(*dp); - i += sizeof(DWORD); fsresult = fs->Lock(nUnit); } diff --git a/src/raspberrypi/devices/scsicd.h b/src/raspberrypi/devices/scsicd.h index 7e738b15..4b6d4387 100644 --- a/src/raspberrypi/devices/scsicd.h +++ b/src/raspberrypi/devices/scsicd.h @@ -108,8 +108,8 @@ private: void OpenIso(const Filepath& path); // Open(ISO) void OpenPhysical(const Filepath& path); // Open(Physical) - void ReadToc(SASIDEV *); - void GetEventStatusNotification(SASIDEV *); + void ReadToc(SASIDEV *) override; + void GetEventStatusNotification(SASIDEV *) override; void LBAtoMSF(DWORD lba, BYTE *msf) const; // LBA→MSF conversion diff --git a/src/raspberrypi/devices/scsihd.h b/src/raspberrypi/devices/scsihd.h index ac4cc0a2..7bafb2f9 100644 --- a/src/raspberrypi/devices/scsihd.h +++ b/src/raspberrypi/devices/scsihd.h @@ -28,7 +28,7 @@ public: void FinalizeSetup(const Filepath&, off_t); void Reset(); - virtual void Open(const Filepath&); + virtual void Open(const Filepath&) override; // Commands virtual int Inquiry(const DWORD *cdb, BYTE *buf) override; diff --git a/src/raspberrypi/devices/scsimo.h b/src/raspberrypi/devices/scsimo.h index 5530bad7..3ed4738c 100644 --- a/src/raspberrypi/devices/scsimo.h +++ b/src/raspberrypi/devices/scsimo.h @@ -25,7 +25,7 @@ public: SCSIMO(); ~SCSIMO() {}; - void Open(const Filepath& path); + void Open(const Filepath& path) override; // Commands int Inquiry(const DWORD *cdb, BYTE *buf) override;