Final batch of fixes from clang-tidy (for now).

This commit is contained in:
Stephen Anthony 2022-08-21 19:33:08 -02:30
parent c64277346a
commit 19da02fb9c
114 changed files with 290 additions and 249 deletions

View File

@ -128,7 +128,7 @@ void CheatCodeDialog::loadConfig()
for(const auto& c: list)
{
l.push_back(c->name());
b.push_back(bool(c->enabled()));
b.push_back(c->enabled());
}
myCheatList->setList(l, b);

View File

@ -39,7 +39,7 @@ namespace {
numericResamplingQuality <= static_cast<int>(AudioSettings::ResamplingQuality::lanczos_3)
) ? static_cast<AudioSettings::ResamplingQuality>(numericResamplingQuality) : AudioSettings::DEFAULT_RESAMPLING_QUALITY;
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AudioSettings::AudioSettings(Settings& settings)

View File

@ -126,4 +126,4 @@ Base::Fmt Base::myDefaultBase = Base::Fmt::_16;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
std::ios_base::fmtflags Base::myHexflags = std::ios_base::hex; // NOLINT
} // Namespace Common
} // namespace Common

View File

@ -30,7 +30,8 @@ EventHandlerSDL2::EventHandlerSDL2(OSystem& osystem)
#ifdef GUI_SUPPORT
{
ostringstream buf;
myQwertz = int{'y'} == static_cast<int>(SDL_GetKeyFromScancode(SDL_Scancode(KBDK_Z)));
myQwertz = int{'y'} == static_cast<int>
(SDL_GetKeyFromScancode(static_cast<SDL_Scancode>(KBDK_Z)));
buf << "Keyboard: " << (myQwertz ? "QWERTZ" : "QWERTY");
Logger::debug(buf.str());
}

View File

@ -357,8 +357,8 @@ bool FBBackendSDL2::adaptRefreshRate(Int32 displayIndex,
const int wantedRefreshRate =
myOSystem.hasConsole() ? myOSystem.console().gameRefreshRate() : 0;
// Take care of rounded refresh rates (e.g. 59.94 Hz)
float factor = std::min(float(currentRefreshRate) / wantedRefreshRate,
float(currentRefreshRate) / (wantedRefreshRate - 1));
float factor = std::min(
static_cast<float>(currentRefreshRate) / wantedRefreshRate, static_cast<float>(currentRefreshRate) / (wantedRefreshRate - 1));
// Calculate difference taking care of integer factors (e.g. 100/120)
float bestDiff = std::abs(factor - std::round(factor)) / factor;
bool adapt = false;
@ -377,8 +377,9 @@ bool FBBackendSDL2::adaptRefreshRate(Int32 displayIndex,
Logger::error("ERROR: Closest display mode could not be retrieved");
return adapt;
}
factor = std::min(float(sdlMode.refresh_rate) / sdlMode.refresh_rate,
float(sdlMode.refresh_rate) / (sdlMode.refresh_rate - 1));
factor = std::min(
static_cast<float>(sdlMode.refresh_rate) / sdlMode.refresh_rate,
static_cast<float>(sdlMode.refresh_rate) / (sdlMode.refresh_rate - 1));
const float diff = std::abs(factor - std::round(factor)) / factor;
if(diff < bestDiff)
{

View File

@ -38,7 +38,7 @@ namespace {
throw runtime_error("unreachable");
}
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBSurfaceSDL2::FBSurfaceSDL2(FBBackendSDL2& backend,

View File

@ -39,7 +39,7 @@ FSNodeZIP::FSNodeZIP(const string& p)
if (_zipFile[0] == '~')
{
#if defined(BSPF_UNIX) || defined(BSPF_MACOS)
const char* home = std::getenv("HOME");
const char* home = std::getenv("HOME"); // NOLINT (not thread safe)
if (home != nullptr)
_zipFile.replace(0, 1, home);
#elif defined(BSPF_WINDOWS)

View File

@ -263,4 +263,5 @@ class HighScoresManager
HighScoresManager& operator=(const HighScoresManager&) = delete;
HighScoresManager& operator=(HighScoresManager&&) = delete;
};
#endif

View File

@ -298,18 +298,18 @@ json JoyMap::convertLegacyMapping(string list)
{
json eventMapping = json::object();
eventMapping["event"] = Event::Type(event);
eventMapping["event"] = static_cast<Event::Type>(event);
if(button != JOY_CTRL_NONE) eventMapping["button"] = button;
if(static_cast<JoyAxis>(axis) != JoyAxis::NONE) {
eventMapping["axis"] = JoyAxis(axis);
eventMapping["axisDirection"] = JoyDir(adir);
eventMapping["axis"] = static_cast<JoyAxis>(axis);
eventMapping["axisDirection"] = static_cast<JoyDir>(adir);
}
if(hat != -1) {
eventMapping["hat"] = hat;
eventMapping["hatDirection"] = JoyHatDir(hdir);
eventMapping["hatDirection"] = static_cast<JoyHatDir>(hdir);
}
eventMappings.push_back(eventMapping);

View File

@ -66,7 +66,7 @@ namespace {
return mask;
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void KeyMap::add(const Event::Type event, const Mapping& mapping)
@ -301,11 +301,11 @@ json KeyMap::convertLegacyMapping(string list)
{
json mapping = json::object();
mapping["event"] = Event::Type(event);
mapping["key"] = StellaKey(key);
mapping["event"] = static_cast<Event::Type>(event);
mapping["key"] = static_cast<StellaKey>(key);
if(StellaMod(mod) != StellaMod::KBDM_NONE)
mapping["mod"] = serializeModkeyMask(StellaMod(mod));
if(static_cast<StellaMod>(mod) != StellaMod::KBDM_NONE)
mapping["mod"] = serializeModkeyMask(static_cast<StellaMod>(mod));
convertedMapping.push_back(mapping);
}

View File

@ -287,6 +287,6 @@ class LinkedObjectPool
LinkedObjectPool& operator=(LinkedObjectPool&&) = delete;
};
} // Namespace Common
} // namespace Common
#endif

View File

@ -46,7 +46,7 @@ PaletteHandler::PaletteType PaletteHandler::toPaletteType(const string& name) co
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string PaletteHandler::toPaletteName(PaletteType type)
{
const string SETTING_NAMES[int(PaletteType::NumTypes)] = {
const string SETTING_NAMES[static_cast<int>(PaletteType::NumTypes)] = {
SETTING_STANDARD, SETTING_Z26, SETTING_USER, SETTING_CUSTOM
};
@ -321,12 +321,13 @@ void PaletteHandler::setPalette()
// Look at all the palettes, since we don't know which one is
// currently active
static constexpr BSPF::array2D<const PaletteArray*, PaletteType::NumTypes, int(ConsoleTiming::numTimings)> palettes = {{
static constexpr BSPF::array2D<const PaletteArray*, PaletteType::NumTypes,
static_cast<int>(ConsoleTiming::numTimings)> palettes = {{
{ &ourNTSCPalette, &ourPALPalette, &ourSECAMPalette },
{ &ourNTSCPaletteZ26, &ourPALPaletteZ26, &ourSECAMPaletteZ26 },
{ &ourUserNTSCPalette, &ourUserPALPalette, &ourUserSECAMPalette },
{ &ourCustomNTSCPalette, &ourCustomPALPalette, &ourSECAMPalette }
}};
}};
// See which format we should be using
const ConsoleTiming timing = myOSystem.console().timing();
const PaletteType paletteType = toPaletteType(name);

View File

@ -39,7 +39,7 @@ namespace {
return result;
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PhysicalJoystick::initialize(int index, const string& desc,

View File

@ -186,6 +186,6 @@ public:
}
};
} // End of namespace Common
} // namespace Common
#endif

View File

@ -469,7 +469,7 @@ IntArray RewindManager::cyclesList() const
const uInt64 firstCycle = getFirstCycles();
// NOLINTNEXTLINE (TODO: convert myStateList to use range-for)
for(auto it = myStateList.cbegin(); it != myStateList.cend(); ++it)
arr.push_back(uInt32(it->cycles - firstCycle));
arr.push_back(static_cast<uInt32>(it->cycles - firstCycle));
return arr;
}

View File

@ -79,6 +79,6 @@ class FixedStack
FixedStack& operator=(FixedStack&&) = delete;
};
} // Namespace Common
} // namespace Common
#endif

