From 709237c79c481ecb58cb2f88c7108bc797f82234 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 19 Apr 2025 12:59:04 -0230 Subject: [PATCH 1/5] Fix minor warning from clang-20. --- src/common/bspf.hxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx index 9408d1d4b..89e093142 100644 --- a/src/common/bspf.hxx +++ b/src/common/bspf.hxx @@ -93,7 +93,7 @@ using ByteBuffer = std::unique_ptr; using DWordBuffer = std::unique_ptr; // We use KB a lot; let's make a literal for it -constexpr size_t operator "" _KB(unsigned long long size) +constexpr size_t operator ""_KB(unsigned long long size) { return static_cast(size * 1024); } From 7b5c19ff5e28dfeb814e912d028cb34b53c01f10 Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 19 Apr 2025 16:11:51 -0230 Subject: [PATCH 2/5] Fix warning from clang-tidy. --- src/cheat/BankRomCheat.cxx | 6 ++--- src/cheat/CheetahCheat.cxx | 6 ++--- src/common/FBBackendSDL2.cxx | 5 ++-- src/common/FBSurfaceSDL2.hxx | 8 +++--- src/common/SoundSDL2.cxx | 3 +-- src/common/StaggeredLogger.cxx | 4 ++- src/debugger/CartDebug.cxx | 3 ++- src/debugger/DebuggerParser.cxx | 24 ++++++++--------- src/debugger/DiStella.cxx | 10 +++---- src/debugger/TIADebug.cxx | 2 +- src/debugger/gui/Cart3EPlusWidget.cxx | 7 ++--- src/debugger/gui/CartBUSWidget.cxx | 20 +++++++------- src/debugger/gui/CartCDFWidget.cxx | 26 +++++++++--------- src/debugger/gui/CartDPCPlusWidget.cxx | 17 ++++++------ src/debugger/gui/CartDPCWidget.cxx | 12 ++++++--- src/debugger/gui/CartE7Widget.cxx | 2 +- src/debugger/gui/CartEnhancedWidget.cxx | 19 ++++++------- src/debugger/gui/DataGridWidget.cxx | 2 +- src/debugger/gui/FlashWidget.cxx | 2 +- src/debugger/gui/PromptWidget.cxx | 2 +- src/debugger/gui/RamWidget.cxx | 2 +- src/debugger/gui/RomListWidget.cxx | 4 +-- src/debugger/gui/RomWidget.cxx | 2 +- src/debugger/gui/ToggleBitWidget.cxx | 4 +-- src/emucore/CartDPC.cxx | 4 +-- src/emucore/CartDPCPlus.cxx | 4 +-- src/emucore/EventHandler.cxx | 12 ++++----- src/emucore/FBSurface.cxx | 2 +- src/emucore/FrameBuffer.cxx | 2 +- src/emucore/PlusROM.cxx | 2 +- src/emucore/tia/Ball.hxx | 3 ++- src/emucore/tia/Missile.cxx | 2 +- src/emucore/tia/Missile.hxx | 3 ++- src/gui/BrowserDialog.cxx | 6 ++--- src/gui/CheckListWidget.cxx | 6 ++--- src/gui/ContextMenu.cxx | 10 +++---- src/gui/DeveloperDialog.cxx | 6 ++--- src/gui/Dialog.cxx | 18 ++++++------- src/gui/Dialog.hxx | 2 +- src/gui/EditableWidget.cxx | 36 +++++++++++-------------- src/gui/FileListWidget.cxx | 2 +- src/gui/Font.cxx | 2 +- src/gui/HighScoresDialog.cxx | 8 +++--- src/gui/LauncherDialog.cxx | 6 ++--- src/gui/ListWidget.cxx | 18 ++++++------- src/gui/RadioButtonWidget.cxx | 4 +-- src/gui/StellaSettingsDialog.cxx | 2 +- src/gui/StringListWidget.cxx | 5 +--- src/gui/TabWidget.cxx | 14 +++++----- src/gui/TimeLineWidget.cxx | 2 +- src/gui/WhatsNewDialog.cxx | 2 +- src/tools/TIDY | 2 +- 52 files changed, 190 insertions(+), 187 deletions(-) diff --git a/src/cheat/BankRomCheat.cxx b/src/cheat/BankRomCheat.cxx index 8c2c677be..16c3a9dbb 100644 --- a/src/cheat/BankRomCheat.cxx +++ b/src/cheat/BankRomCheat.cxx @@ -33,7 +33,7 @@ BankRomCheat::BankRomCheat(OSystem& os, string_view name, string_view code) count = static_cast(BSPF::stoi<16>(myCode.substr(7, 1)) + 1); // Back up original data; we need this if the cheat is ever disabled - for(int i = 0; i < count; ++i) + for(int i = 0; std::cmp_less(i, count); ++i) savedRom[i] = myOSystem.console().cartridge().peek(address + i); } @@ -50,7 +50,7 @@ bool BankRomCheat::disable() const int oldBank = myOSystem.console().cartridge().getBank(address); myOSystem.console().cartridge().bank(bank); - for(int i = 0; i < count; ++i) + for(int i = 0; std::cmp_less(i, count); ++i) myOSystem.console().cartridge().patch(address + i, savedRom[i]); myOSystem.console().cartridge().bank(oldBank); @@ -66,7 +66,7 @@ void BankRomCheat::evaluate() const int oldBank = myOSystem.console().cartridge().getBank(address); myOSystem.console().cartridge().bank(bank); - for(int i = 0; i < count; ++i) + for(int i = 0; std::cmp_less(i, count); ++i) myOSystem.console().cartridge().patch(address + i, value); myOSystem.console().cartridge().bank(oldBank); diff --git a/src/cheat/CheetahCheat.cxx b/src/cheat/CheetahCheat.cxx index 33f6316d8..cbc1395f3 100644 --- a/src/cheat/CheetahCheat.cxx +++ b/src/cheat/CheetahCheat.cxx @@ -28,7 +28,7 @@ CheetahCheat::CheetahCheat(OSystem& os, string_view name, string_view code) count{static_cast(BSPF::stoi<16>(code.substr(5, 1)) + 1)} { // Back up original data; we need this if the cheat is ever disabled - for(int i = 0; i < count; ++i) + for(uInt8 i = 0; i < count; ++i) savedRom[i] = myOSystem.console().cartridge().peek(address + i); } @@ -42,7 +42,7 @@ bool CheetahCheat::enable() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CheetahCheat::disable() { - for(int i = 0; i < count; ++i) + for(uInt8 i = 0; i < count; ++i) myOSystem.console().cartridge().patch(address + i, savedRom[i]); return myEnabled = false; @@ -53,7 +53,7 @@ void CheetahCheat::evaluate() { if(!myEnabled) { - for(int i = 0; i < count; ++i) + for(uInt8 i = 0; i < count; ++i) myOSystem.console().cartridge().patch(address + i, value); myEnabled = true; diff --git a/src/common/FBBackendSDL2.cxx b/src/common/FBBackendSDL2.cxx index 58900018f..2cd96312b 100644 --- a/src/common/FBBackendSDL2.cxx +++ b/src/common/FBBackendSDL2.cxx @@ -287,8 +287,9 @@ bool FBBackendSDL2::setVideoMode(const VideoModeHandler::Mode& mode, int w{0}, h{0}; SDL_GetWindowSize(myWindow, &w, &h); - if(d != displayIndex || static_cast(w) != mode.screenS.w || - static_cast(h) != mode.screenS.h || adaptRefresh) + if(d != displayIndex || + std::cmp_not_equal(w, mode.screenS.w) || + std::cmp_not_equal(h, mode.screenS.h) || adaptRefresh) { // Renderer has to be destroyed *before* the window gets destroyed to avoid memory leaks SDL_DestroyRenderer(myRenderer); diff --git a/src/common/FBSurfaceSDL2.hxx b/src/common/FBSurfaceSDL2.hxx index c53ed44b6..c601c914d 100644 --- a/src/common/FBSurfaceSDL2.hxx +++ b/src/common/FBSurfaceSDL2.hxx @@ -70,7 +70,7 @@ class FBSurfaceSDL2 : public FBSurface private: bool setSrcPosInternal(uInt32 x, uInt32 y) { - if(x != static_cast(mySrcR.x) || y != static_cast(mySrcR.y)) + if(std::cmp_not_equal(x, mySrcR.x) || std::cmp_not_equal(y, mySrcR.y)) { mySrcR.x = x; mySrcR.y = y; mySrcGUIR.moveTo(x, y); @@ -79,7 +79,7 @@ class FBSurfaceSDL2 : public FBSurface return false; } bool setSrcSizeInternal(uInt32 w, uInt32 h) { - if(w != static_cast(mySrcR.w) || h != static_cast(mySrcR.h)) + if(std::cmp_not_equal(w, mySrcR.w) || std::cmp_not_equal(h, mySrcR.h)) { mySrcR.w = w; mySrcR.h = h; mySrcGUIR.setWidth(w); mySrcGUIR.setHeight(h); @@ -88,7 +88,7 @@ class FBSurfaceSDL2 : public FBSurface return false; } bool setDstPosInternal(uInt32 x, uInt32 y) { - if(x != static_cast(myDstR.x) || y != static_cast(myDstR.y)) + if(std::cmp_not_equal(x, myDstR.x) || std::cmp_not_equal(y, myDstR.y)) { myDstR.x = x; myDstR.y = y; myDstGUIR.moveTo(x, y); @@ -97,7 +97,7 @@ class FBSurfaceSDL2 : public FBSurface return false; } bool setDstSizeInternal(uInt32 w, uInt32 h) { - if(w != static_cast(myDstR.w) || h != static_cast(myDstR.h)) + if(std::cmp_not_equal(w, myDstR.w) || std::cmp_not_equal(h, myDstR.h)) { myDstR.w = w; myDstR.h = h; myDstGUIR.setWidth(w); myDstGUIR.setHeight(h); diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL2.cxx index ebdb6d2c5..f1d4e438a 100644 --- a/src/common/SoundSDL2.cxx +++ b/src/common/SoundSDL2.cxx @@ -488,8 +488,7 @@ void SoundSDL2::WavHandlerSDL2::processWav(uInt8* stream, uInt32 len) SDL_assert(cvt.needed); // Obviously, this one is always needed. cvt.len = len * mySpec.channels; // Mono 8 bit sample frames - if(!myCvtBuffer || - myCvtBufferSize < static_cast(cvt.len * cvt.len_mult)) + if(!myCvtBuffer || std::cmp_less(myCvtBufferSize, cvt.len * cvt.len_mult)) { myCvtBufferSize = cvt.len * cvt.len_mult; myCvtBuffer = make_unique(myCvtBufferSize); diff --git a/src/common/StaggeredLogger.cxx b/src/common/StaggeredLogger.cxx index 966710ca8..41aff6371 100644 --- a/src/common/StaggeredLogger.cxx +++ b/src/common/StaggeredLogger.cxx @@ -116,7 +116,9 @@ void StaggeredLogger::startInterval() Int64 msecSinceLastIntervalEnd = duration_cast>(now - myLastIntervalEndTimestamp).count(); - while (msecSinceLastIntervalEnd > myCooldownTime && myCurrentIntervalFactor > 1) { + while (std::cmp_greater(msecSinceLastIntervalEnd, myCooldownTime) && + myCurrentIntervalFactor > 1) + { msecSinceLastIntervalEnd -= myCooldownTime; decreaseInterval(); } diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 0f4ab5a60..6dc65c52d 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -634,6 +634,7 @@ string CartDebug::uniqueLabel(const string& label) string uniqueLabel = label; int count = 0; + // TODO: does find return multiple items?? while(myUserAddresses.find(uniqueLabel) != myUserAddresses.end()) uniqueLabel = label + "." + std::to_string(++count); @@ -1113,7 +1114,7 @@ string CartDebug::saveDisassembly(string path) // prepare for switching banks uInt32 origin = 0; - for(int bank = 0; bank < romBankCount; ++bank) + for(int bank = 0; std::cmp_less(bank, romBankCount); ++bank) { // TODO: not every CartDebugWidget does it like that, we need a method cart.unlockHotspots(); diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index f263ea855..fe89a6419 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -107,7 +107,7 @@ string DebuggerParser::run(string_view command) getArgs(command, verb); commandResult.str(""); - for(int i = 0; i < static_cast(commands.size()); ++i) + for(int i = 0; std::cmp_less(i, commands.size()); ++i) { if(BSPF::equalsIgnoreCase(verb, commands[i].cmdString)) { @@ -205,31 +205,31 @@ int DebuggerParser::decipher_arg(string_view str) bin=false; dec=false; } - if(arg.substr(0, 1) == "*") { + if(arg.starts_with("*")) { derefByte = true; arg.erase(0, 1); - } else if(arg.substr(0, 1) == "@") { + } else if(arg.starts_with("@")) { derefWord = true; arg.erase(0, 1); } - if(arg.substr(0, 1) == "<") { + if(arg.starts_with("<")) { lobyte = true; arg.erase(0, 1); - } else if(arg.substr(0, 1) == ">") { + } else if(arg.starts_with(">")) { hibyte = true; arg.erase(0, 1); } - if(arg.substr(0, 1) == "\\") { + if(arg.starts_with("\\")) { dec = false; bin = true; arg.erase(0, 1); - } else if(arg.substr(0, 1) == "#") { + } else if(arg.starts_with("#")) { dec = true; bin = false; arg.erase(0, 1); - } else if(arg.substr(0, 1) == "$") { + } else if(arg.starts_with("$")) { dec = false; bin = false; arg.erase(0, 1); @@ -1212,7 +1212,7 @@ void DebuggerParser::executeDelTrap() void DebuggerParser::executeDelWatch() { const int which = args[0] - 1; - if(which >= 0 && which < static_cast(myWatches.size())) + if(which >= 0 && std::cmp_less(which, myWatches.size())) { Vec::removeAt(myWatches, which); commandResult << "removed watch"; @@ -2028,7 +2028,7 @@ void DebuggerParser::executeRunToPc() // Update romlist to point to current PC const int pcline = cartdbg.addressToLine(debugger.cpuDebug().pc()); - done = (pcline >= 0) && (list[pcline].address == args[0]); + done = (pcline >= 0) && std::cmp_equal(list[pcline].address, args[0]); progress.incProgress(); ++count; } while(!done && !progress.isCancelled()); @@ -2365,7 +2365,7 @@ void DebuggerParser::executeTimer() for(uInt32 i = 0; i < argCount; ++i) { - if(static_cast(args[i]) >= std::max(0x80U, romBankCount - 1)) + if(std::cmp_greater_equal(args[i], std::max(0x80U, romBankCount - 1))) { if(numAddrs == 2) { @@ -2381,7 +2381,7 @@ void DebuggerParser::executeTimer() outputCommandError("too many bank arguments", myCommand); return; } - if(static_cast(args[i]) >= romBankCount) + if(std::cmp_greater_equal(args[i], romBankCount)) { commandResult << red("invalid bank"); return; diff --git a/src/debugger/DiStella.cxx b/src/debugger/DiStella.cxx index ba1d5b27e..e979cc5eb 100644 --- a/src/debugger/DiStella.cxx +++ b/src/debugger/DiStella.cxx @@ -73,7 +73,7 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list, // Add reserved line equates ostringstream reservedLabel; - for (int k = 0; k <= myAppData.end; k++) { + for (int k = 0; std::cmp_less_equal(k, myAppData.end); k++) { if ((myLabels[k] & (Device::REFERENCED | Device::VALID_ENTRY)) == Device::REFERENCED) { // If we have a piece of code referenced somewhere else, but cannot // locate the label in code (i.e because the address is inside of a @@ -718,7 +718,7 @@ void DiStella::disasmPass1(CartDebug::AddressList& debuggerAddresses) // Stella itself can provide hints on whether an address has ever // been referenced as CODE - while (myAddressQueue.empty() && codeAccessPoint <= myAppData.end) { + while (myAddressQueue.empty() && std::cmp_less_equal(codeAccessPoint, myAppData.end)) { if ((Debugger::debugger().getAccessFlags(codeAccessPoint + myOffset) & Device::CODE) && !(myLabels[codeAccessPoint & myAppData.end] & Device::CODE)) { myAddressQueue.push(codeAccessPoint + myOffset); @@ -730,7 +730,7 @@ void DiStella::disasmPass1(CartDebug::AddressList& debuggerAddresses) duplicateFound = !myAddressQueue.empty() && (myAddressQueue.front() == lastPC); // TODO: check! } // while - for (int k = 0; k <= myAppData.end; k++) { + for (int k = 0; std::cmp_less_equal(k, myAppData.end); k++) { // Let the emulation core know about tentative code if (checkBit(k, Device::CODE) && !(Debugger::debugger().getAccessFlags(k + myOffset) & Device::CODE) @@ -938,8 +938,8 @@ DiStella::AddressType DiStella::mark(uInt32 address, uInt16 mask, bool directive else if(type == CartDebug::AddrType::ZPRAM && myOffset != 0) { return AddressType::ZP_RAM; } - else if(address >= static_cast(myOffset) && - address <= static_cast(myAppData.end + myOffset)) { + else if(std::cmp_greater_equal(address, myOffset) && + std::cmp_less_equal(address, myAppData.end + myOffset)) { myLabels[address - myOffset] = myLabels[address - myOffset] | mask; if(directive) myDirectives[address - myOffset] = mask; diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index 48e4c37ba..4a6e9d9d2 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -1190,7 +1190,7 @@ string TIADebug::toString() // build up output, then return it. buf << std::setfill(' ') << std::left << decWithLabel("scanline", myTIA.scanlines(), - static_cast(myTIA.scanlines()) != oldState.info[4]) << " " + std::cmp_not_equal(myTIA.scanlines(), oldState.info[4])) << " " << boolWithLabel("vsync", vsync(), state.vsb[0] != oldState.vsb[0]) << " " << boolWithLabel("vblank", vblank(), diff --git a/src/debugger/gui/Cart3EPlusWidget.cxx b/src/debugger/gui/Cart3EPlusWidget.cxx index 1dc465f62..c45fface3 100644 --- a/src/debugger/gui/Cart3EPlusWidget.cxx +++ b/src/debugger/gui/Cart3EPlusWidget.cxx @@ -162,8 +162,9 @@ void Cartridge3EPlusWidget::handleCommand(CommandSender* sender, const bool isROM = myBankType[segment]->getSelectedTag() == "ROM"; const int bank = myBankWidgets[segment]->getSelected(); - myBankCommit[segment]->setEnabled((isROM && bank < myCart.romBankCount()) - || (!isROM && bank < myCart.ramBankCount())); + myBankCommit[segment]->setEnabled( + (isROM && std::cmp_less(bank, myCart.romBankCount())) || + (!isROM && std::cmp_less(bank, myCart.ramBankCount()))); break; } case kChangeBank: @@ -197,7 +198,7 @@ void Cartridge3EPlusWidget::updateUIState() { // Set description for each 1K segment state (@ each index) // Set contents for actual banks number and type (@ each even index) - for(int seg = 0; seg < myCart3EP.myBankSegs; ++seg) + for(int seg = 0; std::cmp_less(seg, myCart3EP.myBankSegs); ++seg) { const uInt16 bank = myCart.getSegmentBank(seg); const size_t bank_off = static_cast(seg) * 2; diff --git a/src/debugger/gui/CartBUSWidget.cxx b/src/debugger/gui/CartBUSWidget.cxx index 4c234be16..699cb43ab 100644 --- a/src/debugger/gui/CartBUSWidget.cxx +++ b/src/debugger/gui/CartBUSWidget.cxx @@ -367,8 +367,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] != - static_cast(myOldState.mcounters[i])); + changed.push_back(std::cmp_not_equal(myCart.myMusicCounters[i], + myOldState.mcounters[i])); } myMusicCounters->setList(alist, vlist, changed); @@ -376,8 +376,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] != - static_cast(myOldState.mfreqs[i])); + changed.push_back(std::cmp_not_equal(myCart.myMusicFrequencies[i], + myOldState.mfreqs[i])); } myMusicFrequencies->setList(alist, vlist, changed); @@ -385,8 +385,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) != - static_cast(myOldState.mwaves[i])); + changed.push_back(std::cmp_not_equal(myCart.getWaveform(i) >> 5, + myOldState.mwaves[i])); } myMusicWaveforms->setList(alist, vlist, changed); @@ -394,8 +394,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)) != - static_cast(myOldState.mwavesizes[i])); + changed.push_back(std::cmp_not_equal(myCart.getWaveformSize(i), + myOldState.mwavesizes[i])); } myMusicWaveformSizes->setList(alist, vlist, changed); @@ -403,8 +403,8 @@ void CartridgeBUSWidget::loadConfig() { alist.clear(); vlist.clear(); changed.clear(); alist.push_back(0); vlist.push_back(myCart.getSample()); - changed.push_back((myCart.getSample()) != - static_cast(myOldState.samplepointer[0])); + changed.push_back(std::cmp_not_equal(myCart.getSample(), + myOldState.samplepointer[0])); mySamplePointer->setList(alist, vlist, changed); } diff --git a/src/debugger/gui/CartCDFWidget.cxx b/src/debugger/gui/CartCDFWidget.cxx index ad0c58b98..056917d40 100644 --- a/src/debugger/gui/CartCDFWidget.cxx +++ b/src/debugger/gui/CartCDFWidget.cxx @@ -234,7 +234,7 @@ void CartridgeCDFWidget::saveOldState() if (isCDFJplus()) myOldState.fastfetchoffset.push_back(myCart.myRAM[myCart.myFastFetcherOffset]); - for(uInt32 i = 0; i < static_cast((isCDFJ() || isCDFJplus()) ? 35 : 34); ++i) + for(uInt32 i = 0; i < (isCDFJ() || isCDFJplus() ? 35U : 34U); ++i) { // Pointers are stored as: // PPPFF--- @@ -319,7 +319,7 @@ void CartridgeCDFWidget::loadConfig() alist.clear(); vlist.clear(); changed.clear(); alist.push_back(0); vlist.push_back(myCart.getDatastreamPointer(0x20) >> ds_shift); - changed.push_back(static_cast(myCart.getDatastreamPointer(0x20)) != myOldState.datastreampointers[0x20]); + changed.push_back(std::cmp_not_equal(myCart.getDatastreamPointer(0x20), myOldState.datastreampointers[0x20])); myCommandStreamPointer->setList(alist, vlist, changed); alist.clear(); vlist.clear(); changed.clear(); @@ -343,7 +343,7 @@ void CartridgeCDFWidget::loadConfig() alist.clear(); vlist.clear(); changed.clear(); alist.push_back(0); vlist.push_back(myCart.getDatastreamIncrement(0x20)); - changed.push_back(static_cast(myCart.getDatastreamIncrement(0x20)) != myOldState.datastreamincrements[0x20]); + changed.push_back(std::cmp_not_equal(myCart.getDatastreamIncrement(0x20), myOldState.datastreamincrements[0x20])); myCommandStreamIncrement->setList(alist, vlist, changed); alist.clear(); vlist.clear(); changed.clear(); @@ -359,8 +359,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] != - static_cast(myOldState.mcounters[i])); + changed.push_back(std::cmp_not_equal(myCart.myMusicCounters[i], + myOldState.mcounters[i])); } myMusicCounters->setList(alist, vlist, changed); @@ -368,8 +368,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] != - static_cast(myOldState.mfreqs[i])); + changed.push_back(std::cmp_not_equal(myCart.myMusicFrequencies[i], + myOldState.mfreqs[i])); } myMusicFrequencies->setList(alist, vlist, changed); @@ -377,8 +377,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) != - static_cast(myOldState.mwaves[i])); + changed.push_back(std::cmp_not_equal(myCart.getWaveform(i) >> 5, + myOldState.mwaves[i])); } myMusicWaveforms->setList(alist, vlist, changed); @@ -386,15 +386,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)) != - static_cast(myOldState.mwavesizes[i])); + changed.push_back(std::cmp_not_equal(myCart.getWaveformSize(i), + 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()) != - static_cast(myOldState.samplepointer[0])); + changed.push_back(std::cmp_not_equal(myCart.getSample(), + myOldState.samplepointer[0])); mySamplePointer->setList(alist, vlist, changed); myFastFetch->setState((myCart.myMode & 0x0f) == 0); diff --git a/src/debugger/gui/CartDPCPlusWidget.cxx b/src/debugger/gui/CartDPCPlusWidget.cxx index b18b51888..e2c12aa2f 100644 --- a/src/debugger/gui/CartDPCPlusWidget.cxx +++ b/src/debugger/gui/CartDPCPlusWidget.cxx @@ -253,7 +253,7 @@ void CartridgeDPCPlusWidget::loadConfig() for(int i = 0; i < 8; ++i) { alist.push_back(0); vlist.push_back(myCart.myCounters[i]); - changed.push_back(myCart.myCounters[i] != myOldState.counters[i]); + changed.push_back(std::cmp_not_equal(myCart.myCounters[i], myOldState.counters[i])); } myCounters->setList(alist, vlist, changed); @@ -261,8 +261,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] != - static_cast(myOldState.fraccounters[i])); + changed.push_back(std::cmp_not_equal(myCart.myFractionalCounters[i], + myOldState.fraccounters[i])); } myFracCounters->setList(alist, vlist, changed); @@ -286,8 +286,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] != - static_cast(myOldState.mcounters[i])); + changed.push_back(std::cmp_not_equal(myCart.myMusicCounters[i], + myOldState.mcounters[i])); } myMusicCounters->setList(alist, vlist, changed); @@ -295,8 +295,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] != - static_cast(myOldState.mfreqs[i])); + changed.push_back(std::cmp_not_equal(myCart.myMusicFrequencies[i], + myOldState.mfreqs[i])); } myMusicFrequencies->setList(alist, vlist, changed); @@ -304,7 +304,8 @@ void CartridgeDPCPlusWidget::loadConfig() for(int i = 0; i < 3; ++i) { alist.push_back(0); vlist.push_back(myCart.myMusicWaveforms[i]); - changed.push_back(myCart.myMusicWaveforms[i] != myOldState.mwaves[i]); + changed.push_back(std::cmp_not_equal(myCart.myMusicWaveforms[i], + myOldState.mwaves[i])); } myMusicWaveforms->setList(alist, vlist, changed); diff --git a/src/debugger/gui/CartDPCWidget.cxx b/src/debugger/gui/CartDPCWidget.cxx index 1122eb770..7b29a1519 100644 --- a/src/debugger/gui/CartDPCWidget.cxx +++ b/src/debugger/gui/CartDPCWidget.cxx @@ -169,7 +169,8 @@ void CartridgeDPCWidget::loadConfig() for(int i = 0; i < 8; ++i) { alist.push_back(0); vlist.push_back(myCart.myTops[i]); - changed.push_back(myCart.myTops[i] != myOldState.tops[i]); + changed.push_back(std::cmp_not_equal(myCart.myTops[i], + myOldState.tops[i])); } myTops->setList(alist, vlist, changed); @@ -177,7 +178,8 @@ void CartridgeDPCWidget::loadConfig() for(int i = 0; i < 8; ++i) { alist.push_back(0); vlist.push_back(myCart.myBottoms[i]); - changed.push_back(myCart.myBottoms[i] != myOldState.bottoms[i]); + changed.push_back(std::cmp_not_equal(myCart.myBottoms[i], + myOldState.bottoms[i])); } myBottoms->setList(alist, vlist, changed); @@ -185,7 +187,8 @@ void CartridgeDPCWidget::loadConfig() for(int i = 0; i < 8; ++i) { alist.push_back(0); vlist.push_back(myCart.myCounters[i]); - changed.push_back(myCart.myCounters[i] != myOldState.counters[i]); + changed.push_back(std::cmp_not_equal(myCart.myCounters[i], + myOldState.counters[i])); } myCounters->setList(alist, vlist, changed); @@ -193,7 +196,8 @@ void CartridgeDPCWidget::loadConfig() for(int i = 0; i < 8; ++i) { alist.push_back(0); vlist.push_back(myCart.myFlags[i]); - changed.push_back(myCart.myFlags[i] != myOldState.flags[i]); + changed.push_back(std::cmp_not_equal(myCart.myFlags[i], + myOldState.flags[i])); } myFlags->setList(alist, vlist, changed); diff --git a/src/debugger/gui/CartE7Widget.cxx b/src/debugger/gui/CartE7Widget.cxx index ae4750a90..d338ba201 100644 --- a/src/debugger/gui/CartE7Widget.cxx +++ b/src/debugger/gui/CartE7Widget.cxx @@ -69,7 +69,7 @@ void CartridgeE7Widget::initialize(GuiObject* boss, int ypos = addBaseInformation(size, "M Network", info.view(), 15) + myLineHeight; VariantList items0, items1; - for(int i = 0; i < cart.romBankCount(); ++i) + for(int i = 0; std::cmp_less(i, cart.romBankCount()); ++i) VarList::push_back(items0, getSpotLower(i, myCart.romBankCount())); for(int i = 0; i < 4; ++i) VarList::push_back(items1, getSpotUpper(i)); diff --git a/src/debugger/gui/CartEnhancedWidget.cxx b/src/debugger/gui/CartEnhancedWidget.cxx index 9f9bc550e..075c91527 100644 --- a/src/debugger/gui/CartEnhancedWidget.cxx +++ b/src/debugger/gui/CartEnhancedWidget.cxx @@ -101,7 +101,8 @@ string CartridgeEnhancedWidget::romDescription() if(myCart.romBankCount() > 1) { - for(int bank = 0, offset = 0xFFC; bank < myCart.romBankCount(); ++bank, offset += 0x1000) + for(int bank = 0, offset = 0xFFC; std::cmp_less(bank, myCart.romBankCount()); + ++bank, offset += 0x1000) { uInt16 start = (image[offset + 1] << 8) | image[offset]; start -= start % 0x1000; @@ -183,10 +184,10 @@ void CartridgeEnhancedWidget::bankList(uInt16 bankCount, int seg, VariantList& i const bool hasRamBanks = myCart.myRamBankCount > 0; - for(int bank = 0; bank < bankCount; ++bank) + for(int bank = 0; std::cmp_less(bank, bankCount); ++bank) { ostringstream buf; - const bool isRamBank = (bank >= myCart.romBankCount()); + const bool isRamBank = std::cmp_greater_equal(bank, myCart.romBankCount()); const int bankNum = (bank - (isRamBank ? myCart.romBankCount() : 0)); buf << std::setw(bankNum < 10 ? 2 : 1) << "#" << std::dec << bankNum; @@ -211,7 +212,7 @@ void CartridgeEnhancedWidget::bankSelect(int& ypos) myBankWidgets = make_unique(bankSegs()); - for(int seg = 0; seg < bankSegs(); ++seg) + for(int seg = 0; std::cmp_less(seg, bankSegs()); ++seg) { // fill bank and hotspot list VariantList items; @@ -253,10 +254,10 @@ string CartridgeEnhancedWidget::bankState() { buf << "Segments: "; - for(int seg = 0; seg < bankSegs(); ++seg) + for(int seg = 0; std::cmp_less(seg, bankSegs()); ++seg) { const int bank = myCart.getSegmentBank(seg); - const bool isRamBank = (bank >= myCart.romBankCount()); + const bool isRamBank = std::cmp_greater_equal(bank, myCart.romBankCount()); if(seg > 0) buf << " / "; @@ -321,8 +322,8 @@ void CartridgeEnhancedWidget::saveOldState() } myOldState.banks.clear(); - if (bankSegs() > 1) - for(int seg = 0; seg < bankSegs(); ++seg) + if(bankSegs() > 1) + for(int seg = 0; std::cmp_less(seg, bankSegs()); ++seg) myOldState.banks.push_back(myCart.getSegmentBank(seg)); else myOldState.banks.push_back(myCart.getBank()); @@ -350,7 +351,7 @@ void CartridgeEnhancedWidget::loadConfig() if(myBankWidgets != nullptr) { if(bankSegs() > 1) - for(int seg = 0; seg < bankSegs(); ++seg) + for(int seg = 0; std::cmp_less(seg, bankSegs()); ++seg) myBankWidgets[seg]->setSelectedIndex(myCart.getSegmentBank(seg), myCart.getSegmentBank(seg) != myOldState.banks[seg]); else diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index c095bf27f..ff8800220 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -225,7 +225,7 @@ void DataGridWidget::setValueInternal(int position, int value, bool changed) void DataGridWidget::setValue(int position, int value, bool changed, bool emitSignal) { - if(position >= 0 && position < static_cast(_valueList.size())) + if(position >= 0 && std::cmp_less(position, _valueList.size())) { // Correctly format the data for viewing editString() = Common::Base::toString(value, _base); diff --git a/src/debugger/gui/FlashWidget.cxx b/src/debugger/gui/FlashWidget.cxx index 67fcf48a8..6f4976408 100644 --- a/src/debugger/gui/FlashWidget.cxx +++ b/src/debugger/gui/FlashWidget.cxx @@ -108,7 +108,7 @@ void FlashWidget::loadConfig() myPage[useCount]->setLabel(label.view()); startPage = -1; - if(++useCount == MAX_PAGES) + if(std::cmp_equal(++useCount, MAX_PAGES)) break; } } diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index ecd686026..41cabcc80 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -580,7 +580,7 @@ int PromptWidget::historyDir(int& index, int direction) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void PromptWidget::historyAdd(string_view entry) { - if(_historyIndex >= static_cast(_history.size())) + if(std::cmp_greater_equal(_historyIndex, _history.size())) _history.emplace_back(entry); else _history[_historyIndex] = entry; diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx index a9d88a732..64719c3f6 100644 --- a/src/debugger/gui/RamWidget.cxx +++ b/src/debugger/gui/RamWidget.cxx @@ -501,7 +501,7 @@ string RamWidget::doCompare(string_view str) } const int addr = mySearchAddr[i]; - if(ram[addr] == searchVal) + if(std::cmp_equal(ram[addr], searchVal)) { tempAddrList.push_back(addr); tempValueList.push_back(searchVal); diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index d85000705..a690251f7 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -126,7 +126,7 @@ void RomListWidget::setList(const CartDebug::Disassembly& disasm) myCheckList[i]->setFlags(Widget::FLAG_ENABLED); // Then turn off any extras - if(static_cast(myDisasm->list.size()) < _rows) + if(std::cmp_less(myDisasm->list.size(), _rows)) for(int i = static_cast(myDisasm->list.size()); i < _rows; ++i) myCheckList[i]->clearFlags(Widget::FLAG_ENABLED); @@ -152,7 +152,7 @@ void RomListWidget::setSelected(int item) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void RomListWidget::setHighlighted(int item) { - if(item < -1 || item >= static_cast(myDisasm->list.size())) + if(item < -1 || std::cmp_greater_equal(item, myDisasm->list.size())) return; if(isEnabled()) diff --git a/src/debugger/gui/RomWidget.cxx b/src/debugger/gui/RomWidget.cxx index 0b1afa23b..2ad2e4af0 100644 --- a/src/debugger/gui/RomWidget.cxx +++ b/src/debugger/gui/RomWidget.cxx @@ -257,7 +257,7 @@ uInt16 RomWidget::getAddress(int disasm_line) const CartDebug::DisassemblyList& list = instance().debugger().cartDebug().disassembly().list; - if (disasm_line < static_cast(list.size()) && list[disasm_line].address != 0) + if (std::cmp_less(disasm_line, list.size()) && list[disasm_line].address != 0) return list[disasm_line].address; else return 0; diff --git a/src/debugger/gui/ToggleBitWidget.cxx b/src/debugger/gui/ToggleBitWidget.cxx index 23607c4bf..44fddc310 100644 --- a/src/debugger/gui/ToggleBitWidget.cxx +++ b/src/debugger/gui/ToggleBitWidget.cxx @@ -87,9 +87,9 @@ string ToggleBitWidget::getToolTip(const Common::Point& pos) const string tip = ToggleWidget::getToolTip(pos); - if(idx.x < static_cast(_labelList.size())) + if(std::cmp_less(idx.x, _labelList.size())) { - const string label = _labelList[idx.x]; + const string& label = _labelList[idx.x]; if(!label.empty()) return tip + "\n" + label; diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index f126d365a..1dd53852d 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -124,9 +124,9 @@ FORCE_INLINE void CartridgeDPC::updateMusicModeDataFetchers() newLow = 0; // Update flag register for this data fetcher - if(newLow <= myBottoms[x]) + if(std::cmp_less_equal(newLow, myBottoms[x])) myFlags[x] = 0x00; - else if(newLow <= myTops[x]) + else if(std::cmp_less_equal(newLow, myTops[x])) myFlags[x] = 0xff; myCounters[x] = (myCounters[x] & 0x0700) | static_cast(newLow); diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index 3a613c0ea..a65f9633a 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -190,12 +190,12 @@ inline void CartridgeDPCPlus::callFunction(uInt8 value) myParameterPointer = 0; break; case 1: // Copy ROM to fetcher - for(int i = 0; i < myParameter[3]; ++i) + for(int i = 0; std::cmp_less(i, myParameter[3]); ++i) myDisplayImage[myCounters[myParameter[2] & 0x7]+i] = myProgramImage[ROMdata+i]; myParameterPointer = 0; break; case 2: // Copy value to fetcher - for(int i = 0; i < myParameter[3]; ++i) + for(int i = 0; std::cmp_less(i, myParameter[3]); ++i) myDisplayImage[myCounters[myParameter[2]]+i] = myParameter[0]; myParameterPointer = 0; break; diff --git a/src/emucore/EventHandler.cxx b/src/emucore/EventHandler.cxx index 05c33352b..a6b2a2cc6 100644 --- a/src/emucore/EventHandler.cxx +++ b/src/emucore/EventHandler.cxx @@ -2442,14 +2442,14 @@ Event::Type EventHandler::eventAtIndex(int idx, Event::Group group) if(group == Event::Group::Menu) { - if(index < 0 || index >= static_cast(ourMenuActionList.size())) + if(index < 0 || std::cmp_greater_equal(index, ourMenuActionList.size())) return Event::NoType; else return ourMenuActionList[index].event; } else { - if(index < 0 || index >= static_cast(ourEmulActionList.size())) + if(index < 0 || std::cmp_greater_equal(index, ourEmulActionList.size())) return Event::NoType; else return ourEmulActionList[index].event; @@ -2463,14 +2463,14 @@ string EventHandler::actionAtIndex(int idx, Event::Group group) if(group == Event::Group::Menu) { - if(index < 0 || index >= static_cast(ourMenuActionList.size())) + if(index < 0 || std::cmp_greater_equal(index, ourMenuActionList.size())) return EmptyString; else return ourMenuActionList[index].action; } else { - if(index < 0 || index >= static_cast(ourEmulActionList.size())) + if(index < 0 || std::cmp_greater_equal(index, ourEmulActionList.size())) return EmptyString; else return ourEmulActionList[index].action; @@ -2484,14 +2484,14 @@ string EventHandler::keyAtIndex(int idx, Event::Group group) if(group == Event::Group::Menu) { - if(index < 0 || index >= static_cast(ourMenuActionList.size())) + if(index < 0 || std::cmp_greater_equal(index, ourMenuActionList.size())) return EmptyString; else return ourMenuActionList[index].key; } else { - if(index < 0 || index >= static_cast(ourEmulActionList.size())) + if(index < 0 || std::cmp_greater_equal(index, ourEmulActionList.size())) return EmptyString; else return ourEmulActionList[index].key; diff --git a/src/emucore/FBSurface.cxx b/src/emucore/FBSurface.cxx index a7eba43f2..7c7a1e4bb 100644 --- a/src/emucore/FBSurface.cxx +++ b/src/emucore/FBSurface.cxx @@ -167,7 +167,7 @@ void FBSurface::drawChar(const GUI::Font& font, uInt8 chr, const FontDesc& desc = font.desc(); // If this character is not included in the font, use the default char. - if(chr < desc.firstchar || chr >= desc.firstchar + desc.size) + if(std::cmp_less(chr, desc.firstchar) || chr >= desc.firstchar + desc.size) { if (chr == ' ') return; chr = desc.defaultchar; diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index 9ab033987..a71b31067 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -532,7 +532,7 @@ void FrameBuffer::update(UpdateMode mode) // Pause sound if saved states were removed or states are too far apart myOSystem.sound().pause(stateFrames > intervalFrames || - frames > static_cast(myOSystem.audioSettings().bufferSize() / 2 + 1)); + std::cmp_greater(frames, myOSystem.audioSettings().bufferSize() / 2 + 1)); } redraw |= success; if(redraw) diff --git a/src/emucore/PlusROM.cxx b/src/emucore/PlusROM.cxx index 200077345..d32652d15 100644 --- a/src/emucore/PlusROM.cxx +++ b/src/emucore/PlusROM.cxx @@ -501,7 +501,7 @@ ByteArray PlusROM::getSend() const ByteArray arr; const uInt8 txPos = myTxPos != 0 ? myTxPos : myLastTxPos; - for(int i = 0; i < txPos; ++i) + for(int i = 0; std::cmp_less(i, txPos); ++i) arr.push_back(myTxBuffer[i]); return arr; diff --git a/src/emucore/tia/Ball.hxx b/src/emucore/tia/Ball.hxx index e18ea3adb..8cef6670e 100644 --- a/src/emucore/tia/Ball.hxx +++ b/src/emucore/tia/Ball.hxx @@ -409,7 +409,8 @@ void Ball::tick(bool isReceivingRegularClock) break; } - } else if (myIsRendering && ++myRenderCounter >= (starfieldEffect ? myEffectiveWidth : myWidth)) + } else if (myIsRendering && std::cmp_greater_equal(++myRenderCounter, + starfieldEffect ? myEffectiveWidth : myWidth)) myIsRendering = false; if (++myCounter >= TIAConstants::H_PIXEL) diff --git a/src/emucore/tia/Missile.cxx b/src/emucore/tia/Missile.cxx index 3772782a6..573ad9aa7 100644 --- a/src/emucore/tia/Missile.cxx +++ b/src/emucore/tia/Missile.cxx @@ -145,7 +145,7 @@ void Missile::nusiz(uInt8 value) myWidth = ourWidths[(value & 0x30) >> 4]; myDecodes = DrawCounterDecodes::get().missileDecodes()[myDecodesOffset]; - if (myIsRendering && myRenderCounter >= myWidth) + if (myIsRendering && std::cmp_greater_equal(myRenderCounter, myWidth)) myIsRendering = false; } diff --git a/src/emucore/tia/Missile.hxx b/src/emucore/tia/Missile.hxx index 755925108..8e24600ae 100644 --- a/src/emucore/tia/Missile.hxx +++ b/src/emucore/tia/Missile.hxx @@ -210,7 +210,8 @@ void Missile::tick(uInt8 hclock, bool isReceivingMclock) } } - if (++myRenderCounter >= (isMoving ? myEffectiveWidth : myWidth)) myIsRendering = false; + if (std::cmp_greater_equal(++myRenderCounter, isMoving ? myEffectiveWidth : myWidth)) + myIsRendering = false; } if (++myCounter >= TIAConstants::H_PIXEL) myCounter = 0; diff --git a/src/gui/BrowserDialog.cxx b/src/gui/BrowserDialog.cxx index fb19a32a3..40afc4c14 100644 --- a/src/gui/BrowserDialog.cxx +++ b/src/gui/BrowserDialog.cxx @@ -126,11 +126,11 @@ void BrowserDialog::show(Dialog* parent, const GUI::Font& font, h = FBMinimum::Height; } - if(w > static_cast(font.getMaxCharWidth() * 80)) + if(std::cmp_greater(w, font.getMaxCharWidth() * 80)) w = font.getMaxCharWidth() * 80; - if(ourBrowser == nullptr || &ourBrowser->parent() != &parent->parent() - || ourBrowser->_w > static_cast(w) || ourBrowser->_h > static_cast(h)) + if(ourBrowser == nullptr || &ourBrowser->parent() != &parent->parent() || + std::cmp_greater(ourBrowser->_w, w) || std::cmp_greater(ourBrowser->_h, h)) { ourBrowser = make_unique(parent, font, w, h); } diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx index 476a86ae9..0ef2ff466 100644 --- a/src/gui/CheckListWidget.cxx +++ b/src/gui/CheckListWidget.cxx @@ -59,7 +59,7 @@ void CheckListWidget::setList(const StringList& list, const BoolArray& state) _checkList[i]->setFlags(Widget::FLAG_ENABLED); // Then turn off any extras - if(static_cast(_stateList.size()) < _rows) + if(std::cmp_less(_stateList.size(), _rows)) for(int i = static_cast(_stateList.size()); i < _rows; ++i) _checkList[i]->clearFlags(Widget::FLAG_ENABLED); @@ -69,7 +69,7 @@ void CheckListWidget::setList(const StringList& list, const BoolArray& state) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void CheckListWidget::setLine(int line, string_view str, const bool& state) { - if(line >= static_cast(_list.size())) + if(std::cmp_greater_equal(line, _list.size())) return; _list[line] = str; @@ -147,7 +147,7 @@ Common::Rect CheckListWidget::getEditRect() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CheckListWidget::getState(int line) const { - if(line >= 0 && line < static_cast(_stateList.size())) + if(line >= 0 && std::cmp_less(line, _stateList.size())) return _stateList[line]; else return false; diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx index 748b950e7..6e1ffb4bf 100644 --- a/src/gui/ContextMenu.cxx +++ b/src/gui/ContextMenu.cxx @@ -114,7 +114,7 @@ void ContextMenu::recalc(const Common::Rect& image) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ContextMenu::setSelectedIndex(int idx) { - if(idx >= 0 && idx < static_cast(_entries.size())) + if(idx >= 0 && std::cmp_less(idx, _entries.size())) _selectedItem = idx; else _selectedItem = -1; @@ -423,12 +423,12 @@ void ContextMenu::moveDown() // Otherwise, the offset should increase by 1 if(_selectedOffset == _numEntries) scrollDown(); - else if(_selectedOffset < static_cast(_entries.size())) + else if(std::cmp_less(_selectedOffset, _entries.size())) drawCurrentSelection(_selectedOffset+1); } else { - if(_selectedOffset < static_cast(_entries.size()) - 1) + if(std::cmp_less(_selectedOffset, _entries.size() - 1)) drawCurrentSelection(_selectedOffset+1); } } @@ -445,7 +445,7 @@ void ContextMenu::movePgUp() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ContextMenu::movePgDown() { - if(_firstEntry == static_cast(_entries.size() - _numEntries)) + if(std::cmp_equal(_firstEntry, _entries.size() - _numEntries)) moveToLast(); else scrollDown(_numEntries); @@ -474,7 +474,7 @@ void ContextMenu::moveToLast() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ContextMenu::moveToSelected() { - if(_selectedItem < 0 || _selectedItem >= static_cast(_entries.size())) + if(_selectedItem < 0 || std::cmp_greater_equal(_selectedItem, _entries.size())) return; // First jump immediately to the item diff --git a/src/gui/DeveloperDialog.cxx b/src/gui/DeveloperDialog.cxx index a3fe69b8a..14b67cfa3 100644 --- a/src/gui/DeveloperDialog.cxx +++ b/src/gui/DeveloperDialog.cxx @@ -1489,7 +1489,7 @@ void DeveloperDialog::handleDebugColours(int idx, int color) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DeveloperDialog::handleDebugColours(string_view colors) { - for(int i = 0; i < DEBUG_COLORS && i < static_cast(colors.length()); ++i) + for(int i = 0; i < DEBUG_COLORS && std::cmp_less(i, colors.length()); ++i) { switch(colors[i]) { @@ -1531,11 +1531,11 @@ void DeveloperDialog::handleFontSize() minH = std::min(size.h, minH); myDebuggerWidthSlider->setMinValue(minW); - if(minW > static_cast(myDebuggerWidthSlider->getValue())) + if(std::cmp_greater(minW, myDebuggerWidthSlider->getValue())) myDebuggerWidthSlider->setValue(minW); myDebuggerHeightSlider->setMinValue(minH); - if(minH > static_cast(myDebuggerHeightSlider->getValue())) + if(std::cmp_greater(minH, myDebuggerHeightSlider->getValue())) myDebuggerHeightSlider->setValue(minH); #endif } diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index fbaeb3756..bc81a0a4e 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -208,7 +208,7 @@ string Dialog::getHelpURL() const if(_focusedWidget && _focusedWidget->hasHelp()) return _focusedWidget->getHelpURL(); - if(_tabID < static_cast(_myTabList.size())) + if(std::cmp_less(_tabID, _myTabList.size())) { TabWidget* activeTabGroup = _myTabList[_tabID].widget; @@ -490,7 +490,7 @@ void Dialog::buildCurrentFocusList(int tabID) // Remember which tab item previously had focus, if applicable // This only applies if this method was called for a tab change Widget* tabFocusWidget = nullptr; - if(tabID >= 0 && tabID < static_cast(_myTabList.size())) + if(tabID >= 0 && std::cmp_less(tabID, _myTabList.size())) { // Save focus in previously selected tab column, // and get focus for new tab column @@ -937,7 +937,7 @@ void Dialog::getTabIdForWidget(const Widget* w) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool Dialog::cycleTab(int direction) { - if(_tabID >= 0 && _tabID < static_cast(_myTabList.size())) + if(_tabID >= 0 && std::cmp_less(_tabID, _myTabList.size())) { _myTabList[_tabID].widget->cycleTab(direction); return true; @@ -1086,12 +1086,12 @@ void Dialog::addDefaultsExtraOKCancelBGroup( } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void Dialog::TabFocus::appendFocusList(WidgetArray& list) +void Dialog::TabFocus::appendFocusList(WidgetArray& lst) { const int active = widget->getActiveTab(); - if(active >= 0 && active < static_cast(focus.size())) - Vec::append(list, focus[active].list); + if(active >= 0 && std::cmp_less(active, focus.size())) + Vec::append(lst, focus[active].list); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1146,7 +1146,7 @@ bool Dialog::shouldResize(uInt32& w, uInt32& h) const // returns true if the current size is larger than the allowed size or // if the current size is smaller than the allowed and wanted size - return (static_cast(_w) > w || static_cast(_h) > h || - (static_cast(_w) < w && static_cast(_w) < _max_w) || - (static_cast(_h) < h && static_cast(_h) < _max_h)); + return (std::cmp_greater(_w, w) || std::cmp_greater(_h, h) || + (std::cmp_less(_w, w) && std::cmp_less(_w, _max_w)) || + (std::cmp_less(_h, h) && std::cmp_less(_h, _max_h))); } diff --git a/src/gui/Dialog.hxx b/src/gui/Dialog.hxx index cbdbbd066..bf7cce3f9 100644 --- a/src/gui/Dialog.hxx +++ b/src/gui/Dialog.hxx @@ -256,7 +256,7 @@ class Dialog : public GuiObject explicit TabFocus(TabWidget* w = nullptr) : widget{w} { } - void appendFocusList(WidgetArray& list); + void appendFocusList(WidgetArray& lst); void saveCurrentFocus(Widget* w); Widget* getNewFocus(); }; diff --git a/src/gui/EditableWidget.cxx b/src/gui/EditableWidget.cxx index 9e24757c4..a63cb808b 100644 --- a/src/gui/EditableWidget.cxx +++ b/src/gui/EditableWidget.cxx @@ -127,7 +127,7 @@ int EditableWidget::toCaretPos(int x) const int i = 0; x += caretOfs(); - for(i = 0; i < static_cast(_editString.size()); ++i) + for(i = 0; std::cmp_less(i, _editString.size()); ++i) { x -= _font.getCharWidth(_editString[i]); if(x <= 0) @@ -248,7 +248,7 @@ bool EditableWidget::tryInsertChar(char c, int pos) if(_selectSize < 0) // left to right selection pos += _selectSize; // adjust to new position after removing selected text killSelectedText(); - if(!_maxLen || static_cast(_editString.length()) < _maxLen) + if(!_maxLen || std::cmp_less(_editString.length(), _maxLen)) { myUndoHandler->doChar(); // aggregate single chars _editString.insert(pos, 1, c); @@ -296,7 +296,7 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod) case Event::MoveRightChar: if(_selectSize) handled = setCaretPos(selectEndPos()); - else if(_caretPos < static_cast(_editString.size())) + else if(std::cmp_less(_caretPos, _editString.size())) handled = setCaretPos(_caretPos + 1); _selectSize = 0; break; @@ -327,7 +327,7 @@ bool EditableWidget::handleKeyDown(StellaKey key, StellaMod mod) break; case Event::SelectRightChar: - if(_caretPos < static_cast(_editString.size())) + if(std::cmp_less(_caretPos, _editString.size())) handled = moveCaretPos(+1); break; @@ -532,7 +532,7 @@ void EditableWidget::drawCaretSelection() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool EditableWidget::setCaretPos(int newPos) { - assert(newPos >= 0 && newPos <= int(_editString.size())); + assert(newPos >= 0 && std::cmp_less_equal(newPos, _editString.size())); _caretPos = newPos; _caretTimer = 0; @@ -612,7 +612,7 @@ bool EditableWidget::killChar(int direction, bool addEdit) } else if(direction == 1) // Delete next character (delete) { - if(_caretPos < static_cast(_editString.size())) + if(std::cmp_less(_caretPos, _editString.size())) { if(_selectSize > 0) _selectSize--; @@ -679,7 +679,7 @@ bool EditableWidget::killWord(int direction) } else if(direction == +1) // move to first character of next word { - while(currentPos < static_cast(_editString.size())) + while(std::cmp_less(currentPos, _editString.size())) { if(currentPos && BSPF::isWhiteSpace(_editString[currentPos - 1])) { @@ -715,11 +715,11 @@ bool EditableWidget::moveWord(int direction, bool select) if(direction == -1) // move to first character of previous word { - while (currentPos > 0) + while(currentPos > 0) { - if (BSPF::isWhiteSpace(_editString[currentPos - 1])) + if(BSPF::isWhiteSpace(_editString[currentPos - 1])) { - if (!space) + if(!space) break; } else @@ -734,11 +734,11 @@ bool EditableWidget::moveWord(int direction, bool select) } else if(direction == +1) // move to first character of next word { - while (currentPos < static_cast(_editString.size())) + while(std::cmp_less(currentPos, _editString.size())) { - if (currentPos && BSPF::isWhiteSpace(_editString[currentPos - 1])) + if(currentPos && BSPF::isWhiteSpace(_editString[currentPos - 1])) { - if (!space) + if(!space) break; } else @@ -798,19 +798,13 @@ string EditableWidget::selectString() const // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int EditableWidget::selectStartPos() const { - if(_selectSize < 0) - return _caretPos + _selectSize; - else - return _caretPos; + return (_selectSize < 0) ? _caretPos + _selectSize : _caretPos; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - int EditableWidget::selectEndPos() const { - if(_selectSize > 0) - return _caretPos + _selectSize; - else - return _caretPos; + return (_selectSize > 0) ? _caretPos + _selectSize : _caretPos; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/FileListWidget.cxx b/src/gui/FileListWidget.cxx index 39cb61395..5aa3d8141 100644 --- a/src/gui/FileListWidget.cxx +++ b/src/gui/FileListWidget.cxx @@ -717,7 +717,7 @@ string FileListWidget::getToolTip(const Common::Point& pos) const if(idx < 0) return EmptyString; - if(_includeSubDirs && static_cast(_dirList.size()) > idx) + if(_includeSubDirs && std::cmp_greater(_dirList.size(), idx)) return _toolTipText + _dirList[idx]; const string value = _list[idx]; diff --git a/src/gui/Font.cxx b/src/gui/Font.cxx index 0a7b47f35..b908ec4a4 100644 --- a/src/gui/Font.cxx +++ b/src/gui/Font.cxx @@ -38,7 +38,7 @@ int Font::getCharWidth(uInt8 chr) const return myFontDesc.maxwidth; // If this character is not included in the font, use the default char. - if(chr < myFontDesc.firstchar || myFontDesc.firstchar + myFontDesc.size < chr) + if(std::cmp_less(chr, myFontDesc.firstchar) || myFontDesc.firstchar + myFontDesc.size < chr) { if(chr == ' ') return myFontDesc.maxwidth / 2; diff --git a/src/gui/HighScoresDialog.cxx b/src/gui/HighScoresDialog.cxx index 0b8617190..94dc02d6c 100644 --- a/src/gui/HighScoresDialog.cxx +++ b/src/gui/HighScoresDialog.cxx @@ -409,7 +409,7 @@ void HighScoresDialog::updateWidgets(bool init) myNameWidgets[r]->setLabel(myScores.scores[r].name); myDateWidgets[r]->setLabel(myScores.scores[r].date); - if (static_cast(r) == myEditRank) + if (std::cmp_equal(r, myEditRank)) { myNameWidgets[r]->setFlags(EditTextWidget::FLAG_INVISIBLE); myEditNameWidgets[r]->clearFlags(EditTextWidget::FLAG_INVISIBLE); @@ -440,7 +440,7 @@ void HighScoresDialog::handlePlayedVariation() const Int32 newSpecial = instance().highScores().special(); const bool scoreInvert = instance().highScores().scoreInvert(); - for (myHighScoreRank = 0; myHighScoreRank < static_cast(NUM_RANKS); ++myHighScoreRank) + for (myHighScoreRank = 0; std::cmp_less(myHighScoreRank, NUM_RANKS); ++myHighScoreRank) { const Int32 highScore = myScores.scores[myHighScoreRank].score; @@ -452,10 +452,10 @@ void HighScoresDialog::handlePlayedVariation() break; } - if (myHighScoreRank < static_cast(NUM_RANKS)) + if (std::cmp_less(myHighScoreRank, NUM_RANKS)) { myEditRank = myHighScoreRank; - for (uInt32 r = NUM_RANKS - 1; static_cast(r) > myHighScoreRank; --r) + for (uInt32 r = NUM_RANKS - 1; std::cmp_greater(r, myHighScoreRank); --r) { myScores.scores[r].score = myScores.scores[r - 1].score; myScores.scores[r].special = myScores.scores[r - 1].special; diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 73a8e575c..6ee66b44f 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -657,9 +657,9 @@ void LauncherDialog::setRomInfoFont(const Common::Size& area) // only use fonts <= launcher fonts if(Dialog::fontHeight() >= font.height) { - if(area.h >= static_cast(MIN_ROMINFO_ROWS * font.height + 2 - + MIN_ROMINFO_LINES * font.height) - && area.w >= static_cast(MIN_ROMINFO_CHARS * font.maxwidth)) + if(std::cmp_greater_equal(area.h, + MIN_ROMINFO_ROWS * font.height + 2 + MIN_ROMINFO_LINES * font.height) + && std::cmp_greater_equal(area.w, MIN_ROMINFO_CHARS * font.maxwidth)) { myROMInfoFont = make_unique(font); return; diff --git a/src/gui/ListWidget.cxx b/src/gui/ListWidget.cxx index c96256b5d..706ad0ab0 100644 --- a/src/gui/ListWidget.cxx +++ b/src/gui/ListWidget.cxx @@ -71,7 +71,7 @@ void ListWidget::setSelected(int item) { setDirty(); - if(item < 0 || item >= static_cast(_list.size())) + if(item < 0 || std::cmp_greater_equal(item, _list.size())) return; if(isEnabled()) @@ -117,7 +117,7 @@ void ListWidget::setSelected(string_view item) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ListWidget::setHighlighted(int item) { - if(item < -1 || item >= static_cast(_list.size())) + if(item < -1 || std::cmp_greater_equal(item, _list.size())) return; if(isEnabled()) @@ -140,7 +140,7 @@ void ListWidget::setHighlighted(int item) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - const string& ListWidget::getSelectedString() const { - return (_selectedItem >= 0 && _selectedItem < static_cast(_list.size())) + return (_selectedItem >= 0 && std::cmp_less(_selectedItem, _list.size())) ? _list[_selectedItem] : EmptyString; } @@ -207,18 +207,18 @@ void ListWidget::scrollBarRecalc() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void ListWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount) { - if (!isEnabled()) + if(!isEnabled()) return; resetSelection(); // First check whether the selection changed const int newSelectedItem = findItem(x, y); - if (newSelectedItem >= static_cast(_list.size())) + if(std::cmp_greater_equal(newSelectedItem, _list.size())) return; - if (_selectedItem != newSelectedItem) + if(_selectedItem != newSelectedItem) { - if (_editMode) + if(_editMode) abortEditMode(); _selectedItem = newSelectedItem; sendCommand(ListWidget::kSelectionChangedCmd, _selectedItem, _id); @@ -234,7 +234,7 @@ void ListWidget::handleMouseUp(int x, int y, MouseButton b, int clickCount) { // If this was a double click and the mouse is still over the selected item, // send the double click command - if (clickCount == 2 && (_selectedItem == findItem(x, y))) + if(clickCount == 2 && (_selectedItem == findItem(x, y))) { sendCommand(ListWidget::kDoubleClickedCmd, _selectedItem, _id); @@ -420,7 +420,7 @@ void ListWidget::scrollToCurrent(int item) _currentPos = item - _rows + 1; } - if (_currentPos < 0 || _rows > static_cast(_list.size())) + if (_currentPos < 0 || std::cmp_greater_equal(_rows, _list.size())) _currentPos = 0; else if (_currentPos + _rows > static_cast(_list.size())) _currentPos = static_cast(_list.size()) - _rows; diff --git a/src/gui/RadioButtonWidget.cxx b/src/gui/RadioButtonWidget.cxx index 0fb995211..dee5b0e5d 100644 --- a/src/gui/RadioButtonWidget.cxx +++ b/src/gui/RadioButtonWidget.cxx @@ -249,9 +249,9 @@ RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font, // Depending on font size, either the font or box will need to be // centered vertically - if(_h > static_cast(_buttonSize)) // center box + if(std::cmp_greater(_h, _buttonSize)) // center box _boxY = (_h - _buttonSize) / 2; - else // center text + else // center text _textY = (_buttonSize - _font.getFontHeight()) / 2; setFill(CheckboxWidget::FillType::Normal); // NOLINT diff --git a/src/gui/StellaSettingsDialog.cxx b/src/gui/StellaSettingsDialog.cxx index 0b42829b5..80b3f9bc2 100644 --- a/src/gui/StellaSettingsDialog.cxx +++ b/src/gui/StellaSettingsDialog.cxx @@ -496,7 +496,7 @@ int StellaSettingsDialog::valueToLevel(int value) for (int i = NUM_LEVELS - 1; i > 0; --i) { - if (value >= values[i]) + if (std::cmp_greater_equal(value, values[i])) return i; } return 0; diff --git a/src/gui/StringListWidget.cxx b/src/gui/StringListWidget.cxx index abe07f16b..9f39f28d8 100644 --- a/src/gui/StringListWidget.cxx +++ b/src/gui/StringListWidget.cxx @@ -54,10 +54,7 @@ int StringListWidget::getToolTipIndex(const Common::Point& pos) const { const int idx = (pos.y - getAbsY()) / _lineHeight + _currentPos; - if(idx >= static_cast(_list.size())) - return -1; - else - return idx; + return std::cmp_greater_equal(idx, _list.size()) ? -1 : idx; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/gui/TabWidget.cxx b/src/gui/TabWidget.cxx index a128b64e8..2da3f5177 100644 --- a/src/gui/TabWidget.cxx +++ b/src/gui/TabWidget.cxx @@ -98,7 +98,7 @@ int TabWidget::addTab(string_view title, int tabWidth) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::setActiveTab(int tabID, bool show) { - assert(0 <= tabID && tabID < int(_tabs.size())); + assert(0 <= tabID && std::cmp_less(tabID, _tabs.size())); if (_activeTab != -1) { @@ -120,7 +120,7 @@ void TabWidget::setActiveTab(int tabID, bool show) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::enableTab(int tabID, bool enable) { - assert(0 <= tabID && tabID < int(_tabs.size())); + assert(0 <= tabID && std::cmp_less(tabID, _tabs.size())); _tabs[tabID].enabled = enable; // Note: We do not have to disable the widgets because the tab is disabled @@ -168,7 +168,7 @@ void TabWidget::cycleTab(int direction) { do { tabID++; - if(tabID == static_cast(_tabs.size())) + if(std::cmp_equal(tabID, _tabs.size())) tabID = 0; } while(!_tabs[tabID].enabled); } @@ -181,14 +181,14 @@ void TabWidget::cycleTab(int direction) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TabWidget::setParentWidget(int tabID, Widget* parent) { - assert(0 <= tabID && tabID < static_cast(_tabs.size())); + assert(0 <= tabID && std::cmp_less(tabID, _tabs.size())); _tabs[tabID].parentWidget = parent; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Widget* TabWidget::parentWidget(int tabID) { - assert(0 <= tabID && tabID < int(_tabs.size())); + assert(0 <= tabID && std::cmp_less(tabID, _tabs.size())); if(!_tabs[tabID].parentWidget) { @@ -209,7 +209,7 @@ void TabWidget::handleMouseDown(int x, int y, MouseButton b, int clickCount) int tabID = -1; x -= kTabLeftOffset; - for(int i = 0; i < static_cast(_tabs.size()); ++i) + for(int i = 0; std::cmp_less(i, _tabs.size()); ++i) { const int tabWidth = _tabs[i].tabWidth ? _tabs[i].tabWidth : _tabWidth; if(x >= 0 && x < tabWidth) @@ -283,7 +283,7 @@ void TabWidget::drawWidget(bool hilite) // Iterate over all tabs and draw them int x = _x + kTabLeftOffset; - for(int i = 0; i < static_cast(_tabs.size()); ++i) + for(int i = 0; std::cmp_less(i, _tabs.size()); ++i) { const int tabWidth = _tabs[i].tabWidth ? _tabs[i].tabWidth : _tabWidth; const ColorId fontcolor = _tabs[i].enabled ? kTextColor : kColor; diff --git a/src/gui/TimeLineWidget.cxx b/src/gui/TimeLineWidget.cxx index e378c5be5..b7d084b61 100644 --- a/src/gui/TimeLineWidget.cxx +++ b/src/gui/TimeLineWidget.cxx @@ -101,7 +101,7 @@ void TimeLineWidget::setStepValues(const IntArray& steps) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void TimeLineWidget::handleMouseMoved(int x, int y) { - if(isEnabled() && _isDragging && x >= static_cast(_labelWidth)) + if(isEnabled() && _isDragging && std::cmp_greater_equal(x, _labelWidth)) setValue(posToValue(x - _labelWidth)); } diff --git a/src/gui/WhatsNewDialog.cxx b/src/gui/WhatsNewDialog.cxx index 433d44cf9..525279921 100644 --- a/src/gui/WhatsNewDialog.cxx +++ b/src/gui/WhatsNewDialog.cxx @@ -78,7 +78,7 @@ WhatsNewDialog::WhatsNewDialog(OSystem& osystem, DialogContainer& parent, // Set needed dimensions ypos += VGAP * 2 + buttonHeight + VBORDER; - assert(ypos <= int(FBMinimum::Height)); // minimal launcher height + assert(std::cmp_less_equal(ypos, FBMinimum::Height)); // minimal launcher height setSize(MAX_CHARS * fontWidth + HBORDER * 2, ypos, max_w, max_h); WidgetArray wid; diff --git a/src/tools/TIDY b/src/tools/TIDY index e004cfaff..0e2929c28 100755 --- a/src/tools/TIDY +++ b/src/tools/TIDY @@ -1,6 +1,6 @@ #!/usr/bin/env bash -run-clang-tidy-19 -header-filter=\(.*\.hxx\) \ +run-clang-tidy-20 -header-filter=\(.*\.hxx\) \ -checks=*,\ -abseil*,\ -altera*,\ From c34127a5364f0cb5ace2901963a2299ce04f7f8b Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Sat, 26 Apr 2025 22:15:08 -0230 Subject: [PATCH 3/5] First pass at SDL3 conversion. For now, just rename classes to 'SDL'. --- debian/control | 2 +- ...entHandlerSDL2.cxx => EventHandlerSDL.cxx} | 22 +++--- ...entHandlerSDL2.hxx => EventHandlerSDL.hxx} | 42 +++++------ .../{FBBackendSDL2.cxx => FBBackendSDL.cxx} | 71 +++++++++---------- .../{FBBackendSDL2.hxx => FBBackendSDL.hxx} | 26 +++---- .../{FBSurfaceSDL2.cxx => FBSurfaceSDL.cxx} | 60 ++++++++-------- .../{FBSurfaceSDL2.hxx => FBSurfaceSDL.hxx} | 31 ++++---- src/common/MediaFactory.hxx | 12 ++-- src/common/{SoundSDL2.cxx => SoundSDL.cxx} | 68 +++++++++--------- src/common/{SoundSDL2.hxx => SoundSDL.hxx} | 38 +++++----- src/common/module.mk | 8 +-- src/common/sdl_blitter/BilinearBlitter.cxx | 4 +- src/common/sdl_blitter/BilinearBlitter.hxx | 6 +- src/common/sdl_blitter/BlitterFactory.cxx | 2 +- src/common/sdl_blitter/BlitterFactory.hxx | 4 +- src/common/sdl_blitter/QisBlitter.cxx | 8 +-- src/common/sdl_blitter/QisBlitter.hxx | 8 +-- src/emucore/FBBackend.hxx | 2 +- src/os/libretro/EventHandlerLIBRETRO.hxx | 4 +- src/os/macos/AboutBox.h | 2 +- src/os/macos/AboutBoxTextView.h | 2 +- src/os/windows/Stella.vcxproj | 18 ++--- src/os/windows/Stella.vcxproj.filters | 16 ++--- 23 files changed, 226 insertions(+), 230 deletions(-) rename src/common/{EventHandlerSDL2.cxx => EventHandlerSDL.cxx} (93%) rename src/common/{EventHandlerSDL2.hxx => EventHandlerSDL.hxx} (63%) rename src/common/{FBBackendSDL2.cxx => FBBackendSDL.cxx} (91%) rename src/common/{FBBackendSDL2.hxx => FBBackendSDL.hxx} (94%) rename src/common/{FBSurfaceSDL2.cxx => FBSurfaceSDL.cxx} (82%) rename src/common/{FBSurfaceSDL2.hxx => FBSurfaceSDL.hxx} (83%) rename src/common/{SoundSDL2.cxx => SoundSDL.cxx} (89%) rename src/common/{SoundSDL2.hxx => SoundSDL.hxx} (88%) diff --git a/debian/control b/debian/control index d986cb2c3..2584a9cc0 100644 --- a/debian/control +++ b/debian/control @@ -19,7 +19,7 @@ Depends: ${misc:Depends}, ${shlibs:Depends} Recommends: joystick (>= 1:1.5.1) Pre-Depends: ${misc:Pre-Depends} -Description: Atari 2600 Emulator for SDL2 +Description: Atari 2600 Emulator for SDL Stella is a portable emulator of the old Atari 2600 video-game console. You can play most Atari 2600 games with it. . diff --git a/src/common/EventHandlerSDL2.cxx b/src/common/EventHandlerSDL.cxx similarity index 93% rename from src/common/EventHandlerSDL2.cxx rename to src/common/EventHandlerSDL.cxx index 84f5741e2..b1da636dd 100644 --- a/src/common/EventHandlerSDL2.cxx +++ b/src/common/EventHandlerSDL.cxx @@ -17,12 +17,12 @@ #include "Logger.hxx" #include "OSystem.hxx" -#include "EventHandlerSDL2.hxx" +#include "EventHandlerSDL.hxx" #include "ThreadDebugging.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -EventHandlerSDL2::EventHandlerSDL2(OSystem& osystem) +EventHandlerSDL::EventHandlerSDL(OSystem& osystem) : EventHandler{osystem} { ASSERT_MAIN_THREAD; @@ -45,14 +45,14 @@ EventHandlerSDL2::EventHandlerSDL2(OSystem& osystem) << SDL_GetError() << '\n'; Logger::error(buf.view()); } - Logger::debug("EventHandlerSDL2::EventHandlerSDL2 SDL_INIT_JOYSTICK"); + Logger::debug("EventHandlerSDL::EventHandlerSDL SDL_INIT_JOYSTICK"); #endif SDL_SetHint(SDL_HINT_MOUSE_FOCUS_CLICKTHROUGH, "1"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -EventHandlerSDL2::~EventHandlerSDL2() +EventHandlerSDL::~EventHandlerSDL() { ASSERT_MAIN_THREAD; @@ -61,7 +61,7 @@ EventHandlerSDL2::~EventHandlerSDL2() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandlerSDL2::enableTextEvents(bool enable) +void EventHandlerSDL::enableTextEvents(bool enable) { ASSERT_MAIN_THREAD; @@ -72,13 +72,13 @@ void EventHandlerSDL2::enableTextEvents(bool enable) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandlerSDL2::copyText(const string& text) const +void EventHandlerSDL::copyText(const string& text) const { SDL_SetClipboardText(text.c_str()); }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string EventHandlerSDL2::pasteText(string& text) const +string EventHandlerSDL::pasteText(string& text) const { if(SDL_HasClipboardText()) text = SDL_GetClipboardText(); @@ -89,7 +89,7 @@ string EventHandlerSDL2::pasteText(string& text) const }; // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void EventHandlerSDL2::pollEvent() +void EventHandlerSDL::pollEvent() { ASSERT_MAIN_THREAD; @@ -192,7 +192,7 @@ void EventHandlerSDL2::pollEvent() case SDL_JOYDEVICEADDED: { - addPhysicalJoystick(make_shared(myEvent.jdevice.which)); + addPhysicalJoystick(make_shared(myEvent.jdevice.which)); break; // SDL_JOYDEVICEADDED } case SDL_JOYDEVICEREMOVED: @@ -261,7 +261,7 @@ void EventHandlerSDL2::pollEvent() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -EventHandlerSDL2::JoystickSDL2::JoystickSDL2(int idx) +EventHandlerSDL::JoystickSDL::JoystickSDL(int idx) { ASSERT_MAIN_THREAD; @@ -285,7 +285,7 @@ EventHandlerSDL2::JoystickSDL2::JoystickSDL2(int idx) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -EventHandlerSDL2::JoystickSDL2::~JoystickSDL2() +EventHandlerSDL::JoystickSDL::~JoystickSDL() { ASSERT_MAIN_THREAD; diff --git a/src/common/EventHandlerSDL2.hxx b/src/common/EventHandlerSDL.hxx similarity index 63% rename from src/common/EventHandlerSDL2.hxx rename to src/common/EventHandlerSDL.hxx index ea4ee4cf9..2fee43d90 100644 --- a/src/common/EventHandlerSDL2.hxx +++ b/src/common/EventHandlerSDL.hxx @@ -15,8 +15,8 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ -#ifndef EVENTHANDLER_SDL2_HXX -#define EVENTHANDLER_SDL2_HXX +#ifndef EVENTHANDLER_SDL_HXX +#define EVENTHANDLER_SDL_HXX #include "SDL_lib.hxx" #include "EventHandler.hxx" @@ -24,19 +24,19 @@ /** This class handles event collection from the point of view of the specific - backend toolkit (SDL2). It converts from SDL2-specific events into events + backend toolkit (SDL). It converts from SDL-specific events into events that the Stella core can understand. @author Stephen Anthony */ -class EventHandlerSDL2 : public EventHandler +class EventHandlerSDL : public EventHandler { public: /** - Create a new SDL2 event handler object + Create a new SDL event handler object */ - explicit EventHandlerSDL2(OSystem& osystem); - ~EventHandlerSDL2() override; + explicit EventHandlerSDL(OSystem& osystem); + ~EventHandlerSDL() override; private: /** @@ -51,7 +51,7 @@ class EventHandlerSDL2 : public EventHandler string pasteText(string& text) const override; /** - Collects and dispatches any pending SDL2 events. + Collects and dispatches any pending SDL events. */ void pollEvent() override; @@ -60,31 +60,31 @@ class EventHandlerSDL2 : public EventHandler // A thin wrapper around a basic PhysicalJoystick, holding the pointer to // the underlying SDL joystick device. - class JoystickSDL2 : public PhysicalJoystick + class JoystickSDL : public PhysicalJoystick { public: - explicit JoystickSDL2(int idx); - virtual ~JoystickSDL2(); + explicit JoystickSDL(int idx); + virtual ~JoystickSDL(); private: SDL_Joystick* myStick{nullptr}; private: // Following constructors and assignment operators not supported - JoystickSDL2() = delete; - JoystickSDL2(const JoystickSDL2&) = delete; - JoystickSDL2(JoystickSDL2&&) = delete; - JoystickSDL2& operator=(const JoystickSDL2&) = delete; - JoystickSDL2& operator=(JoystickSDL2&&) = delete; + JoystickSDL() = delete; + JoystickSDL(const JoystickSDL&) = delete; + JoystickSDL(JoystickSDL&&) = delete; + JoystickSDL& operator=(const JoystickSDL&) = delete; + JoystickSDL& operator=(JoystickSDL&&) = delete; }; private: // Following constructors and assignment operators not supported - EventHandlerSDL2() = delete; - EventHandlerSDL2(const EventHandlerSDL2&) = delete; - EventHandlerSDL2(EventHandlerSDL2&&) = delete; - EventHandlerSDL2& operator=(const EventHandlerSDL2&) = delete; - EventHandlerSDL2& operator=(EventHandlerSDL2&&) = delete; + EventHandlerSDL() = delete; + EventHandlerSDL(const EventHandlerSDL&) = delete; + EventHandlerSDL(EventHandlerSDL&&) = delete; + EventHandlerSDL& operator=(const EventHandlerSDL&) = delete; + EventHandlerSDL& operator=(EventHandlerSDL&&) = delete; }; #endif diff --git a/src/common/FBBackendSDL2.cxx b/src/common/FBBackendSDL.cxx similarity index 91% rename from src/common/FBBackendSDL2.cxx rename to src/common/FBBackendSDL.cxx index 2cd96312b..1586a11f7 100644 --- a/src/common/FBBackendSDL2.cxx +++ b/src/common/FBBackendSDL.cxx @@ -25,33 +25,33 @@ #include "Settings.hxx" #include "ThreadDebugging.hxx" -#include "FBSurfaceSDL2.hxx" -#include "FBBackendSDL2.hxx" +#include "FBSurfaceSDL.hxx" +#include "FBBackendSDL.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FBBackendSDL2::FBBackendSDL2(OSystem& osystem) +FBBackendSDL::FBBackendSDL(OSystem& osystem) : myOSystem{osystem} { ASSERT_MAIN_THREAD; - // Initialize SDL2 context + // Initialize SDL context if(SDL_InitSubSystem(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) { ostringstream buf; buf << "ERROR: Couldn't initialize SDL: " << SDL_GetError(); throw runtime_error(buf.str()); } - Logger::debug("FBBackendSDL2::FBBackendSDL2 SDL_Init()"); + Logger::debug("FBBackendSDL::FBBackendSDL SDL_Init()"); // We need a pixel format for palette value calculations - // It's done this way (vs directly accessing a FBSurfaceSDL2 object) + // It's done this way (vs directly accessing a FBSurfaceSDL object) // since the structure may be needed before any FBSurface's have // been created myPixelFormat = SDL_AllocFormat(SDL_PIXELFORMAT_ARGB8888); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FBBackendSDL2::~FBBackendSDL2() +FBBackendSDL::~FBBackendSDL() { ASSERT_MAIN_THREAD; @@ -73,9 +73,9 @@ FBBackendSDL2::~FBBackendSDL2() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBBackendSDL2::queryHardware(vector& fullscreenRes, - vector& windowedRes, - VariantList& renderers) +void FBBackendSDL::queryHardware(vector& fullscreenRes, + vector& windowedRes, + VariantList& renderers) { ASSERT_MAIN_THREAD; @@ -190,7 +190,7 @@ void FBBackendSDL2::queryHardware(vector& fullscreenRes, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool FBBackendSDL2::isCurrentWindowPositioned() const +bool FBBackendSDL::isCurrentWindowPositioned() const { ASSERT_MAIN_THREAD; @@ -199,19 +199,18 @@ bool FBBackendSDL2::isCurrentWindowPositioned() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Common::Point FBBackendSDL2::getCurrentWindowPos() const +Common::Point FBBackendSDL::getCurrentWindowPos() const { ASSERT_MAIN_THREAD; Common::Point pos; - SDL_GetWindowPosition(myWindow, &pos.x, &pos.y); return pos; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Int32 FBBackendSDL2::getCurrentDisplayIndex() const +Int32 FBBackendSDL::getCurrentDisplayIndex() const { ASSERT_MAIN_THREAD; @@ -219,8 +218,8 @@ Int32 FBBackendSDL2::getCurrentDisplayIndex() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool FBBackendSDL2::setVideoMode(const VideoModeHandler::Mode& mode, - int winIdx, const Common::Point& winPos) +bool FBBackendSDL::setVideoMode(const VideoModeHandler::Mode& mode, + int winIdx, const Common::Point& winPos) { ASSERT_MAIN_THREAD; @@ -346,8 +345,8 @@ bool FBBackendSDL2::setVideoMode(const VideoModeHandler::Mode& mode, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool FBBackendSDL2::adaptRefreshRate(Int32 displayIndex, - SDL_DisplayMode& adaptedSdlMode) +bool FBBackendSDL::adaptRefreshRate(Int32 displayIndex, + SDL_DisplayMode& adaptedSdlMode) { ASSERT_MAIN_THREAD; @@ -406,7 +405,7 @@ bool FBBackendSDL2::adaptRefreshRate(Int32 displayIndex, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool FBBackendSDL2::createRenderer() +bool FBBackendSDL::createRenderer() { ASSERT_MAIN_THREAD; @@ -460,7 +459,7 @@ bool FBBackendSDL2::createRenderer() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBBackendSDL2::setTitle(string_view title) +void FBBackendSDL::setTitle(string_view title) { ASSERT_MAIN_THREAD; @@ -471,7 +470,7 @@ void FBBackendSDL2::setTitle(string_view title) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string FBBackendSDL2::about() const +string FBBackendSDL::about() const { ASSERT_MAIN_THREAD; @@ -493,7 +492,7 @@ string FBBackendSDL2::about() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBBackendSDL2::showCursor(bool show) +void FBBackendSDL::showCursor(bool show) { ASSERT_MAIN_THREAD; @@ -501,7 +500,7 @@ void FBBackendSDL2::showCursor(bool show) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBBackendSDL2::grabMouse(bool grab) +void FBBackendSDL::grabMouse(bool grab) { ASSERT_MAIN_THREAD; @@ -509,7 +508,7 @@ void FBBackendSDL2::grabMouse(bool grab) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool FBBackendSDL2::fullScreen() const +bool FBBackendSDL::fullScreen() const { ASSERT_MAIN_THREAD; @@ -521,7 +520,7 @@ bool FBBackendSDL2::fullScreen() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -int FBBackendSDL2::refreshRate() const +int FBBackendSDL::refreshRate() const { ASSERT_MAIN_THREAD; @@ -538,7 +537,7 @@ int FBBackendSDL2::refreshRate() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBBackendSDL2::renderToScreen() +void FBBackendSDL::renderToScreen() { ASSERT_MAIN_THREAD; @@ -547,7 +546,7 @@ void FBBackendSDL2::renderToScreen() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBBackendSDL2::setWindowIcon() +void FBBackendSDL::setWindowIcon() { #if !defined(BSPF_MACOS) && !defined(RETRON77) #include "stella_icon.hxx" @@ -561,20 +560,20 @@ void FBBackendSDL2::setWindowIcon() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -unique_ptr FBBackendSDL2::createSurface( +unique_ptr FBBackendSDL::createSurface( uInt32 w, uInt32 h, ScalingInterpolation inter, const uInt32* data ) const { - return make_unique - (const_cast(*this), w, h, inter, data); + return make_unique + (const_cast(*this), w, h, inter, data); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBBackendSDL2::readPixels(uInt8* buffer, size_t pitch, - const Common::Rect& rect) const +void FBBackendSDL::readPixels(uInt8* buffer, size_t pitch, + const Common::Rect& rect) const { ASSERT_MAIN_THREAD; @@ -586,7 +585,7 @@ void FBBackendSDL2::readPixels(uInt8* buffer, size_t pitch, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBBackendSDL2::clear() +void FBBackendSDL::clear() { ASSERT_MAIN_THREAD; @@ -594,7 +593,7 @@ void FBBackendSDL2::clear() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBBackendSDL2::detectFeatures() +void FBBackendSDL::detectFeatures() { myRenderTargetSupport = detectRenderTargetSupport(); @@ -603,7 +602,7 @@ void FBBackendSDL2::detectFeatures() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool FBBackendSDL2::detectRenderTargetSupport() +bool FBBackendSDL::detectRenderTargetSupport() { ASSERT_MAIN_THREAD; @@ -632,7 +631,7 @@ bool FBBackendSDL2::detectRenderTargetSupport() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBBackendSDL2::determineDimensions() +void FBBackendSDL::determineDimensions() { ASSERT_MAIN_THREAD; diff --git a/src/common/FBBackendSDL2.hxx b/src/common/FBBackendSDL.hxx similarity index 94% rename from src/common/FBBackendSDL2.hxx rename to src/common/FBBackendSDL.hxx index bc2066a7d..e1986c4ad 100644 --- a/src/common/FBBackendSDL2.hxx +++ b/src/common/FBBackendSDL.hxx @@ -15,31 +15,31 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ -#ifndef FB_BACKEND_SDL2_HXX -#define FB_BACKEND_SDL2_HXX +#ifndef FB_BACKEND_SDL_HXX +#define FB_BACKEND_SDL_HXX #include "SDL_lib.hxx" class OSystem; -class FBSurfaceSDL2; +class FBSurfaceSDL; #include "bspf.hxx" #include "FBBackend.hxx" /** - This class implements a standard SDL2 2D, hardware accelerated framebuffer + This class implements a standard SDL 2D, hardware accelerated framebuffer backend. Behind the scenes, it may be using Direct3D, OpenGL(ES), etc. @author Stephen Anthony */ -class FBBackendSDL2 : public FBBackend +class FBBackendSDL : public FBBackend { public: /** - Creates a new SDL2 framebuffer + Creates a new SDL framebuffer */ - explicit FBBackendSDL2(OSystem& osystem); - ~FBBackendSDL2() override; + explicit FBBackendSDL(OSystem& osystem); + ~FBBackendSDL() override; public: /** @@ -305,11 +305,11 @@ class FBBackendSDL2 : public FBBackend private: // Following constructors and assignment operators not supported - FBBackendSDL2() = delete; - FBBackendSDL2(const FBBackendSDL2&) = delete; - FBBackendSDL2(FBBackendSDL2&&) = delete; - FBBackendSDL2& operator=(const FBBackendSDL2&) = delete; - FBBackendSDL2& operator=(FBBackendSDL2&&) = delete; + FBBackendSDL() = delete; + FBBackendSDL(const FBBackendSDL&) = delete; + FBBackendSDL(FBBackendSDL&&) = delete; + FBBackendSDL& operator=(const FBBackendSDL&) = delete; + FBBackendSDL& operator=(FBBackendSDL&&) = delete; }; #endif diff --git a/src/common/FBSurfaceSDL2.cxx b/src/common/FBSurfaceSDL.cxx similarity index 82% rename from src/common/FBSurfaceSDL2.cxx rename to src/common/FBSurfaceSDL.cxx index b058d7b9e..9f000cc5a 100644 --- a/src/common/FBSurfaceSDL2.cxx +++ b/src/common/FBSurfaceSDL.cxx @@ -15,7 +15,7 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ -#include "FBSurfaceSDL2.hxx" +#include "FBSurfaceSDL.hxx" #include "Logger.hxx" #include "ThreadDebugging.hxx" @@ -41,10 +41,10 @@ namespace { } // namespace // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FBSurfaceSDL2::FBSurfaceSDL2(FBBackendSDL2& backend, - uInt32 width, uInt32 height, - ScalingInterpolation inter, - const uInt32* staticData) +FBSurfaceSDL::FBSurfaceSDL(FBBackendSDL& backend, + uInt32 width, uInt32 height, + ScalingInterpolation inter, + const uInt32* staticData) : myBackend{backend}, myInterpolationMode{inter} { @@ -53,7 +53,7 @@ FBSurfaceSDL2::FBSurfaceSDL2(FBBackendSDL2& backend, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -FBSurfaceSDL2::~FBSurfaceSDL2() +FBSurfaceSDL::~FBSurfaceSDL() { ASSERT_MAIN_THREAD; @@ -65,7 +65,7 @@ FBSurfaceSDL2::~FBSurfaceSDL2() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, ColorId color) +void FBSurfaceSDL::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, ColorId color) { ASSERT_MAIN_THREAD; @@ -79,45 +79,45 @@ void FBSurfaceSDL2::fillRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h, ColorId col } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt32 FBSurfaceSDL2::width() const +uInt32 FBSurfaceSDL::width() const { return mySurface->w; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt32 FBSurfaceSDL2::height() const +uInt32 FBSurfaceSDL::height() const { return mySurface->h; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const Common::Rect& FBSurfaceSDL2::srcRect() const +const Common::Rect& FBSurfaceSDL::srcRect() const { return mySrcGUIR; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -const Common::Rect& FBSurfaceSDL2::dstRect() const +const Common::Rect& FBSurfaceSDL::dstRect() const { return myDstGUIR; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::setSrcPos(uInt32 x, uInt32 y) +void FBSurfaceSDL::setSrcPos(uInt32 x, uInt32 y) { if(setSrcPosInternal(x, y)) reinitializeBlitter(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::setSrcSize(uInt32 w, uInt32 h) +void FBSurfaceSDL::setSrcSize(uInt32 w, uInt32 h) { if(setSrcSizeInternal(w, h)) reinitializeBlitter(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::setSrcRect(const Common::Rect& r) +void FBSurfaceSDL::setSrcRect(const Common::Rect& r) { const bool posChanged = setSrcPosInternal(r.x(), r.y()), sizeChanged = setSrcSizeInternal(r.w(), r.h()); @@ -127,21 +127,21 @@ void FBSurfaceSDL2::setSrcRect(const Common::Rect& r) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::setDstPos(uInt32 x, uInt32 y) +void FBSurfaceSDL::setDstPos(uInt32 x, uInt32 y) { if(setDstPosInternal(x, y)) reinitializeBlitter(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::setDstSize(uInt32 w, uInt32 h) +void FBSurfaceSDL::setDstSize(uInt32 w, uInt32 h) { if(setDstSizeInternal(w, h)) reinitializeBlitter(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::setDstRect(const Common::Rect& r) +void FBSurfaceSDL::setDstRect(const Common::Rect& r) { const bool posChanged = setDstPosInternal(r.x(), r.y()), sizeChanged = setDstSizeInternal(r.w(), r.h()); @@ -151,22 +151,23 @@ void FBSurfaceSDL2::setDstRect(const Common::Rect& r) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::setVisible(bool visible) +void FBSurfaceSDL::setVisible(bool visible) { myIsVisible = visible; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::translateCoords(Int32& x, Int32& y) const +void FBSurfaceSDL::translateCoords(Int32& x, Int32& y) const { x -= myDstR.x; x /= myDstR.w / mySrcR.w; y -= myDstR.y; y /= myDstR.h / mySrcR.h; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool FBSurfaceSDL2::render() +bool FBSurfaceSDL::render() { - if (!myBlitter) reinitializeBlitter(); + if(!myBlitter) + reinitializeBlitter(); if(myIsVisible && myBlitter) { @@ -178,7 +179,7 @@ bool FBSurfaceSDL2::render() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::invalidate() +void FBSurfaceSDL::invalidate() { ASSERT_MAIN_THREAD; @@ -186,7 +187,7 @@ void FBSurfaceSDL2::invalidate() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::invalidateRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) +void FBSurfaceSDL::invalidateRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) { ASSERT_MAIN_THREAD; @@ -202,13 +203,13 @@ void FBSurfaceSDL2::invalidateRect(uInt32 x, uInt32 y, uInt32 w, uInt32 h) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::reload() +void FBSurfaceSDL::reload() { reinitializeBlitter(true); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::resize(uInt32 width, uInt32 height) +void FBSurfaceSDL::resize(uInt32 width, uInt32 height) { ASSERT_MAIN_THREAD; @@ -224,8 +225,7 @@ void FBSurfaceSDL2::resize(uInt32 width, uInt32 height) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::createSurface(uInt32 width, uInt32 height, - const uInt32* data) +void FBSurfaceSDL::createSurface(uInt32 width, uInt32 height, const uInt32* data) { ASSERT_MAIN_THREAD; @@ -258,7 +258,7 @@ void FBSurfaceSDL2::createSurface(uInt32 width, uInt32 height, } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::reinitializeBlitter(bool force) +void FBSurfaceSDL::reinitializeBlitter(bool force) { if (force) myBlitter.reset(); @@ -273,13 +273,13 @@ void FBSurfaceSDL2::reinitializeBlitter(bool force) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::applyAttributes() +void FBSurfaceSDL::applyAttributes() { reinitializeBlitter(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void FBSurfaceSDL2::setScalingInterpolation(ScalingInterpolation interpolation) +void FBSurfaceSDL::setScalingInterpolation(ScalingInterpolation interpolation) { if (interpolation == ScalingInterpolation::sharp && ( diff --git a/src/common/FBSurfaceSDL2.hxx b/src/common/FBSurfaceSDL.hxx similarity index 83% rename from src/common/FBSurfaceSDL2.hxx rename to src/common/FBSurfaceSDL.hxx index c601c914d..1986b7629 100644 --- a/src/common/FBSurfaceSDL2.hxx +++ b/src/common/FBSurfaceSDL.hxx @@ -15,26 +15,26 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ -#ifndef FBSURFACE_SDL2_HXX -#define FBSURFACE_SDL2_HXX +#ifndef FBSURFACE_SDL_HXX +#define FBSURFACE_SDL_HXX #include "bspf.hxx" #include "FBSurface.hxx" -#include "FBBackendSDL2.hxx" +#include "FBBackendSDL.hxx" #include "sdl_blitter/Blitter.hxx" /** - An FBSurface suitable for the SDL2 Render2D API, making use of hardware + An FBSurface suitable for the SDL Render2D API, making use of hardware acceleration behind the scenes. @author Stephen Anthony */ -class FBSurfaceSDL2 : public FBSurface +class FBSurfaceSDL : public FBSurface { public: - FBSurfaceSDL2(FBBackendSDL2& backend, uInt32 width, uInt32 height, - ScalingInterpolation inter, const uInt32* staticData); - ~FBSurfaceSDL2() override; + FBSurfaceSDL(FBBackendSDL& backend, uInt32 width, uInt32 height, + ScalingInterpolation inter, const uInt32* staticData); + ~FBSurfaceSDL() override; // Most of the surface drawing primitives are implemented in FBSurface; // the ones implemented here use SDL-specific code for extra performance @@ -111,18 +111,17 @@ class FBSurfaceSDL2 : public FBSurface void reinitializeBlitter(bool force = false); // Following constructors and assignment operators not supported - FBSurfaceSDL2() = delete; - FBSurfaceSDL2(const FBSurfaceSDL2&) = delete; - FBSurfaceSDL2(FBSurfaceSDL2&&) = delete; - FBSurfaceSDL2& operator=(const FBSurfaceSDL2&) = delete; - FBSurfaceSDL2& operator=(FBSurfaceSDL2&&) = delete; + FBSurfaceSDL() = delete; + FBSurfaceSDL(const FBSurfaceSDL&) = delete; + FBSurfaceSDL(FBSurfaceSDL&&) = delete; + FBSurfaceSDL& operator=(const FBSurfaceSDL&) = delete; + FBSurfaceSDL& operator=(FBSurfaceSDL&&) = delete; private: - FBBackendSDL2& myBackend; + FBBackendSDL& myBackend; unique_ptr myBlitter; - ScalingInterpolation myInterpolationMode - {ScalingInterpolation::none}; + ScalingInterpolation myInterpolationMode{ScalingInterpolation::none}; SDL_Surface* mySurface{nullptr}; SDL_Rect mySrcR{-1, -1, -1, -1}, myDstR{-1, -1, -1, -1}; diff --git a/src/common/MediaFactory.hxx b/src/common/MediaFactory.hxx index d12338bca..8d33fe306 100644 --- a/src/common/MediaFactory.hxx +++ b/src/common/MediaFactory.hxx @@ -53,8 +53,8 @@ #include "EventHandlerLIBRETRO.hxx" #include "FBBackendLIBRETRO.hxx" #elif defined(SDL_SUPPORT) - #include "EventHandlerSDL2.hxx" - #include "FBBackendSDL2.hxx" + #include "EventHandlerSDL.hxx" + #include "FBBackendSDL.hxx" #else #error Unsupported backend! #endif @@ -63,7 +63,7 @@ #if defined(__LIB_RETRO__) #include "SoundLIBRETRO.hxx" #elif defined(SDL_SUPPORT) - #include "SoundSDL2.hxx" + #include "SoundSDL.hxx" #else #include "SoundNull.hxx" #endif @@ -133,7 +133,7 @@ class MediaFactory #if defined(__LIB_RETRO__) return make_unique(osystem); #elif defined(SDL_SUPPORT) - return make_unique(osystem); + return make_unique(osystem); #else #error Unsupported platform for FrameBuffer! #endif @@ -145,7 +145,7 @@ class MediaFactory #if defined(__LIB_RETRO__) return make_unique(osystem, audioSettings); #elif defined(SOUND_SUPPORT) && defined(SDL_SUPPORT) - return make_unique(osystem, audioSettings); + return make_unique(osystem, audioSettings); #else return make_unique(osystem); #endif @@ -159,7 +159,7 @@ class MediaFactory #if defined(__LIB_RETRO__) return make_unique(osystem); #elif defined(SDL_SUPPORT) - return make_unique(osystem); + return make_unique(osystem); #else #error Unsupported platform for EventHandler! #endif diff --git a/src/common/SoundSDL2.cxx b/src/common/SoundSDL.cxx similarity index 89% rename from src/common/SoundSDL2.cxx rename to src/common/SoundSDL.cxx index f1d4e438a..b3751e41d 100644 --- a/src/common/SoundSDL2.cxx +++ b/src/common/SoundSDL.cxx @@ -31,16 +31,16 @@ #include "audio/LanczosResampler.hxx" #include "ThreadDebugging.hxx" -#include "SoundSDL2.hxx" +#include "SoundSDL.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SoundSDL2::SoundSDL2(OSystem& osystem, AudioSettings& audioSettings) +SoundSDL::SoundSDL(OSystem& osystem, AudioSettings& audioSettings) : Sound{osystem}, myAudioSettings{audioSettings} { ASSERT_MAIN_THREAD; - Logger::debug("SoundSDL2::SoundSDL2 started ..."); + Logger::debug("SoundSDL::SoundSDL started ..."); if(SDL_InitSubSystem(SDL_INIT_AUDIO) < 0) { @@ -58,11 +58,11 @@ SoundSDL2::SoundSDL2(OSystem& osystem, AudioSettings& audioSettings) if(!openDevice()) return; - Logger::debug("SoundSDL2::SoundSDL2 initialized"); + Logger::debug("SoundSDL::SoundSDL initialized"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SoundSDL2::~SoundSDL2() +SoundSDL::~SoundSDL() { ASSERT_MAIN_THREAD; @@ -74,7 +74,7 @@ SoundSDL2::~SoundSDL2() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::queryHardware(VariantList& devices) +void SoundSDL::queryHardware(VariantList& devices) { ASSERT_MAIN_THREAD; @@ -98,7 +98,7 @@ void SoundSDL2::queryHardware(VariantList& devices) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool SoundSDL2::openDevice() +bool SoundSDL::openDevice() { ASSERT_MAIN_THREAD; @@ -136,15 +136,15 @@ bool SoundSDL2::openDevice() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::setEnabled(bool enable) +void SoundSDL::setEnabled(bool enable) { mute(!enable); pause(!enable); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::open(shared_ptr audioQueue, - shared_ptr emulationTiming) +void SoundSDL::open(shared_ptr audioQueue, + shared_ptr emulationTiming) { const string pre_about = myAboutString; @@ -158,7 +158,7 @@ void SoundSDL2::open(shared_ptr audioQueue, myEmulationTiming = emulationTiming; myWavHandler.setSpeed(262 * 60 * 2. / myEmulationTiming->audioSampleRate()); - Logger::debug("SoundSDL2::open started ..."); + Logger::debug("SoundSDL::open started ..."); audioQueue->ignoreOverflows(!myAudioSettings.enabled()); if(!myAudioSettings.enabled()) @@ -184,11 +184,11 @@ void SoundSDL2::open(shared_ptr audioQueue, // And start the SDL sound subsystem ... pause(false); - Logger::debug("SoundSDL2::open finished"); + Logger::debug("SoundSDL::open finished"); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::mute(bool enable) +void SoundSDL::mute(bool enable) { if(enable) myVolumeFactor = 0; @@ -197,7 +197,7 @@ void SoundSDL2::mute(bool enable) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::toggleMute() +void SoundSDL::toggleMute() { const bool wasMuted = myVolumeFactor == 0; mute(!wasMuted); @@ -211,7 +211,7 @@ void SoundSDL2::toggleMute() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool SoundSDL2::pause(bool enable) +bool SoundSDL::pause(bool enable) { ASSERT_MAIN_THREAD; @@ -225,7 +225,7 @@ bool SoundSDL2::pause(bool enable) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::setVolume(uInt32 volume) +void SoundSDL::setVolume(uInt32 volume) { if(myIsInitializedFlag && (volume <= 100)) { @@ -235,7 +235,7 @@ void SoundSDL2::setVolume(uInt32 volume) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::adjustVolume(int direction) +void SoundSDL::adjustVolume(int direction) { Int32 percent = myAudioSettings.volume(); percent = BSPF::clamp(percent + direction * 2, 0, 100); @@ -257,7 +257,7 @@ void SoundSDL2::adjustVolume(int direction) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -string SoundSDL2::about() const +string SoundSDL::about() const { ostringstream buf; buf << "Sound enabled:\n" @@ -315,7 +315,7 @@ string SoundSDL2::about() const } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::initResampler() +void SoundSDL::initResampler() { const Resampler::NextFragmentCallback nextFragmentCallback = [this] () -> Int16* { Int16* nextFragment = nullptr; @@ -365,9 +365,9 @@ void SoundSDL2::initResampler() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::callback(void* object, uInt8* stream, int len) +void SoundSDL::callback(void* object, uInt8* stream, int len) { - const auto* self = static_cast(object); + const auto* self = static_cast(object); if(self->myAudioQueue && self->myResampler) { @@ -378,14 +378,14 @@ void SoundSDL2::callback(void* object, uInt8* stream, int len) self->myResampler->fillFragment(s, length); for(uInt32 i = 0; i < length; ++i) - s[i] *= SoundSDL2::myVolumeFactor; + s[i] *= SoundSDL::myVolumeFactor; } else SDL_memset(stream, 0, len); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool SoundSDL2::playWav(const string& fileName, uInt32 position, uInt32 length) +bool SoundSDL::playWav(const string& fileName, uInt32 position, uInt32 length) { const char* const device = myDeviceId ? myDevices.at(myDeviceId).first.c_str() @@ -395,19 +395,19 @@ bool SoundSDL2::playWav(const string& fileName, uInt32 position, uInt32 length) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::stopWav() +void SoundSDL::stopWav() { myWavHandler.stop(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -uInt32 SoundSDL2::wavSize() const +uInt32 SoundSDL::wavSize() const { return myWavHandler.size(); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool SoundSDL2::WavHandlerSDL2::play( +bool SoundSDL::WavHandlerSDL::play( const string& fileName, const char* device, uInt32 position, uInt32 length) { // Load WAV file @@ -450,7 +450,7 @@ bool SoundSDL2::WavHandlerSDL2::play( } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::WavHandlerSDL2::stop() +void SoundSDL::WavHandlerSDL::stop() { if(myBuffer) { @@ -467,7 +467,7 @@ void SoundSDL2::WavHandlerSDL2::stop() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::WavHandlerSDL2::processWav(uInt8* stream, uInt32 len) +void SoundSDL::WavHandlerSDL::processWav(uInt8* stream, uInt32 len) { SDL_memset(stream, mySpec.silence, len); if(myRemaining) @@ -500,7 +500,7 @@ void SoundSDL2::WavHandlerSDL2::processWav(uInt8* stream, uInt32 len) SDL_ConvertAudio(&cvt); // Mix volume adjusted WAV data into silent buffer SDL_MixAudioFormat(stream, cvt.buf, mySpec.format, cvt.len_cvt, - SDL_MIX_MAXVOLUME * SoundSDL2::myVolumeFactor); + SDL_MIX_MAXVOLUME * SoundSDL::myVolumeFactor); } else { @@ -517,14 +517,14 @@ void SoundSDL2::WavHandlerSDL2::processWav(uInt8* stream, uInt32 len) } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::WavHandlerSDL2::callback(void* object, uInt8* stream, int len) +void SoundSDL::WavHandlerSDL::callback(void* object, uInt8* stream, int len) { - static_cast(object)->processWav( + static_cast(object)->processWav( stream, static_cast(len)); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -SoundSDL2::WavHandlerSDL2::~WavHandlerSDL2() +SoundSDL::WavHandlerSDL::~WavHandlerSDL() { if(myDevice) { @@ -534,13 +534,13 @@ SoundSDL2::WavHandlerSDL2::~WavHandlerSDL2() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -void SoundSDL2::WavHandlerSDL2::pause(bool state) const +void SoundSDL::WavHandlerSDL::pause(bool state) const { if(myDevice) SDL_PauseAudioDevice(myDevice, state ? 1 : 0); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -float SoundSDL2::myVolumeFactor = 0.F; +float SoundSDL::myVolumeFactor = 0.F; #endif // SOUND_SUPPORT diff --git a/src/common/SoundSDL2.hxx b/src/common/SoundSDL.hxx similarity index 88% rename from src/common/SoundSDL2.hxx rename to src/common/SoundSDL.hxx index 907800c8c..0bed644d2 100644 --- a/src/common/SoundSDL2.hxx +++ b/src/common/SoundSDL.hxx @@ -17,8 +17,8 @@ #ifdef SOUND_SUPPORT -#ifndef SOUND_SDL2_HXX -#define SOUND_SDL2_HXX +#ifndef SOUND_SDL_HXX +#define SOUND_SDL_HXX class OSystem; class AudioQueue; @@ -36,15 +36,15 @@ class Resampler; @author Stephen Anthony and Christian Speckner (DirtyHairy) */ -class SoundSDL2 : public Sound +class SoundSDL : public Sound { public: /** Create a new sound object. The init method must be invoked before using the object. */ - SoundSDL2(OSystem& osystem, AudioSettings& audioSettings); - ~SoundSDL2() override; + SoundSDL(OSystem& osystem, AudioSettings& audioSettings); + ~SoundSDL() override; public: /** @@ -172,13 +172,13 @@ class SoundSDL2 : public Sound string myAboutString; /** - This class implements WAV file playback using the SDL2 sound API. + This class implements WAV file playback using the SDL sound API. */ - class WavHandlerSDL2 + class WavHandlerSDL { public: - explicit WavHandlerSDL2() = default; - ~WavHandlerSDL2(); + explicit WavHandlerSDL() = default; + ~WavHandlerSDL(); bool play(const string& fileName, const char* device, uInt32 position, uInt32 length); @@ -206,13 +206,13 @@ class SoundSDL2 : public Sound static void callback(void* object, uInt8* stream, int len); // Following constructors and assignment operators not supported - WavHandlerSDL2(const WavHandlerSDL2&) = delete; - WavHandlerSDL2(WavHandlerSDL2&&) = delete; - WavHandlerSDL2& operator=(const WavHandlerSDL2&) = delete; - WavHandlerSDL2& operator=(WavHandlerSDL2&&) = delete; + WavHandlerSDL(const WavHandlerSDL&) = delete; + WavHandlerSDL(WavHandlerSDL&&) = delete; + WavHandlerSDL& operator=(const WavHandlerSDL&) = delete; + WavHandlerSDL& operator=(WavHandlerSDL&&) = delete; }; - WavHandlerSDL2 myWavHandler; + WavHandlerSDL myWavHandler; static float myVolumeFactor; // Current volume level (0 - 100) @@ -221,11 +221,11 @@ class SoundSDL2 : public Sound static void callback(void* object, uInt8* stream, int len); // Following constructors and assignment operators not supported - SoundSDL2() = delete; - SoundSDL2(const SoundSDL2&) = delete; - SoundSDL2(SoundSDL2&&) = delete; - SoundSDL2& operator=(const SoundSDL2&) = delete; - SoundSDL2& operator=(SoundSDL2&&) = delete; + SoundSDL() = delete; + SoundSDL(const SoundSDL&) = delete; + SoundSDL(SoundSDL&&) = delete; + SoundSDL& operator=(const SoundSDL&) = delete; + SoundSDL& operator=(SoundSDL&&) = delete; }; #endif diff --git a/src/common/module.mk b/src/common/module.mk index 58bee6d5d..bf2549f64 100644 --- a/src/common/module.mk +++ b/src/common/module.mk @@ -6,9 +6,9 @@ MODULE_OBJS := \ src/common/Base.o \ src/common/Bezel.o \ src/common/DevSettingsHandler.o \ - src/common/EventHandlerSDL2.o \ - src/common/FBBackendSDL2.o \ - src/common/FBSurfaceSDL2.o \ + src/common/EventHandlerSDL.o \ + src/common/FBBackendSDL.o \ + src/common/FBSurfaceSDL.o \ src/common/FpsMeter.o \ src/common/FSNodeZIP.o \ src/common/HighScoresManager.o \ @@ -25,7 +25,7 @@ MODULE_OBJS := \ src/common/PKeyboardHandler.o \ src/common/PNGLibrary.o \ src/common/RewindManager.o \ - src/common/SoundSDL2.o \ + src/common/SoundSDL.o \ src/common/StaggeredLogger.o \ src/common/StateManager.o \ src/common/ThreadDebugging.o \ diff --git a/src/common/sdl_blitter/BilinearBlitter.cxx b/src/common/sdl_blitter/BilinearBlitter.cxx index 89b279df8..f98cd74ab 100644 --- a/src/common/sdl_blitter/BilinearBlitter.cxx +++ b/src/common/sdl_blitter/BilinearBlitter.cxx @@ -15,12 +15,12 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ -#include "FBBackendSDL2.hxx" +#include "FBBackendSDL.hxx" #include "ThreadDebugging.hxx" #include "BilinearBlitter.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -BilinearBlitter::BilinearBlitter(FBBackendSDL2& fb, bool interpolate) +BilinearBlitter::BilinearBlitter(FBBackendSDL& fb, bool interpolate) : myFB{fb}, myInterpolate{interpolate} { diff --git a/src/common/sdl_blitter/BilinearBlitter.hxx b/src/common/sdl_blitter/BilinearBlitter.hxx index d5ae01a32..a8636409a 100644 --- a/src/common/sdl_blitter/BilinearBlitter.hxx +++ b/src/common/sdl_blitter/BilinearBlitter.hxx @@ -18,7 +18,7 @@ #ifndef BILINEAR_BLITTER_HXX #define BILINEAR_BLITTER_HXX -class FBBackendSDL2; +class FBBackendSDL; #include "Blitter.hxx" #include "SDL_lib.hxx" @@ -27,7 +27,7 @@ class BilinearBlitter : public Blitter { public: - BilinearBlitter(FBBackendSDL2& fb, bool interpolate); + BilinearBlitter(FBBackendSDL& fb, bool interpolate); ~BilinearBlitter() override; @@ -41,7 +41,7 @@ class BilinearBlitter : public Blitter { void blit(SDL_Surface& surface) override; private: - FBBackendSDL2& myFB; + FBBackendSDL& myFB; SDL_Texture* myTexture{nullptr}; SDL_Texture* mySecondaryTexture{nullptr}; diff --git a/src/common/sdl_blitter/BlitterFactory.cxx b/src/common/sdl_blitter/BlitterFactory.cxx index 253f9d492..4d682c359 100644 --- a/src/common/sdl_blitter/BlitterFactory.cxx +++ b/src/common/sdl_blitter/BlitterFactory.cxx @@ -21,7 +21,7 @@ #include "QisBlitter.hxx" unique_ptr -BlitterFactory::createBlitter(FBBackendSDL2& fb, ScalingAlgorithm scaling) +BlitterFactory::createBlitter(FBBackendSDL& fb, ScalingAlgorithm scaling) { if (!fb.isInitialized()) { throw runtime_error("BlitterFactory requires an initialized framebuffer!"); diff --git a/src/common/sdl_blitter/BlitterFactory.hxx b/src/common/sdl_blitter/BlitterFactory.hxx index 2107767b1..a13b38105 100644 --- a/src/common/sdl_blitter/BlitterFactory.hxx +++ b/src/common/sdl_blitter/BlitterFactory.hxx @@ -21,7 +21,7 @@ #include #include "Blitter.hxx" -#include "FBBackendSDL2.hxx" +#include "FBBackendSDL.hxx" #include "bspf.hxx" class BlitterFactory { @@ -35,7 +35,7 @@ class BlitterFactory { public: - static unique_ptr createBlitter(FBBackendSDL2& fb, ScalingAlgorithm scaling); + static unique_ptr createBlitter(FBBackendSDL& fb, ScalingAlgorithm scaling); }; #endif // BLITTER_FACTORY_HXX diff --git a/src/common/sdl_blitter/QisBlitter.cxx b/src/common/sdl_blitter/QisBlitter.cxx index 17d21208a..a29f29278 100644 --- a/src/common/sdl_blitter/QisBlitter.cxx +++ b/src/common/sdl_blitter/QisBlitter.cxx @@ -15,12 +15,12 @@ // this file, and for a DISCLAIMER OF ALL WARRANTIES. //============================================================================ -#include "FBBackendSDL2.hxx" +#include "FBBackendSDL.hxx" #include "ThreadDebugging.hxx" #include "QisBlitter.hxx" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -QisBlitter::QisBlitter(FBBackendSDL2& fb) +QisBlitter::QisBlitter(FBBackendSDL& fb) : myFB{fb} { } @@ -32,7 +32,7 @@ QisBlitter::~QisBlitter() } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -bool QisBlitter::isSupported(const FBBackendSDL2& fb) +bool QisBlitter::isSupported(const FBBackendSDL& fb) { if (!fb.isInitialized()) throw runtime_error("framebuffer not initialized"); @@ -112,7 +112,6 @@ void QisBlitter::blit(SDL_Surface& surface) SDL_RenderCopy(myFB.renderer(), intermediateTexture, &myIntermediateRect, &myDstRect); } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void QisBlitter::blitToIntermediate() { @@ -131,7 +130,6 @@ void QisBlitter::blitToIntermediate() SDL_SetRenderTarget(myFB.renderer(), nullptr); } - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void QisBlitter::recreateTexturesIfNecessary() { diff --git a/src/common/sdl_blitter/QisBlitter.hxx b/src/common/sdl_blitter/QisBlitter.hxx index 8b8950e6a..ffdbfa9fa 100644 --- a/src/common/sdl_blitter/QisBlitter.hxx +++ b/src/common/sdl_blitter/QisBlitter.hxx @@ -18,7 +18,7 @@ #ifndef QIS_BLITTER_HXX #define QIS_BLITTER_HXX -class FBBackendSDL2; +class FBBackendSDL; #include "Blitter.hxx" #include "SDL_lib.hxx" @@ -27,9 +27,9 @@ class QisBlitter : public Blitter { public: - explicit QisBlitter(FBBackendSDL2& fb); + explicit QisBlitter(FBBackendSDL& fb); - static bool isSupported(const FBBackendSDL2& fb); + static bool isSupported(const FBBackendSDL& fb); ~QisBlitter() override; @@ -44,7 +44,7 @@ class QisBlitter : public Blitter { private: - FBBackendSDL2& myFB; + FBBackendSDL& myFB; SDL_Texture* mySrcTexture{nullptr}; SDL_Texture* mySecondarySrcTexture{nullptr}; diff --git a/src/emucore/FBBackend.hxx b/src/emucore/FBBackend.hxx index 26642c35b..80a9a7828 100644 --- a/src/emucore/FBBackend.hxx +++ b/src/emucore/FBBackend.hxx @@ -29,7 +29,7 @@ class FBSurface; /** This class provides an interface/abstraction for platform-specific, framebuffer-related rendering operations. Different graphical - platforms will inherit from this. For most ports that means SDL2, + platforms will inherit from this. For most ports that means SDL, but some (such as libretro) use their own graphical subsystem. @author Stephen Anthony diff --git a/src/os/libretro/EventHandlerLIBRETRO.hxx b/src/os/libretro/EventHandlerLIBRETRO.hxx index 214676804..554e0f0c8 100644 --- a/src/os/libretro/EventHandlerLIBRETRO.hxx +++ b/src/os/libretro/EventHandlerLIBRETRO.hxx @@ -31,7 +31,7 @@ class EventHandlerLIBRETRO : public EventHandler { public: /** - Create a new LIBRETRO event handler object + Create a new LIBRETRO event handler object. */ explicit EventHandlerLIBRETRO(OSystem& osystem) : EventHandler(osystem) { } ~EventHandlerLIBRETRO() override = default; @@ -43,7 +43,7 @@ class EventHandlerLIBRETRO : public EventHandler void enableTextEvents(bool enable) override { } /** - Collects and dispatches any pending SDL2 events. + Collects and dispatches any pending events. */ void pollEvent() override { } diff --git a/src/os/macos/AboutBox.h b/src/os/macos/AboutBox.h index 7f65035fa..fc0b8fee8 100644 --- a/src/os/macos/AboutBox.h +++ b/src/os/macos/AboutBox.h @@ -19,7 +19,7 @@ /** AboutBox window class and support functions for the macOS - SDL2 port of Stella. + SDL port of Stella. @author Mark Grebe */ diff --git a/src/os/macos/AboutBoxTextView.h b/src/os/macos/AboutBoxTextView.h index 3d45df2c5..cc5a59959 100644 --- a/src/os/macos/AboutBoxTextView.h +++ b/src/os/macos/AboutBoxTextView.h @@ -19,7 +19,7 @@ /** AboutBoxTextView class and support functions for the macOS - SDL2 port of Stella. + SDL port of Stella. @author Mark Grebe */ diff --git a/src/os/windows/Stella.vcxproj b/src/os/windows/Stella.vcxproj index 8dc80e2ae..3046858e9 100755 --- a/src/os/windows/Stella.vcxproj +++ b/src/os/windows/Stella.vcxproj @@ -416,9 +416,9 @@ - - - + + + @@ -784,7 +784,7 @@ - + @@ -1382,9 +1382,9 @@ - - - + + + @@ -1790,7 +1790,7 @@ - + @@ -2003,4 +2003,4 @@ - \ No newline at end of file + diff --git a/src/os/windows/Stella.vcxproj.filters b/src/os/windows/Stella.vcxproj.filters index 89b949e32..a49913e5d 100644 --- a/src/os/windows/Stella.vcxproj.filters +++ b/src/os/windows/Stella.vcxproj.filters @@ -1146,13 +1146,13 @@ Source Files\common - + Source Files\common - + Source Files\common - + Source Files\common @@ -1203,7 +1203,7 @@ Source Files\common - + Source Files\common @@ -2402,13 +2402,13 @@ Header Files\common - + Header Files\common - + Header Files\common - + Header Files\common @@ -2477,7 +2477,7 @@ Header Files\common - + Header Files\common From e13b683c5236adf8560613a883a0af8841ee49cb Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Tue, 29 Apr 2025 10:46:39 -0230 Subject: [PATCH 4/5] Updated Xcode project with name changes for SDL2 classes. --- src/os/macos/stella.xcodeproj/project.pbxproj | 118 +++++++++--------- 1 file changed, 59 insertions(+), 59 deletions(-) diff --git a/src/os/macos/stella.xcodeproj/project.pbxproj b/src/os/macos/stella.xcodeproj/project.pbxproj index 48025bdca..f5a3a266d 100644 --- a/src/os/macos/stella.xcodeproj/project.pbxproj +++ b/src/os/macos/stella.xcodeproj/project.pbxproj @@ -283,10 +283,16 @@ DC30924D212F74930020DAD0 /* TimerManager.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC30924B212F74930020DAD0 /* TimerManager.hxx */; }; DC3131ED2C540CE2008A1E43 /* CortexM0.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC3131EB2C540CE2008A1E43 /* CortexM0.cxx */; }; DC3131EE2C540CE2008A1E43 /* CortexM0.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC3131EC2C540CE2008A1E43 /* CortexM0.hxx */; }; - DC368F5818A2FB710084199C /* SoundSDL2.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC368F5218A2FB710084199C /* SoundSDL2.cxx */; }; - DC368F5918A2FB710084199C /* SoundSDL2.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC368F5318A2FB710084199C /* SoundSDL2.hxx */; }; DC36D2C814CAFAB0007DC821 /* CartFA2.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC36D2C614CAFAB0007DC821 /* CartFA2.cxx */; }; DC36D2C914CAFAB0007DC821 /* CartFA2.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC36D2C714CAFAB0007DC821 /* CartFA2.hxx */; }; + DC39F2A02DC107F3006D74A8 /* FBSurfaceSDL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC39F29D2DC107F3006D74A8 /* FBSurfaceSDL.cxx */; }; + DC39F2A12DC107F3006D74A8 /* EventHandlerSDL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC39F2992DC107F3006D74A8 /* EventHandlerSDL.cxx */; }; + DC39F2A22DC107F3006D74A8 /* SoundSDL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC39F29F2DC107F3006D74A8 /* SoundSDL.cxx */; }; + DC39F2A32DC107F3006D74A8 /* FBBackendSDL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC39F29B2DC107F3006D74A8 /* FBBackendSDL.cxx */; }; + DC39F2A42DC107F3006D74A8 /* EventHandlerSDL.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC39F2982DC107F3006D74A8 /* EventHandlerSDL.hxx */; }; + DC39F2A52DC107F3006D74A8 /* FBBackendSDL.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC39F29A2DC107F3006D74A8 /* FBBackendSDL.hxx */; }; + DC39F2A62DC107F3006D74A8 /* FBSurfaceSDL.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC39F29C2DC107F3006D74A8 /* FBSurfaceSDL.hxx */; }; + DC39F2A72DC107F3006D74A8 /* SoundSDL.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC39F29E2DC107F3006D74A8 /* SoundSDL.hxx */; }; DC3C9BC52469C8F700CF2D47 /* PaletteHandler.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC3C9BC32469C8F700CF2D47 /* PaletteHandler.cxx */; }; DC3C9BC62469C8F700CF2D47 /* PaletteHandler.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC3C9BC42469C8F700CF2D47 /* PaletteHandler.hxx */; }; DC3C9BCB2469C93D00CF2D47 /* VideoAudioDialog.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC3C9BC72469C93D00CF2D47 /* VideoAudioDialog.cxx */; }; @@ -451,8 +457,6 @@ DC70065E241EC97900A459AB /* Stella14x28tFont.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC70065B241EC97900A459AB /* Stella14x28tFont.hxx */; }; DC71C399221623D9005DE92F /* ControllerDetector.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC71C397221623D8005DE92F /* ControllerDetector.hxx */; }; DC71C39A221623D9005DE92F /* ControllerDetector.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC71C398221623D9005DE92F /* ControllerDetector.cxx */; }; - DC73BD851915E5B1003FAFAD /* FBSurfaceSDL2.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC73BD831915E5B1003FAFAD /* FBSurfaceSDL2.cxx */; }; - DC73BD861915E5B1003FAFAD /* FBSurfaceSDL2.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC73BD841915E5B1003FAFAD /* FBSurfaceSDL2.hxx */; }; DC73BD891915E5E3003FAFAD /* FBSurface.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DC73BD871915E5E3003FAFAD /* FBSurface.cxx */; }; DC73BD8A1915E5E3003FAFAD /* FBSurface.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC73BD881915E5E3003FAFAD /* FBSurface.hxx */; }; DC74D6A2138D4D7E00F05C5C /* StringParser.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DC74D6A0138D4D7E00F05C5C /* StringParser.hxx */; }; @@ -602,8 +606,6 @@ DCB60AC92535E30600A5C1D2 /* VideoModeHandler.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCB60AC72535E30500A5C1D2 /* VideoModeHandler.cxx */; }; DCB60ACA2535E30600A5C1D2 /* VideoModeHandler.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCB60AC82535E30600A5C1D2 /* VideoModeHandler.hxx */; }; DCB60ACC25430FC600A5C1D2 /* FBBackend.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCB60ACB25430FC600A5C1D2 /* FBBackend.hxx */; }; - DCB60AD02543100900A5C1D2 /* FBBackendSDL2.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCB60ACD2543100900A5C1D2 /* FBBackendSDL2.cxx */; }; - DCB60AD12543100900A5C1D2 /* FBBackendSDL2.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCB60ACE2543100900A5C1D2 /* FBBackendSDL2.hxx */; }; DCB87E581A104C1E00BF2A3B /* MediaFactory.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCB87E571A104C1E00BF2A3B /* MediaFactory.hxx */; }; DCBA539925557E2800087DD7 /* UndoHandler.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCBA539725557E2700087DD7 /* UndoHandler.hxx */; }; DCBA539A25557E2800087DD7 /* UndoHandler.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCBA539825557E2800087DD7 /* UndoHandler.cxx */; }; @@ -764,8 +766,6 @@ DCFB9FAC1ECA2609004FD69B /* DelayQueueIteratorImpl.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCFB9FAB1ECA2609004FD69B /* DelayQueueIteratorImpl.hxx */; }; DCFCDE7220C9E66500915CBE /* EmulationWorker.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCFCDE7020C9E66500915CBE /* EmulationWorker.cxx */; }; DCFCDE7320C9E66500915CBE /* EmulationWorker.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCFCDE7120C9E66500915CBE /* EmulationWorker.hxx */; }; - DCFF14CD18B0260300A20364 /* EventHandlerSDL2.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCFF14CB18B0260300A20364 /* EventHandlerSDL2.cxx */; }; - DCFF14CE18B0260300A20364 /* EventHandlerSDL2.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCFF14CC18B0260300A20364 /* EventHandlerSDL2.hxx */; }; DCFFE59D12100E1400DFA000 /* ComboDialog.cxx in Sources */ = {isa = PBXBuildFile; fileRef = DCFFE59B12100E1400DFA000 /* ComboDialog.cxx */; }; DCFFE59E12100E1400DFA000 /* ComboDialog.hxx in Headers */ = {isa = PBXBuildFile; fileRef = DCFFE59C12100E1400DFA000 /* ComboDialog.hxx */; }; E007231E210FBF5E002CF343 /* FpsMeter.hxx in Headers */ = {isa = PBXBuildFile; fileRef = E007231C210FBF5C002CF343 /* FpsMeter.hxx */; }; @@ -1165,10 +1165,16 @@ DC30924B212F74930020DAD0 /* TimerManager.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TimerManager.hxx; sourceTree = ""; }; DC3131EB2C540CE2008A1E43 /* CortexM0.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CortexM0.cxx; sourceTree = ""; }; DC3131EC2C540CE2008A1E43 /* CortexM0.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CortexM0.hxx; sourceTree = ""; }; - DC368F5218A2FB710084199C /* SoundSDL2.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SoundSDL2.cxx; sourceTree = ""; }; - DC368F5318A2FB710084199C /* SoundSDL2.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SoundSDL2.hxx; sourceTree = ""; }; DC36D2C614CAFAB0007DC821 /* CartFA2.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CartFA2.cxx; sourceTree = ""; }; DC36D2C714CAFAB0007DC821 /* CartFA2.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = CartFA2.hxx; sourceTree = ""; }; + DC39F2982DC107F3006D74A8 /* EventHandlerSDL.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = EventHandlerSDL.hxx; sourceTree = ""; }; + DC39F2992DC107F3006D74A8 /* EventHandlerSDL.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = EventHandlerSDL.cxx; sourceTree = ""; }; + DC39F29A2DC107F3006D74A8 /* FBBackendSDL.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = FBBackendSDL.hxx; sourceTree = ""; }; + DC39F29B2DC107F3006D74A8 /* FBBackendSDL.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FBBackendSDL.cxx; sourceTree = ""; }; + DC39F29C2DC107F3006D74A8 /* FBSurfaceSDL.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = FBSurfaceSDL.hxx; sourceTree = ""; }; + DC39F29D2DC107F3006D74A8 /* FBSurfaceSDL.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FBSurfaceSDL.cxx; sourceTree = ""; }; + DC39F29E2DC107F3006D74A8 /* SoundSDL.hxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = SoundSDL.hxx; sourceTree = ""; }; + DC39F29F2DC107F3006D74A8 /* SoundSDL.cxx */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SoundSDL.cxx; sourceTree = ""; }; DC3C9BC32469C8F700CF2D47 /* PaletteHandler.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PaletteHandler.cxx; sourceTree = ""; }; DC3C9BC42469C8F700CF2D47 /* PaletteHandler.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = PaletteHandler.hxx; sourceTree = ""; }; DC3C9BC72469C93D00CF2D47 /* VideoAudioDialog.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoAudioDialog.cxx; sourceTree = ""; }; @@ -1333,8 +1339,6 @@ DC70065B241EC97900A459AB /* Stella14x28tFont.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Stella14x28tFont.hxx; sourceTree = ""; }; DC71C397221623D8005DE92F /* ControllerDetector.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ControllerDetector.hxx; sourceTree = ""; }; DC71C398221623D9005DE92F /* ControllerDetector.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ControllerDetector.cxx; sourceTree = ""; }; - DC73BD831915E5B1003FAFAD /* FBSurfaceSDL2.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FBSurfaceSDL2.cxx; sourceTree = ""; }; - DC73BD841915E5B1003FAFAD /* FBSurfaceSDL2.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = FBSurfaceSDL2.hxx; sourceTree = ""; }; DC73BD871915E5E3003FAFAD /* FBSurface.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FBSurface.cxx; sourceTree = ""; }; DC73BD881915E5E3003FAFAD /* FBSurface.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = FBSurface.hxx; sourceTree = ""; }; DC74D6A0138D4D7E00F05C5C /* StringParser.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = StringParser.hxx; sourceTree = ""; }; @@ -1485,8 +1489,6 @@ DCB60AC72535E30500A5C1D2 /* VideoModeHandler.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VideoModeHandler.cxx; sourceTree = ""; }; DCB60AC82535E30600A5C1D2 /* VideoModeHandler.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = VideoModeHandler.hxx; sourceTree = ""; }; DCB60ACB25430FC600A5C1D2 /* FBBackend.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = FBBackend.hxx; sourceTree = ""; }; - DCB60ACD2543100900A5C1D2 /* FBBackendSDL2.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FBBackendSDL2.cxx; sourceTree = ""; }; - DCB60ACE2543100900A5C1D2 /* FBBackendSDL2.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = FBBackendSDL2.hxx; sourceTree = ""; }; DCB87E571A104C1E00BF2A3B /* MediaFactory.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = MediaFactory.hxx; sourceTree = ""; }; DCBA539725557E2700087DD7 /* UndoHandler.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = UndoHandler.hxx; sourceTree = ""; }; DCBA539825557E2800087DD7 /* UndoHandler.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UndoHandler.cxx; sourceTree = ""; }; @@ -1648,8 +1650,6 @@ DCFB9FAB1ECA2609004FD69B /* DelayQueueIteratorImpl.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = DelayQueueIteratorImpl.hxx; sourceTree = ""; }; DCFCDE7020C9E66500915CBE /* EmulationWorker.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EmulationWorker.cxx; sourceTree = ""; }; DCFCDE7120C9E66500915CBE /* EmulationWorker.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = EmulationWorker.hxx; sourceTree = ""; }; - DCFF14CB18B0260300A20364 /* EventHandlerSDL2.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventHandlerSDL2.cxx; sourceTree = ""; }; - DCFF14CC18B0260300A20364 /* EventHandlerSDL2.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = EventHandlerSDL2.hxx; sourceTree = ""; }; DCFFE59B12100E1400DFA000 /* ComboDialog.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ComboDialog.cxx; sourceTree = ""; }; DCFFE59C12100E1400DFA000 /* ComboDialog.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = ComboDialog.hxx; sourceTree = ""; }; E007231C210FBF5C002CF343 /* FpsMeter.hxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = FpsMeter.hxx; sourceTree = ""; }; @@ -2011,85 +2011,85 @@ isa = PBXGroup; children = ( DCC6A4AD20A2620D00863C59 /* audio */, - E09F413A201E901D004A3391 /* AudioQueue.cxx */, E09F4139201E901C004A3391 /* AudioQueue.hxx */, - E0FABEEA20E9948100EB8E28 /* AudioSettings.cxx */, + E09F413A201E901D004A3391 /* AudioQueue.cxx */, E0FABEE920E9948000EB8E28 /* AudioSettings.hxx */, - DC79F81017A88D9E00288B91 /* Base.cxx */, + E0FABEEA20E9948100EB8E28 /* AudioSettings.cxx */, DC79F81117A88D9E00288B91 /* Base.hxx */, - DCE716182AA78BD700B870EA /* Bezel.cxx */, + DC79F81017A88D9E00288B91 /* Base.cxx */, DCE716192AA78BD700B870EA /* Bezel.hxx */, + DCE716182AA78BD700B870EA /* Bezel.cxx */, DCC527D810B9DA6A005E1287 /* bspf.hxx */, - DC6DC5E9273C2C3A00F64413 /* DevSettingsHandler.cxx */, DC6DC5EA273C2C3A00F64413 /* DevSettingsHandler.hxx */, - DCFF14CB18B0260300A20364 /* EventHandlerSDL2.cxx */, - DCFF14CC18B0260300A20364 /* EventHandlerSDL2.hxx */, - DCB60ACD2543100900A5C1D2 /* FBBackendSDL2.cxx */, - DCB60ACE2543100900A5C1D2 /* FBBackendSDL2.hxx */, - DC73BD831915E5B1003FAFAD /* FBSurfaceSDL2.cxx */, - DC73BD841915E5B1003FAFAD /* FBSurfaceSDL2.hxx */, - E007231D210FBF5D002CF343 /* FpsMeter.cxx */, + DC6DC5E9273C2C3A00F64413 /* DevSettingsHandler.cxx */, + DC39F2982DC107F3006D74A8 /* EventHandlerSDL.hxx */, + DC39F2992DC107F3006D74A8 /* EventHandlerSDL.cxx */, + DC39F29A2DC107F3006D74A8 /* FBBackendSDL.hxx */, + DC39F29B2DC107F3006D74A8 /* FBBackendSDL.cxx */, + DC39F29C2DC107F3006D74A8 /* FBSurfaceSDL.hxx */, + DC39F29D2DC107F3006D74A8 /* FBSurfaceSDL.cxx */, E007231C210FBF5C002CF343 /* FpsMeter.hxx */, + E007231D210FBF5D002CF343 /* FpsMeter.cxx */, DCE395EA16CB0B5F008DB1E5 /* FSNodeFactory.hxx */, - DCE395EB16CB0B5F008DB1E5 /* FSNodeZIP.cxx */, DCE395EC16CB0B5F008DB1E5 /* FSNodeZIP.hxx */, - DC816CFA25757D9A00FBCCDA /* HighScoresManager.cxx */, + DCE395EB16CB0B5F008DB1E5 /* FSNodeZIP.cxx */, DC816CF925757D9A00FBCCDA /* HighScoresManager.hxx */, - E08D2F3C23089B9B000BD709 /* JoyMap.cxx */, + DC816CFA25757D9A00FBCCDA /* HighScoresManager.cxx */, E08D2F3D23089B9B000BD709 /* JoyMap.hxx */, - DC564F7428C11C2B00177588 /* JPGLibrary.cxx */, + E08D2F3C23089B9B000BD709 /* JoyMap.cxx */, DC564F7328C11C2B00177588 /* JPGLibrary.hxx */, + DC564F7428C11C2B00177588 /* JPGLibrary.cxx */, DC6DC5EB273C2C3A00F64413 /* jsonDefinitions.hxx */, - DCBD31E72299ADB400567357 /* KeyMap.cxx */, DCBD31E52299ADB400567357 /* KeyMap.hxx */, + DCBD31E72299ADB400567357 /* KeyMap.cxx */, DCA078321F8C1B04008EFEE5 /* LinkedObjectPool.hxx */, - E0EA1FFE227A42D0008BA944 /* Logger.cxx */, E0EA1FFD227A42D0008BA944 /* Logger.hxx */, + E0EA1FFE227A42D0008BA944 /* Logger.cxx */, DCB20EC61A0C506C0048F595 /* main.cxx */, DCB87E571A104C1E00BF2A3B /* MediaFactory.hxx */, - DC56FCDC14CCCC4900A31CC3 /* MouseControl.cxx */, DC56FCDD14CCCC4900A31CC3 /* MouseControl.hxx */, - DC3C9BC32469C8F700CF2D47 /* PaletteHandler.cxx */, + DC56FCDC14CCCC4900A31CC3 /* MouseControl.cxx */, DC3C9BC42469C8F700CF2D47 /* PaletteHandler.hxx */, - DCA233AE23B583FE0032ABF3 /* PhosphorHandler.cxx */, + DC3C9BC32469C8F700CF2D47 /* PaletteHandler.cxx */, DCA233AF23B583FE0032ABF3 /* PhosphorHandler.hxx */, - DC6DC91A205DB879004A5FC3 /* PhysicalJoystick.cxx */, + DCA233AE23B583FE0032ABF3 /* PhosphorHandler.cxx */, DC6DC91B205DB879004A5FC3 /* PhysicalJoystick.hxx */, - DC6DC91C205DB879004A5FC3 /* PJoystickHandler.cxx */, + DC6DC91A205DB879004A5FC3 /* PhysicalJoystick.cxx */, DC6DC91D205DB879004A5FC3 /* PJoystickHandler.hxx */, - DC1BC6642066B4390076F74A /* PKeyboardHandler.cxx */, + DC6DC91C205DB879004A5FC3 /* PJoystickHandler.cxx */, DC1BC6652066B4390076F74A /* PKeyboardHandler.hxx */, - DCD6FC9111C28C6F005DA767 /* PNGLibrary.cxx */, + DC1BC6642066B4390076F74A /* PKeyboardHandler.cxx */, DCD6FC9211C28C6F005DA767 /* PNGLibrary.hxx */, + DCD6FC9111C28C6F005DA767 /* PNGLibrary.cxx */, DCBD31E62299ADB400567357 /* Rect.hxx */, E06508B72272447200B341AC /* repository */, - DCDDEAC01F5DBF0400C67366 /* RewindManager.cxx */, DCDDEAC11F5DBF0400C67366 /* RewindManager.hxx */, + DCDDEAC01F5DBF0400C67366 /* RewindManager.cxx */, E08FCD4B23A037D80051F59B /* sdl_blitter */, DCA078331F8C1B04008EFEE5 /* SDL_lib.hxx */, DC2C5EDA1F8F2403007D2A09 /* smartmod.hxx */, DCF467B40F93993B00B25D7A /* SoundNull.hxx */, - DC368F5218A2FB710084199C /* SoundSDL2.cxx */, - DC368F5318A2FB710084199C /* SoundSDL2.hxx */, + DC39F29E2DC107F3006D74A8 /* SoundSDL.hxx */, + DC39F29F2DC107F3006D74A8 /* SoundSDL.cxx */, DC5D1AA6102C6FC900E59AC1 /* Stack.hxx */, - DCF8621721C9D43300F95F52 /* StaggeredLogger.cxx */, DCF8621821C9D43300F95F52 /* StaggeredLogger.hxx */, - DCDDEAC21F5DBF0400C67366 /* StateManager.cxx */, + DCF8621721C9D43300F95F52 /* StaggeredLogger.cxx */, DCDDEAC31F5DBF0400C67366 /* StateManager.hxx */, + DCDDEAC21F5DBF0400C67366 /* StateManager.cxx */, DC5C768E14C26F7C0031EBC7 /* StellaKeys.hxx */, DC74D6A0138D4D7E00F05C5C /* StringParser.hxx */, - DC6F394B21B897F300897AD8 /* ThreadDebugging.cxx */, DC6F394C21B897F300897AD8 /* ThreadDebugging.hxx */, - DC30924A212F74930020DAD0 /* TimerManager.cxx */, + DC6F394B21B897F300897AD8 /* ThreadDebugging.cxx */, DC30924B212F74930020DAD0 /* TimerManager.hxx */, + DC30924A212F74930020DAD0 /* TimerManager.cxx */, DCC467EA14FBEC9600E15508 /* tv_filters */, DC7A24D4173B1CF600B20FE9 /* Variant.hxx */, DCF490791A0ECE5B00A67AA9 /* Vec.hxx */, DCF467BC0F9399F500B25D7A /* Version.hxx */, - DCB60AC72535E30500A5C1D2 /* VideoModeHandler.cxx */, DCB60AC82535E30600A5C1D2 /* VideoModeHandler.hxx */, - DCE395ED16CB0B5F008DB1E5 /* ZipHandler.cxx */, + DCB60AC72535E30500A5C1D2 /* VideoModeHandler.cxx */, DCE395EE16CB0B5F008DB1E5 /* ZipHandler.hxx */, + DCE395ED16CB0B5F008DB1E5 /* ZipHandler.cxx */, ); name = common; path = ../common; @@ -2926,7 +2926,6 @@ 2D91740609BA90380026E9FF /* GameInfoDialog.hxx in Headers */, DCE9158C201543B900960CC0 /* TimeLineWidget.hxx in Headers */, 2D91740809BA90380026E9FF /* GuiObject.hxx in Headers */, - DC73BD861915E5B1003FAFAD /* FBSurfaceSDL2.hxx in Headers */, 2D91740A09BA90380026E9FF /* HelpDialog.hxx in Headers */, 2D91740B09BA90380026E9FF /* Launcher.hxx in Headers */, 2D91740C09BA90380026E9FF /* LauncherDialog.hxx in Headers */, @@ -2999,6 +2998,10 @@ 2D91745309BA90380026E9FF /* CommandMenu.hxx in Headers */, E0306E111F93E916003DDD52 /* JitterEmulation.hxx in Headers */, DC0E98E52801CD1600097C68 /* Cart0FA0.hxx in Headers */, + DC39F2A42DC107F3006D74A8 /* EventHandlerSDL.hxx in Headers */, + DC39F2A52DC107F3006D74A8 /* FBBackendSDL.hxx in Headers */, + DC39F2A62DC107F3006D74A8 /* FBSurfaceSDL.hxx in Headers */, + DC39F2A72DC107F3006D74A8 /* SoundSDL.hxx in Headers */, DC0932182C50017A00527D3C /* ElfEnvironment.hxx in Headers */, DC1E474F24D34F3B0047E61A /* WhatsNewDialog.hxx in Headers */, 2D91745509BA90380026E9FF /* CpuWidget.hxx in Headers */, @@ -3087,7 +3090,6 @@ DC816D0225757DC300FBCCDA /* HighScoresDialog.hxx in Headers */, DC5D2C530F117CFD004D1660 /* StellaFont.hxx in Headers */, DC5D2C540F117CFD004D1660 /* StellaLargeFont.hxx in Headers */, - DCB60AD12543100900A5C1D2 /* FBBackendSDL2.hxx in Headers */, DC5D2C550F117CFD004D1660 /* StellaMediumFont.hxx in Headers */, DC3EE8681E2C0E6D00905161 /* inftrees.h in Headers */, DC932D440F278A5200FEFEFC /* DefProps.hxx in Headers */, @@ -3268,10 +3270,8 @@ DC96162D1F817830008A2206 /* AmigaMouseWidget.hxx in Headers */, DCAACB17188D636F00A4D282 /* CartDFWidget.hxx in Headers */, DCF3A6FF1DFC75E3008A8AF3 /* TIA.hxx in Headers */, - DC368F5918A2FB710084199C /* SoundSDL2.hxx in Headers */, DCF3A6F91DFC75E3008A8AF3 /* AnalogReadout.hxx in Headers */, DC6DC5E8273C2BED00F64413 /* GlobalKeyHandler.hxx in Headers */, - DCFF14CE18B0260300A20364 /* EventHandlerSDL2.hxx in Headers */, DCA6A9122C7CD04000EEB5FF /* CartELFWidget.hxx in Headers */, DC047FEF1A4A6F3600348F0F /* JoystickDialog.hxx in Headers */, CFE3F60E1E84A9A200A8204E /* CartCDFWidget.hxx in Headers */, @@ -3314,7 +3314,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 1600; + LastUpgradeCheck = 1630; ORGANIZATIONNAME = "Stella-emu"; }; buildConfigurationList = 2D91752109BA903B0026E9FF /* Build configuration list for PBXProject "stella" */; @@ -3543,7 +3543,6 @@ 2D91750609BA90380026E9FF /* TiaZoomWidget.cxx in Sources */, DC1E89062C4033280033E15F /* ElfParser.cxx in Sources */, CFE3F6131E84A9CE00A8204E /* CartBUS.cxx in Sources */, - DC73BD851915E5B1003FAFAD /* FBSurfaceSDL2.cxx in Sources */, DCDDEAC41F5DBF0400C67366 /* RewindManager.cxx in Sources */, E09F413C201E901D004A3391 /* AudioQueue.cxx in Sources */, 2D91750809BA90380026E9FF /* AudioWidget.cxx in Sources */, @@ -3681,6 +3680,10 @@ DCDA03B01A2009BB00711920 /* CartWD.cxx in Sources */, E0A3841C2589741A0062AA93 /* SqliteStatement.cxx in Sources */, DCC6A4B220A2622500863C59 /* SimpleResampler.cxx in Sources */, + DC39F2A02DC107F3006D74A8 /* FBSurfaceSDL.cxx in Sources */, + DC39F2A12DC107F3006D74A8 /* EventHandlerSDL.cxx in Sources */, + DC39F2A22DC107F3006D74A8 /* SoundSDL.cxx in Sources */, + DC39F2A32DC107F3006D74A8 /* FBBackendSDL.cxx in Sources */, DCA6A9162C7E0ADD00EEB5FF /* CartELFStateWidget.cxx in Sources */, DC21E5BF21CA903E007D0E1A /* OSystemMACOS.cxx in Sources */, DC84397C247B294E00C6A4FC /* CartTVBoy.cxx in Sources */, @@ -3739,7 +3742,6 @@ DCE9681E276A40AC00E99839 /* NavigationWidget.cxx in Sources */, DCAACAFE188D631500A4D282 /* CartDFSC.cxx in Sources */, DCAACB0E188D636F00A4D282 /* Cart4KSCWidget.cxx in Sources */, - DCB60AD02543100900A5C1D2 /* FBBackendSDL2.cxx in Sources */, DC911C7526333B9200666AC0 /* CartMVC.cxx in Sources */, DCAACB10188D636F00A4D282 /* CartBFSCWidget.cxx in Sources */, DCC2FDF6255EB82500FA5E81 /* ToolTip.cxx in Sources */, @@ -3747,8 +3749,6 @@ DCAACB14188D636F00A4D282 /* CartDFSCWidget.cxx in Sources */, DCAACB16188D636F00A4D282 /* CartDFWidget.cxx in Sources */, E0D4153D25A120340031A8D6 /* SettingsRepositoryMACOS.mm in Sources */, - DC368F5818A2FB710084199C /* SoundSDL2.cxx in Sources */, - DCFF14CD18B0260300A20364 /* EventHandlerSDL2.cxx in Sources */, DC3EE8561E2C0E6D00905161 /* adler32.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; From 0d660c2be6686a6fc04c243b444425e2c25dbccc Mon Sep 17 00:00:00 2001 From: Stephen Anthony Date: Thu, 8 May 2025 16:55:38 -0230 Subject: [PATCH 5/5] Updated included libpng to version 1.6.48. --- src/lib/libpng/png.c | 12 ++++----- src/lib/libpng/png.h | 20 +++++++-------- src/lib/libpng/pngconf.h | 47 +++++++++++++++------------------- src/lib/libpng/pngdebug.h | 8 ++++-- src/lib/libpng/pngerror.c | 2 +- src/lib/libpng/pngget.c | 2 +- src/lib/libpng/pnginfo.h | 51 ++++++++++--------------------------- src/lib/libpng/pnglibconf.h | 13 ++++++++-- src/lib/libpng/pngmem.c | 2 +- src/lib/libpng/pngpread.c | 2 +- src/lib/libpng/pngpriv.h | 40 ++++++++++++++++------------- src/lib/libpng/pngread.c | 2 +- src/lib/libpng/pngrio.c | 4 +-- src/lib/libpng/pngrtran.c | 2 +- src/lib/libpng/pngrutil.c | 2 +- src/lib/libpng/pngset.c | 19 ++++++-------- src/lib/libpng/pngstruct.h | 12 ++++----- src/lib/libpng/pngwio.c | 8 +++--- src/lib/libpng/pngwrite.c | 2 +- src/lib/libpng/pngwutil.c | 2 +- 20 files changed, 117 insertions(+), 135 deletions(-) diff --git a/src/lib/libpng/png.c b/src/lib/libpng/png.c index 6d533ec40..a9179ffbb 100644 --- a/src/lib/libpng/png.c +++ b/src/lib/libpng/png.c @@ -13,7 +13,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_47 Your_png_h_is_not_version_1_6_47; +typedef png_libpng_version_1_6_48 Your_png_h_is_not_version_1_6_48; /* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the * corresponding macro definitions. This causes a compile time failure if @@ -700,7 +700,7 @@ png_get_io_ptr(png_const_structrp png_ptr) * function of your own because "FILE *" isn't necessarily available. */ void PNGAPI -png_init_io(png_structrp png_ptr, png_FILE_p fp) +png_init_io(png_structrp png_ptr, FILE *fp) { png_debug(1, "in png_init_io"); @@ -815,7 +815,7 @@ png_get_copyright(png_const_structrp png_ptr) return PNG_STRING_COPYRIGHT #else return PNG_STRING_NEWLINE \ - "libpng version 1.6.47" PNG_STRING_NEWLINE \ + "libpng version 1.6.48" PNG_STRING_NEWLINE \ "Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ @@ -1491,7 +1491,7 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy) } #endif /* COLORSPACE */ -#ifdef PNG_iCCP_SUPPORTED +#ifdef PNG_READ_iCCP_SUPPORTED /* Error message generation */ static char png_icc_tag_char(png_uint_32 byte) @@ -1567,9 +1567,7 @@ png_icc_profile_error(png_const_structrp png_ptr, png_const_charp name, return 0; } -#endif /* iCCP */ -#ifdef PNG_READ_iCCP_SUPPORTED /* Encoded value of D50 as an ICC XYZNumber. From the ICC 2010 spec the value * is XYZ(0.9642,1.0,0.8249), which scales to: * @@ -3969,7 +3967,7 @@ png_image_free_function(png_voidp argument) # ifdef PNG_STDIO_SUPPORTED if (cp->owned_file != 0) { - FILE *fp = png_voidcast(FILE*, cp->png_ptr->io_ptr); + FILE *fp = png_voidcast(FILE *, cp->png_ptr->io_ptr); cp->owned_file = 0; /* Ignore errors here. */ diff --git a/src/lib/libpng/png.h b/src/lib/libpng/png.h index 9b069e4ee..665511c55 100644 --- a/src/lib/libpng/png.h +++ b/src/lib/libpng/png.h @@ -1,6 +1,6 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.47 + * libpng version 1.6.48 * * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson @@ -14,7 +14,7 @@ * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.97, January 1998, through 1.6.35, July 2018: * Glenn Randers-Pehrson - * libpng versions 1.6.36, December 2018, through 1.6.47, February 2025: + * libpng versions 1.6.36, December 2018, through 1.6.48, April 2025: * Cosmin Truta * See also "Contributing Authors", below. */ @@ -238,7 +238,7 @@ * ... * 1.5.30 15 10530 15.so.15.30[.0] * ... - * 1.6.47 16 10647 16.so.16.47[.0] + * 1.6.48 16 10648 16.so.16.48[.0] * * Henceforth the source version will match the shared-library major and * minor numbers; the shared-library major version number will be used for @@ -274,7 +274,7 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.47" +#define PNG_LIBPNG_VER_STRING "1.6.48" #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n" /* The versions of shared library builds should stay in sync, going forward */ @@ -285,7 +285,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 47 +#define PNG_LIBPNG_VER_RELEASE 48 /* This should be zero for a public release, or non-zero for a * development version. @@ -316,7 +316,7 @@ * From version 1.0.1 it is: * XXYYZZ, where XX=major, YY=minor, ZZ=release */ -#define PNG_LIBPNG_VER 10647 /* 1.6.47 */ +#define PNG_LIBPNG_VER 10648 /* 1.6.48 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -426,7 +426,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_47; +typedef char* png_libpng_version_1_6_48; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -1570,7 +1570,7 @@ PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr, #ifdef PNG_STDIO_SUPPORTED /* Initialize the input/output for the PNG file to the default functions. */ -PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, png_FILE_p fp)); +PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, FILE *fp)); #endif /* Replace the (error and abort), and warning functions with user @@ -3088,7 +3088,7 @@ PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image, */ PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image, - FILE* file)); + FILE *file)); /* The PNG header is read from the stdio FILE object. */ #endif /* STDIO */ @@ -3163,7 +3163,7 @@ PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image, PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file, int convert_to_8_bit, const void *buffer, png_int_32 row_stride, const void *colormap)); - /* Write the image to the given (FILE*). */ + /* Write the image to the given FILE object. */ #endif /* SIMPLIFIED_WRITE_STDIO */ /* With all write APIs if image is in one of the linear formats with 16-bit diff --git a/src/lib/libpng/pngconf.h b/src/lib/libpng/pngconf.h index 42fa973c2..e46b06111 100644 --- a/src/lib/libpng/pngconf.h +++ b/src/lib/libpng/pngconf.h @@ -1,6 +1,6 @@ /* pngconf.h - machine-configurable file for libpng * - * libpng version 1.6.47 + * libpng version 1.6.48 * * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson @@ -219,25 +219,13 @@ /* NOTE: PNGCBAPI always defaults to PNGCAPI. */ # if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD) -# error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed" +# error PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed # endif -# if (defined(_MSC_VER) && _MSC_VER < 800) ||\ - (defined(__BORLANDC__) && __BORLANDC__ < 0x500) - /* older Borland and MSC - * compilers used '__export' and required this to be after - * the type. - */ -# ifndef PNG_EXPORT_TYPE -# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP -# endif -# define PNG_DLL_EXPORT __export -# else /* newer compiler */ -# define PNG_DLL_EXPORT __declspec(dllexport) -# ifndef PNG_DLL_IMPORT -# define PNG_DLL_IMPORT __declspec(dllimport) -# endif -# endif /* compiler */ +# define PNG_DLL_EXPORT __declspec(dllexport) +# ifndef PNG_DLL_IMPORT +# define PNG_DLL_IMPORT __declspec(dllimport) +# endif #else /* !Windows */ # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) @@ -479,7 +467,7 @@ #if CHAR_BIT == 8 && UCHAR_MAX == 255 typedef unsigned char png_byte; #else -# error "libpng requires 8-bit bytes" +# error libpng requires 8-bit bytes #endif #if INT_MIN == -32768 && INT_MAX == 32767 @@ -487,7 +475,7 @@ #elif SHRT_MIN == -32768 && SHRT_MAX == 32767 typedef short png_int_16; #else -# error "libpng requires a signed 16-bit type" +# error libpng requires a signed 16-bit integer type #endif #if UINT_MAX == 65535 @@ -495,7 +483,7 @@ #elif USHRT_MAX == 65535 typedef unsigned short png_uint_16; #else -# error "libpng requires an unsigned 16-bit type" +# error libpng requires an unsigned 16-bit integer type #endif #if INT_MIN < -2147483646 && INT_MAX > 2147483646 @@ -503,7 +491,7 @@ #elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646 typedef long int png_int_32; #else -# error "libpng requires a signed 32-bit (or more) type" +# error libpng requires a signed 32-bit (or longer) integer type #endif #if UINT_MAX > 4294967294U @@ -511,7 +499,7 @@ #elif ULONG_MAX > 4294967294U typedef unsigned long int png_uint_32; #else -# error "libpng requires an unsigned 32-bit (or more) type" +# error libpng requires an unsigned 32-bit (or longer) integer type #endif /* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t. @@ -592,10 +580,6 @@ typedef const png_fixed_point * png_const_fixed_point_p; typedef size_t * png_size_tp; typedef const size_t * png_const_size_tp; -#ifdef PNG_STDIO_SUPPORTED -typedef FILE * png_FILE_p; -#endif - #ifdef PNG_FLOATING_POINT_SUPPORTED typedef double * png_doublep; typedef const double * png_const_doublep; @@ -617,6 +601,15 @@ typedef double * * png_doublepp; /* Pointers to pointers to pointers; i.e., pointer to array */ typedef char * * * png_charppp; +#ifdef PNG_STDIO_SUPPORTED +/* With PNG_STDIO_SUPPORTED it was possible to use I/O streams that were + * not necessarily stdio FILE streams, to allow building Windows applications + * before Win32 and Windows CE applications before WinCE 3.0, but that kind + * of support has long been discontinued. + */ +typedef FILE * png_FILE_p; /* [Deprecated] */ +#endif + #endif /* PNG_BUILDING_SYMBOL_TABLE */ #endif /* PNGCONF_H */ diff --git a/src/lib/libpng/pngdebug.h b/src/lib/libpng/pngdebug.h index ab9ea632d..af1ae9e82 100644 --- a/src/lib/libpng/pngdebug.h +++ b/src/lib/libpng/pngdebug.h @@ -1,6 +1,6 @@ -/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c +/* pngdebug.h - internal debugging macros for libpng * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -10,6 +10,10 @@ * and license in png.h */ +#ifndef PNGPRIV_H +# error This file must not be included by applications; please include +#endif + /* Define PNG_DEBUG at compile time for debugging information. Higher * numbers for PNG_DEBUG mean more debugging information. This has * only been added since version 0.95 so it is not implemented throughout diff --git a/src/lib/libpng/pngerror.c b/src/lib/libpng/pngerror.c index 275b188d0..01a7ef534 100644 --- a/src/lib/libpng/pngerror.c +++ b/src/lib/libpng/pngerror.c @@ -1,6 +1,6 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Copyright (c) 2018-2024 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. diff --git a/src/lib/libpng/pngget.c b/src/lib/libpng/pngget.c index 3623c5c7c..1ebb1144f 100644 --- a/src/lib/libpng/pngget.c +++ b/src/lib/libpng/pngget.c @@ -1,6 +1,6 @@ /* pngget.c - retrieval of values from info struct * - * Copyright (c) 2018-2024 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. diff --git a/src/lib/libpng/pnginfo.h b/src/lib/libpng/pnginfo.h index c2a907bc5..584a42f95 100644 --- a/src/lib/libpng/pnginfo.h +++ b/src/lib/libpng/pnginfo.h @@ -1,6 +1,6 @@ -/* pnginfo.h - header file for PNG reference library +/* pnginfo.h - internal structures for libpng * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -10,43 +10,20 @@ * and license in png.h */ - /* png_info is a structure that holds the information in a PNG file so - * that the application can find out the characteristics of the image. - * If you are reading the file, this structure will tell you what is - * in the PNG file. If you are writing the file, fill in the information - * you want to put into the PNG file, using png_set_*() functions, then - * call png_write_info(). +#ifndef PNGPRIV_H +# error This file must not be included by applications; please include +#endif + +/* INTERNAL, PRIVATE definition of a PNG. * - * The names chosen should be very close to the PNG specification, so - * consult that document for information about the meaning of each field. + * png_info is a modifiable description of a PNG datastream. The fields inside + * this structure are accessed through png_get_() functions and modified + * using png_set_() functions. * - * With libpng < 0.95, it was only possible to directly set and read the - * the values in the png_info_struct, which meant that the contents and - * order of the values had to remain fixed. With libpng 0.95 and later, - * however, there are now functions that abstract the contents of - * png_info_struct from the application, so this makes it easier to use - * libpng with dynamic libraries, and even makes it possible to use - * libraries that don't have all of the libpng ancillary chunk-handing - * functionality. In libpng-1.5.0 this was moved into a separate private - * file that is not visible to applications. - * - * The following members may have allocated storage attached that should be - * cleaned up before the structure is discarded: palette, trans, text, - * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile, - * splt_palettes, scal_unit, row_pointers, and unknowns. By default, these - * are automatically freed when the info structure is deallocated, if they were - * allocated internally by libpng. This behavior can be changed by means - * of the png_data_freer() function. - * - * More allocation details: all the chunk-reading functions that - * change these members go through the corresponding png_set_* - * functions. A function to clear these members is available: see - * png_free_data(). The png_set_* functions do not depend on being - * able to point info structure members to any of the storage they are - * passed (they make their own copies), EXCEPT that the png_set_text - * functions use the same storage passed to them in the text_ptr or - * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns - * functions do not make their own copies. + * Some functions in libpng do directly access members of png_info. However, + * this should be avoided. png_struct objects contain members which hold + * caches, sometimes optimised, of the values from png_info objects, and + * png_info is not passed to the functions which read and write image data. */ #ifndef PNGINFO_H #define PNGINFO_H diff --git a/src/lib/libpng/pnglibconf.h b/src/lib/libpng/pnglibconf.h index c62c49704..941049465 100644 --- a/src/lib/libpng/pnglibconf.h +++ b/src/lib/libpng/pnglibconf.h @@ -1,8 +1,8 @@ /* pnglibconf.h - library build configuration */ -/* libpng version 1.6.43 */ +/* libpng version 1.6.48 */ -/* Copyright (c) 2018-2024 Cosmin Truta */ +/* Copyright (c) 2018-2025 Cosmin Truta */ /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */ /* This code is released under the libpng license. */ @@ -88,11 +88,14 @@ #define PNG_READ_USER_TRANSFORM_SUPPORTED #define PNG_READ_bKGD_SUPPORTED #define PNG_READ_cHRM_SUPPORTED +#define PNG_READ_cICP_SUPPORTED +#define PNG_READ_cLLI_SUPPORTED #define PNG_READ_eXIf_SUPPORTED #define PNG_READ_gAMA_SUPPORTED #define PNG_READ_hIST_SUPPORTED #define PNG_READ_iCCP_SUPPORTED #define PNG_READ_iTXt_SUPPORTED +#define PNG_READ_mDCV_SUPPORTED #define PNG_READ_oFFs_SUPPORTED #define PNG_READ_pCAL_SUPPORTED #define PNG_READ_pHYs_SUPPORTED @@ -158,11 +161,14 @@ #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #define PNG_WRITE_bKGD_SUPPORTED #define PNG_WRITE_cHRM_SUPPORTED +#define PNG_WRITE_cICP_SUPPORTED +#define PNG_WRITE_cLLI_SUPPORTED #define PNG_WRITE_eXIf_SUPPORTED #define PNG_WRITE_gAMA_SUPPORTED #define PNG_WRITE_hIST_SUPPORTED #define PNG_WRITE_iCCP_SUPPORTED #define PNG_WRITE_iTXt_SUPPORTED +#define PNG_WRITE_mDCV_SUPPORTED #define PNG_WRITE_oFFs_SUPPORTED #define PNG_WRITE_pCAL_SUPPORTED #define PNG_WRITE_pHYs_SUPPORTED @@ -176,11 +182,14 @@ #define PNG_WRITE_zTXt_SUPPORTED #define PNG_bKGD_SUPPORTED #define PNG_cHRM_SUPPORTED +#define PNG_cICP_SUPPORTED +#define PNG_cLLI_SUPPORTED #define PNG_eXIf_SUPPORTED #define PNG_gAMA_SUPPORTED #define PNG_hIST_SUPPORTED #define PNG_iCCP_SUPPORTED #define PNG_iTXt_SUPPORTED +#define PNG_mDCV_SUPPORTED #define PNG_oFFs_SUPPORTED #define PNG_pCAL_SUPPORTED #define PNG_pHYs_SUPPORTED diff --git a/src/lib/libpng/pngmem.c b/src/lib/libpng/pngmem.c index 90c13b106..71e61c99f 100644 --- a/src/lib/libpng/pngmem.c +++ b/src/lib/libpng/pngmem.c @@ -1,6 +1,6 @@ /* pngmem.c - stub functions for memory allocation * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. diff --git a/src/lib/libpng/pngpread.c b/src/lib/libpng/pngpread.c index 60d810693..0a3e822cf 100644 --- a/src/lib/libpng/pngpread.c +++ b/src/lib/libpng/pngpread.c @@ -1,6 +1,6 @@ /* pngpread.c - read a png file in push mode * - * Copyright (c) 2018-2024 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. diff --git a/src/lib/libpng/pngpriv.h b/src/lib/libpng/pngpriv.h index d514dff5c..a6f8d67d3 100644 --- a/src/lib/libpng/pngpriv.h +++ b/src/lib/libpng/pngpriv.h @@ -1,6 +1,6 @@ /* pngpriv.h - private declarations for use inside libpng * - * Copyright (c) 2018-2024 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -19,8 +19,20 @@ * they should be well aware of the issues that may arise from doing so. */ + +/* pngpriv.h must be included first in each translation unit inside libpng. + * On the other hand, it must not be included at all, directly or indirectly, + * by any application code that uses the libpng API. + */ #ifndef PNGPRIV_H -#define PNGPRIV_H +# define PNGPRIV_H +#else +# error Duplicate inclusion of pngpriv.h; please check the libpng source files +#endif + +#if defined(PNG_H) || defined(PNGCONF_H) || defined(PNGLCONF_H) +# error This file must not be included by applications; please include +#endif /* Feature Test Macros. The following are defined here to ensure that correctly * implemented libraries reveal the APIs libpng needs to build and hide those @@ -57,7 +69,6 @@ */ #if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H) # include - /* Pick up the definition of 'restrict' from config.h if it was read: */ # define PNG_RESTRICT restrict #endif @@ -67,9 +78,7 @@ * are not internal definitions may be required. This is handled below just * before png.h is included, but load the configuration now if it is available. */ -#ifndef PNGLCONF_H -# include "pnglibconf.h" -#endif +#include "pnglibconf.h" /* Local renames may change non-exported API functions from png.h */ #if defined(PNG_PREFIX) && !defined(PNGPREFIX_H) @@ -991,17 +1000,15 @@ * must match that used in the build, or we must be using pnglibconf.h.prebuilt: */ #if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM -# error ZLIB_VERNUM != PNG_ZLIB_VERNUM \ - "-I (include path) error: see the notes in pngpriv.h" - /* This means that when pnglibconf.h was built the copy of zlib.h that it - * used is not the same as the one being used here. Because the build of - * libpng makes decisions to use inflateInit2 and inflateReset2 based on the - * zlib version number and because this affects handling of certain broken - * PNG files the -I directives must match. +# error The include path of is incorrect + /* When pnglibconf.h was built, the copy of zlib.h that it used was not the + * same as the one being used here. Considering how libpng makes decisions + * to use the zlib API based on the zlib version number, the -I options must + * match. * - * The most likely explanation is that you passed a -I in CFLAGS. This will - * not work; all the preprocessor directives and in particular all the -I - * directives must be in CPPFLAGS. + * A possible cause of this mismatch is that you passed an -I option in + * CFLAGS, which is unlikely to work. All the preprocessor options, and all + * the -I options in particular, should be in CPPFLAGS. */ #endif @@ -2162,4 +2169,3 @@ PNG_INTERNAL_FUNCTION(int, #endif #endif /* PNG_VERSION_INFO_ONLY */ -#endif /* PNGPRIV_H */ diff --git a/src/lib/libpng/pngread.c b/src/lib/libpng/pngread.c index 0fd364827..4f55f6408 100644 --- a/src/lib/libpng/pngread.c +++ b/src/lib/libpng/pngread.c @@ -1328,7 +1328,7 @@ png_image_read_header(png_voidp argument) #ifdef PNG_STDIO_SUPPORTED int PNGAPI -png_image_begin_read_from_stdio(png_imagep image, FILE* file) +png_image_begin_read_from_stdio(png_imagep image, FILE *file) { if (image != NULL && image->version == PNG_IMAGE_VERSION) { diff --git a/src/lib/libpng/pngrio.c b/src/lib/libpng/pngrio.c index 3b137f275..b4a216161 100644 --- a/src/lib/libpng/pngrio.c +++ b/src/lib/libpng/pngrio.c @@ -1,6 +1,6 @@ /* pngrio.c - functions for data input * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -56,7 +56,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, size_t length) /* fread() returns 0 on error, so it is OK to store this in a size_t * instead of an int, which is what fread() actually returns. */ - check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr)); + check = fread(data, 1, length, png_voidcast(FILE *, png_ptr->io_ptr)); if (check != length) png_error(png_ptr, "Read Error"); diff --git a/src/lib/libpng/pngrtran.c b/src/lib/libpng/pngrtran.c index a6ce30a52..0fea13a41 100644 --- a/src/lib/libpng/pngrtran.c +++ b/src/lib/libpng/pngrtran.c @@ -1,6 +1,6 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Copyright (c) 2018-2024 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. diff --git a/src/lib/libpng/pngrutil.c b/src/lib/libpng/pngrutil.c index d0f3ed35d..7d9a00186 100644 --- a/src/lib/libpng/pngrutil.c +++ b/src/lib/libpng/pngrutil.c @@ -1,6 +1,6 @@ /* pngrutil.c - utilities to read a PNG file * - * Copyright (c) 2018-2024 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. diff --git a/src/lib/libpng/pngset.c b/src/lib/libpng/pngset.c index d7f3393c4..3e63c2724 100644 --- a/src/lib/libpng/pngset.c +++ b/src/lib/libpng/pngset.c @@ -300,17 +300,14 @@ png_set_mDCV(png_const_structrp png_ptr, png_inforp info_ptr, double maxDL, double minDL) { png_set_mDCV_fixed(png_ptr, info_ptr, - /* The ITU approach is to scale by 50,000, not 100,000 so just divide - * the input values by 2 and use png_fixed: - */ - png_fixed(png_ptr, white_x / 2, "png_set_mDCV(white(x))"), - png_fixed(png_ptr, white_y / 2, "png_set_mDCV(white(y))"), - png_fixed(png_ptr, red_x / 2, "png_set_mDCV(red(x))"), - png_fixed(png_ptr, red_y / 2, "png_set_mDCV(red(y))"), - png_fixed(png_ptr, green_x / 2, "png_set_mDCV(green(x))"), - png_fixed(png_ptr, green_y / 2, "png_set_mDCV(green(y))"), - png_fixed(png_ptr, blue_x / 2, "png_set_mDCV(blue(x))"), - png_fixed(png_ptr, blue_y / 2, "png_set_mDCV(blue(y))"), + png_fixed(png_ptr, white_x, "png_set_mDCV(white(x))"), + png_fixed(png_ptr, white_y, "png_set_mDCV(white(y))"), + png_fixed(png_ptr, red_x, "png_set_mDCV(red(x))"), + png_fixed(png_ptr, red_y, "png_set_mDCV(red(y))"), + png_fixed(png_ptr, green_x, "png_set_mDCV(green(x))"), + png_fixed(png_ptr, green_y, "png_set_mDCV(green(y))"), + png_fixed(png_ptr, blue_x, "png_set_mDCV(blue(x))"), + png_fixed(png_ptr, blue_y, "png_set_mDCV(blue(y))"), png_fixed_ITU(png_ptr, maxDL, "png_set_mDCV(maxDL)"), png_fixed_ITU(png_ptr, minDL, "png_set_mDCV(minDL)")); } diff --git a/src/lib/libpng/pngstruct.h b/src/lib/libpng/pngstruct.h index 324424495..b17a54fe8 100644 --- a/src/lib/libpng/pngstruct.h +++ b/src/lib/libpng/pngstruct.h @@ -1,6 +1,6 @@ -/* pngstruct.h - header file for PNG reference library +/* pngstruct.h - internal structures for libpng * - * Copyright (c) 2018-2022 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -10,11 +10,9 @@ * and license in png.h */ -/* The structure that holds the information to read and write PNG files. - * The only people who need to care about what is inside of this are the - * people who will be modifying the library for their own special needs. - * It should NOT be accessed directly by an application. - */ +#ifndef PNGPRIV_H +# error This file must not be included by applications; please include +#endif #ifndef PNGSTRUCT_H #define PNGSTRUCT_H diff --git a/src/lib/libpng/pngwio.c b/src/lib/libpng/pngwio.c index 38c9c006c..96a3187ff 100644 --- a/src/lib/libpng/pngwio.c +++ b/src/lib/libpng/pngwio.c @@ -1,6 +1,6 @@ /* pngwio.c - functions for data output * - * Copyright (c) 2018 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2014,2016,2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. @@ -54,7 +54,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, size_t length) if (png_ptr == NULL) return; - check = fwrite(data, 1, length, (png_FILE_p)(png_ptr->io_ptr)); + check = fwrite(data, 1, length, (FILE *)png_ptr->io_ptr); if (check != length) png_error(png_ptr, "Write Error"); @@ -77,12 +77,12 @@ png_flush(png_structrp png_ptr) void PNGCBAPI png_default_flush(png_structp png_ptr) { - png_FILE_p io_ptr; + FILE *io_ptr; if (png_ptr == NULL) return; - io_ptr = png_voidcast(png_FILE_p, (png_ptr->io_ptr)); + io_ptr = png_voidcast(FILE *, png_ptr->io_ptr); fflush(io_ptr); } # endif diff --git a/src/lib/libpng/pngwrite.c b/src/lib/libpng/pngwrite.c index b7aeff4ce..35a5d17b6 100644 --- a/src/lib/libpng/pngwrite.c +++ b/src/lib/libpng/pngwrite.c @@ -2333,7 +2333,7 @@ int PNGAPI png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap) { - /* Write the image to the given (FILE*). */ + /* Write the image to the given FILE object. */ if (image != NULL && image->version == PNG_IMAGE_VERSION) { if (file != NULL && buffer != NULL) diff --git a/src/lib/libpng/pngwutil.c b/src/lib/libpng/pngwutil.c index be706afe6..863ffe8c2 100644 --- a/src/lib/libpng/pngwutil.c +++ b/src/lib/libpng/pngwutil.c @@ -1,6 +1,6 @@ /* pngwutil.c - utilities to write a PNG file * - * Copyright (c) 2018-2024 Cosmin Truta + * Copyright (c) 2018-2025 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.