From 8dbd545433d9d58b6de6e7c2a48ac08e1f0e36ed Mon Sep 17 00:00:00 2001 From: stephena Date: Sun, 3 Apr 2016 00:35:00 +0000 Subject: [PATCH] After thinking about it a little, I wondered why we even need to wrap several std:: functions into BSPF namespace at all. So I removed them, and have the calls map directly to the std:: versions. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3304 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/common/Base.cxx | 18 ++++++++--------- src/common/ZipHandler.cxx | 2 +- src/common/bspf.hxx | 7 ------- src/debugger/CartDebug.cxx | 12 +++++------ src/debugger/Debugger.cxx | 8 ++++---- src/debugger/DebuggerParser.cxx | 8 ++++---- src/debugger/TIADebug.cxx | 2 +- src/debugger/gui/CartRamWidget.cxx | 4 ++-- src/debugger/gui/DataGridWidget.cxx | 4 ++-- src/debugger/gui/DebuggerDialog.cxx | 2 +- src/debugger/gui/NullControlWidget.hxx | 2 +- src/debugger/gui/PromptWidget.cxx | 4 ++-- src/debugger/gui/RamWidget.cxx | 2 +- src/debugger/gui/RomListWidget.cxx | 4 ++-- src/debugger/gui/TiaZoomWidget.cxx | 4 ++-- src/emucore/Cart0840.cxx | 2 +- src/emucore/Cart4K.cxx | 2 +- src/emucore/Cart4KSC.cxx | 2 +- src/emucore/CartAR.cxx | 2 +- src/emucore/CartBF.cxx | 2 +- src/emucore/CartBFSC.cxx | 2 +- src/emucore/CartCM.cxx | 2 +- src/emucore/CartCTY.cxx | 2 +- src/emucore/CartDF.cxx | 2 +- src/emucore/CartDFSC.cxx | 2 +- src/emucore/CartDPC.cxx | 2 +- src/emucore/CartDPCPlus.cxx | 2 +- src/emucore/CartE0.cxx | 2 +- src/emucore/CartE7.cxx | 2 +- src/emucore/CartEF.cxx | 2 +- src/emucore/CartEFSC.cxx | 2 +- src/emucore/CartF0.cxx | 2 +- src/emucore/CartF4.cxx | 2 +- src/emucore/CartF4SC.cxx | 2 +- src/emucore/CartF6.cxx | 2 +- src/emucore/CartF6SC.cxx | 2 +- src/emucore/CartF8.cxx | 2 +- src/emucore/CartF8SC.cxx | 2 +- src/emucore/CartFA.cxx | 2 +- src/emucore/CartFE.cxx | 2 +- src/emucore/CartUA.cxx | 2 +- src/emucore/CartWD.cxx | 2 +- src/emucore/CartX07.cxx | 2 +- src/emucore/Console.cxx | 4 ++-- src/emucore/FBSurface.cxx | 4 ++-- src/emucore/FrameBuffer.cxx | 18 ++++++++--------- src/emucore/TIA.cxx | 28 +++++++++++++------------- src/emucore/TIASurface.cxx | 6 +++--- src/gui/CheckListWidget.cxx | 2 +- src/gui/ComboDialog.cxx | 4 ++-- src/gui/ContextMenu.cxx | 8 ++++---- src/gui/Dialog.cxx | 4 ++-- src/gui/DialogContainer.cxx | 4 ++-- src/gui/InputDialog.cxx | 4 ++-- src/gui/Launcher.cxx | 8 ++++---- src/gui/LauncherDialog.cxx | 2 +- src/gui/MessageBox.cxx | 6 +++--- src/gui/RomInfoWidget.cxx | 2 +- src/gui/UIDialog.cxx | 28 +++++++++++++------------- src/gui/VideoDialog.cxx | 4 ++-- src/gui/Widget.cxx | 4 ++-- 61 files changed, 136 insertions(+), 143 deletions(-) diff --git a/src/common/Base.cxx b/src/common/Base.cxx index 2d1136ff8..4c8586019 100644 --- a/src/common/Base.cxx +++ b/src/common/Base.cxx @@ -65,32 +65,32 @@ string Base::toString(int value, Common::Base::Format outputBase) case Base::F_10: // base 10: 3 or 5 bytes (depending on value) if(value < 0x100) - BSPF::snprintf(vToS_buf, 4, "%3d", value); + std::snprintf(vToS_buf, 4, "%3d", value); else - BSPF::snprintf(vToS_buf, 6, "%5d", value); + std::snprintf(vToS_buf, 6, "%5d", value); break; case Base::F_16_1: // base 16: 1 byte wide - BSPF::snprintf(vToS_buf, 2, myFmt[0], value); + std::snprintf(vToS_buf, 2, myFmt[0], value); break; case Base::F_16_2: // base 16: 2 bytes wide - BSPF::snprintf(vToS_buf, 3, myFmt[1], value); + std::snprintf(vToS_buf, 3, myFmt[1], value); break; case Base::F_16_4: // base 16: 4 bytes wide - BSPF::snprintf(vToS_buf, 5, myFmt[2], value); + std::snprintf(vToS_buf, 5, myFmt[2], value); break; case Base::F_16_8: // base 16: 8 bytes wide - BSPF::snprintf(vToS_buf, 9, myFmt[3], value); + std::snprintf(vToS_buf, 9, myFmt[3], value); break; case Base::F_16: // base 16: 2, 4, 8 bytes (depending on value) default: if(value < 0x100) - BSPF::snprintf(vToS_buf, 3, myFmt[1], value); + std::snprintf(vToS_buf, 3, myFmt[1], value); else if(value < 0x10000) - BSPF::snprintf(vToS_buf, 5, myFmt[2], value); + std::snprintf(vToS_buf, 5, myFmt[2], value); else - BSPF::snprintf(vToS_buf, 9, myFmt[3], value); + std::snprintf(vToS_buf, 9, myFmt[3], value); break; } diff --git a/src/common/ZipHandler.cxx b/src/common/ZipHandler.cxx index 001820411..3eda6e8dc 100644 --- a/src/common/ZipHandler.cxx +++ b/src/common/ZipHandler.cxx @@ -616,7 +616,7 @@ ZipHandler::zip_error { // Read in the next chunk of data bool success = stream_read(zip->file, zip->buffer, offset, - BSPF::min(input_remaining, (uInt32)sizeof(zip->buffer)), + std::min(input_remaining, (uInt32)sizeof(zip->buffer)), read_length); if(!success) { diff --git a/src/common/bspf.hxx b/src/common/bspf.hxx index 9c9c1374e..b47c3e2f6 100644 --- a/src/common/bspf.hxx +++ b/src/common/bspf.hxx @@ -97,13 +97,6 @@ namespace BSPF // Some convenience functions template inline T clamp(T a, T l, T u) { return (au) ? u : a; } -using std::swap; -using std::min; -using std::max; -using std::abs; -using std::snprintf; -using std::vsnprintf; - // Compare two strings, ignoring case inline int compareIgnoreCase(const string& s1, const string& s2) { diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index bdcd3f9ad..fe53a11dd 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -59,7 +59,7 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem) myConsole.cartridge().getImage(banksize); BankInfo info; - info.size = BSPF::min(banksize, 4096); + info.size = std::min(banksize, 4096); for(int i = 0; i < myConsole.cartridge().bankCount(); ++i) myBankInfo.push_back(info); @@ -196,7 +196,7 @@ string CartDebug::toString() if(state.rport[i] - curraddr > bytesPerLine || bytesSoFar >= 256) { char port[37]; - BSPF::snprintf(port, 36, "%04x: (rport = %04x, wport = %04x)\n", + std::snprintf(port, 36, "%04x: (rport = %04x, wport = %04x)\n", state.rport[i], state.rport[i], state.wport[i]); port[2] = port[3] = 'x'; buf << DebuggerParser::red(port); @@ -347,7 +347,7 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const { if(begin == list_size) begin = end; if(tag.type != CartDebug::ROW) - length = BSPF::max(length, uInt32(tag.disasm.length())); + length = std::max(length, uInt32(tag.disasm.length())); --lines; } @@ -383,7 +383,7 @@ bool CartDebug::addDirective(CartDebug::DisasmType type, if(bank < 0) // Do we want the current bank or ZP RAM? bank = (myDebugger.cpuDebug().pc() & 0x1000) ? getBank() : int(myBankInfo.size())-1; - bank = BSPF::min(bank, bankCount()); + bank = std::min(bank, bankCount()); BankInfo& info = myBankInfo[bank]; DirectiveList& list = info.directiveList; @@ -515,7 +515,7 @@ bool CartDebug::addLabel(const string& label, uInt16 address) removeLabel(label); myUserAddresses.insert(make_pair(label, address)); myUserLabels.insert(make_pair(address, label)); - myLabelLength = BSPF::max(myLabelLength, uInt16(label.size())); + myLabelLength = std::max(myLabelLength, uInt16(label.size())); mySystem.setDirtyPage(address); return true; } @@ -1139,7 +1139,7 @@ string CartDebug::saveDisassembly() << ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n"; int max_len = 0; for(const auto& iter: myUserLabels) - max_len = BSPF::max(max_len, int(iter.second.size())); + max_len = std::max(max_len, int(iter.second.size())); for(const auto& iter: myUserLabels) out << ALIGN(max_len) << iter.second << " = $" << iter.first << "\n"; } diff --git a/src/debugger/Debugger.cxx b/src/debugger/Debugger.cxx index 11e8c753d..feb1871f9 100644 --- a/src/debugger/Debugger.cxx +++ b/src/debugger/Debugger.cxx @@ -143,10 +143,10 @@ void Debugger::initialize() // The debugger dialog is resizable, within certain bounds // We check those bounds now - myWidth = BSPF::max(myWidth, uInt32(DebuggerDialog::kSmallFontMinW)); - myHeight = BSPF::max(myHeight, uInt32(DebuggerDialog::kSmallFontMinH)); - myWidth = BSPF::min(myWidth, uInt32(d.w)); - myHeight = BSPF::min(myHeight, uInt32(d.h)); + myWidth = std::max(myWidth, uInt32(DebuggerDialog::kSmallFontMinW)); + myHeight = std::max(myHeight, uInt32(DebuggerDialog::kSmallFontMinH)); + myWidth = std::min(myWidth, uInt32(d.w)); + myHeight = std::min(myHeight, uInt32(d.h)); myOSystem.settings().setValue("dbg.res", GUI::Size(myWidth, myHeight)); diff --git a/src/debugger/DebuggerParser.cxx b/src/debugger/DebuggerParser.cxx index 3ed5ae0bd..22afcf4c6 100644 --- a/src/debugger/DebuggerParser.cxx +++ b/src/debugger/DebuggerParser.cxx @@ -1437,7 +1437,7 @@ void DebuggerParser::executeTrap() { uInt32 beg = args[0]; uInt32 end = argCount >= 2 ? args[1] : beg; - if(beg > end) BSPF::swap(beg, end); + if(beg > end) std::swap(beg, end); for(uInt32 i = beg; i <= end; ++i) { @@ -1453,7 +1453,7 @@ void DebuggerParser::executeTrapread() { uInt32 beg = args[0]; uInt32 end = argCount >= 2 ? args[1] : beg; - if(beg > end) BSPF::swap(beg, end); + if(beg > end) std::swap(beg, end); for(uInt32 i = beg; i <= end; ++i) { @@ -1468,7 +1468,7 @@ void DebuggerParser::executeTrapwrite() { uInt32 beg = args[0]; uInt32 end = argCount >= 2 ? args[1] : beg; - if(beg > end) BSPF::swap(beg, end); + if(beg > end) std::swap(beg, end); for(uInt32 i = beg; i <= end; ++i) { @@ -1483,7 +1483,7 @@ void DebuggerParser::executeType() { uInt32 beg = args[0]; uInt32 end = argCount >= 2 ? args[1] : beg; - if(beg > end) BSPF::swap(beg, end); + if(beg > end) std::swap(beg, end); for(uInt32 i = beg; i <= end; ++i) { diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index cd3210055..189862a06 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -706,7 +706,7 @@ string TIADebug::audFreq(uInt8 div) double hz = 30000.0; if(div) hz /= div; - BSPF::snprintf(buf, 9, "%5.1f", hz); + std::snprintf(buf, 9, "%5.1f", hz); ret += buf; ret += "Hz"; diff --git a/src/debugger/gui/CartRamWidget.cxx b/src/debugger/gui/CartRamWidget.cxx index 144deaf32..bffa992a9 100644 --- a/src/debugger/gui/CartRamWidget.cxx +++ b/src/debugger/gui/CartRamWidget.cxx @@ -111,8 +111,8 @@ CartRamWidget::InternalRamWidget::InternalRamWidget(GuiObject* boss, int x, int y, int w, int h, CartDebugWidget& dbg) : RamWidget(boss, lfont, nfont, x, y, w, h, - dbg.internalRamSize(), BSPF::min(dbg.internalRamSize() / 16, 16u), - BSPF::min(dbg.internalRamSize() / 16, 16u) * 16), + dbg.internalRamSize(), std::min(dbg.internalRamSize() / 16, 16u), + std::min(dbg.internalRamSize() / 16, 16u) * 16), myCart(dbg) { } diff --git a/src/debugger/gui/DataGridWidget.cxx b/src/debugger/gui/DataGridWidget.cxx index d45e6e325..9ae4f3573 100644 --- a/src/debugger/gui/DataGridWidget.cxx +++ b/src/debugger/gui/DataGridWidget.cxx @@ -238,8 +238,8 @@ void DataGridWidget::setValue(int position, int value, bool changed, // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void DataGridWidget::setRange(int lower, int upper) { - _lowerBound = BSPF::max(0, lower); - _upperBound = BSPF::min(1 << _bits, upper); + _lowerBound = std::max(0, lower); + _upperBound = std::min(1 << _bits, upper); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/debugger/gui/DebuggerDialog.cxx b/src/debugger/gui/DebuggerDialog.cxx index 5032aae82..443f700ca 100644 --- a/src/debugger/gui/DebuggerDialog.cxx +++ b/src/debugger/gui/DebuggerDialog.cxx @@ -453,7 +453,7 @@ void DebuggerDialog::addRomArea() GUI::Rect DebuggerDialog::getTiaBounds() const { // The area showing the TIA image (NTSC and PAL supported, up to 260 lines) - GUI::Rect r(0, 0, 320, BSPF::max(260, int(_h * 0.35))); + GUI::Rect r(0, 0, 320, std::max(260, int(_h * 0.35))); return r; } diff --git a/src/debugger/gui/NullControlWidget.hxx b/src/debugger/gui/NullControlWidget.hxx index 88c494663..fb609c7d6 100644 --- a/src/debugger/gui/NullControlWidget.hxx +++ b/src/debugger/gui/NullControlWidget.hxx @@ -37,7 +37,7 @@ class NullControlWidget : public ControllerWidget << controller.name() << "):"; const int fontHeight = font.getFontHeight(), lineHeight = font.getLineHeight(), - lwidth = BSPF::max(font.getStringWidth(buf.str()), + lwidth = std::max(font.getStringWidth(buf.str()), font.getStringWidth("Controller input")); new StaticTextWidget(boss, font, x, y+2, lwidth, fontHeight, buf.str(), kTextAlignLeft); diff --git a/src/debugger/gui/PromptWidget.cxx b/src/debugger/gui/PromptWidget.cxx index 0ab2a0b3a..db2b7c2b3 100644 --- a/src/debugger/gui/PromptWidget.cxx +++ b/src/debugger/gui/PromptWidget.cxx @@ -752,7 +752,7 @@ void PromptWidget::nextLine() // Call this (at least) when the current line changes or when a new line is added void PromptWidget::updateScrollBuffer() { - int lastchar = BSPF::max(_promptEndPos, _currentPos); + int lastchar = std::max(_promptEndPos, _currentPos); int line = lastchar / _lineWidth; int numlines = (line < _linesInBuffer) ? line + 1 : _linesInBuffer; int firstline = line - numlines + 1; @@ -787,7 +787,7 @@ int PromptWidget::printf(const char* format, ...) int PromptWidget::vprintf(const char* format, va_list argptr) { char buf[2048]; // Note: generates warnings about 'nonliteral' format - int count = BSPF::vsnprintf(buf, sizeof(buf), format, argptr); + int count = std::vsnprintf(buf, sizeof(buf), format, argptr); print(buf); return count; diff --git a/src/debugger/gui/RamWidget.cxx b/src/debugger/gui/RamWidget.cxx index fd700e147..f85fd7d48 100644 --- a/src/debugger/gui/RamWidget.cxx +++ b/src/debugger/gui/RamWidget.cxx @@ -305,7 +305,7 @@ void RamWidget::fillGrid(bool updateOld) // Update RAM labels uInt32 rport = readPort(start), page = rport & 0xf0; char buf[5]; - BSPF::snprintf(buf, 5, "%04X", rport); + std::snprintf(buf, 5, "%04X", rport); buf[2] = buf[3] = 'x'; myRamStart->setLabel(buf); for(uInt32 row = 0; row < myNumRows; ++row, page += 0x10) diff --git a/src/debugger/gui/RomListWidget.cxx b/src/debugger/gui/RomListWidget.cxx index 132b78a88..f9b04f468 100644 --- a/src/debugger/gui/RomListWidget.cxx +++ b/src/debugger/gui/RomListWidget.cxx @@ -66,7 +66,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont, const int fontWidth = lfont.getMaxCharWidth(), numchars = w / fontWidth; - _labelWidth = BSPF::max(16, int(0.20 * (numchars - 12))) * fontWidth - 1; + _labelWidth = std::max(16, int(0.20 * (numchars - 12))) * fontWidth - 1; _bytesWidth = 12 * fontWidth; ////////////////////////////////////////////////////// @@ -75,7 +75,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont, // rowheight is determined by largest item on a line, // possibly meaning that number of rows will change - _fontHeight = BSPF::max(_fontHeight, CheckboxWidget::boxSize()); + _fontHeight = std::max(_fontHeight, CheckboxWidget::boxSize()); _rows = h / _fontHeight; // Create a CheckboxWidget for each row in the list diff --git a/src/debugger/gui/TiaZoomWidget.cxx b/src/debugger/gui/TiaZoomWidget.cxx index 7afe69238..93abcb662 100644 --- a/src/debugger/gui/TiaZoomWidget.cxx +++ b/src/debugger/gui/TiaZoomWidget.cxx @@ -38,8 +38,8 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font, _bgcolor = _bgcolorhi = kDlgColor; // Use all available space, up to the maximum bounds of the TIA image - _w = BSPF::min(w, 320); - _h = BSPF::min(h, 260); + _w = std::min(w, 320); + _h = std::min(h, 260); addFocusWidget(this); diff --git a/src/emucore/Cart0840.cxx b/src/emucore/Cart0840.cxx index e2cb07049..16460c46c 100644 --- a/src/emucore/Cart0840.cxx +++ b/src/emucore/Cart0840.cxx @@ -28,7 +28,7 @@ Cartridge0840::Cartridge0840(const uInt8* image, uInt32 size, const Settings& se myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(8192u, size)); + memcpy(myImage, image, std::min(8192u, size)); createCodeAccessBase(8192); // Remember startup bank diff --git a/src/emucore/Cart4K.cxx b/src/emucore/Cart4K.cxx index 456e950eb..2f413e4cc 100644 --- a/src/emucore/Cart4K.cxx +++ b/src/emucore/Cart4K.cxx @@ -27,7 +27,7 @@ Cartridge4K::Cartridge4K(const uInt8* image, uInt32 size, const Settings& settin : Cartridge(settings) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(4096u, size)); + memcpy(myImage, image, std::min(4096u, size)); createCodeAccessBase(4096); } diff --git a/src/emucore/Cart4KSC.cxx b/src/emucore/Cart4KSC.cxx index fe2b93ae5..957ff7d7d 100644 --- a/src/emucore/Cart4KSC.cxx +++ b/src/emucore/Cart4KSC.cxx @@ -27,7 +27,7 @@ Cartridge4KSC::Cartridge4KSC(const uInt8* image, uInt32 size, const Settings& se : Cartridge(settings) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(4096u, size)); + memcpy(myImage, image, std::min(4096u, size)); createCodeAccessBase(4096); } diff --git a/src/emucore/CartAR.cxx b/src/emucore/CartAR.cxx index c5a2b39d3..d79eb9fea 100644 --- a/src/emucore/CartAR.cxx +++ b/src/emucore/CartAR.cxx @@ -27,7 +27,7 @@ CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size, const Settings& settings) : Cartridge(settings), - mySize(BSPF::max(size, 8448u)), + mySize(std::max(size, 8448u)), myLoadImages(nullptr), myWriteEnabled(false), myPower(true), diff --git a/src/emucore/CartBF.cxx b/src/emucore/CartBF.cxx index 73571e1a0..10714069e 100644 --- a/src/emucore/CartBF.cxx +++ b/src/emucore/CartBF.cxx @@ -28,7 +28,7 @@ CartridgeBF::CartridgeBF(const uInt8* image, uInt32 size, const Settings& settin myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(262144u, size)); + memcpy(myImage, image, std::min(262144u, size)); createCodeAccessBase(262144); // Remember startup bank diff --git a/src/emucore/CartBFSC.cxx b/src/emucore/CartBFSC.cxx index a274e1bd0..57f297c0c 100644 --- a/src/emucore/CartBFSC.cxx +++ b/src/emucore/CartBFSC.cxx @@ -28,7 +28,7 @@ CartridgeBFSC::CartridgeBFSC(const uInt8* image, uInt32 size, const Settings& se myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(262144u, size)); + memcpy(myImage, image, std::min(262144u, size)); createCodeAccessBase(262144); // Remember startup bank diff --git a/src/emucore/CartCM.cxx b/src/emucore/CartCM.cxx index b0f8d3ae7..bae7a1e69 100644 --- a/src/emucore/CartCM.cxx +++ b/src/emucore/CartCM.cxx @@ -31,7 +31,7 @@ CartridgeCM::CartridgeCM(const uInt8* image, uInt32 size, const Settings& settin myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(16384u, size)); + memcpy(myImage, image, std::min(16384u, size)); createCodeAccessBase(16384); // On powerup, the last bank of ROM is enabled and RAM is disabled diff --git a/src/emucore/CartCTY.cxx b/src/emucore/CartCTY.cxx index 4a26c880d..af7b5a1d1 100644 --- a/src/emucore/CartCTY.cxx +++ b/src/emucore/CartCTY.cxx @@ -39,7 +39,7 @@ CartridgeCTY::CartridgeCTY(const uInt8* image, uInt32 size, const OSystem& osyst myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(32768u, size)); + memcpy(myImage, image, std::min(32768u, size)); createCodeAccessBase(32768); // Point to the first tune diff --git a/src/emucore/CartDF.cxx b/src/emucore/CartDF.cxx index 798f6e4a9..0049b17ef 100644 --- a/src/emucore/CartDF.cxx +++ b/src/emucore/CartDF.cxx @@ -28,7 +28,7 @@ CartridgeDF::CartridgeDF(const uInt8* image, uInt32 size, const Settings& settin myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(131072u, size)); + memcpy(myImage, image, std::min(131072u, size)); createCodeAccessBase(131072); // Remember startup bank diff --git a/src/emucore/CartDFSC.cxx b/src/emucore/CartDFSC.cxx index 9edb96e2e..aedfce8cc 100644 --- a/src/emucore/CartDFSC.cxx +++ b/src/emucore/CartDFSC.cxx @@ -28,7 +28,7 @@ CartridgeDFSC::CartridgeDFSC(const uInt8* image, uInt32 size, const Settings& se myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(131072u, size)); + memcpy(myImage, image, std::min(131072u, size)); createCodeAccessBase(131072); // Remember startup bank diff --git a/src/emucore/CartDPC.cxx b/src/emucore/CartDPC.cxx index 1938f07ba..8a2834849 100644 --- a/src/emucore/CartDPC.cxx +++ b/src/emucore/CartDPC.cxx @@ -32,7 +32,7 @@ CartridgeDPC::CartridgeDPC(const uInt8* image, uInt32 size, myCurrentBank(0) { // Make a copy of the entire image - memcpy(myImage, image, BSPF::min(size, 8192u + 2048u + 256u)); + memcpy(myImage, image, std::min(size, 8192u + 2048u + 256u)); createCodeAccessBase(8192); // Pointer to the program ROM (8K @ 0 byte offset) diff --git a/src/emucore/CartDPCPlus.cxx b/src/emucore/CartDPCPlus.cxx index 3391e7bcb..70aa4a143 100644 --- a/src/emucore/CartDPCPlus.cxx +++ b/src/emucore/CartDPCPlus.cxx @@ -40,7 +40,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size, { // Store image, making sure it's at least 29KB uInt32 minsize = 4096 * 6 + 4096 + 1024 + 255; - mySize = BSPF::max(minsize, size); + mySize = std::max(minsize, size); myImage = make_ptr(mySize); memcpy(myImage.get(), image, size); createCodeAccessBase(4096 * 6); diff --git a/src/emucore/CartE0.cxx b/src/emucore/CartE0.cxx index 9e4d8c4e0..58ffa2984 100644 --- a/src/emucore/CartE0.cxx +++ b/src/emucore/CartE0.cxx @@ -27,7 +27,7 @@ CartridgeE0::CartridgeE0(const uInt8* image, uInt32 size, const Settings& settin : Cartridge(settings) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(8192u, size)); + memcpy(myImage, image, std::min(8192u, size)); createCodeAccessBase(8192); } diff --git a/src/emucore/CartE7.cxx b/src/emucore/CartE7.cxx index cd84e6973..4405aa284 100644 --- a/src/emucore/CartE7.cxx +++ b/src/emucore/CartE7.cxx @@ -28,7 +28,7 @@ CartridgeE7::CartridgeE7(const uInt8* image, uInt32 size, const Settings& settin myCurrentRAM(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(16384u, size)); + memcpy(myImage, image, std::min(16384u, size)); createCodeAccessBase(16384 + 2048); // Remember startup bank diff --git a/src/emucore/CartEF.cxx b/src/emucore/CartEF.cxx index 77cadc64b..756a6b590 100644 --- a/src/emucore/CartEF.cxx +++ b/src/emucore/CartEF.cxx @@ -28,7 +28,7 @@ CartridgeEF::CartridgeEF(const uInt8* image, uInt32 size, const Settings& settin myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(65536u, size)); + memcpy(myImage, image, std::min(65536u, size)); createCodeAccessBase(65536); // Remember startup bank diff --git a/src/emucore/CartEFSC.cxx b/src/emucore/CartEFSC.cxx index 3769bfe6d..2a69d60b1 100644 --- a/src/emucore/CartEFSC.cxx +++ b/src/emucore/CartEFSC.cxx @@ -26,7 +26,7 @@ CartridgeEFSC::CartridgeEFSC(const uInt8* image, uInt32 size, const Settings& se myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(65536u, size)); + memcpy(myImage, image, std::min(65536u, size)); createCodeAccessBase(65536); // Remember startup bank diff --git a/src/emucore/CartF0.cxx b/src/emucore/CartF0.cxx index c0203349f..9f9021bb4 100644 --- a/src/emucore/CartF0.cxx +++ b/src/emucore/CartF0.cxx @@ -28,7 +28,7 @@ CartridgeF0::CartridgeF0(const uInt8* image, uInt32 size, const Settings& settin myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(65536u, size)); + memcpy(myImage, image, std::min(65536u, size)); createCodeAccessBase(65536); // Remember startup bank diff --git a/src/emucore/CartF4.cxx b/src/emucore/CartF4.cxx index 8d35c8eac..aca745b83 100644 --- a/src/emucore/CartF4.cxx +++ b/src/emucore/CartF4.cxx @@ -29,7 +29,7 @@ CartridgeF4::CartridgeF4(const uInt8* image, uInt32 size, const Settings& settin myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(32768u, size)); + memcpy(myImage, image, std::min(32768u, size)); createCodeAccessBase(32768); // Remember startup bank diff --git a/src/emucore/CartF4SC.cxx b/src/emucore/CartF4SC.cxx index 4612fdbf6..5d9d01ed6 100644 --- a/src/emucore/CartF4SC.cxx +++ b/src/emucore/CartF4SC.cxx @@ -28,7 +28,7 @@ CartridgeF4SC::CartridgeF4SC(const uInt8* image, uInt32 size, const Settings& se myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(32768u, size)); + memcpy(myImage, image, std::min(32768u, size)); createCodeAccessBase(32768); // Remember startup bank diff --git a/src/emucore/CartF6.cxx b/src/emucore/CartF6.cxx index f5047c558..10d65e84c 100644 --- a/src/emucore/CartF6.cxx +++ b/src/emucore/CartF6.cxx @@ -28,7 +28,7 @@ CartridgeF6::CartridgeF6(const uInt8* image, uInt32 size, const Settings& settin myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(16384u, size)); + memcpy(myImage, image, std::min(16384u, size)); createCodeAccessBase(16384); // Remember startup bank diff --git a/src/emucore/CartF6SC.cxx b/src/emucore/CartF6SC.cxx index 524f32ff3..9f0b75bb5 100644 --- a/src/emucore/CartF6SC.cxx +++ b/src/emucore/CartF6SC.cxx @@ -28,7 +28,7 @@ CartridgeF6SC::CartridgeF6SC(const uInt8* image, uInt32 size, const Settings& se myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(16384u, size)); + memcpy(myImage, image, std::min(16384u, size)); createCodeAccessBase(16384); // Remember startup bank diff --git a/src/emucore/CartF8.cxx b/src/emucore/CartF8.cxx index 22c9a2062..44d1d9d99 100644 --- a/src/emucore/CartF8.cxx +++ b/src/emucore/CartF8.cxx @@ -29,7 +29,7 @@ CartridgeF8::CartridgeF8(const uInt8* image, uInt32 size, const string& md5, myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(8192u, size)); + memcpy(myImage, image, std::min(8192u, size)); createCodeAccessBase(8192); // Normally bank 1 is the reset bank, unless we're dealing with ROMs diff --git a/src/emucore/CartF8SC.cxx b/src/emucore/CartF8SC.cxx index ebc30d177..4035452eb 100644 --- a/src/emucore/CartF8SC.cxx +++ b/src/emucore/CartF8SC.cxx @@ -28,7 +28,7 @@ CartridgeF8SC::CartridgeF8SC(const uInt8* image, uInt32 size, const Settings& se myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(8192u, size)); + memcpy(myImage, image, std::min(8192u, size)); createCodeAccessBase(8192); // Remember startup bank diff --git a/src/emucore/CartFA.cxx b/src/emucore/CartFA.cxx index 0cffaa8de..1bce34aff 100644 --- a/src/emucore/CartFA.cxx +++ b/src/emucore/CartFA.cxx @@ -28,7 +28,7 @@ CartridgeFA::CartridgeFA(const uInt8* image, uInt32 size, const Settings& settin myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(12288u, size)); + memcpy(myImage, image, std::min(12288u, size)); createCodeAccessBase(12288); // Remember startup bank diff --git a/src/emucore/CartFE.cxx b/src/emucore/CartFE.cxx index 5dd19b0e7..6104bd8a2 100644 --- a/src/emucore/CartFE.cxx +++ b/src/emucore/CartFE.cxx @@ -30,7 +30,7 @@ CartridgeFE::CartridgeFE(const uInt8* image, uInt32 size, const Settings& settin myLastAddressChanged(false) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(8192u, size)); + memcpy(myImage, image, std::min(8192u, size)); // We use System::PageAccess.codeAccessBase, but don't allow its use // through a pointer, since the address space of FE carts can change diff --git a/src/emucore/CartUA.cxx b/src/emucore/CartUA.cxx index 51cc7051d..07c4a8207 100644 --- a/src/emucore/CartUA.cxx +++ b/src/emucore/CartUA.cxx @@ -28,7 +28,7 @@ CartridgeUA::CartridgeUA(const uInt8* image, uInt32 size, const Settings& settin myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(8192u, size)); + memcpy(myImage, image, std::min(8192u, size)); createCodeAccessBase(8192); // Remember startup bank diff --git a/src/emucore/CartWD.cxx b/src/emucore/CartWD.cxx index 02175ea5f..9aa9d1902 100644 --- a/src/emucore/CartWD.cxx +++ b/src/emucore/CartWD.cxx @@ -28,7 +28,7 @@ CartridgeWD::CartridgeWD(const uInt8* image, uInt32 size, const Settings& settings) : Cartridge(settings), - mySize(BSPF::min(8195u, size)), + mySize(std::min(8195u, size)), myCyclesAtBankswitchInit(0), myPendingBank(0), myCurrentBank(0) diff --git a/src/emucore/CartX07.cxx b/src/emucore/CartX07.cxx index 54eb8fb74..f860c8844 100644 --- a/src/emucore/CartX07.cxx +++ b/src/emucore/CartX07.cxx @@ -30,7 +30,7 @@ CartridgeX07::CartridgeX07(const uInt8* image, uInt32 size, const Settings& sett myCurrentBank(0) { // Copy the ROM image into my buffer - memcpy(myImage, image, BSPF::min(65536u, size)); + memcpy(myImage, image, std::min(65536u, size)); createCodeAccessBase(65536); // Remember startup bank diff --git a/src/emucore/Console.cxx b/src/emucore/Console.cxx index 56a13c3e7..cdb6fff54 100644 --- a/src/emucore/Console.cxx +++ b/src/emucore/Console.cxx @@ -560,7 +560,7 @@ void Console::setTIAProperties() myConsoleInfo.InitialFrameRate = "50"; // PAL ROMs normally need at least 250 lines - height = BSPF::max(height, 250u); + height = std::max(height, 250u); } // Make sure these values fit within the bounds of the desktop @@ -569,7 +569,7 @@ void Console::setTIAProperties() if(height > dheight) { ystart += height - dheight; - ystart = BSPF::min(ystart, 64u); + ystart = std::min(ystart, 64u); height = dheight; } myTIA->setYStart(ystart); diff --git a/src/emucore/FBSurface.cxx b/src/emucore/FBSurface.cxx index 464b8892b..3675793f3 100644 --- a/src/emucore/FBSurface.cxx +++ b/src/emucore/FBSurface.cxx @@ -43,8 +43,8 @@ void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const GUI::Rect& rect) c memcpy(buffer, src, width() * height() * 4); else { - uInt32 w = BSPF::min(rect.width(), width()); - uInt32 h = BSPF::min(rect.height(), height()); + uInt32 w = std::min(rect.width(), width()); + uInt32 h = std::min(rect.height(), height()); // Copy 'height' lines of width 'pitch' (in bytes for both) uInt8* dst = buffer; diff --git a/src/emucore/FrameBuffer.cxx b/src/emucore/FrameBuffer.cxx index d85a3c788..801886c4a 100644 --- a/src/emucore/FrameBuffer.cxx +++ b/src/emucore/FrameBuffer.cxx @@ -72,8 +72,8 @@ bool FrameBuffer::initialize() query_h = s.h; } // Various parts of the codebase assume a minimum screen size - myDesktopSize.w = BSPF::max(query_w, uInt32(kFBMinW)); - myDesktopSize.h = BSPF::max(query_h, uInt32(kFBMinH)); + myDesktopSize.w = std::max(query_w, uInt32(kFBMinW)); + myDesktopSize.h = std::max(query_h, uInt32(kFBMinH)); //////////////////////////////////////////////////////////////////// // Create fonts to draw text @@ -275,7 +275,7 @@ void FrameBuffer::update() { const ConsoleInfo& info = myOSystem.console().about(); char msg[30]; - BSPF::snprintf(msg, 30, "%3u @ %3.2ffps => %s", + std::snprintf(msg, 30, "%3u @ %3.2ffps => %s", myOSystem.console().tia().scanlines(), myOSystem.console().getFramerate(), info.DisplayFormat.c_str()); myStatsMsg.surface->fillRect(0, 0, myStatsMsg.w, myStatsMsg.h, kBGColor); @@ -743,10 +743,10 @@ VideoMode::VideoMode(uInt32 iw, uInt32 ih, uInt32 sw, uInt32 sh, zoom(z), description(desc) { - sw = BSPF::max(sw, uInt32(FrameBuffer::kTIAMinW)); - sh = BSPF::max(sh, uInt32(FrameBuffer::kTIAMinH)); - iw = BSPF::min(iw, sw); - ih = BSPF::min(ih, sh); + sw = std::max(sw, uInt32(FrameBuffer::kTIAMinW)); + sh = std::max(sh, uInt32(FrameBuffer::kTIAMinH)); + iw = std::min(iw, sw); + ih = std::min(ih, sh); int ix = (sw - iw) >> 1; int iy = (sh - ih) >> 1; image = GUI::Rect(ix, iy, ix+iw, iy+ih); @@ -801,8 +801,8 @@ void VideoMode::applyAspectCorrection(uInt32 aspect, bool stretch) } // Now re-calculate the dimensions - iw = BSPF::min(iw, screen.w); - ih = BSPF::min(ih, screen.h); + iw = std::min(iw, screen.w); + ih = std::min(ih, screen.h); image.moveTo((screen.w - iw) >> 1, (screen.h - ih) >> 1); image.setWidth(iw); diff --git a/src/emucore/TIA.cxx b/src/emucore/TIA.cxx index fe509736b..f8b5165fc 100644 --- a/src/emucore/TIA.cxx +++ b/src/emucore/TIA.cxx @@ -194,10 +194,10 @@ void TIA::frameReset() // In any event, at most 320 lines can be processed uInt32 scanlines = myFrameYStart + myFrameHeight; if(myMaximumNumberOfScanlines == 290) - scanlines = BSPF::max(scanlines, 262u); // NTSC + scanlines = std::max(scanlines, 262u); // NTSC else - scanlines = BSPF::max(scanlines, 312u); // PAL - myStopDisplayOffset = 228 * BSPF::min(scanlines, 320u); + scanlines = std::max(scanlines, 312u); // PAL + myStopDisplayOffset = 228 * std::min(scanlines, 320u); // Reasonable values to start and stop the current frame drawing myClockWhenFrameStarted = mySystem->cycles() * 3; @@ -2294,12 +2294,12 @@ void TIA::pokeHMP0(uInt8 value, Int32 clock) // Check if HMOVE is currently active if(myCurrentHMOVEPos != 0x7FFFFFFF && - hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockP0 * 4, 7)) + hpos < std::min(myCurrentHMOVEPos + 6 + myMotionClockP0 * 4, 7)) { Int32 newMotion = (value ^ 0x80) >> 4; // Check if new horizontal move can still be applied normally if(newMotion > myMotionClockP0 || - hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) + hpos <= std::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) { myPOSP0 -= (newMotion - myMotionClockP0); myMotionClockP0 = newMotion; @@ -2328,12 +2328,12 @@ void TIA::pokeHMP1(uInt8 value, Int32 clock) // Check if HMOVE is currently active if(myCurrentHMOVEPos != 0x7FFFFFFF && - hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockP1 * 4, 7)) + hpos < std::min(myCurrentHMOVEPos + 6 + myMotionClockP1 * 4, 7)) { Int32 newMotion = (value ^ 0x80) >> 4; // Check if new horizontal move can still be applied normally if(newMotion > myMotionClockP1 || - hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) + hpos <= std::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) { myPOSP1 -= (newMotion - myMotionClockP1); myMotionClockP1 = newMotion; @@ -2362,12 +2362,12 @@ void TIA::pokeHMM0(uInt8 value, Int32 clock) // Check if HMOVE is currently active if(myCurrentHMOVEPos != 0x7FFFFFFF && - hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockM0 * 4, 7)) + hpos < std::min(myCurrentHMOVEPos + 6 + myMotionClockM0 * 4, 7)) { Int32 newMotion = (value ^ 0x80) >> 4; // Check if new horizontal move can still be applied normally if(newMotion > myMotionClockM0 || - hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) + hpos <= std::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) { myPOSM0 -= (newMotion - myMotionClockM0); myMotionClockM0 = newMotion; @@ -2395,12 +2395,12 @@ void TIA::pokeHMM1(uInt8 value, Int32 clock) // Check if HMOVE is currently active if(myCurrentHMOVEPos != 0x7FFFFFFF && - hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockM1 * 4, 7)) + hpos < std::min(myCurrentHMOVEPos + 6 + myMotionClockM1 * 4, 7)) { Int32 newMotion = (value ^ 0x80) >> 4; // Check if new horizontal move can still be applied normally if(newMotion > myMotionClockM1 || - hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) + hpos <= std::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) { myPOSM1 -= (newMotion - myMotionClockM1); myMotionClockM1 = newMotion; @@ -2428,12 +2428,12 @@ void TIA::pokeHMBL(uInt8 value, Int32 clock) // Check if HMOVE is currently active if(myCurrentHMOVEPos != 0x7FFFFFFF && - hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockBL * 4, 7)) + hpos < std::min(myCurrentHMOVEPos + 6 + myMotionClockBL * 4, 7)) { Int32 newMotion = (value ^ 0x80) >> 4; // Check if new horizontal move can still be applied normally if(newMotion > myMotionClockBL || - hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) + hpos <= std::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) { myPOSBL -= (newMotion - myMotionClockBL); myMotionClockBL = newMotion; @@ -2468,7 +2468,7 @@ void TIA::pokeHMBL(uInt8 value, Int32 clock) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - inline void TIA::applyActiveHMOVEMotion(int hpos, Int16& pos, Int32 motionClock) { - if(hpos < BSPF::min(myCurrentHMOVEPos + 6 + 16 * 4, 7)) + if(hpos < std::min(myCurrentHMOVEPos + 6 + 16 * 4, 7)) { Int32 decrements_passed = (hpos - (myCurrentHMOVEPos + 4)) >> 2; pos += 8; diff --git a/src/emucore/TIASurface.cxx b/src/emucore/TIASurface.cxx index 1224fb747..20584d9f3 100644 --- a/src/emucore/TIASurface.cxx +++ b/src/emucore/TIASurface.cxx @@ -213,8 +213,8 @@ uInt32 TIASurface::enableScanlines(int relative, int absolute) FBSurface::Attributes& attr = mySLineSurface->attributes(); if(relative == 0) attr.blendalpha = absolute; else attr.blendalpha += relative; - attr.blendalpha = BSPF::max(0u, attr.blendalpha); - attr.blendalpha = BSPF::min(100u, attr.blendalpha); + attr.blendalpha = std::max(0u, attr.blendalpha); + attr.blendalpha = std::min(100u, attr.blendalpha); mySLineSurface->applyAttributes(); mySLineSurface->setDirty(); @@ -245,7 +245,7 @@ void TIASurface::enablePhosphor(bool enable, int blend) uInt8 TIASurface::getPhosphor(uInt8 c1, uInt8 c2) const { if(c2 > c1) - BSPF::swap(c1, c2); + std::swap(c1, c2); return ((c1 - c2) * myPhosphorBlend)/100 + c2; } diff --git a/src/gui/CheckListWidget.cxx b/src/gui/CheckListWidget.cxx index caf2faf87..9360cfa1d 100644 --- a/src/gui/CheckListWidget.cxx +++ b/src/gui/CheckListWidget.cxx @@ -29,7 +29,7 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font, // rowheight is determined by largest item on a line, // possibly meaning that number of rows will change - _fontHeight = BSPF::max(_fontHeight, CheckboxWidget::boxSize()); + _fontHeight = std::max(_fontHeight, CheckboxWidget::boxSize()); _rows = h / _fontHeight; // Create a CheckboxWidget for each row in the list diff --git a/src/gui/ComboDialog.cxx b/src/gui/ComboDialog.cxx index 9c33d5a8b..f784253e4 100644 --- a/src/gui/ComboDialog.cxx +++ b/src/gui/ComboDialog.cxx @@ -54,7 +54,7 @@ ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font, // Get maximum width of popupwidget int pwidth = 0; for(const auto& s: combolist) - pwidth = BSPF::max(font.getStringWidth(s.first), pwidth); + pwidth = std::max(font.getStringWidth(s.first), pwidth); // Label for dialog, indicating which combo is being changed myComboName = new StaticTextWidget(this, font, xpos, ypos, _w - xpos - 10, @@ -109,7 +109,7 @@ void ComboDialog::loadConfig() { StringList events = instance().eventHandler().getComboListForEvent(myComboEvent); - uInt32 size = BSPF::min(uInt32(events.size()), 8u); + uInt32 size = std::min(uInt32(events.size()), 8u); for(uInt32 i = 0; i < size; ++i) myEvents[i]->setSelected("", events[i]); diff --git a/src/gui/ContextMenu.cxx b/src/gui/ContextMenu.cxx index 9e27bbbf0..094fb803a 100644 --- a/src/gui/ContextMenu.cxx +++ b/src/gui/ContextMenu.cxx @@ -55,7 +55,7 @@ void ContextMenu::addItems(const VariantList& items) // Resize to largest string int maxwidth = 0; for(const auto& e: _entries) - maxwidth = BSPF::max(maxwidth, _font.getStringWidth(e.first)); + maxwidth = std::max(maxwidth, _font.getStringWidth(e.first)); _x = _y = 0; _w = maxwidth + 10; @@ -100,7 +100,7 @@ void ContextMenu::recalc(const GUI::Rect& image) { // Now is the time to adjust the height // If it's higher than the screen, we need to scroll through - uInt32 maxentries = BSPF::min(18u, (image.height() - 4) / _rowHeight); + uInt32 maxentries = std::min(18u, (image.height() - 4) / _rowHeight); if(_entries.size() > maxentries) { // We show two less than the max, so we have room for two scroll buttons @@ -495,7 +495,7 @@ void ContextMenu::scrollUp(int distance) if(_firstEntry == 0) return; - _firstEntry = BSPF::max(_firstEntry - distance, 0); + _firstEntry = std::max(_firstEntry - distance, 0); _scrollUpColor = _firstEntry > 0 ? kScrollColor : kColor; _scrollDnColor = kScrollColor; @@ -509,7 +509,7 @@ void ContextMenu::scrollDown(int distance) if(_firstEntry == max_offset) return; - _firstEntry = BSPF::min(_firstEntry + distance, max_offset); + _firstEntry = std::min(_firstEntry + distance, max_offset); _scrollUpColor = kScrollColor; _scrollDnColor = _firstEntry < max_offset ? kScrollColor : kColor; diff --git a/src/gui/Dialog.cxx b/src/gui/Dialog.cxx index 7ed60ed08..fc93055ff 100644 --- a/src/gui/Dialog.cxx +++ b/src/gui/Dialog.cxx @@ -648,8 +648,8 @@ void Dialog::addOKCancelBGroup(WidgetArray& wid, const GUI::Font& font, const string& okText, const string& cancelText) { - int buttonWidth = BSPF::max(font.getStringWidth("Cancel"), - BSPF::max(font.getStringWidth(okText), + int buttonWidth = std::max(font.getStringWidth("Cancel"), + std::max(font.getStringWidth(okText), font.getStringWidth(okText))) + 15; int buttonHeight = font.getLineHeight() + 4; ButtonWidget* b; diff --git a/src/gui/DialogContainer.cxx b/src/gui/DialogContainer.cxx index 6edc764f0..490e4f63c 100644 --- a/src/gui/DialogContainer.cxx +++ b/src/gui/DialogContainer.cxx @@ -214,8 +214,8 @@ void DialogContainer::handleMouseButtonEvent(MouseButton b, int x, int y) } if(myLastClick.count && (myTime < myLastClick.time + kDoubleClickDelay) - && BSPF::abs(myLastClick.x - x) < 3 - && BSPF::abs(myLastClick.y - y) < 3) + && std::abs(myLastClick.x - x) < 3 + && std::abs(myLastClick.y - y) < 3) { myLastClick.count++; } diff --git a/src/gui/InputDialog.cxx b/src/gui/InputDialog.cxx index a693e6165..a947e47fa 100644 --- a/src/gui/InputDialog.cxx +++ b/src/gui/InputDialog.cxx @@ -46,8 +46,8 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent, StringList actions; // Set real dimensions - _w = BSPF::min(50 * fontWidth + 10, max_w); - _h = BSPF::min(15 * (lineHeight + 4) + 14, max_h); + _w = std::min(50 * fontWidth + 10, max_w); + _h = std::min(15 * (lineHeight + 4) + 14, max_h); // The tab widget xpos = 2; ypos = vBorder; diff --git a/src/gui/Launcher.cxx b/src/gui/Launcher.cxx index 625843ec1..061001d33 100644 --- a/src/gui/Launcher.cxx +++ b/src/gui/Launcher.cxx @@ -37,10 +37,10 @@ Launcher::Launcher(OSystem& osystem) // The launcher dialog is resizable, within certain bounds // We check those bounds now - myWidth = BSPF::max(myWidth, uInt32(FrameBuffer::kFBMinW)); - myHeight = BSPF::max(myHeight, uInt32(FrameBuffer::kFBMinH)); - myWidth = BSPF::min(myWidth, uInt32(d.w)); - myHeight = BSPF::min(myHeight, uInt32(d.h)); + myWidth = std::max(myWidth, uInt32(FrameBuffer::kFBMinW)); + myHeight = std::max(myHeight, uInt32(FrameBuffer::kFBMinH)); + myWidth = std::min(myWidth, uInt32(d.w)); + myHeight = std::min(myHeight, uInt32(d.h)); myOSystem.settings().setValue("launcherres", GUI::Size(myWidth, myHeight)); diff --git a/src/gui/LauncherDialog.cxx b/src/gui/LauncherDialog.cxx index 98f39e103..602df83aa 100644 --- a/src/gui/LauncherDialog.cxx +++ b/src/gui/LauncherDialog.cxx @@ -82,7 +82,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent, // It has to fit between both labels if(w >= 640) { - int fwidth = BSPF::min(15 * fontWidth, xpos - 20 - lwidth); + int fwidth = std::min(15 * fontWidth, xpos - 20 - lwidth); xpos -= fwidth + 5; myPattern = new EditTextWidget(this, font, xpos, ypos, fwidth, fontHeight, ""); diff --git a/src/gui/MessageBox.cxx b/src/gui/MessageBox.cxx index 862f130bb..13c842c11 100644 --- a/src/gui/MessageBox.cxx +++ b/src/gui/MessageBox.cxx @@ -69,9 +69,9 @@ void MessageBox::addText(const GUI::Font& font, const StringList& text) // Set real dimensions int str_w = 0; for(const auto& s: text) - str_w = BSPF::max(int(s.length()), str_w); - _w = BSPF::min(str_w * fontWidth + 20, _w); - _h = BSPF::min(uInt32((text.size() + 2) * lineHeight + 20), uInt32(_h)); + str_w = std::max(int(s.length()), str_w); + _w = std::min(str_w * fontWidth + 20, _w); + _h = std::min(uInt32((text.size() + 2) * lineHeight + 20), uInt32(_h)); xpos = 10; ypos = 10; for(const auto& s: text) diff --git a/src/gui/RomInfoWidget.cxx b/src/gui/RomInfoWidget.cxx index eab3e3de4..23ee7eb5e 100644 --- a/src/gui/RomInfoWidget.cxx +++ b/src/gui/RomInfoWidget.cxx @@ -100,7 +100,7 @@ void RomInfoWidget::parseProperties() // Scale surface to available image area const GUI::Rect& src = mySurface->srcRect(); - float scale = BSPF::min(float(myAvail.w) / src.width(), float(myAvail.h) / src.height()); + float scale = std::min(float(myAvail.w) / src.width(), float(myAvail.h) / src.height()); mySurface->setDstSize(uInt32(src.width() * scale), uInt32(src.height() * scale)); } catch(const runtime_error& e) diff --git a/src/gui/UIDialog.cxx b/src/gui/UIDialog.cxx index fbb024102..e5fafd57d 100644 --- a/src/gui/UIDialog.cxx +++ b/src/gui/UIDialog.cxx @@ -134,7 +134,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent, // Add message concerning usage xpos = vBorder; ypos += 1*(lineHeight + 4); lwidth = ifont.getStringWidth("(*) Changes require application restart"); - new StaticTextWidget(myTab, ifont, xpos, ypos, BSPF::min(lwidth, _w-20), fontHeight, + new StaticTextWidget(myTab, ifont, xpos, ypos, std::min(lwidth, _w-20), fontHeight, "(*) Changes require application restart", kTextAlignLeft); @@ -284,7 +284,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent, // Add message concerning usage xpos = vBorder; ypos += 1*(lineHeight + 4); lwidth = ifont.getStringWidth("(*) Requires application restart"); - new StaticTextWidget(myTab, ifont, xpos, ypos, BSPF::min(lwidth, _w-20), fontHeight, + new StaticTextWidget(myTab, ifont, xpos, ypos, std::min(lwidth, _w-20), fontHeight, "(*) Requires application restart", kTextAlignLeft); @@ -310,10 +310,10 @@ void UIDialog::loadConfig() const GUI::Size& ls = instance().settings().getSize("launcherres"); uInt32 w = ls.w, h = ls.h; - w = BSPF::max(w, uInt32(FrameBuffer::kFBMinW)); - h = BSPF::max(h, uInt32(FrameBuffer::kFBMinH)); - w = BSPF::min(w, instance().frameBuffer().desktopSize().w); - h = BSPF::min(h, instance().frameBuffer().desktopSize().h); + w = std::max(w, uInt32(FrameBuffer::kFBMinW)); + h = std::max(h, uInt32(FrameBuffer::kFBMinH)); + w = std::min(w, instance().frameBuffer().desktopSize().w); + h = std::min(h, instance().frameBuffer().desktopSize().h); myLauncherWidthSlider->setValue(w); myLauncherWidthLabel->setValue(w); @@ -336,10 +336,10 @@ void UIDialog::loadConfig() // Debugger size const GUI::Size& ds = instance().settings().getSize("dbg.res"); w = ds.w, h = ds.h; - w = BSPF::max(w, uInt32(DebuggerDialog::kSmallFontMinW)); - h = BSPF::max(h, uInt32(DebuggerDialog::kSmallFontMinH)); - w = BSPF::min(w, ds.w); - h = BSPF::min(h, ds.h); + w = std::max(w, uInt32(DebuggerDialog::kSmallFontMinW)); + h = std::max(h, uInt32(DebuggerDialog::kSmallFontMinH)); + w = std::min(w, ds.w); + h = std::min(h, ds.h); myDebuggerWidthSlider->setValue(w); myDebuggerWidthLabel->setValue(w); @@ -417,8 +417,8 @@ void UIDialog::setDefaults() { case 0: // Launcher options { - uInt32 w = BSPF::min(instance().frameBuffer().desktopSize().w, 1000u); - uInt32 h = BSPF::min(instance().frameBuffer().desktopSize().h, 600u); + uInt32 w = std::min(instance().frameBuffer().desktopSize().w, 1000u); + uInt32 h = std::min(instance().frameBuffer().desktopSize().h, 600u); myLauncherWidthSlider->setValue(w); myLauncherWidthLabel->setValue(w); myLauncherHeightSlider->setValue(h); @@ -432,8 +432,8 @@ void UIDialog::setDefaults() case 1: // Debugger options { #ifdef DEBUGGER_SUPPORT - uInt32 w = BSPF::min(instance().frameBuffer().desktopSize().w, uInt32(DebuggerDialog::kMediumFontMinW)); - uInt32 h = BSPF::min(instance().frameBuffer().desktopSize().h, uInt32(DebuggerDialog::kMediumFontMinH)); + uInt32 w = std::min(instance().frameBuffer().desktopSize().w, uInt32(DebuggerDialog::kMediumFontMinW)); + uInt32 h = std::min(instance().frameBuffer().desktopSize().h, uInt32(DebuggerDialog::kMediumFontMinH)); myDebuggerWidthSlider->setValue(w); myDebuggerWidthLabel->setValue(w); myDebuggerHeightSlider->setValue(h); diff --git a/src/gui/VideoDialog.cxx b/src/gui/VideoDialog.cxx index 005fb1dfc..1c8e67f97 100644 --- a/src/gui/VideoDialog.cxx +++ b/src/gui/VideoDialog.cxx @@ -53,8 +53,8 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent, VariantList items; // Set real dimensions - _w = BSPF::min(52 * fontWidth + 10, max_w); - _h = BSPF::min(14 * (lineHeight + 4) + 10, max_h); + _w = std::min(52 * fontWidth + 10, max_w); + _h = std::min(14 * (lineHeight + 4) + 10, max_h); // The tab widget xpos = ypos = 5; diff --git a/src/gui/Widget.cxx b/src/gui/Widget.cxx index 02ccdb26a..5bc8b7ef6 100644 --- a/src/gui/Widget.cxx +++ b/src/gui/Widget.cxx @@ -312,7 +312,7 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font, void StaticTextWidget::setValue(int value) { char buf[256]; - BSPF::snprintf(buf, 255, "%d", value); + std::snprintf(buf, 255, "%d", value); _label = buf; setDirty(); @@ -701,7 +701,7 @@ int SliderWidget::valueToPos(int value) { if(value < _valueMin) value = _valueMin; else if(value > _valueMax) value = _valueMax; - int range = BSPF::max(_valueMax - _valueMin, 1); // don't divide by zero + int range = std::max(_valueMax - _valueMin, 1); // don't divide by zero return ((_w - _labelWidth - 4) * (value - _valueMin) / range); }