View File

@ -33,7 +33,7 @@ namespace {
return formattedTime.data();
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StaggeredLogger::StaggeredLogger(const string& message, Logger::Level level)

View File

@ -40,6 +40,6 @@ void removeAt(vector<T>& dst, uInt32 idx)
dst.erase(dst.cbegin()+idx);
}
} // Namespace Vec
} // namespace Vec
#endif

View File

@ -50,7 +50,7 @@ namespace {
return sinc(x) * sinc(x / static_cast<float>(a));
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
LanczosResampler::LanczosResampler(
@ -72,9 +72,9 @@ LanczosResampler::LanczosResampler(
myPrecomputedKernelCount{reducedDenominator(formatFrom.sampleRate, formatTo.sampleRate)},
myKernelSize{2 * kernelParameter},
myKernelParameter{kernelParameter},
myHighPassL{HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)},
myHighPassR{HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)},
myHighPass{HIGH_PASS_CUT_OFF, float(formatFrom.sampleRate)}
myHighPassL{HIGH_PASS_CUT_OFF, static_cast<float>(formatFrom.sampleRate)},
myHighPassR{HIGH_PASS_CUT_OFF, static_cast<float>(formatFrom.sampleRate)},
myHighPass{HIGH_PASS_CUT_OFF, static_cast<float>(formatFrom.sampleRate)}
{
myPrecomputedKernels = make_unique<float[]>(
static_cast<size_t>(myPrecomputedKernelCount) * myKernelSize);

View File

@ -51,12 +51,13 @@ namespace {
KeyValueRepositoryAtomic& myKvr;
const string& myKey;
};
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CompositeKVRJsonAdapter::CompositeKVRJsonAdapter(KeyValueRepositoryAtomic& kvr)
: myKvr{kvr}
{}
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
shared_ptr<KeyValueRepository> CompositeKVRJsonAdapter::get(const string& key)

View File

@ -27,7 +27,7 @@ namespace {
return parsed.is_discarded() ? json(s) : parsed;
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValueRepositoryJsonFile::KeyValueRepositoryJsonFile(const FSNode& node)

View File

@ -66,7 +66,7 @@ namespace {
}
out.put('"');
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
KeyValueRepositoryPropertyFile::KeyValueRepositoryPropertyFile(

View File

@ -36,7 +36,7 @@
namespace {
constexpr Int32 CURRENT_VERSION = 1;
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StellaDb::StellaDb(const string& databaseDirectory, const string& databaseName)

View File

@ -37,7 +37,7 @@ class QisBlitter : public Blitter {
SDL_Rect srcRect,
SDL_Rect destRect,
FBSurface::Attributes attributes,
SDL_Surface* staticData = nullptr
SDL_Surface* staticData
) override;
void blit(SDL_Surface& surface) override;

View File

@ -192,12 +192,3 @@ void NTSCFilter::convertToAdjustable(Adjustable& adjustable,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
AtariNTSC::Setup NTSCFilter::myCustomSetup = AtariNTSC::TV_Composite;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const std::array<NTSCFilter::AdjustableTag, int(NTSCFilter::Adjustables::NUM_ADJUSTABLES)> NTSCFilter::ourCustomAdjustables = { {
{ "sharpness", &myCustomSetup.sharpness },
{ "resolution", &myCustomSetup.resolution },
{ "artifacts", &myCustomSetup.artifacts },
{ "fringing", &myCustomSetup.fringing },
{ "bleeding", &myCustomSetup.bleed }
} };

View File

@ -148,7 +148,14 @@ class NTSCFilter
float* value{nullptr};
};
uInt32 myCurrentAdjustable{0};
static const std::array<AdjustableTag, 5> ourCustomAdjustables;
static constexpr std::array<AdjustableTag, 5> ourCustomAdjustables = {{
{ "sharpness", &myCustomSetup.sharpness },
{ "resolution", &myCustomSetup.resolution },
{ "artifacts", &myCustomSetup.artifacts },
{ "fringing", &myCustomSetup.fringing },
{ "bleeding", &myCustomSetup.bleed }
}};
private:
// Following constructors and assignment operators not supported

View File

@ -248,7 +248,8 @@ bool CartDebug::disassembleAddr(uInt16 address, bool force)
const Cartridge& cart = myConsole.cartridge();
const int segCount = cart.segmentCount();
// ROM/RAM bank or ZP-RAM?
const int addrBank = (address & 0x1000) ? getBank(address) : int(myBankInfo.size()) - 1;
const int addrBank = (address & 0x1000)
? getBank(address) : static_cast<int>(myBankInfo.size()) - 1;
if(segCount > 1)
{
@ -476,7 +477,7 @@ bool CartDebug::addDirective(Device::AccessType type,
if(bank < 0) // Do we want the current bank or ZP RAM?
bank = (myDebugger.cpuDebug().pc() & 0x1000) ?
getBank(myDebugger.cpuDebug().pc()) : int(myBankInfo.size())-1;
getBank(myDebugger.cpuDebug().pc()) : static_cast<int>(myBankInfo.size())-1;
bank = std::min(bank, romBankCount());
BankInfo& info = myBankInfo[bank];
@ -628,7 +629,7 @@ bool CartDebug::addLabel(const string& label, uInt16 address)
removeLabel(label);
myUserAddresses.emplace(label, address);
myUserLabels.emplace(address, label);
myLabelLength = std::max(myLabelLength, uInt16(label.size()));
myLabelLength = std::max(myLabelLength, static_cast<uInt16>(label.size()));
mySystem.setDirtyPage(address);
return true;
}
@ -1393,7 +1394,7 @@ string CartDebug::saveDisassembly(string path)
<< ";-----------------------------------------------------------\n\n";
int max_len = 16;
for(const auto& iter: myUserLabels)
max_len = std::max(max_len, int(iter.second.size()));
max_len = std::max(max_len, static_cast<int>(iter.second.size()));
for(const auto& iter: myUserLabels)
out << ALIGN(max_len) << iter.second << "= $" << iter.first << "\n";
}

View File

@ -563,7 +563,7 @@ string DebuggerParser::eval()
if(args[i] < 0x10000)
buf << " %" << Base::toString(args[i], Base::Fmt::_2);
buf << " #" << int(args[i]);
buf << " #" << static_cast<int>(args[i]);
if(i != argCount - 1)
buf << endl;
}
@ -756,7 +756,7 @@ void DebuggerParser::executeDirective(Device::AccessType type)
// "a"
void DebuggerParser::executeA()
{
debugger.cpuDebug().setA(uInt8(args[0]));
debugger.cpuDebug().setA(static_cast<uInt8>(args[0]));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1909,7 +1909,7 @@ void DebuggerParser::executeRunToPc()
// "s"
void DebuggerParser::executeS()
{
debugger.cpuDebug().setSP(uInt8(args[0]));
debugger.cpuDebug().setSP(static_cast<uInt8>(args[0]));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2488,14 +2488,14 @@ void DebuggerParser::executeWinds(bool unwind)
// "x"
void DebuggerParser::executeX()
{
debugger.cpuDebug().setX(uInt8(args[0]));
debugger.cpuDebug().setX(static_cast<uInt8>(args[0]));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "y"
void DebuggerParser::executeY()
{
debugger.cpuDebug().setY(uInt8(args[0]));
debugger.cpuDebug().setY(static_cast<uInt8>(args[0]));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -293,7 +293,7 @@ void TIADebug::saveOldState()
bool TIADebug::vdelP0(int newVal)
{
if(newVal > -1)
mySystem.poke(VDELP0, bool(newVal));
mySystem.poke(VDELP0, static_cast<bool>(newVal));
return myTIA.registerValue(VDELP0) & 0x01;
}
@ -302,7 +302,7 @@ bool TIADebug::vdelP0(int newVal)
bool TIADebug::vdelP1(int newVal)
{
if(newVal > -1)
mySystem.poke(VDELP1, bool(newVal));
mySystem.poke(VDELP1, static_cast<bool>(newVal));
return myTIA.registerValue(VDELP1) & 0x01;
}
@ -311,7 +311,7 @@ bool TIADebug::vdelP1(int newVal)
bool TIADebug::vdelBL(int newVal)
{
if(newVal > -1)
mySystem.poke(VDELBL, bool(newVal));
mySystem.poke(VDELBL, static_cast<bool>(newVal));
return myTIA.registerValue(VDELBL) & 0x01;
}
@ -320,7 +320,7 @@ bool TIADebug::vdelBL(int newVal)
bool TIADebug::enaM0(int newVal)
{
if(newVal > -1)
mySystem.poke(ENAM0, bool(newVal) << 1);
mySystem.poke(ENAM0, static_cast<bool>(newVal) << 1);
return myTIA.registerValue(ENAM0) & 0x02;
}
@ -329,7 +329,7 @@ bool TIADebug::enaM0(int newVal)
bool TIADebug::enaM1(int newVal)
{
if(newVal > -1)
mySystem.poke(ENAM1, bool(newVal) << 1);
mySystem.poke(ENAM1, static_cast<bool>(newVal) << 1);
return myTIA.registerValue(ENAM1) & 0x02;
}
@ -338,7 +338,7 @@ bool TIADebug::enaM1(int newVal)
bool TIADebug::enaBL(int newVal)
{
if(newVal > -1)
mySystem.poke(ENABL, bool(newVal) << 1);
mySystem.poke(ENABL, static_cast<bool>(newVal) << 1);
return myTIA.registerValue(ENABL) & 0x02;
}
@ -347,7 +347,7 @@ bool TIADebug::enaBL(int newVal)
bool TIADebug::resMP0(int newVal)
{
if(newVal > -1)
mySystem.poke(RESMP0, bool(newVal) << 1);
mySystem.poke(RESMP0, static_cast<bool>(newVal) << 1);
return myTIA.registerValue(RESMP0) & 0x02;
}
@ -356,7 +356,7 @@ bool TIADebug::resMP0(int newVal)
bool TIADebug::resMP1(int newVal)
{
if(newVal > -1)
mySystem.poke(RESMP1, bool(newVal) << 1);
mySystem.poke(RESMP1, static_cast<bool>(newVal) << 1);
return myTIA.registerValue(RESMP1) & 0x02;
}
@ -365,7 +365,7 @@ bool TIADebug::resMP1(int newVal)
bool TIADebug::refP0(int newVal)
{
if(newVal > -1)
mySystem.poke(REFP0, bool(newVal) << 3);
mySystem.poke(REFP0, static_cast<bool>(newVal) << 3);
return myTIA.registerValue(REFP0) & 0x08;
}
@ -374,7 +374,7 @@ bool TIADebug::refP0(int newVal)
bool TIADebug::refP1(int newVal)
{
if(newVal > -1)
mySystem.poke(REFP1, bool(newVal) << 3);
mySystem.poke(REFP1, static_cast<bool>(newVal) << 3);
return myTIA.registerValue(REFP1) & 0x08;
}

View File

@ -162,23 +162,26 @@ void CartridgeARMWidget::loadConfig()
alist.clear(); vlist.clear(); changed.clear();
alist.push_back(0); vlist.push_back(myCart.prevCycles());
changed.push_back(myCart.prevCycles() != uInt32(myOldState.armPrevRun[0]));
changed.push_back(myCart.prevCycles() !=
static_cast<uInt32>(myOldState.armPrevRun[0]));
myPrevThumbCycles->setList(alist, vlist, changed);
alist.clear(); vlist.clear(); changed.clear();
alist.push_back(0); vlist.push_back(myCart.prevStats().instructions);
changed.push_back(myCart.prevStats().instructions != uInt32(myOldState.armPrevRun[1]));
changed.push_back(myCart.prevStats().instructions !=
static_cast<uInt32>(myOldState.armPrevRun[1]));
myPrevThumbInstructions->setList(alist, vlist, changed);
alist.clear(); vlist.clear(); changed.clear();
alist.push_back(0); vlist.push_back(myCart.cycles());
changed.push_back(myCart.cycles() != uInt32(myOldState.armRun[0]));
changed.push_back(myCart.cycles() !=
static_cast<uInt32>(myOldState.armRun[0]));
myThumbCycles->setList(alist, vlist, changed);
alist.clear(); vlist.clear(); changed.clear();
alist.push_back(0); vlist.push_back(myCart.stats().instructions);
changed.push_back(myCart.stats().instructions != uInt32(myOldState.armRun[1]));
changed.push_back(myCart.stats().instructions !=
static_cast<uInt32>(myOldState.armRun[1]));
myThumbInstructions->setList(alist, vlist, changed);
CartDebugWidget::loadConfig();

View File

@ -368,7 +368,8 @@ void CartridgeBUSWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.myMusicCounters[i]);
changed.push_back(myCart.myMusicCounters[i] != uInt32(myOldState.mcounters[i]));
changed.push_back(myCart.myMusicCounters[i] !=
static_cast<uInt32>(myOldState.mcounters[i]));
}
myMusicCounters->setList(alist, vlist, changed);
@ -376,7 +377,8 @@ void CartridgeBUSWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.myMusicFrequencies[i]);
changed.push_back(myCart.myMusicFrequencies[i] != uInt32(myOldState.mfreqs[i]));
changed.push_back(myCart.myMusicFrequencies[i] !=
static_cast<uInt32>(myOldState.mfreqs[i]));
}
myMusicFrequencies->setList(alist, vlist, changed);
@ -384,7 +386,8 @@ void CartridgeBUSWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.getWaveform(i) >> 5);
changed.push_back((myCart.getWaveform(i) >> 5) != uInt32(myOldState.mwaves[i]));
changed.push_back((myCart.getWaveform(i) >> 5) !=
static_cast<uInt32>(myOldState.mwaves[i]));
}
myMusicWaveforms->setList(alist, vlist, changed);
@ -392,7 +395,8 @@ void CartridgeBUSWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.getWaveformSize(i));
changed.push_back((myCart.getWaveformSize(i)) != uInt32(myOldState.mwavesizes[i]));
changed.push_back((myCart.getWaveformSize(i)) !=
static_cast<uInt32>(myOldState.mwavesizes[i]));
}
myMusicWaveformSizes->setList(alist, vlist, changed);
@ -400,7 +404,8 @@ void CartridgeBUSWidget::loadConfig()
{
alist.clear(); vlist.clear(); changed.clear();
alist.push_back(0); vlist.push_back(myCart.getSample());
changed.push_back((myCart.getSample()) != uInt32(myOldState.samplepointer[0]));
changed.push_back((myCart.getSample()) !=
static_cast<uInt32>(myOldState.samplepointer[0]));
mySamplePointer->setList(alist, vlist, changed);
}

