From 3c5c81df0de0bccb194ab68eac29f49979cf9bfb Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Mon, 9 Nov 2020 18:20:50 -0330 Subject: [PATCH] A few more fixes for suggestions from clang static analyzer. --- src/emucore/CartEnhanced.cxx | 4 ++-- src/gui/InputDialog.cxx | 3 ++- src/gui/VideoAudioDialog.cxx | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/emucore/CartEnhanced.cxx b/src/emucore/CartEnhanced.cxx index e24d5a5b7..22eb63ee7 100644 --- a/src/emucore/CartEnhanced.cxx +++ b/src/emucore/CartEnhanced.cxx @@ -93,7 +93,7 @@ void CartridgeEnhanced::install(System& system) // Set the page accessing method for the RAM writing pages // Note: Writes are mapped to poke() (NOT using direcPokeBase) to check for read from write port (RWP) access.type = System::PageAccessType::WRITE; - for(uInt16 addr = ROM_OFFSET + myWriteOffset; addr < ROM_OFFSET + myWriteOffset + myRamSize; addr += System::PAGE_SIZE) + for(size_t addr = ROM_OFFSET + myWriteOffset; addr < ROM_OFFSET + myWriteOffset + myRamSize; addr += System::PAGE_SIZE) { const uInt16 offset = addr & myRamMask; @@ -105,7 +105,7 @@ void CartridgeEnhanced::install(System& system) // Set the page accessing method for the RAM reading pages access.type = System::PageAccessType::READ; - for(uInt16 addr = ROM_OFFSET + myReadOffset; addr < ROM_OFFSET + myReadOffset + myRamSize; addr += System::PAGE_SIZE) + for(size_t addr = ROM_OFFSET + myReadOffset; addr < ROM_OFFSET + myReadOffset + myRamSize; addr += System::PAGE_SIZE) { const uInt16 offset = addr & myRamMask; diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index d5d847f1b..82dae982a 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -672,7 +672,8 @@ void InputDialog::handleCommand(CommandSender* sender, int cmd, break; case kPSpeedChanged: - myPaddleSpeed->setValueLabel(Paddles::setAnalogSensitivity(myPaddleSpeed->getValue()) * 100.F + 0.5F); + myPaddleSpeed->setValueLabel(std::round(Paddles::setAnalogSensitivity( + myPaddleSpeed->getValue()) * 100.F)); break; case kDejitterAvChanged: diff --git a/src/gui/VideoAudioDialog.cxx b/src/gui/VideoAudioDialog.cxx index 47c955b94..f68be6df8 100644 --- a/src/gui/VideoAudioDialog.cxx +++ b/src/gui/VideoAudioDialog.cxx @@ -631,7 +631,7 @@ void VideoAudioDialog::loadConfig() myVolumeSlider->setValue(audioSettings.volume()); // Device - uInt32 deviceId = BSPF::clamp(audioSettings.device(), 0u, + uInt32 deviceId = BSPF::clamp(audioSettings.device(), 0U, uInt32(instance().sound().supportedDevices().size() - 1)); myDevicePopup->setSelected(deviceId);