mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-02 11:41:34 +00:00
Cleanup sonarcloud issues
This commit is contained in:
parent
b17ab75c6d
commit
60e1434e2b
|
@ -78,7 +78,7 @@ const std::string *SBC_Version::GetString()
|
|||
case sbc_bananapi_m4:
|
||||
return &m_str_bananapi_m4;
|
||||
default:
|
||||
LOGERROR("Unknown type of sbc detected: %d", m_sbc_version);
|
||||
LOGERROR("Unknown type of sbc detected: %d", m_sbc_version)
|
||||
return &m_str_unknown_sbc;
|
||||
}
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ void SBC_Version::Init()
|
|||
const std::ifstream input_stream(SBC_Version::m_device_tree_model_path);
|
||||
|
||||
if (input_stream.fail()) {
|
||||
LOGERROR("Failed to open %s. Are you running as root?", SBC_Version::m_device_tree_model_path.c_str());
|
||||
LOGERROR("Failed to open %s. Are you running as root?", SBC_Version::m_device_tree_model_path.c_str())
|
||||
throw std::runtime_error("Failed to open /proc/device-tree/model");
|
||||
}
|
||||
|
||||
|
@ -113,11 +113,11 @@ void SBC_Version::Init()
|
|||
for (const auto &[key, value] : m_proc_device_tree_mapping) {
|
||||
if (device_tree_model.rfind(key, 0) == 0) {
|
||||
m_sbc_version = value;
|
||||
LOGINFO("Detected device %s", GetString()->c_str());
|
||||
LOGINFO("Detected device %s", GetString()->c_str())
|
||||
return;
|
||||
}
|
||||
}
|
||||
LOGERROR("%s Unable to determine single board computer type. Defaulting to Raspberry Pi 4", __PRETTY_FUNCTION__);
|
||||
LOGERROR("%s Unable to determine single board computer type. Defaulting to Raspberry Pi 4", __PRETTY_FUNCTION__)
|
||||
m_sbc_version = sbc_version_type::sbc_raspberry_pi_4;
|
||||
}
|
||||
|
||||
|
@ -167,8 +167,8 @@ DWORD SBC_Version::GetDeviceTreeRanges(const char *filename, DWORD offset)
|
|||
DWORD address = ~0;
|
||||
if (FILE *fp = fopen(filename, "rb"); fp) {
|
||||
fseek(fp, offset, SEEK_SET);
|
||||
if (BYTE buf[4]; fread(buf, 1, sizeof buf, fp) == sizeof buf) {
|
||||
address = buf[0] << 24 | buf[1] << 16 | buf[2] << 8 | buf[3] << 0;
|
||||
if (std::array<BYTE, 4> buf; fread(buf.data(), 1, buf.size(), fp) == buf.size()) {
|
||||
address = (int)buf[0] << 24 | (int)buf[1] << 16 | (int)buf[2] << 8 | (int)buf[3] << 0;
|
||||
}
|
||||
fclose(fp);
|
||||
}
|
||||
|
@ -178,14 +178,14 @@ DWORD SBC_Version::GetDeviceTreeRanges(const char *filename, DWORD offset)
|
|||
#if defined __linux__
|
||||
DWORD SBC_Version::GetPeripheralAddress(void)
|
||||
{
|
||||
LOGTRACE("%s", __PRETTY_FUNCTION__);
|
||||
LOGTRACE("%s", __PRETTY_FUNCTION__)
|
||||
DWORD address = GetDeviceTreeRanges("/proc/device-tree/soc/ranges", 4);
|
||||
if (address == 0) {
|
||||
address = GetDeviceTreeRanges("/proc/device-tree/soc/ranges", 8);
|
||||
}
|
||||
address = (address == (DWORD)~0) ? 0x20000000 : address;
|
||||
|
||||
LOGDEBUG("Peripheral address : 0x%8x\n", address);
|
||||
LOGDEBUG("Peripheral address : 0x%8x\n", address)
|
||||
|
||||
return address;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ class SysTimer_AllWinner : public PlatformSpecificTimer
|
|||
static const uint32_t HS_TMR_CLK_PRE_SCALE_2 = (1 << 4);
|
||||
static const uint32_t HS_TMR_CLK_PRE_SCALE_4 = (2 << 4);
|
||||
static const uint32_t HS_TMR_CLK_PRE_SCALE_8 = (3 << 4);
|
||||
static const uint32_t HS_TMR_CLK_PRE_SCALE_16 = (4 << 4);
|
||||
static const uint32_t HS_TMR_CLK_PRE_SCALE_16 = (4 << 4); //NOSONAR This matches the datasheet
|
||||
static const uint32_t HS_TMR_MODE_SINGLE = (1 << 7);
|
||||
static const uint32_t HS_TMR_TEST_MODE = (1 << 31);
|
||||
|
||||
|
|
|
@ -68,8 +68,8 @@ string access_token;
|
|||
DeviceFactory device_factory;
|
||||
shared_ptr<ControllerManager> controller_manager;
|
||||
RascsiImage rascsi_image;
|
||||
shared_ptr<RascsiResponse> rascsi_response; //(device_factory, controller_manager, ScsiController::LUN_MAX);
|
||||
shared_ptr<RascsiExecutor> executor; //(rascsi_response, rascsi_image, device_factory, controller_manager);
|
||||
shared_ptr<RascsiResponse> rascsi_response;
|
||||
shared_ptr<RascsiExecutor> executor;
|
||||
const ProtobufSerializer serializer;
|
||||
|
||||
void Banner(int argc, char* argv[])
|
||||
|
|
|
@ -138,10 +138,10 @@ class MockAbstractController : public AbstractController // NOSONAR Having many
|
|||
}
|
||||
~MockAbstractController() override = default;
|
||||
|
||||
vector<int> &InitCmd(int size)
|
||||
vector<int> &InitCmd(int size) // NOSONAR Hides function on purpose
|
||||
{
|
||||
return AbstractController::InitCmd(size);
|
||||
} // NOSONAR Hides function on purpose
|
||||
}
|
||||
};
|
||||
|
||||
class MockScsiController : public ScsiController
|
||||
|
|
Loading…
Reference in New Issue
Block a user