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
This commit is contained in:
stephena 2016-04-03 00:35:00 +00:00
parent 91e3afb3bb
commit 8dbd545433
61 changed files with 136 additions and 143 deletions

View File

@ -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) case Base::F_10: // base 10: 3 or 5 bytes (depending on value)
if(value < 0x100) if(value < 0x100)
BSPF::snprintf(vToS_buf, 4, "%3d", value); std::snprintf(vToS_buf, 4, "%3d", value);
else else
BSPF::snprintf(vToS_buf, 6, "%5d", value); std::snprintf(vToS_buf, 6, "%5d", value);
break; break;
case Base::F_16_1: // base 16: 1 byte wide 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; break;
case Base::F_16_2: // base 16: 2 bytes wide 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; break;
case Base::F_16_4: // base 16: 4 bytes wide 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; break;
case Base::F_16_8: // base 16: 8 bytes wide 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; break;
case Base::F_16: // base 16: 2, 4, 8 bytes (depending on value) case Base::F_16: // base 16: 2, 4, 8 bytes (depending on value)
default: default:
if(value < 0x100) if(value < 0x100)
BSPF::snprintf(vToS_buf, 3, myFmt[1], value); std::snprintf(vToS_buf, 3, myFmt[1], value);
else if(value < 0x10000) else if(value < 0x10000)
BSPF::snprintf(vToS_buf, 5, myFmt[2], value); std::snprintf(vToS_buf, 5, myFmt[2], value);
else else
BSPF::snprintf(vToS_buf, 9, myFmt[3], value); std::snprintf(vToS_buf, 9, myFmt[3], value);
break; break;
} }

View File