View File

@ -285,7 +285,8 @@ void CartridgeCDFWidget::loadConfig()
{
alist.clear(); vlist.clear(); changed.clear();
alist.push_back(0); vlist.push_back(myCart.myRAM[myCart.myFastFetcherOffset]);
changed.push_back((myCart.myRAM[myCart.myFastFetcherOffset]) != uInt32(myOldState.fastfetchoffset[0]));
changed.push_back((myCart.myRAM[myCart.myFastFetcherOffset]) !=
static_cast<uInt32>(myOldState.fastfetchoffset[0]));
myFastFetcherOffset->setList(alist, vlist, changed);
}
@ -360,7 +361,8 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.myMusicCounters[i]);
changed.push_back(myCart.myMusicCounters[i] != uInt32(myOldState.mcounters[i]));
changed.push_back(myCart.myMusicCounters[i] !=
static_cast<uInt32>(myOldState.mcounters[i]));
}
myMusicCounters->setList(alist, vlist, changed);
@ -368,7 +370,8 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.myMusicFrequencies[i]);
changed.push_back(myCart.myMusicFrequencies[i] != uInt32(myOldState.mfreqs[i]));
changed.push_back(myCart.myMusicFrequencies[i] !=
static_cast<uInt32>(myOldState.mfreqs[i]));
}
myMusicFrequencies->setList(alist, vlist, changed);
@ -376,7 +379,8 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.getWaveform(i) >> 5);
changed.push_back((myCart.getWaveform(i) >> 5) != uInt32(myOldState.mwaves[i]));
changed.push_back((myCart.getWaveform(i) >> 5) !=
static_cast<uInt32>(myOldState.mwaves[i]));
}
myMusicWaveforms->setList(alist, vlist, changed);
@ -384,13 +388,15 @@ void CartridgeCDFWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.getWaveformSize(i));
changed.push_back((myCart.getWaveformSize(i)) != uInt32(myOldState.mwavesizes[i]));
changed.push_back((myCart.getWaveformSize(i)) !=
static_cast<uInt32>(myOldState.mwavesizes[i]));
}
myMusicWaveformSizes->setList(alist, vlist, changed);
alist.clear(); vlist.clear(); changed.clear();
alist.push_back(0); vlist.push_back(myCart.getSample());
changed.push_back((myCart.getSample()) != uInt32(myOldState.samplepointer[0]));
changed.push_back((myCart.getSample()) !=
static_cast<uInt32>(myOldState.samplepointer[0]));
mySamplePointer->setList(alist, vlist, changed);
myFastFetch->setState((myCart.myMode & 0x0f) == 0);