@ -616,7 +616,7 @@ ZipHandler::zip_error
{ {
// Read in the next chunk of data // Read in the next chunk of data
bool success = stream_read(zip->file, zip->buffer, offset, 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); read_length);
if(!success) if(!success)
{ {

View File

@ -97,13 +97,6 @@ namespace BSPF
// Some convenience functions // Some convenience functions
template<typename T> inline T clamp(T a, T l, T u) { return (a<l) ? l : (a>u) ? u : a; } template<typename T> inline T clamp(T a, T l, T u) { return (a<l) ? l : (a>u) ? 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 // Compare two strings, ignoring case
inline int compareIgnoreCase(const string& s1, const string& s2) inline int compareIgnoreCase(const string& s1, const string& s2)
{ {

View File

@ -59,7 +59,7 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
myConsole.cartridge().getImage(banksize); myConsole.cartridge().getImage(banksize);
BankInfo info; BankInfo info;
info.size = BSPF::min(banksize, 4096); info.size = std::min(banksize, 4096);
for(int i = 0; i < myConsole.cartridge().bankCount(); ++i) for(int i = 0; i < myConsole.cartridge().bankCount(); ++i)
myBankInfo.push_back(info); myBankInfo.push_back(info);
@ -196,7 +196,7 @@ string CartDebug::toString()
if(state.rport[i] - curraddr > bytesPerLine || bytesSoFar >= 256) if(state.rport[i] - curraddr > bytesPerLine || bytesSoFar >= 256)
{ {
char port[37]; 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]); state.rport[i], state.rport[i], state.wport[i]);
port[2] = port[3] = 'x'; port[2] = port[3] = 'x';
buf << DebuggerParser::red(port); buf << DebuggerParser::red(port);
@ -347,7 +347,7 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const
{ {
if(begin == list_size) begin = end; if(begin == list_size) begin = end;
if(tag.type != CartDebug::ROW) if(tag.type != CartDebug::ROW)
length = BSPF::max(length, uInt32(tag.disasm.length())); length = std::max(length, uInt32(tag.disasm.length()));
--lines; --lines;
} }
@ -383,7 +383,7 @@ bool CartDebug::addDirective(CartDebug::DisasmType type,
if(bank < 0) // Do we want the current bank or ZP RAM? if(bank < 0) // Do we want the current bank or ZP RAM?
bank = (myDebugger.cpuDebug().pc() & 0x1000) ? getBank() : int(myBankInfo.size())-1; bank = (myDebugger.cpuDebug().pc() & 0x1000) ? getBank() : int(myBankInfo.size())-1;
bank = BSPF::min(bank, bankCount()); bank = std::min(bank, bankCount());
BankInfo& info = myBankInfo[bank]; BankInfo& info = myBankInfo[bank];
DirectiveList& list = info.directiveList; DirectiveList& list = info.directiveList;
@ -515,7 +515,7 @@ bool CartDebug::addLabel(const string& label, uInt16 address)
removeLabel(label); removeLabel(label);
myUserAddresses.insert(make_pair(label, address)); myUserAddresses.insert(make_pair(label, address));
myUserLabels.insert(make_pair(address, label)); myUserLabels.insert(make_pair(address, label));
myLabelLength = BSPF::max(myLabelLength, uInt16(label.size())); myLabelLength = std::max(myLabelLength, uInt16(label.size()));
mySystem.setDirtyPage(address); mySystem.setDirtyPage(address);
return true; return true;
} }
@ -1139,7 +1139,7 @@ string CartDebug::saveDisassembly()
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n"; << ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
int max_len = 0; int max_len = 0;
for(const auto& iter: myUserLabels) 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) for(const auto& iter: myUserLabels)
out << ALIGN(max_len) << iter.second << " = $" << iter.first << "\n"; out << ALIGN(max_len) << iter.second << " = $" << iter.first << "\n";
} }

View File

@ -143,10 +143,10 @@ void Debugger::initialize()
// The debugger dialog is resizable, within certain bounds // The debugger dialog is resizable, within certain bounds
// We check those bounds now // We check those bounds now
myWidth = BSPF::max(myWidth, uInt32(DebuggerDialog::kSmallFontMinW)); myWidth = std::max(myWidth, uInt32(DebuggerDialog::kSmallFontMinW));
myHeight = BSPF::max(myHeight, uInt32(DebuggerDialog::kSmallFontMinH)); myHeight = std::max(myHeight, uInt32(DebuggerDialog::kSmallFontMinH));
myWidth = BSPF::min(myWidth, uInt32(d.w)); myWidth = std::min(myWidth, uInt32(d.w));
myHeight = BSPF::min(myHeight, uInt32(d.h)); myHeight = std::min(myHeight, uInt32(d.h));
myOSystem.settings().setValue("dbg.res", GUI::Size(myWidth, myHeight)); myOSystem.settings().setValue("dbg.res", GUI::Size(myWidth, myHeight));

View File

@ -1437,7 +1437,7 @@ void DebuggerParser::executeTrap()
{ {
uInt32 beg = args[0]; uInt32 beg = args[0];
uInt32 end = argCount >= 2 ? args[1] : beg; 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) for(uInt32 i = beg; i <= end; ++i)
{ {
@ -1453,7 +1453,7 @@ void DebuggerParser::executeTrapread()
{ {
uInt32 beg = args[0]; uInt32 beg = args[0];
uInt32 end = argCount >= 2 ? args[1] : beg; 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) for(uInt32 i = beg; i <= end; ++i)
{ {
@ -1468,7 +1468,7 @@ void DebuggerParser::executeTrapwrite()
{ {
uInt32 beg = args[0]; uInt32 beg = args[0];
uInt32 end = argCount >= 2 ? args[1] : beg; 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) for(uInt32 i = beg; i <= end; ++i)
{ {
@ -1483,7 +1483,7 @@ void DebuggerParser::executeType()
{ {
uInt32 beg = args[0]; uInt32 beg = args[0];
uInt32 end = argCount >= 2 ? args[1] : beg; 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) for(uInt32 i = beg; i <= end; ++i)
{ {

View File

@ -706,7 +706,7 @@ string TIADebug::audFreq(uInt8 div)
double hz = 30000.0; double hz = 30000.0;
if(div) hz /= div; if(div) hz /= div;
BSPF::snprintf(buf, 9, "%5.1f", hz); std::snprintf(buf, 9, "%5.1f", hz);
ret += buf; ret += buf;
ret += "Hz"; ret += "Hz";

View File

@ -111,8 +111,8 @@ CartRamWidget::InternalRamWidget::InternalRamWidget(GuiObject* boss,
int x, int y, int w, int h, int x, int y, int w, int h,
CartDebugWidget& dbg) CartDebugWidget& dbg)
: RamWidget(boss, lfont, nfont, x, y, w, h, : RamWidget(boss, lfont, nfont, x, y, w, h,
dbg.internalRamSize(), BSPF::min(dbg.internalRamSize() / 16, 16u), dbg.internalRamSize(), std::min(dbg.internalRamSize() / 16, 16u),
BSPF::min(dbg.internalRamSize() / 16, 16u) * 16), std::min(dbg.internalRamSize() / 16, 16u) * 16),
myCart(dbg) myCart(dbg)
{ {
} }

View File

@ -238,8 +238,8 @@ void DataGridWidget::setValue(int position, int value, bool changed,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DataGridWidget::setRange(int lower, int upper) void DataGridWidget::setRange(int lower, int upper)
{ {
_lowerBound = BSPF::max(0, lower); _lowerBound = std::max(0, lower);
_upperBound = BSPF::min(1 << _bits, upper); _upperBound = std::min(1 << _bits, upper);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -453,7 +453,7 @@ void DebuggerDialog::addRomArea()
GUI::Rect DebuggerDialog::getTiaBounds() const GUI::Rect DebuggerDialog::getTiaBounds() const
{ {
// The area showing the TIA image (NTSC and PAL supported, up to 260 lines) // 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; return r;
} }

View File

@ -37,7 +37,7 @@ class NullControlWidget : public ControllerWidget
<< controller.name() << "):"; << controller.name() << "):";
const int fontHeight = font.getFontHeight(), const int fontHeight = font.getFontHeight(),
lineHeight = font.getLineHeight(), lineHeight = font.getLineHeight(),
lwidth = BSPF::max(font.getStringWidth(buf.str()), lwidth = std::max(font.getStringWidth(buf.str()),
font.getStringWidth("Controller input")); font.getStringWidth("Controller input"));
new StaticTextWidget(boss, font, x, y+2, lwidth, new StaticTextWidget(boss, font, x, y+2, lwidth,
fontHeight, buf.str(), kTextAlignLeft); fontHeight, buf.str(), kTextAlignLeft);

View File

@ -752,7 +752,7 @@ void PromptWidget::nextLine()
// Call this (at least) when the current line changes or when a new line is added // Call this (at least) when the current line changes or when a new line is added
void PromptWidget::updateScrollBuffer() void PromptWidget::updateScrollBuffer()
{ {
int lastchar = BSPF::max(_promptEndPos, _currentPos); int lastchar = std::max(_promptEndPos, _currentPos);
int line = lastchar / _lineWidth; int line = lastchar / _lineWidth;
int numlines = (line < _linesInBuffer) ? line + 1 : _linesInBuffer; int numlines = (line < _linesInBuffer) ? line + 1 : _linesInBuffer;
int firstline = line - numlines + 1; int firstline = line - numlines + 1;
@ -787,7 +787,7 @@ int PromptWidget::printf(const char* format, ...)
int PromptWidget::vprintf(const char* format, va_list argptr) int PromptWidget::vprintf(const char* format, va_list argptr)
{ {
char buf[2048]; // Note: generates warnings about 'nonliteral' format 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); print(buf);
return count; return count;

View File

@ -305,7 +305,7 @@ void RamWidget::fillGrid(bool updateOld)
// Update RAM labels // Update RAM labels
uInt32 rport = readPort(start), page = rport & 0xf0; uInt32 rport = readPort(start), page = rport & 0xf0;
char buf[5]; char buf[5];
BSPF::snprintf(buf, 5, "%04X", rport); std::snprintf(buf, 5, "%04X", rport);
buf[2] = buf[3] = 'x'; buf[2] = buf[3] = 'x';
myRamStart->setLabel(buf); myRamStart->setLabel(buf);
for(uInt32 row = 0; row < myNumRows; ++row, page += 0x10) for(uInt32 row = 0; row < myNumRows; ++row, page += 0x10)

View File

@ -66,7 +66,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
const int fontWidth = lfont.getMaxCharWidth(), const int fontWidth = lfont.getMaxCharWidth(),
numchars = w / fontWidth; 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; _bytesWidth = 12 * fontWidth;
////////////////////////////////////////////////////// //////////////////////////////////////////////////////
@ -75,7 +75,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
// rowheight is determined by largest item on a line, // rowheight is determined by largest item on a line,
// possibly meaning that number of rows will change // possibly meaning that number of rows will change
_fontHeight = BSPF::max(_fontHeight, CheckboxWidget::boxSize()); _fontHeight = std::max(_fontHeight, CheckboxWidget::boxSize());
_rows = h / _fontHeight; _rows = h / _fontHeight;
// Create a CheckboxWidget for each row in the list // Create a CheckboxWidget for each row in the list

View File

@ -38,8 +38,8 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
_bgcolor = _bgcolorhi = kDlgColor; _bgcolor = _bgcolorhi = kDlgColor;
// Use all available space, up to the maximum bounds of the TIA image // Use all available space, up to the maximum bounds of the TIA image
_w = BSPF::min(w, 320); _w = std::min(w, 320);
_h = BSPF::min(h, 260); _h = std::min(h, 260);
addFocusWidget(this); addFocusWidget(this);

View File

@ -28,7 +28,7 @@ Cartridge0840::Cartridge0840(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(8192u, size)); memcpy(myImage, image, std::min(8192u, size));
createCodeAccessBase(8192); createCodeAccessBase(8192);
// Remember startup bank // Remember startup bank

View File

@ -27,7 +27,7 @@ Cartridge4K::Cartridge4K(const uInt8* image, uInt32 size, const Settings& settin
: Cartridge(settings) : Cartridge(settings)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(4096u, size)); memcpy(myImage, image, std::min(4096u, size));
createCodeAccessBase(4096); createCodeAccessBase(4096);
} }

View File

@ -27,7 +27,7 @@ Cartridge4KSC::Cartridge4KSC(const uInt8* image, uInt32 size, const Settings& se
: Cartridge(settings) : Cartridge(settings)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(4096u, size)); memcpy(myImage, image, std::min(4096u, size));
createCodeAccessBase(4096); createCodeAccessBase(4096);
} }

View File

@ -27,7 +27,7 @@
CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size, CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
const Settings& settings) const Settings& settings)
: Cartridge(settings), : Cartridge(settings),
mySize(BSPF::max(size, 8448u)), mySize(std::max(size, 8448u)),
myLoadImages(nullptr), myLoadImages(nullptr),
myWriteEnabled(false), myWriteEnabled(false),
myPower(true), myPower(true),

View File

@ -28,7 +28,7 @@ CartridgeBF::CartridgeBF(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(262144u, size)); memcpy(myImage, image, std::min(262144u, size));
createCodeAccessBase(262144); createCodeAccessBase(262144);
// Remember startup bank // Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeBFSC::CartridgeBFSC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(262144u, size)); memcpy(myImage, image, std::min(262144u, size));
createCodeAccessBase(262144); createCodeAccessBase(262144);
// Remember startup bank // Remember startup bank

View File

@ -31,7 +31,7 @@ CartridgeCM::CartridgeCM(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(16384u, size)); memcpy(myImage, image, std::min(16384u, size));
createCodeAccessBase(16384); createCodeAccessBase(16384);
// On powerup, the last bank of ROM is enabled and RAM is disabled // On powerup, the last bank of ROM is enabled and RAM is disabled

View File

@ -39,7 +39,7 @@ CartridgeCTY::CartridgeCTY(const uInt8* image, uInt32 size, const OSystem& osyst
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(32768u, size)); memcpy(myImage, image, std::min(32768u, size));
createCodeAccessBase(32768); createCodeAccessBase(32768);
// Point to the first tune // Point to the first tune

View File

@ -28,7 +28,7 @@ CartridgeDF::CartridgeDF(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(131072u, size)); memcpy(myImage, image, std::min(131072u, size));
createCodeAccessBase(131072); createCodeAccessBase(131072);
// Remember startup bank // Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeDFSC::CartridgeDFSC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(131072u, size)); memcpy(myImage, image, std::min(131072u, size));
createCodeAccessBase(131072); createCodeAccessBase(131072);
// Remember startup bank // Remember startup bank

View File

@ -32,7 +32,7 @@ CartridgeDPC::CartridgeDPC(const uInt8* image, uInt32 size,
myCurrentBank(0) myCurrentBank(0)
{ {
// Make a copy of the entire image // 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); createCodeAccessBase(8192);
// Pointer to the program ROM (8K @ 0 byte offset) // Pointer to the program ROM (8K @ 0 byte offset)

View File

@ -40,7 +40,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
{ {
// Store image, making sure it's at least 29KB // Store image, making sure it's at least 29KB
uInt32 minsize = 4096 * 6 + 4096 + 1024 + 255; uInt32 minsize = 4096 * 6 + 4096 + 1024 + 255;
mySize = BSPF::max(minsize, size); mySize = std::max(minsize, size);
myImage = make_ptr<uInt8[]>(mySize); myImage = make_ptr<uInt8[]>(mySize);
memcpy(myImage.get(), image, size); memcpy(myImage.get(), image, size);
createCodeAccessBase(4096 * 6); createCodeAccessBase(4096 * 6);

View File

@ -27,7 +27,7 @@ CartridgeE0::CartridgeE0(const uInt8* image, uInt32 size, const Settings& settin
: Cartridge(settings) : Cartridge(settings)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(8192u, size)); memcpy(myImage, image, std::min(8192u, size));
createCodeAccessBase(8192); createCodeAccessBase(8192);
} }

View File

@ -28,7 +28,7 @@ CartridgeE7::CartridgeE7(const uInt8* image, uInt32 size, const Settings& settin
myCurrentRAM(0) myCurrentRAM(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(16384u, size)); memcpy(myImage, image, std::min(16384u, size));
createCodeAccessBase(16384 + 2048); createCodeAccessBase(16384 + 2048);
// Remember startup bank // Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeEF::CartridgeEF(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(65536u, size)); memcpy(myImage, image, std::min(65536u, size));
createCodeAccessBase(65536); createCodeAccessBase(65536);
// Remember startup bank // Remember startup bank

View File

@ -26,7 +26,7 @@ CartridgeEFSC::CartridgeEFSC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(65536u, size)); memcpy(myImage, image, std::min(65536u, size));
createCodeAccessBase(65536); createCodeAccessBase(65536);
// Remember startup bank // Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeF0::CartridgeF0(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(65536u, size)); memcpy(myImage, image, std::min(65536u, size));
createCodeAccessBase(65536); createCodeAccessBase(65536);
// Remember startup bank // Remember startup bank

View File

@ -29,7 +29,7 @@ CartridgeF4::CartridgeF4(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(32768u, size)); memcpy(myImage, image, std::min(32768u, size));
createCodeAccessBase(32768); createCodeAccessBase(32768);
// Remember startup bank // Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeF4SC::CartridgeF4SC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(32768u, size)); memcpy(myImage, image, std::min(32768u, size));
createCodeAccessBase(32768); createCodeAccessBase(32768);
// Remember startup bank // Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeF6::CartridgeF6(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(16384u, size)); memcpy(myImage, image, std::min(16384u, size));
createCodeAccessBase(16384); createCodeAccessBase(16384);
// Remember startup bank // Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeF6SC::CartridgeF6SC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(16384u, size)); memcpy(myImage, image, std::min(16384u, size));
createCodeAccessBase(16384); createCodeAccessBase(16384);
// Remember startup bank // Remember startup bank

View File

@ -29,7 +29,7 @@ CartridgeF8::CartridgeF8(const uInt8* image, uInt32 size, const string& md5,
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(8192u, size)); memcpy(myImage, image, std::min(8192u, size));
createCodeAccessBase(8192); createCodeAccessBase(8192);
// Normally bank 1 is the reset bank, unless we're dealing with ROMs // Normally bank 1 is the reset bank, unless we're dealing with ROMs

View File

@ -28,7 +28,7 @@ CartridgeF8SC::CartridgeF8SC(const uInt8* image, uInt32 size, const Settings& se
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(8192u, size)); memcpy(myImage, image, std::min(8192u, size));
createCodeAccessBase(8192); createCodeAccessBase(8192);
// Remember startup bank // Remember startup bank

View File

@ -28,7 +28,7 @@ CartridgeFA::CartridgeFA(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(12288u, size)); memcpy(myImage, image, std::min(12288u, size));
createCodeAccessBase(12288); createCodeAccessBase(12288);
// Remember startup bank // Remember startup bank

View File

@ -30,7 +30,7 @@ CartridgeFE::CartridgeFE(const uInt8* image, uInt32 size, const Settings& settin
myLastAddressChanged(false) myLastAddressChanged(false)
{ {
// Copy the ROM image into my buffer // 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 // We use System::PageAccess.codeAccessBase, but don't allow its use
// through a pointer, since the address space of FE carts can change // through a pointer, since the address space of FE carts can change

View File

@ -28,7 +28,7 @@ CartridgeUA::CartridgeUA(const uInt8* image, uInt32 size, const Settings& settin
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(8192u, size)); memcpy(myImage, image, std::min(8192u, size));
createCodeAccessBase(8192); createCodeAccessBase(8192);
// Remember startup bank // Remember startup bank

View File

@ -28,7 +28,7 @@
CartridgeWD::CartridgeWD(const uInt8* image, uInt32 size, CartridgeWD::CartridgeWD(const uInt8* image, uInt32 size,
const Settings& settings) const Settings& settings)
: Cartridge(settings), : Cartridge(settings),
mySize(BSPF::min(8195u, size)), mySize(std::min(8195u, size)),
myCyclesAtBankswitchInit(0), myCyclesAtBankswitchInit(0),
myPendingBank(0), myPendingBank(0),
myCurrentBank(0) myCurrentBank(0)

View File

@ -30,7 +30,7 @@ CartridgeX07::CartridgeX07(const uInt8* image, uInt32 size, const Settings& sett
myCurrentBank(0) myCurrentBank(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, BSPF::min(65536u, size)); memcpy(myImage, image, std::min(65536u, size));
createCodeAccessBase(65536); createCodeAccessBase(65536);
// Remember startup bank // Remember startup bank

View File

@ -560,7 +560,7 @@ void Console::setTIAProperties()
myConsoleInfo.InitialFrameRate = "50"; myConsoleInfo.InitialFrameRate = "50";
// PAL ROMs normally need at least 250 lines // 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 // Make sure these values fit within the bounds of the desktop
@ -569,7 +569,7 @@ void Console::setTIAProperties()
if(height > dheight) if(height > dheight)
{ {
ystart += height - dheight; ystart += height - dheight;
ystart = BSPF::min(ystart, 64u); ystart = std::min(ystart, 64u);
height = dheight; height = dheight;
} }
myTIA->setYStart(ystart); myTIA->setYStart(ystart);

View File

@ -43,8 +43,8 @@ void FBSurface::readPixels(uInt8* buffer, uInt32 pitch, const GUI::Rect& rect) c
memcpy(buffer, src, width() * height() * 4); memcpy(buffer, src, width() * height() * 4);
else else
{ {
uInt32 w = BSPF::min(rect.width(), width()); uInt32 w = std::min(rect.width(), width());
uInt32 h = BSPF::min(rect.height(), height()); uInt32 h = std::min(rect.height(), height());
// Copy 'height' lines of width 'pitch' (in bytes for both) // Copy 'height' lines of width 'pitch' (in bytes for both)
uInt8* dst = buffer; uInt8* dst = buffer;

View File

@ -72,8 +72,8 @@ bool FrameBuffer::initialize()
query_h = s.h; query_h = s.h;
} }
// Various parts of the codebase assume a minimum screen size // Various parts of the codebase assume a minimum screen size
myDesktopSize.w = BSPF::max(query_w, uInt32(kFBMinW)); myDesktopSize.w = std::max(query_w, uInt32(kFBMinW));
myDesktopSize.h = BSPF::max(query_h, uInt32(kFBMinH)); myDesktopSize.h = std::max(query_h, uInt32(kFBMinH));
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
// Create fonts to draw text // Create fonts to draw text
@ -275,7 +275,7 @@ void FrameBuffer::update()
{ {
const ConsoleInfo& info = myOSystem.console().about(); const ConsoleInfo& info = myOSystem.console().about();
char msg[30]; 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().tia().scanlines(),
myOSystem.console().getFramerate(), info.DisplayFormat.c_str()); myOSystem.console().getFramerate(), info.DisplayFormat.c_str());
myStatsMsg.surface->fillRect(0, 0, myStatsMsg.w, myStatsMsg.h, kBGColor); 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), zoom(z),
description(desc) description(desc)
{ {
sw = BSPF::max(sw, uInt32(FrameBuffer::kTIAMinW)); sw = std::max(sw, uInt32(FrameBuffer::kTIAMinW));
sh = BSPF::max(sh, uInt32(FrameBuffer::kTIAMinH)); sh = std::max(sh, uInt32(FrameBuffer::kTIAMinH));
iw = BSPF::min(iw, sw); iw = std::min(iw, sw);
ih = BSPF::min(ih, sh); ih = std::min(ih, sh);
int ix = (sw - iw) >> 1; int ix = (sw - iw) >> 1;
int iy = (sh - ih) >> 1; int iy = (sh - ih) >> 1;
image = GUI::Rect(ix, iy, ix+iw, iy+ih); 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 // Now re-calculate the dimensions
iw = BSPF::min(iw, screen.w); iw = std::min(iw, screen.w);
ih = BSPF::min(ih, screen.h); ih = std::min(ih, screen.h);
image.moveTo((screen.w - iw) >> 1, (screen.h - ih) >> 1); image.moveTo((screen.w - iw) >> 1, (screen.h - ih) >> 1);
image.setWidth(iw); image.setWidth(iw);

View File

@ -194,10 +194,10 @@ void TIA::frameReset()
// In any event, at most 320 lines can be processed // In any event, at most 320 lines can be processed
uInt32 scanlines = myFrameYStart + myFrameHeight; uInt32 scanlines = myFrameYStart + myFrameHeight;
if(myMaximumNumberOfScanlines == 290) if(myMaximumNumberOfScanlines == 290)
scanlines = BSPF::max(scanlines, 262u); // NTSC scanlines = std::max(scanlines, 262u); // NTSC
else else
scanlines = BSPF::max(scanlines, 312u); // PAL scanlines = std::max(scanlines, 312u); // PAL
myStopDisplayOffset = 228 * BSPF::min(scanlines, 320u); myStopDisplayOffset = 228 * std::min(scanlines, 320u);
// Reasonable values to start and stop the current frame drawing // Reasonable values to start and stop the current frame drawing
myClockWhenFrameStarted = mySystem->cycles() * 3; myClockWhenFrameStarted = mySystem->cycles() * 3;
@ -2294,12 +2294,12 @@ void TIA::pokeHMP0(uInt8 value, Int32 clock)
// Check if HMOVE is currently active // Check if HMOVE is currently active
if(myCurrentHMOVEPos != 0x7FFFFFFF && if(myCurrentHMOVEPos != 0x7FFFFFFF &&
hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockP0 * 4, 7)) hpos < std::min(myCurrentHMOVEPos + 6 + myMotionClockP0 * 4, 7))
{ {
Int32 newMotion = (value ^ 0x80) >> 4; Int32 newMotion = (value ^ 0x80) >> 4;
// Check if new horizontal move can still be applied normally // Check if new horizontal move can still be applied normally
if(newMotion > myMotionClockP0 || if(newMotion > myMotionClockP0 ||
hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) hpos <= std::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
{ {
myPOSP0 -= (newMotion - myMotionClockP0); myPOSP0 -= (newMotion - myMotionClockP0);
myMotionClockP0 = newMotion; myMotionClockP0 = newMotion;
@ -2328,12 +2328,12 @@ void TIA::pokeHMP1(uInt8 value, Int32 clock)
// Check if HMOVE is currently active // Check if HMOVE is currently active
if(myCurrentHMOVEPos != 0x7FFFFFFF && if(myCurrentHMOVEPos != 0x7FFFFFFF &&
hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockP1 * 4, 7)) hpos < std::min(myCurrentHMOVEPos + 6 + myMotionClockP1 * 4, 7))
{ {
Int32 newMotion = (value ^ 0x80) >> 4; Int32 newMotion = (value ^ 0x80) >> 4;
// Check if new horizontal move can still be applied normally // Check if new horizontal move can still be applied normally
if(newMotion > myMotionClockP1 || if(newMotion > myMotionClockP1 ||
hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) hpos <= std::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
{ {
myPOSP1 -= (newMotion - myMotionClockP1); myPOSP1 -= (newMotion - myMotionClockP1);
myMotionClockP1 = newMotion; myMotionClockP1 = newMotion;
@ -2362,12 +2362,12 @@ void TIA::pokeHMM0(uInt8 value, Int32 clock)
// Check if HMOVE is currently active // Check if HMOVE is currently active
if(myCurrentHMOVEPos != 0x7FFFFFFF && if(myCurrentHMOVEPos != 0x7FFFFFFF &&
hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockM0 * 4, 7)) hpos < std::min(myCurrentHMOVEPos + 6 + myMotionClockM0 * 4, 7))
{ {
Int32 newMotion = (value ^ 0x80) >> 4; Int32 newMotion = (value ^ 0x80) >> 4;
// Check if new horizontal move can still be applied normally // Check if new horizontal move can still be applied normally
if(newMotion > myMotionClockM0 || if(newMotion > myMotionClockM0 ||
hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) hpos <= std::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
{ {
myPOSM0 -= (newMotion - myMotionClockM0); myPOSM0 -= (newMotion - myMotionClockM0);
myMotionClockM0 = newMotion; myMotionClockM0 = newMotion;
@ -2395,12 +2395,12 @@ void TIA::pokeHMM1(uInt8 value, Int32 clock)
// Check if HMOVE is currently active // Check if HMOVE is currently active
if(myCurrentHMOVEPos != 0x7FFFFFFF && if(myCurrentHMOVEPos != 0x7FFFFFFF &&
hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockM1 * 4, 7)) hpos < std::min(myCurrentHMOVEPos + 6 + myMotionClockM1 * 4, 7))
{ {
Int32 newMotion = (value ^ 0x80) >> 4; Int32 newMotion = (value ^ 0x80) >> 4;
// Check if new horizontal move can still be applied normally // Check if new horizontal move can still be applied normally
if(newMotion > myMotionClockM1 || if(newMotion > myMotionClockM1 ||
hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) hpos <= std::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
{ {
myPOSM1 -= (newMotion - myMotionClockM1); myPOSM1 -= (newMotion - myMotionClockM1);
myMotionClockM1 = newMotion; myMotionClockM1 = newMotion;
@ -2428,12 +2428,12 @@ void TIA::pokeHMBL(uInt8 value, Int32 clock)
// Check if HMOVE is currently active // Check if HMOVE is currently active
if(myCurrentHMOVEPos != 0x7FFFFFFF && if(myCurrentHMOVEPos != 0x7FFFFFFF &&
hpos < BSPF::min(myCurrentHMOVEPos + 6 + myMotionClockBL * 4, 7)) hpos < std::min(myCurrentHMOVEPos + 6 + myMotionClockBL * 4, 7))
{ {
Int32 newMotion = (value ^ 0x80) >> 4; Int32 newMotion = (value ^ 0x80) >> 4;
// Check if new horizontal move can still be applied normally // Check if new horizontal move can still be applied normally
if(newMotion > myMotionClockBL || if(newMotion > myMotionClockBL ||
hpos <= BSPF::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7)) hpos <= std::min(myCurrentHMOVEPos + 6 + newMotion * 4, 7))
{ {
myPOSBL -= (newMotion - myMotionClockBL); myPOSBL -= (newMotion - myMotionClockBL);
myMotionClockBL = newMotion; myMotionClockBL = newMotion;
@ -2468,7 +2468,7 @@ void TIA::pokeHMBL(uInt8 value, Int32 clock)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
inline void TIA::applyActiveHMOVEMotion(int hpos, Int16& pos, Int32 motionClock) 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; Int32 decrements_passed = (hpos - (myCurrentHMOVEPos + 4)) >> 2;
pos += 8; pos += 8;

View File

@ -213,8 +213,8 @@ uInt32 TIASurface::enableScanlines(int relative, int absolute)
FBSurface::Attributes& attr = mySLineSurface->attributes(); FBSurface::Attributes& attr = mySLineSurface->attributes();
if(relative == 0) attr.blendalpha = absolute; if(relative == 0) attr.blendalpha = absolute;
else attr.blendalpha += relative; else attr.blendalpha += relative;
attr.blendalpha = BSPF::max(0u, attr.blendalpha); attr.blendalpha = std::max(0u, attr.blendalpha);
attr.blendalpha = BSPF::min(100u, attr.blendalpha); attr.blendalpha = std::min(100u, attr.blendalpha);
mySLineSurface->applyAttributes(); mySLineSurface->applyAttributes();
mySLineSurface->setDirty(); mySLineSurface->setDirty();
@ -245,7 +245,7 @@ void TIASurface::enablePhosphor(bool enable, int blend)
uInt8 TIASurface::getPhosphor(uInt8 c1, uInt8 c2) const uInt8 TIASurface::getPhosphor(uInt8 c1, uInt8 c2) const
{ {
if(c2 > c1) if(c2 > c1)
BSPF::swap(c1, c2); std::swap(c1, c2);
return ((c1 - c2) * myPhosphorBlend)/100 + c2; return ((c1 - c2) * myPhosphorBlend)/100 + c2;
} }

View File

@ -29,7 +29,7 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font,
// rowheight is determined by largest item on a line, // rowheight is determined by largest item on a line,
// possibly meaning that number of rows will change // possibly meaning that number of rows will change
_fontHeight = BSPF::max(_fontHeight, CheckboxWidget::boxSize()); _fontHeight = std::max(_fontHeight, CheckboxWidget::boxSize());
_rows = h / _fontHeight; _rows = h / _fontHeight;
// Create a CheckboxWidget for each row in the list // Create a CheckboxWidget for each row in the list

View File

@ -54,7 +54,7 @@ ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font,
// Get maximum width of popupwidget // Get maximum width of popupwidget
int pwidth = 0; int pwidth = 0;
for(const auto& s: combolist) 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 // Label for dialog, indicating which combo is being changed
myComboName = new StaticTextWidget(this, font, xpos, ypos, _w - xpos - 10, myComboName = new StaticTextWidget(this, font, xpos, ypos, _w - xpos - 10,
@ -109,7 +109,7 @@ void ComboDialog::loadConfig()
{ {
StringList events = instance().eventHandler().getComboListForEvent(myComboEvent); 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) for(uInt32 i = 0; i < size; ++i)
myEvents[i]->setSelected("", events[i]); myEvents[i]->setSelected("", events[i]);

View File

@ -55,7 +55,7 @@ void ContextMenu::addItems(const VariantList& items)
// Resize to largest string // Resize to largest string
int maxwidth = 0; int maxwidth = 0;
for(const auto& e: _entries) for(const auto& e: _entries)
maxwidth = BSPF::max(maxwidth, _font.getStringWidth(e.first)); maxwidth = std::max(maxwidth, _font.getStringWidth(e.first));
_x = _y = 0; _x = _y = 0;
_w = maxwidth + 10; _w = maxwidth + 10;
@ -100,7 +100,7 @@ void ContextMenu::recalc(const GUI::Rect& image)
{ {
// Now is the time to adjust the height // Now is the time to adjust the height
// If it's higher than the screen, we need to scroll through // 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) if(_entries.size() > maxentries)
{ {
// We show two less than the max, so we have room for two scroll buttons // 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) if(_firstEntry == 0)
return; return;
_firstEntry = BSPF::max(_firstEntry - distance, 0); _firstEntry = std::max(_firstEntry - distance, 0);
_scrollUpColor = _firstEntry > 0 ? kScrollColor : kColor; _scrollUpColor = _firstEntry > 0 ? kScrollColor : kColor;
_scrollDnColor = kScrollColor; _scrollDnColor = kScrollColor;
@ -509,7 +509,7 @@ void ContextMenu::scrollDown(int distance)
if(_firstEntry == max_offset) if(_firstEntry == max_offset)
return; return;
_firstEntry = BSPF::min(_firstEntry + distance, max_offset); _firstEntry = std::min(_firstEntry + distance, max_offset);
_scrollUpColor = kScrollColor; _scrollUpColor = kScrollColor;
_scrollDnColor = _firstEntry < max_offset ? kScrollColor : kColor; _scrollDnColor = _firstEntry < max_offset ? kScrollColor : kColor;

View File

@ -648,8 +648,8 @@ void Dialog::addOKCancelBGroup(WidgetArray& wid, const GUI::Font& font,
const string& okText, const string& cancelText) const string& okText, const string& cancelText)
{ {
int buttonWidth = BSPF::max(font.getStringWidth("Cancel"), int buttonWidth = std::max(font.getStringWidth("Cancel"),
BSPF::max(font.getStringWidth(okText), std::max(font.getStringWidth(okText),
font.getStringWidth(okText))) + 15; font.getStringWidth(okText))) + 15;
int buttonHeight = font.getLineHeight() + 4; int buttonHeight = font.getLineHeight() + 4;
ButtonWidget* b; ButtonWidget* b;

View File

@ -214,8 +214,8 @@ void DialogContainer::handleMouseButtonEvent(MouseButton b, int x, int y)
} }
if(myLastClick.count && (myTime < myLastClick.time + kDoubleClickDelay) if(myLastClick.count && (myTime < myLastClick.time + kDoubleClickDelay)
&& BSPF::abs(myLastClick.x - x) < 3 && std::abs(myLastClick.x - x) < 3
&& BSPF::abs(myLastClick.y - y) < 3) && std::abs(myLastClick.y - y) < 3)
{ {
myLastClick.count++; myLastClick.count++;
} }

View File

@ -46,8 +46,8 @@ InputDialog::InputDialog(OSystem& osystem, DialogContainer& parent,
StringList actions; StringList actions;
// Set real dimensions // Set real dimensions
_w = BSPF::min(50 * fontWidth + 10, max_w); _w = std::min(50 * fontWidth + 10, max_w);
_h = BSPF::min(15 * (lineHeight + 4) + 14, max_h); _h = std::min(15 * (lineHeight + 4) + 14, max_h);
// The tab widget // The tab widget
xpos = 2; ypos = vBorder; xpos = 2; ypos = vBorder;

View File

@ -37,10 +37,10 @@ Launcher::Launcher(OSystem& osystem)
// The launcher dialog is resizable, within certain bounds // The launcher dialog is resizable, within certain bounds
// We check those bounds now // We check those bounds now
myWidth = BSPF::max(myWidth, uInt32(FrameBuffer::kFBMinW)); myWidth = std::max(myWidth, uInt32(FrameBuffer::kFBMinW));
myHeight = BSPF::max(myHeight, uInt32(FrameBuffer::kFBMinH)); myHeight = std::max(myHeight, uInt32(FrameBuffer::kFBMinH));
myWidth = BSPF::min(myWidth, uInt32(d.w)); myWidth = std::min(myWidth, uInt32(d.w));
myHeight = BSPF::min(myHeight, uInt32(d.h)); myHeight = std::min(myHeight, uInt32(d.h));
myOSystem.settings().setValue("launcherres", myOSystem.settings().setValue("launcherres",
GUI::Size(myWidth, myHeight)); GUI::Size(myWidth, myHeight));

View File

@ -82,7 +82,7 @@ LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
// It has to fit between both labels // It has to fit between both labels
if(w >= 640) if(w >= 640)
{ {
int fwidth = BSPF::min(15 * fontWidth, xpos - 20 - lwidth); int fwidth = std::min(15 * fontWidth, xpos - 20 - lwidth);
xpos -= fwidth + 5; xpos -= fwidth + 5;
myPattern = new EditTextWidget(this, font, xpos, ypos, myPattern = new EditTextWidget(this, font, xpos, ypos,
fwidth, fontHeight, ""); fwidth, fontHeight, "");

View File

@ -69,9 +69,9 @@ void MessageBox::addText(const GUI::Font& font, const StringList& text)
// Set real dimensions // Set real dimensions
int str_w = 0; int str_w = 0;
for(const auto& s: text) for(const auto& s: text)
str_w = BSPF::max(int(s.length()), str_w); str_w = std::max(int(s.length()), str_w);
_w = BSPF::min(str_w * fontWidth + 20, _w); _w = std::min(str_w * fontWidth + 20, _w);
_h = BSPF::min(uInt32((text.size() + 2) * lineHeight + 20), uInt32(_h)); _h = std::min(uInt32((text.size() + 2) * lineHeight + 20), uInt32(_h));
xpos = 10; ypos = 10; xpos = 10; ypos = 10;
for(const auto& s: text) for(const auto& s: text)

View File

@ -100,7 +100,7 @@ void RomInfoWidget::parseProperties()
// Scale surface to available image area // Scale surface to available image area
const GUI::Rect& src = mySurface->srcRect(); 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)); mySurface->setDstSize(uInt32(src.width() * scale), uInt32(src.height() * scale));
} }
catch(const runtime_error& e) catch(const runtime_error& e)

View File

@ -134,7 +134,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
// Add message concerning usage // Add message concerning usage
xpos = vBorder; ypos += 1*(lineHeight + 4); xpos = vBorder; ypos += 1*(lineHeight + 4);
lwidth = ifont.getStringWidth("(*) Changes require application restart"); 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", "(*) Changes require application restart",
kTextAlignLeft); kTextAlignLeft);
@ -284,7 +284,7 @@ UIDialog::UIDialog(OSystem& osystem, DialogContainer& parent,
// Add message concerning usage // Add message concerning usage
xpos = vBorder; ypos += 1*(lineHeight + 4); xpos = vBorder; ypos += 1*(lineHeight + 4);
lwidth = ifont.getStringWidth("(*) Requires application restart"); 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", "(*) Requires application restart",
kTextAlignLeft); kTextAlignLeft);
@ -310,10 +310,10 @@ void UIDialog::loadConfig()
const GUI::Size& ls = instance().settings().getSize("launcherres"); const GUI::Size& ls = instance().settings().getSize("launcherres");
uInt32 w = ls.w, h = ls.h; uInt32 w = ls.w, h = ls.h;
w = BSPF::max(w, uInt32(FrameBuffer::kFBMinW)); w = std::max(w, uInt32(FrameBuffer::kFBMinW));
h = BSPF::max(h, uInt32(FrameBuffer::kFBMinH)); h = std::max(h, uInt32(FrameBuffer::kFBMinH));
w = BSPF::min(w, instance().frameBuffer().desktopSize().w); w = std::min(w, instance().frameBuffer().desktopSize().w);
h = BSPF::min(h, instance().frameBuffer().desktopSize().h); h = std::min(h, instance().frameBuffer().desktopSize().h);
myLauncherWidthSlider->setValue(w); myLauncherWidthSlider->setValue(w);
myLauncherWidthLabel->setValue(w); myLauncherWidthLabel->setValue(w);
@ -336,10 +336,10 @@ void UIDialog::loadConfig()
// Debugger size // Debugger size
const GUI::Size& ds = instance().settings().getSize("dbg.res"); const GUI::Size& ds = instance().settings().getSize("dbg.res");
w = ds.w, h = ds.h; w = ds.w, h = ds.h;
w = BSPF::max(w, uInt32(DebuggerDialog::kSmallFontMinW)); w = std::max(w, uInt32(DebuggerDialog::kSmallFontMinW));
h = BSPF::max(h, uInt32(DebuggerDialog::kSmallFontMinH)); h = std::max(h, uInt32(DebuggerDialog::kSmallFontMinH));
w = BSPF::min(w, ds.w); w = std::min(w, ds.w);
h = BSPF::min(h, ds.h); h = std::min(h, ds.h);
myDebuggerWidthSlider->setValue(w); myDebuggerWidthSlider->setValue(w);
myDebuggerWidthLabel->setValue(w); myDebuggerWidthLabel->setValue(w);
@ -417,8 +417,8 @@ void UIDialog::setDefaults()
{ {
case 0: // Launcher options case 0: // Launcher options
{ {
uInt32 w = BSPF::min(instance().frameBuffer().desktopSize().w, 1000u); uInt32 w = std::min(instance().frameBuffer().desktopSize().w, 1000u);
uInt32 h = BSPF::min(instance().frameBuffer().desktopSize().h, 600u); uInt32 h = std::min(instance().frameBuffer().desktopSize().h, 600u);
myLauncherWidthSlider->setValue(w); myLauncherWidthSlider->setValue(w);
myLauncherWidthLabel->setValue(w); myLauncherWidthLabel->setValue(w);
myLauncherHeightSlider->setValue(h); myLauncherHeightSlider->setValue(h);
@ -432,8 +432,8 @@ void UIDialog::setDefaults()
case 1: // Debugger options case 1: // Debugger options
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
uInt32 w = BSPF::min(instance().frameBuffer().desktopSize().w, uInt32(DebuggerDialog::kMediumFontMinW)); uInt32 w = std::min(instance().frameBuffer().desktopSize().w, uInt32(DebuggerDialog::kMediumFontMinW));
uInt32 h = BSPF::min(instance().frameBuffer().desktopSize().h, uInt32(DebuggerDialog::kMediumFontMinH)); uInt32 h = std::min(instance().frameBuffer().desktopSize().h, uInt32(DebuggerDialog::kMediumFontMinH));
myDebuggerWidthSlider->setValue(w); myDebuggerWidthSlider->setValue(w);
myDebuggerWidthLabel->setValue(w); myDebuggerWidthLabel->setValue(w);
myDebuggerHeightSlider->setValue(h); myDebuggerHeightSlider->setValue(h);

View File

@ -53,8 +53,8 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
VariantList items; VariantList items;
// Set real dimensions // Set real dimensions
_w = BSPF::min(52 * fontWidth + 10, max_w); _w = std::min(52 * fontWidth + 10, max_w);
_h = BSPF::min(14 * (lineHeight + 4) + 10, max_h); _h = std::min(14 * (lineHeight + 4) + 10, max_h);
// The tab widget // The tab widget
xpos = ypos = 5; xpos = ypos = 5;

View File

@ -312,7 +312,7 @@ StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
void StaticTextWidget::setValue(int value) void StaticTextWidget::setValue(int value)
{ {
char buf[256]; char buf[256];
BSPF::snprintf(buf, 255, "%d", value); std::snprintf(buf, 255, "%d", value);
_label = buf; _label = buf;
setDirty(); setDirty();
@ -701,7 +701,7 @@ int SliderWidget::valueToPos(int value)
{ {
if(value < _valueMin) value = _valueMin; if(value < _valueMin) value = _valueMin;
else if(value > _valueMax) value = _valueMax; 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); return ((_w - _labelWidth - 4) * (value - _valueMin) / range);
} }