View File

@ -262,7 +262,8 @@ void CartridgeDPCPlusWidget::loadConfig()
for(int i = 0; i < 8; ++i)
{
alist.push_back(0); vlist.push_back(myCart.myFractionalCounters[i]);
changed.push_back(myCart.myFractionalCounters[i] != uInt32(myOldState.fraccounters[i]));
changed.push_back(myCart.myFractionalCounters[i] !=
static_cast<uInt32>(myOldState.fraccounters[i]));
}
myFracCounters->setList(alist, vlist, changed);
@ -286,7 +287,8 @@ void CartridgeDPCPlusWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.myMusicCounters[i]);
changed.push_back(myCart.myMusicCounters[i] != uInt32(myOldState.mcounters[i]));
changed.push_back(myCart.myMusicCounters[i] !=
static_cast<uInt32>(myOldState.mcounters[i]));
}
myMusicCounters->setList(alist, vlist, changed);
@ -294,7 +296,8 @@ void CartridgeDPCPlusWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.myMusicFrequencies[i]);
changed.push_back(myCart.myMusicFrequencies[i] != uInt32(myOldState.mfreqs[i]));
changed.push_back(myCart.myMusicFrequencies[i] !=
static_cast<uInt32>(myOldState.mfreqs[i]));
}
myMusicFrequencies->setList(alist, vlist, changed);

View File

@ -123,7 +123,7 @@ string CartridgeEnhancedWidget::romDescription()
else
{
uInt16 start = (image[myCart.mySize - 3] << 8) | image[myCart.mySize - 4];
start -= start % std::min(int(size), 0x1000);
start -= start % std::min(static_cast<int>(size), 0x1000);
const uInt16 end = start + static_cast<uInt16>(myCart.mySize) - 1;
// special check for ROMs where the extra RAM is not included in the image (e.g. CV).
if((start & 0xFFFU) < size)

View File

@ -374,12 +374,12 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod)
break;
case KBDK_DOWN:
if (_currentRow < int(_rows) - 1)
if (_currentRow < _rows - 1)
{
_currentRow++;
dirty = true;
}
else if(_currentCol < int(_cols) - 1)
else if(_currentCol < _cols - 1)
{
_currentRow = 0;
_currentCol++;
@ -402,12 +402,12 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod)
break;
case KBDK_RIGHT:
if (_currentCol < int(_cols) - 1)
if (_currentCol < _cols - 1)
{
_currentCol++;
dirty = true;
}
else if(_currentRow < int(_rows) - 1)
else if(_currentRow < _rows - 1)
{
_currentCol = 0;
_currentRow++;
@ -428,7 +428,7 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod)
case KBDK_PAGEDOWN:
if(StellaModTest::isShift(mod) && _scrollBar)
handleMouseWheel(0, 0, +1);
else if (_currentRow < int(_rows) - 1)
else if (_currentRow < _rows - 1)
{
_currentRow = _rows - 1;
dirty = true;
@ -444,7 +444,7 @@ bool DataGridWidget::handleKeyDown(StellaKey key, StellaMod mod)
break;
case KBDK_END:
if (_currentCol < int(_cols) - 1)
if (_currentCol < _cols - 1)
{
_currentCol = _cols - 1;
dirty = true;

View File

@ -741,7 +741,7 @@ Common::Rect DebuggerDialog::getStatusBounds() const
return {
tia.x() + tia.w() + 1,
0,
tia.x() + tia.w() + 225 + (_w > 1030 ? int(0.35 * (_w - 1030)) : 0),
tia.x() + tia.w() + 225 + (_w > 1030 ? static_cast<int>(0.35 * (_w - 1030)) : 0),
tia.y() + tia.h()
};
}

View File

@ -69,15 +69,15 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& lfont,
StringList labels;
#define CREATE_IO_REGS(desc, bits, bitsID, editable) \
t = new StaticTextWidget(boss, lfont, xpos, ypos+2, lwidth, fontHeight,\
desc); \
xpos += t->getWidth() + 5; \
bits = new ToggleBitWidget(boss, nfont, xpos, ypos, 8, 1, 1, labels); \
bits->setTarget(this); \
bits->setID(bitsID); \
if(editable) addFocusWidget(bits); else bits->setEditable(false); \
bits->setList(off, on);
#define CREATE_IO_REGS(desc, bits, bitsID, editable) \
t = new StaticTextWidget(boss, lfont, xpos, ypos+2, lwidth, fontHeight, \
desc); \
xpos += t->getWidth() + 5; \
(bits) = new ToggleBitWidget(boss, nfont, xpos, ypos, 8, 1, 1, labels); \
(bits)->setTarget(this); \
(bits)->setID(bitsID); \
if(editable) addFocusWidget(bits); else (bits)->setEditable(false); \
(bits)->setList(off, on);
// SWCHA bits in 'poke' mode
labels.clear();
@ -286,7 +286,7 @@ void RiotWidget::loadConfig()
changed.clear(); \
for(uInt32 i = 0; i < state.s_bits.size(); ++i) \
changed.push_back(state.s_bits[i] != oldstate.s_bits[i]); \
bits->setState(state.s_bits, changed);
(bits)->setState(state.s_bits, changed);
IntArray alist;
IntArray vlist;

View File

@ -63,7 +63,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
const int fontWidth = lfont.getMaxCharWidth(),
numchars = w / fontWidth;
_labelWidth = std::max(14, int(0.45 * (numchars - 8 - 8 - 9 - 2))) * fontWidth - 1;
_labelWidth = std::max(14, static_cast<int>(0.45 * (numchars - 8 - 8 - 9 - 2))) * fontWidth - 1;
_bytesWidth = 9 * fontWidth;
///////////////////////////////////////////////////////

View File

@ -115,7 +115,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
t = new StaticTextWidget(boss, lfont, xpos, ypos + 2, 2*fontWidth, fontHeight,
dbgLabels[row], TextAlign::Left);
myFixedColors[row] = new ColorWidget(boss, nfont, xpos + 2 + t->getWidth() + 4,
ypos + 2, uInt32(1.5*lineHeight), lineHeight - 4);
ypos + 2, static_cast<uInt32>(1.5*lineHeight), lineHeight - 4);
myFixedColors[row]->setTarget(this);
}
xpos += t->getWidth() + myFixedColors[0]->getWidth() + 24;
@ -126,7 +126,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
t = new StaticTextWidget(boss, lfont, xpos, ypos + 2, 2*fontWidth, fontHeight,
dbgLabels[row], TextAlign::Left);
myFixedColors[row] = new ColorWidget(boss, nfont, xpos + 2 + t->getWidth() + 4,
ypos + 2, uInt32(1.5*lineHeight), lineHeight - 4);
ypos + 2, static_cast<uInt32>(1.5*lineHeight), lineHeight - 4);
myFixedColors[row]->setTarget(this);
}

View File

@ -116,7 +116,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod)
break;
case KBDK_DOWN:
if (_currentRow < int(_rows) - 1)
if (_currentRow < _rows - 1)
{
_currentRow++;
dirty = true;
@ -132,7 +132,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod)
break;
case KBDK_RIGHT:
if (_currentCol < int(_cols) - 1)
if (_currentCol < _cols - 1)
{
_currentCol++;
dirty = true;
@ -148,7 +148,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod)
break;
case KBDK_PAGEDOWN:
if (_currentRow < int(_rows) - 1)
if (_currentRow < _rows - 1)
{
_currentRow = _rows - 1;
dirty = true;
@ -164,7 +164,7 @@ bool ToggleWidget::handleKeyDown(StellaKey key, StellaMod mod)
break;
case KBDK_END:
if (_currentCol < int(_cols) - 1)
if (_currentCol < _cols - 1)
{
_currentCol = _cols - 1;
dirty = true;

View File

@ -31,7 +31,7 @@ Cartridge::Cartridge(const Settings& settings, const string& md5)
: mySettings{settings}
{
const auto to_uInt32 = [](const string& s, uInt32 pos) {
return uInt32(std::stoul(s.substr(pos, 8), nullptr, 16));
return static_cast<uInt32>(std::stoul(s.substr(pos, 8), nullptr, 16));
};
const uInt32 seed = to_uInt32(md5, 0) ^ to_uInt32(md5, 8) ^

View File

@ -73,7 +73,7 @@ bool Cartridge0840::checkSwitchBank(uInt16 address, uInt8)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 Cartridge0840::peek(uInt16 address)
{
checkSwitchBank(address);
checkSwitchBank(address, 0);
// Because of the way we've set up accessing above, we can only
// get here when the addresses are from 0x800 - 0xFFF
@ -84,7 +84,7 @@ uInt8 Cartridge0840::peek(uInt16 address)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Cartridge0840::poke(uInt16 address, uInt8 value)
{
checkSwitchBank(address);
checkSwitchBank(address, 0);
// Because of the way accessing is set up, we will may get here by
// doing a write to 0x800 - 0xFFF or cart; we ignore the cart write

View File

@ -96,7 +96,7 @@ class Cartridge0840 : public CartridgeEnhanced
bool poke(uInt16 address, uInt8 value) override;
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
uInt16 hotspot() const override { return 0x0840; }

View File

@ -81,7 +81,7 @@ uInt8 Cartridge0FA0::peek(uInt16 address)
{
address &= myBankMask;
checkSwitchBank(address);
checkSwitchBank(address, 0);
// Because of the way accessing is set up, we will only get here
// when doing a TIA read
@ -93,7 +93,7 @@ bool Cartridge0FA0::poke(uInt16 address, uInt8 value)
{
address &= myBankMask;
checkSwitchBank(address);
checkSwitchBank(address, 0);
// Because of the way accessing is set up, we will may get here by
// doing a write to TIA or cart; we ignore the cart write

View File

@ -105,7 +105,7 @@ class Cartridge0FA0 : public CartridgeEnhanced
*/
bool randomStartBank() const override { return false; }
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
uInt16 hotspot() const override { return 0x06a0; }

View File

@ -74,7 +74,7 @@ class Cartridge2K : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override { return false; }
bool checkSwitchBank(uInt16, uInt8) override { return false; }
private:
// Following constructors and assignment operators not supported

View File

@ -71,7 +71,7 @@ class Cartridge4K : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override { return false; }
bool checkSwitchBank(uInt16, uInt8) override { return false; }
private:
// Following constructors and assignment operators not supported

View File

@ -72,7 +72,7 @@ class CartridgeBF : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
uInt16 hotspot() const override { return 0x1F80; }

View File

@ -58,7 +58,7 @@ namespace {
throw runtime_error("unreachable");
}
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeCDF::CartridgeCDF(const ByteBuffer& image, size_t size,

View File

@ -79,7 +79,7 @@ class CartridgeCV : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16, uInt8 = 0) override { return false; }
bool checkSwitchBank(uInt16, uInt8) override { return false; }
protected:
// Initial RAM data from the cart (doesn't always exist)

View File

@ -72,7 +72,7 @@ class CartridgeDF : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
uInt16 hotspot() const override { return 0x1FC0; }

View File

@ -85,7 +85,7 @@ class CartridgeE0 : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
uInt16 hotspot() const override { return 0x1FE0; }

View File

@ -72,7 +72,7 @@ class CartridgeEF : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
uInt16 hotspot() const override { return 0x1FE0; }

View File

@ -66,7 +66,8 @@ CartridgeEnhanced::CartridgeEnhanced(const ByteBuffer& image, size_t size,
void CartridgeEnhanced::install(System& system)
{
// limit banked RAM size to the size of one RAM bank
const uInt16 ramSize = myRamBankCount > 0 ? 1 << (myBankShift - 1) : uInt16(myRamSize);
const uInt16 ramSize = myRamBankCount > 0 ? 1 << (myBankShift - 1) :
static_cast<uInt16>(myRamSize);
// calculate bank switching and RAM sizes and masks
myBankSize = 1 << myBankShift; // e.g. = 2 ^ 12 = 4K = 0x1000
@ -74,7 +75,7 @@ void CartridgeEnhanced::install(System& system)
// Either the bankswitching supports multiple segments
// or the ROM is < 4K (-> 1 segment)
myBankSegs = std::min(1 << (MAX_BANK_SHIFT - myBankShift),
int(mySize) / myBankSize); // e.g. = 1
static_cast<int>(mySize) / myBankSize); // e.g. = 1
// ROM has an offset if RAM inside a bank (e.g. for F8SC)
myRomOffset = myRamBankCount > 0U ? 0U : static_cast<uInt16>(myRamSize * 2);
myRamMask = ramSize - 1; // e.g. = 0xFFFF (doesn't matter for RAM size 0)
@ -160,7 +161,7 @@ uInt8 CartridgeEnhanced::peek(uInt16 address)
// hotspots in TIA range are reacting to pokes only
if (hotspot() >= 0x80)
checkSwitchBank(address & ADDR_MASK);
checkSwitchBank(address & ADDR_MASK, 0);
if(isRamBank(address))
{
@ -202,7 +203,7 @@ bool CartridgeEnhanced::poke(uInt16 address, uInt8 value)
if(isRamBank(address))
{
if(bool(address & (myBankSize >> 1)) == myRamWpHigh)
if(static_cast<bool>(address & (myBankSize >> 1)) == myRamWpHigh)
{
address &= myRamMask;
// The RAM banks follow the ROM banks and are half the size of a ROM bank
@ -214,7 +215,7 @@ bool CartridgeEnhanced::poke(uInt16 address, uInt8 value)
else
{
//address &= myBankMask;
if(bool(address & myRamSize) == myRamWpHigh)
if(static_cast<bool>(address & myRamSize) == myRamWpHigh)
{
pokeRAM(myRAM[address & myRamMask], pokeAddress, value);
return true;
@ -272,10 +273,12 @@ bool CartridgeEnhanced::bank(uInt16 bank, uInt16 segment)
// Setup RAM bank
const uInt16 ramBank = (bank - romBankCount()) % myRamBankCount;
// The RAM banks follow the ROM banks and are half the size of a ROM bank
const uInt32 bankOffset = uInt32(mySize) + (ramBank << (myBankShift - 1));
const uInt32 bankOffset = static_cast<uInt32>(mySize) +
(ramBank << (myBankShift - 1));
// Remember what bank is in this segment
myCurrentSegOffset[segment] = uInt32(mySize) + (ramBank << myBankShift);
myCurrentSegOffset[segment] = static_cast<uInt32>(mySize) +
(ramBank << myBankShift);
// Set the page accessing method for the RAM writing pages
// Note: Writes are mapped to poke() (NOT using directPokeBase) to check for read from write port (RWP)

View File

@ -286,7 +286,7 @@ class CartridgeEnhanced : public Cartridge
@return True if a bank switch happened.
*/
virtual bool checkSwitchBank(uInt16 address, uInt8 value = 0) = 0;
virtual bool checkSwitchBank(uInt16 address, uInt8 value) = 0;
private:
/**

View File

@ -69,7 +69,7 @@ class CartridgeF0 : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8 value) override;
uInt16 hotspot() const override { return 0x1FF0; }

View File

@ -68,7 +68,7 @@ class CartridgeF4 : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
uInt16 hotspot() const override { return 0x1FF4; }

View File

@ -68,7 +68,7 @@ class CartridgeF6 : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8 value) override;
uInt16 hotspot() const override { return 0x1FF6; }

View File

@ -68,7 +68,7 @@ class CartridgeF8 : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8 value) override;
uInt16 hotspot() const override { return 0x1FF8; }

View File

@ -72,7 +72,7 @@ class CartridgeFA : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
uInt16 hotspot() const override { return 0x1FF8; }

View File

@ -109,7 +109,7 @@ class CartridgeFA2 : public CartridgeFA
bool poke(uInt16 address, uInt8 value) override;
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8 value) override;
uInt16 hotspot() const override { return 0x1FF5; }

View File

@ -74,7 +74,7 @@ bool CartridgeFC::poke(uInt16 address, uInt8 value)
break;
default:
checkSwitchBank(address);
checkSwitchBank(address, 0);
}
return false;
}

View File

@ -90,7 +90,7 @@ class CartridgeFC : public CartridgeEnhanced
bool poke(uInt16 address, uInt8 value) override;
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
uInt16 hotspot() const override { return 0x1FF8; }

View File

@ -67,7 +67,7 @@ uInt8 CartridgeMDM::peek(uInt16 address)
// Because of the way we've set up accessing above, we can only
// get here when the addresses are from 0x800 - 0xBFF
checkSwitchBank(address);
checkSwitchBank(address, 0);
const int hotspot = ((address & 0x0F00) >> 8) - 8;
return myHotSpotPageAccess[hotspot].device->peek(address);
@ -80,7 +80,7 @@ bool CartridgeMDM::poke(uInt16 address, uInt8 value)
// about those below $1000
if(!(address & 0x1000))
{
checkSwitchBank(address);
checkSwitchBank(address, 0);
const int hotspot = ((address & 0x0F00) >> 8) - 8;
myHotSpotPageAccess[hotspot].device->poke(address, value);

View File

@ -137,7 +137,7 @@ class CartridgeMDM : public CartridgeEnhanced
bool poke(uInt16 address, uInt8 value) override;
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
private:
// Previous Device's page access

View File

@ -22,9 +22,9 @@
/**
Implementation of MovieCart.
1K of memory is presented on the bus, but is repeated to fill the 4K image space.
Contents are dynamically altered with streaming image and audio content as specific
128-byte regions are entered.
1K of memory is presented on the bus, but is repeated to fill the 4K image
space. Contents are dynamically altered with streaming image and audio content
as specific 128-byte regions are entered.
Original implementation: github.com/lodefmode/moviecart
@author Rob Bairos
@ -45,7 +45,7 @@ namespace {
constexpr int BACK_SECONDS = 10;
constexpr int TITLE_CYCLES = 1000000;
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/**
@ -61,7 +61,7 @@ class StreamReader : public Serializable
if(myFile)
myFileSize = myFile.size();
return bool(myFile);
return static_cast<bool>(myFile);
}
void blankPartialLines(bool index) {

View File

@ -66,7 +66,7 @@ uInt8 CartridgeSB::peek(uInt16 address)
{
address &= (0x17FF + romBankCount());
checkSwitchBank(address);
checkSwitchBank(address, 0);
if(!(address & 0x1000))
{
@ -84,7 +84,7 @@ bool CartridgeSB::poke(uInt16 address, uInt8 value)
{
address &= (0x17FF + romBankCount());
checkSwitchBank(address);
checkSwitchBank(address, 0);
if(!(address & 0x1000))
{

View File

@ -98,7 +98,7 @@ class CartridgeSB : public CartridgeEnhanced
bool poke(uInt16 address, uInt8 value) override;
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
uInt16 hotspot() const override { return 0x0800; }

View File

@ -97,7 +97,7 @@ class CartridgeTVBoy : public CartridgeEnhanced
#endif
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8 value) override;
uInt16 hotspot() const override { return 0x1800; }

View File

@ -85,7 +85,7 @@ uInt8 CartridgeUA::peek(uInt16 address)
{
address &= myBankMask;
checkSwitchBank(address);
checkSwitchBank(address, 0);
// Because of the way accessing is set up, we will only get here
// when doing a TIA read
@ -98,7 +98,7 @@ bool CartridgeUA::poke(uInt16 address, uInt8 value)
{
address &= myBankMask;
checkSwitchBank(address);
checkSwitchBank(address, 0);
// Because of the way accessing is set up, we will may get here by
// doing a write to TIA or cart; we ignore the cart write

View File

@ -99,7 +99,7 @@ class CartridgeUA : public CartridgeEnhanced
bool poke(uInt16 address, uInt8 value) override;
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
uInt16 hotspot() const override { return 0x0220; }

View File

@ -158,7 +158,7 @@ class CartridgeWD : public CartridgeEnhanced
*/
bool randomStartBank() const override { return false; }
bool checkSwitchBank(uInt16, uInt8 = 0) override { return false; }
bool checkSwitchBank(uInt16, uInt8) override { return false; }
uInt16 hotspot() const override { return 0x0030; }

View File

@ -74,7 +74,7 @@ uInt8 CartridgeX07::peek(uInt16 address)
else if(!(lowAddress & 0x200))
value = mySystem->tia().peek(address);
checkSwitchBank(address);
checkSwitchBank(address, 0);
return value;
}
@ -90,7 +90,7 @@ bool CartridgeX07::poke(uInt16 address, uInt8 value)
else if(!(lowAddress & 0x200))
mySystem->tia().poke(address, value);
checkSwitchBank(address);
checkSwitchBank(address, 0);
return false;
}

View File

@ -106,7 +106,7 @@ class CartridgeX07 : public CartridgeEnhanced
bool poke(uInt16 address, uInt8 value) override;
private:
bool checkSwitchBank(uInt16 address, uInt8 value = 0) override;
bool checkSwitchBank(uInt16 address, uInt8) override;
private:
// Following constructors and assignment operators not supported

View File

@ -77,9 +77,10 @@
#include "Console.hxx"
namespace {
// Emulation speed is a positive float that multiplies the framerate. However, the UI controls
// adjust speed in terms of a speedup factor (1/10, 1/9 .. 1/2, 1, 2, 3, .., 10). The following
// mapping and formatting functions implement this conversion. The speedup factor is represented
// Emulation speed is a positive float that multiplies the framerate. However,
// the UI controls adjust speed in terms of a speedup factor (1/10,
// 1/9 .. 1/2, 1, 2, 3, .., 10). The following mapping and formatting
// functions implement this conversion. The speedup factor is represented
// by an integer value between -900 and 900 (0 means no speedup).
constexpr int MAX_SPEED = 900;
@ -112,8 +113,7 @@ namespace {
return ss.str();
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Console::Console(OSystem& osystem, unique_ptr<Cartridge>& cart,

View File

@ -120,7 +120,8 @@ string Controller::getName(const Type type)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Controller::getPropName(const Type type)
{
static constexpr std::array<const char*, int(Controller::Type::LastType)> PROP_NAMES =
static constexpr std::array<const char*,
static_cast<int>(Controller::Type::LastType)> PROP_NAMES =
{
"AUTO",
"AMIGAMOUSE", "ATARIMOUSE", "ATARIVOX", "BOOSTERGRIP", "COMPUMATE",

View File

@ -26,7 +26,7 @@ namespace {
{
return n / d + ((n % d == 0) ? 0 : 1);
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EmulationTiming::EmulationTiming(FrameLayout frameLayout, ConsoleTiming consoleTiming)

View File

@ -2033,14 +2033,14 @@ json EventHandler::convertLegacyComboMapping(string list)
buf >> event;
// skip all NoType events
if(event != Event::NoType)
events.push_back(Event::Type(event));
events.push_back(static_cast<Event::Type>(event));
}
// only store if there are any NoType events
if(!events.empty())
{
json combo;
combo["combo"] = Event::Type(Event::Combo1 + i);
combo["combo"] = static_cast<Event::Type>(Event::Combo1 + i);
combo["events"] = events;
convertedMapping.push_back(combo);
}
@ -2171,14 +2171,14 @@ void EventHandler::saveComboMapping()
// skip all NoType events
if(event != Event::NoType)
events.push_back(Event::Type(event));
events.push_back(static_cast<Event::Type>(event));
}
// only store if there are any NoType events
if(!events.empty())
{
json combo;
combo["combo"] = Event::Type(Event::Combo1 + i);
combo["combo"] = static_cast<Event::Type>(Event::Combo1 + i);
combo["events"] = events;
mapping.push_back(combo);
}

View File

@ -356,7 +356,7 @@ int FBSurface::drawString(const GUI::Font& font, const string& s,
drawString(font, leftStr, x, y, w, color, align, deltax, false, shadowColor,
linkStart, linkLen, underline);
if(linkStart != string::npos)
linkStart = std::max(0, int(linkStart - leftStr.length()));
linkStart = std::max(0, static_cast<int>(linkStart - leftStr.length()));
h -= font.getFontHeight();
y += font.getFontHeight();

View File

@ -616,7 +616,8 @@ void FrameBuffer::createMessage(const string& message, MessagePosition position,
const int fontHeight = font().getFontHeight();
const int VBORDER = fontHeight / 4;
myMsg.counter = std::min(uInt32(myOSystem.frameRate()) * 2, 120U); // Show message for 2 seconds
// Show message for 2 seconds
myMsg.counter = std::min(static_cast<uInt32>(myOSystem.frameRate()) * 2, 120U);
if(myMsg.counter == 0)
myMsg.counter = 120;

View File

@ -89,10 +89,10 @@ static uInt8 PADDING[64] = {
};
// F, G, H and I are basic MD5 functions.
#define F(x, y, z) (((x) & (y)) | ((~x) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~z)))
#define F(x, y, z) (((x) & (y)) | ((~(x)) & (z)))
#define G(x, y, z) (((x) & (z)) | ((y) & (~(z))))
#define H(x, y, z) ((x) ^ (y) ^ (z))
#define I(x, y, z) ((y) ^ ((x) | (~z)))
#define I(x, y, z) ((y) ^ ((x) | (~(z))))
// ROTATE_LEFT rotates x left n bits.
#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n))))
@ -336,4 +336,4 @@ string hash(const uInt8* buffer, size_t length)
return result;
}
} // Namespace MD5
} // namespace MD5

View File

@ -49,6 +49,6 @@ namespace MD5 {
*/
string hash(const string& buffer);
} // Namespace MD5
} // namespace MD5
#endif

View File

@ -262,7 +262,7 @@ void MT24LC256::jpee_clock_fall()
{
if (!jpee_pptr)
{
jpee_packet[0] = uInt8(jpee_nb);
jpee_packet[0] = static_cast<uInt8>(jpee_nb);
if (jpee_smallmode && ((jpee_nb & 0xF0) == 0xA0))
{
jpee_packet[1] = (jpee_nb >> 1) & 7;
@ -307,7 +307,7 @@ void MT24LC256::jpee_clock_fall()
{
if (!jpee_pptr)
{
jpee_packet[0] = uInt8(jpee_nb);
jpee_packet[0] = static_cast<uInt8>(jpee_nb);
if (jpee_smallmode)
jpee_pptr=2;
else
@ -316,7 +316,7 @@ void MT24LC256::jpee_clock_fall()
else if (jpee_pptr < 70)
{
JPEE_LOG1("I2C_SENT(%02X)",jpee_nb & 0xFF)
jpee_packet[jpee_pptr++] = uInt8(jpee_nb);
jpee_packet[jpee_pptr++] = static_cast<uInt8>(jpee_nb);
jpee_address = (jpee_packet[1] << 8) | jpee_packet[2];
if (jpee_pptr > 2)
jpee_ad_known = 1;

View File

@ -176,7 +176,7 @@ bool OSystem::initialize(const Settings::Options& options)
createSound();
// Create random number generator
myRandom = make_unique<Random>(uInt32(TimerManager::getTicks()));
myRandom = make_unique<Random>(static_cast<uInt32>(TimerManager::getTicks()));
#ifdef CHEATCODE_SUPPORT
myCheatManager = make_unique<CheatManager>(*this);

View File

@ -39,7 +39,7 @@ namespace {
constexpr uInt16 WRITE_SEND_BUFFER = 0x1FF1;
constexpr uInt16 RECEIVE_BUFFER = 0x1FF2;
constexpr uInt16 RECEIVE_BUFFER_SIZE = 0x1FF3;
}
} // namespace
#endif
using std::chrono::milliseconds;

View File

@ -51,7 +51,7 @@ namespace {
from++;
}
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ProfilingRunner::ProfilingRunner(int argc, char* argv[])
@ -187,7 +187,8 @@ bool ProfilingRunner::runOne(const ProfilingRun& run)
if (tia.newFramePending()) tia.renderToFrameBuffer();
const uInt32 percentNow = uInt32(std::min((100 * cycles) / cyclesTarget, static_cast<uInt64>(100)));
const uInt32 percentNow = static_cast<uInt32>(std::min((100 * cycles) /
cyclesTarget, static_cast<uInt64>(100)));
updateProgress(percent, percentNow);
percent = percentNow;

View File

@ -194,7 +194,7 @@ Settings::Settings()
// Misc options
setPermanent("loglevel", int(Logger::Level::INFO));
setPermanent("loglevel", static_cast<int>(Logger::Level::INFO));
setPermanent("logtoconsole", "0");
setPermanent("avoxport", "");
setPermanent("fastscbios", "true");
@ -473,7 +473,7 @@ void Settings::validate()
i = getInt("loglevel");
if(i < static_cast<int>(Logger::Level::MIN) || i > static_cast<int>(Logger::Level::MAX))
setValue("loglevel", int(Logger::Level::INFO));
setValue("loglevel", static_cast<int>(Logger::Level::INFO));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -42,7 +42,7 @@ namespace {
ScalingInterpolation::sharp;
#endif
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIASurface::TIASurface(OSystem& system)
@ -257,7 +257,7 @@ void TIASurface::changeScanlineIntensity(int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIASurface::ScanlineMask TIASurface::scanlineMaskType(int direction)
{
const string Masks[int(ScanlineMask::NumMasks)] = {
const string Masks[static_cast<int>(ScanlineMask::NumMasks)] = {
SETTING_STANDARD,
SETTING_THIN,
SETTING_PIXELS,
@ -276,7 +276,7 @@ TIASurface::ScanlineMask TIASurface::scanlineMaskType(int direction)
i = BSPF::clampw(i + direction, 0, static_cast<int>(ScanlineMask::NumMasks) - 1);
myOSystem.settings().setValue("tv.scanmask", Masks[i]);
}
return ScanlineMask(i);
return static_cast<ScanlineMask>(i);
}
++i;
}
@ -286,7 +286,7 @@ TIASurface::ScanlineMask TIASurface::scanlineMaskType(int direction)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASurface::cycleScanlineMask(int direction)
{
const string Names[int(ScanlineMask::NumMasks)] = {
const string Names[static_cast<int>(ScanlineMask::NumMasks)] = {
"Standard",
"Thin lines",
"Pixelated",
@ -310,7 +310,9 @@ void TIASurface::enablePhosphor(bool enable, int blend)
if(myPhosphorHandler.initialize(enable, blend))
{
myPBlend = blend;
myFilter = static_cast<Filter>(enable ? uInt8(myFilter) | 0x01 : uInt8(myFilter) & 0x10);
myFilter = static_cast<Filter>(
enable ? static_cast<uInt8>(myFilter) | 0x01
: static_cast<uInt8>(myFilter) & 0x10);
myRGBFramebuffer.fill(0);
}
}
@ -334,7 +336,7 @@ void TIASurface::createScanlineSurface()
: vRepeats(c_vRepeats), data(c_data)
{}
};
static std::array<Pattern, int(ScanlineMask::NumMasks)> Patterns = {{
static std::array<Pattern, static_cast<int>(ScanlineMask::NumMasks)> Patterns = {{
Pattern(1, // standard
{
{ 0x00000000 },
@ -438,7 +440,9 @@ void TIASurface::createScanlineSurface()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIASurface::enableNTSC(bool enable)
{
myFilter = static_cast<Filter>(enable ? uInt8(myFilter) | 0x10 : uInt8(myFilter) & 0x01);
myFilter = static_cast<Filter>(
enable ? static_cast<uInt8>(myFilter) | 0x10
: static_cast<uInt8>(myFilter) & 0x01);
const uInt32 surfaceWidth = enable ?
AtariNTSC::outWidth(TIAConstants::frameBufferWidth) : TIAConstants::frameBufferWidth;

View File

@ -45,10 +45,10 @@ using Common::Base;
#endif
#ifdef __BIG_ENDIAN__
#define CONV_DATA(d) (((d & 0xFFFF)>>8) | ((d & 0xffff)<<8)) & 0xffff
#define CONV_RAMROM(d) ((d>>8) | (d<<8)) & 0xffff
#define CONV_DATA(d) ((((d) & 0xFFFF)>>8) | (((d) & 0xffff)<<8)) & 0xffff
#define CONV_RAMROM(d) (((d)>>8) | ((d)<<8)) & 0xffff
#else
#define CONV_DATA(d) (d & 0xFFFF)
#define CONV_DATA(d) ((d) & 0xFFFF)
#define CONV_RAMROM(d) (d)
#endif
@ -679,7 +679,7 @@ uInt32 Thumbulator::read32(uInt32 addr)
fatalError("read32", addr, "abort - out of range");
#endif
data = read16(addr+0);
data |= (uInt32(read16(addr+2))) << 16;
data |= read16(addr+2) << 16;
DO_DBUG(statusMsg << "read32(" << Base::HEX8 << addr << ")=" << Base::HEX8 << data << endl);
return data;
@ -689,7 +689,7 @@ uInt32 Thumbulator::read32(uInt32 addr)
fatalError("read32", addr, "abort - out of range");
#endif
data = read16(addr+0);
data |= (static_cast<uInt32>(read16(addr+2))) << 16;
data |= read16(addr+2) << 16;
DO_DBUG(statusMsg << "read32(" << Base::HEX8 << addr << ")=" << Base::HEX8 << data << endl);
return data;

View File

@ -127,7 +127,7 @@ bool AnalogReadout::save(Serializer& out) const
myConnection.save(out);
out.putLong(myTimestamp);
out.putInt(int(myConsoleTiming));
out.putInt(static_cast<int>(myConsoleTiming));
out.putDouble(myClockFreq);
out.putBool(myIsDumped);

View File

@ -31,7 +31,7 @@ namespace {
(R_MAX + R * static_cast<double>(vMax)) / (R_MAX + R * static_cast<double>(v)))
);
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Audio::Audio()

View File

@ -290,7 +290,7 @@ bool Playfield::save(Serializer& out) const
out.putByte(myDebugColor);
out.putBool(myDebugEnabled);
out.putByte(uInt8(myColorMode));
out.putByte(static_cast<uInt8>(myColorMode));
out.putBool(myScoreGlitch);
out.putInt(myPattern);

View File

@ -275,7 +275,7 @@ bool TIA::save(Serializer& out) const
if(!myInput0.save(out)) return false;
if(!myInput1.save(out)) return false;
out.putInt(int(myHstate));
out.putInt(static_cast<int>(myHstate));
out.putInt(myHctr);
out.putInt(myHctrDelta);
@ -291,7 +291,7 @@ bool TIA::save(Serializer& out) const
out.putInt(myLinesSinceChange);
out.putInt(int(myPriority));
out.putInt(static_cast<int>(myPriority));
out.putByte(mySubClock);
out.putLong(myLastCycle);
@ -1251,7 +1251,7 @@ bool TIA::driveUnusedPinsRandom(uInt8 mode)
// If mode is 0 or 1, use it as a boolean (off or on)
// Otherwise, return the state
if (mode == 0 || mode == 1)
myTIAPinsDriven = bool(mode);
myTIAPinsDriven = static_cast<bool>(mode);
return myTIAPinsDriven;
}

View File

@ -120,7 +120,7 @@ bool AbstractFrameManager::save(Serializer& out) const
out.putInt(myCurrentFrameFinalLines);
out.putInt(myPreviousFrameFinalLines);
out.putInt(myTotalFrames);
out.putInt(uInt32(myLayout));
out.putInt(static_cast<uInt32>(myLayout));
return onSave(out);
}

View File

@ -175,7 +175,7 @@ bool FrameManager::onSave(Serializer& out) const
{
if (!myJitterEmulation.save(out)) return false;
out.putInt(uInt32(myState));
out.putInt(static_cast<uInt32>(myState));
out.putInt(myLineInState);
out.putInt(myVsyncLines);
out.putInt(myY);

View File

@ -437,8 +437,8 @@ void DeveloperDialog::addVideoTab(const GUI::Font& font)
pwidth, lineHeight, items, desc, lwidth, dbg_cmds[idx]);
wid.push_back(myDbgColour[idx]);
x += myDbgColour[idx]->getWidth() + fontWidth * 1.25;
myDbgColourSwatch[idx] = new ColorWidget(myTab, font, x, ypos - 1,
uInt32(2 * lineHeight), lineHeight);
myDbgColourSwatch[idx] = new ColorWidget(
myTab, font, x, ypos - 1, static_cast<uInt32>(2 * lineHeight), lineHeight);
ypos += lineHeight + VGAP * 1;
};

View File

@ -24,9 +24,10 @@
#include "EmulationDialog.hxx"
namespace {
// Emulation speed is a positive float that multiplies the framerate. However, the UI controls
// adjust speed in terms of a speedup factor (1/10, 1/9 .. 1/2, 1, 2, 3, .., 10). The following
// mapping and formatting functions implement this conversion. The speedup factor is represented
// Emulation speed is a positive float that multiplies the framerate. However,
// the UI controls adjust speed in terms of a speedup factor (1/10,
// 1/9 .. 1/2, 1, 2, 3, .., 10). The following mapping and formatting
// functions implement this conversion. The speedup factor is represented
// by an integer value between -900 and 900 (0 means no speedup).
constexpr int MAX_SPEED = 900;
@ -59,7 +60,7 @@ namespace {
return ss.str();
}
}
} // namespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EmulationDialog::EmulationDialog(OSystem& osystem, DialogContainer& parent,

View File

@ -330,7 +330,8 @@ bool EventMappingWidget::handleKeyUp(StellaKey key, StellaMod mod)
if(myMod & KBDM_GUI)
myMod |= KBDM_GUI;
}
if (instance().eventHandler().addKeyMapping(event, myEventMode, StellaKey(myLastKey), StellaMod(myMod)))
if (instance().eventHandler().addKeyMapping(event, myEventMode,
static_cast<StellaKey>(myLastKey), static_cast<StellaMod>(myMod)))
stopRemapping();
}
return true;

View File

@ -680,16 +680,17 @@ const FileListWidget::Icon* FileListWidget::getIcon(int i) const
0b11111111111'11111111110,
0b11111111111'11111111110
};
static const Icon* small_icons[int(IconType::numTypes)] = {
const int idx = static_cast<int>(IconType::numTypes);
static const Icon* small_icons[idx] = {
&unknown_small, &rom_small, &directory_small, &zip_small, &up_small
};
static const Icon* large_icons[int(IconType::numTypes)] = {
static const Icon* large_icons[idx] = {
&unknown_large, &rom_large, &directory_large, &zip_large, &up_large,
};
const bool smallIcon = iconWidth() < 24;
const int iconType = int(_iconTypeList[i]);
const int iconType = static_cast<int>(_iconTypeList[i]);
assert(iconType < int(IconType::numTypes));
assert(iconType < idx);
return smallIcon ? small_icons[iconType] : large_icons[iconType];
}

View File

@ -59,4 +59,4 @@ int Font::getStringWidth(const string& str) const
[&](int x, char c) { return x + getCharWidth(c); });
}
} // namespace GUI
} // namespace GUI

Some files were not shown because too many files have changed in this diff Show More