First pass at code cleanup from enabling higher levels of warnings in clang/gcc.

This commit is contained in:
Stephen Anthony 2017-10-11 12:23:54 -02:30
parent 5883f2dfcc
commit 35624553b6
71 changed files with 150 additions and 154 deletions

View File

@ -55,7 +55,7 @@ class FilesystemNodeFactory
return new FilesystemNodeZIP(path);
break;
}
return 0;
return nullptr;
}
private:

View File

@ -108,7 +108,7 @@ void PNGLibrary::loadImage(const string& filename, FBSurface& surface)
// Cleanup
done:
if(png_ptr)
png_destroy_read_struct(&png_ptr, info_ptr ? &info_ptr : 0, 0);
png_destroy_read_struct(&png_ptr, info_ptr ? &info_ptr : nullptr, nullptr);
if(err_message)
throw runtime_error(err_message);

View File

@ -140,8 +140,8 @@ class PNGLibrary
static void png_read_data(png_structp ctx, png_bytep area, png_size_t size);
static void png_write_data(png_structp ctx, png_bytep area, png_size_t size);
static void png_io_flush(png_structp ctx);
static void png_user_warn(png_structp ctx, png_const_charp str);
static void png_user_error(png_structp ctx, png_const_charp str);
[[noreturn]] static void png_user_warn(png_structp ctx, png_const_charp str);
[[noreturn]] static void png_user_error(png_structp ctx, png_const_charp str);
private:
// Following constructors and assignment operators not supported

View File

@ -29,7 +29,7 @@
#include "StateManager.hxx"
#define STATE_HEADER "05000302state"
#define MOVIE_HEADER "03030000movie"
// #define MOVIE_HEADER "03030000movie"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StateManager::StateManager(OSystem& osystem)

View File

@ -168,7 +168,6 @@ bool ZipHandler::stream_read(fstream* stream, void* buffer, uInt64 offset,
{
return false;
}
return false;
}

View File

@ -83,4 +83,4 @@ inline uInt8 smartmod<256>(uInt8 x)
return x & 0xFF;
}
#endif // SMARTMOD_HXX
#endif // SMARTMOD_HXX

View File

@ -56,12 +56,12 @@ void AtariNTSC::initializePalette(const uInt8* palette)
uInt32* kernel = myColorTable[entry];
genKernel(myImpl, y, i, q, kernel);
for ( uInt32 i = 0; i < rgb_kernel_size / 2; i++ )
for ( uInt32 c = 0; c < rgb_kernel_size / 2; ++c )
{
uInt32 error = rgb -
kernel [i ] - kernel [(i+10)%14+14] -
kernel [i + 7] - kernel [i + 3 +14];
kernel [i + 3 + 14] += error;
kernel [c ] - kernel [(c+10)%14+14] -
kernel [c + 7] - kernel [c + 3 +14];
kernel [c + 3 + 14] += error;
}
}
}

View File

@ -123,7 +123,7 @@ class AtariNTSC
Used to calculate an averaged color for the 'phosphor' effect.
@param c RGB Color 1 (current frame)
@param p RGB Color 2 (previous frame)
@param cp RGB Color 2 (previous frame)
@return Averaged value of the two RGB colors
*/

View File

@ -723,7 +723,7 @@ string CartDebug::loadListFile()
if(addr_s.length() == 0)
continue;
const char* p = addr_s[0] == 'U' ? addr_s.c_str() + 1 : addr_s.c_str();
addr = int(strtoul(p, NULL, 16));
addr = int(strtoul(p, nullptr, 16));
// For now, completely ignore ROM addresses
if(!(addr & 0x1000))
@ -1462,8 +1462,10 @@ const char* const CartDebug::ourTIAMnemonicW[64] = {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* const CartDebug::ourIOMnemonic[24] = {
"SWCHA", "SWACNT", "SWCHB", "SWBCNT", "INTIM", "TIMINT", 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, "TIM1T", "TIM8T", "TIM64T", "T1024T"
"SWCHA", "SWACNT", "SWCHB", "SWBCNT", "INTIM", "TIMINT",
"$286", "$287", "$288", "$289", "$28a", "$28b", "$28c",
"$28d", "$28e", "$28f", "$290", "$291", "$292", "$293",
"TIM1T", "TIM8T", "TIM64T", "T1024T"
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -59,6 +59,7 @@
Debugger* Debugger::myStaticDebugger = nullptr;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// FIXME - use a vector for this
static const char* const builtin_functions[][3] = {
// { "name", "definition", "help text" }
@ -91,6 +92,7 @@ static const char* const builtin_functions[][3] = {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Names are defined here, but processed in YaccParser
// FIXME - use a vector for this
static const char* const pseudo_registers[][2] = {
// { "name", "help text" }

View File

@ -349,8 +349,8 @@ bool TIADebug::collision(CollisionBit id) const
case Cx_BLPF: return myTIA.collCXBLPF() & 0x80;
case Cx_P0P1: return myTIA.collCXPPMM() & 0x80;
case Cx_M0M1: return myTIA.collCXPPMM() & 0x40;
default: return false; // make compiler happy
}
return false; // make compiler happy
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -703,13 +703,13 @@ int TIADebug::frameCycles() const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int TIADebug::cyclesLo() const
{
return (int)myTIA.cycles();
return int(myTIA.cycles());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int TIADebug::cyclesHi() const
{
return (int)(myTIA.cycles() >> 32);
return int(myTIA.cycles() >> 32);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -324,7 +324,7 @@ void CartridgeBUSWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.myMusicCounters[i]);
changed.push_back(myCart.myMusicCounters[i] != (uInt32)myOldState.mcounters[i]);
changed.push_back(myCart.myMusicCounters[i] != uInt32(myOldState.mcounters[i]));
}
myMusicCounters->setList(alist, vlist, changed);
@ -332,7 +332,7 @@ void CartridgeBUSWidget::loadConfig()
for(int i = 0; i < 3; ++i)
{
alist.push_back(0); vlist.push_back(myCart.myMusicFrequencies[i]);
changed.push_back(myCart.myMusicFrequencies[i] != (uInt32)myOldState.mfreqs[i]);
changed.push_back(myCart.myMusicFrequencies[i] != uInt32(myOldState.mfreqs[i]));
}
myMusicFrequencies->setList(alist, vlist, changed);

View File

@ -213,7 +213,7 @@ bool PromptWidget::handleKeyDown(StellaKey key, StellaMod mod)
{
str[i] = buffer(_promptStartPos + i) & 0x7f;
// whitespace characters
if(strchr("{*@<> =[]()+-/&|!^~%", str[i]) != NULL )
if(strchr("{*@<> =[]()+-/&|!^~%", str[i]))
{
lastDelimPos = i;
delimiter = str[i];

View File

@ -115,7 +115,6 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
default: // TODO - properly handle all other cases
return false;
}
return false;
};
setTextFilter(f);
}

View File

@ -561,7 +561,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& lfont,
addFocusWidget(myPF[2]);
// PFx bit labels
auto start = [&](int w) { return (w - sfWidth) / 2; };
auto start = [&](int sw) { return (sw - sfWidth) / 2; };
int colw = myPF[0]->getWidth() / 4;
xpos = 10 + 2*fontWidth + 5 + start(colw);
int _ypos = ypos - sfHeight;

View File

@ -178,7 +178,7 @@ bool Cartridge3E::bank(uInt16 bank)
mySystem->setPageAccess(addr, access);
}
access.directPeekBase = 0;
access.directPeekBase = nullptr;
access.type = System::PA_WRITE;
// Map write-port RAM image into the system

View File

@ -53,7 +53,7 @@ void Cartridge4KSC::install(System& system)
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{

View File

@ -58,7 +58,7 @@ void CartridgeBFSC::install(System& system)
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{

View File

@ -65,7 +65,8 @@ CartridgeBUS::CartridgeBUS(const BytePtr& image, uInt32 size,
#ifdef THUMB_SUPPORT
// Create Thumbulator ARM emulator
myThumbEmulator = make_unique<Thumbulator>((uInt16*)myImage, (uInt16*)myBUSRAM,
myThumbEmulator = make_unique<Thumbulator>(
reinterpret_cast<uInt16*>(myImage), reinterpret_cast<uInt16*>(myBUSRAM),
settings.getBool("thumb.trapfatal"), Thumbulator::ConfigureFor::BUS, this);
#endif
setInitialState();
@ -528,7 +529,6 @@ uInt32 CartridgeBUS::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2)
// _GetWavePtr - return the counter
case 2:
return myMusicCounters[value1];
break;
// _SetWaveSize - set size of waveform buffer
case 3:

View File

@ -69,9 +69,9 @@ CartridgeCDF::CartridgeCDF(const BytePtr& image, uInt32 size,
#ifdef THUMB_SUPPORT
// Create Thumbulator ARM emulator
myThumbEmulator = make_unique<Thumbulator>(
(uInt16*)myImage, (uInt16*)myCDFRAM, settings.getBool("thumb.trapfatal"),
myVersion ? Thumbulator::ConfigureFor::CDF1 : Thumbulator::ConfigureFor::CDF,
this);
reinterpret_cast<uInt16*>(myImage), reinterpret_cast<uInt16*>(myCDFRAM),
settings.getBool("thumb.trapfatal"), myVersion ?
Thumbulator::ConfigureFor::CDF1 : Thumbulator::ConfigureFor::CDF, this);
#endif
setInitialState();
}
@ -465,7 +465,6 @@ uInt32 CartridgeCDF::thumbCallback(uInt8 function, uInt32 value1, uInt32 value2)
// _GetWavePtr - return the counter
case 2:
return myMusicCounters[value1];
break;
// _SetWaveSize - set size of waveform buffer
case 3:

View File

@ -143,7 +143,7 @@ bool CartridgeCM::bank(uInt16 bank)
if((mySWCHA & 0x30) == 0x20)
access.directPokeBase = &myRAM[addr & 0x7FF];
else
access.directPokeBase = 0;
access.directPokeBase = nullptr;
mySystem->setPageAccess(addr, access);
}

View File

@ -74,8 +74,8 @@ void CartridgeCV::install(System& system)
}
// Set the page accessing method for the RAM writing pages
access.directPeekBase = 0;
access.codeAccessBase = 0;
access.directPeekBase = nullptr;
access.codeAccessBase = nullptr;
access.type = System::PA_WRITE;
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{
@ -84,7 +84,7 @@ void CartridgeCV::install(System& system)
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE)
{

View File

@ -58,8 +58,8 @@ void CartridgeCVPlus::install(System& system)
mySystem->setPageAccess(addr, access);
// Set the page accessing method for the RAM writing pages
access.directPeekBase = 0;
access.codeAccessBase = 0;
access.directPeekBase = nullptr;
access.codeAccessBase = nullptr;
access.type = System::PA_WRITE;
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{
@ -69,7 +69,7 @@ void CartridgeCVPlus::install(System& system)
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1000; addr < 0x1400; addr += System::PAGE_SIZE)
{

View File

@ -58,7 +58,7 @@ void CartridgeDFSC::install(System& system)
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{

View File

@ -57,7 +57,7 @@ void CartridgeE0::install(System& system)
myCurrentSlice[3] = 7;
// Set the page accessing methods for the hot spots in the last segment
access.directPeekBase = 0;
access.directPeekBase = nullptr;
access.codeAccessBase = &myCodeAccessBase[8128];
access.type = System::PA_READ;
for(uInt16 addr = (0x1FE0 & ~System::PAGE_MASK); addr < 0x2000;

View File

@ -162,7 +162,7 @@ void CartridgeE7::bankRAM(uInt16 bank)
}
// Set the page accessing method for the 256 bytes of RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1900; addr < 0x1A00; addr += System::PAGE_SIZE)
{
@ -208,7 +208,7 @@ bool CartridgeE7::bank(uInt16 slice)
}
// Set the page accessing method for the 1K slice of RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1400; addr < 0x1800; addr += System::PAGE_SIZE)
{

View File

@ -58,7 +58,7 @@ void CartridgeEFSC::install(System& system)
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{

View File

@ -58,7 +58,7 @@ void CartridgeF4SC::install(System& system)
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{

View File

@ -58,7 +58,7 @@ void CartridgeF6SC::install(System& system)
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{

View File

@ -58,7 +58,7 @@ void CartridgeF8SC::install(System& system)
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1080; addr < 0x1100; addr += System::PAGE_SIZE)
{

View File

@ -58,7 +58,7 @@ void CartridgeFA::install(System& system)
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1100; addr < 0x1200; addr += System::PAGE_SIZE)
{

View File

@ -70,7 +70,7 @@ void CartridgeFA2::install(System& system)
}
// Set the page accessing method for the RAM reading pages
access.directPokeBase = 0;
access.directPokeBase = nullptr;
access.type = System::PA_READ;
for(uInt16 addr = 0x1100; addr < 0x1200; addr += System::PAGE_SIZE)
{

View File

@ -132,8 +132,6 @@ uInt8 CartridgeWD::peek(uInt16 address)
else
return mySegment3[address & 0x03FF];
}
return 0; // Make the compiler happy; we'll never reach this
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -869,7 +869,7 @@ void Console::generateColorLossPalette()
uInt32* palette[9] = {
&ourNTSCPalette[0], &ourPALPalette[0], &ourSECAMPalette[0],
&ourNTSCPaletteZ26[0], &ourPALPaletteZ26[0], &ourSECAMPaletteZ26[0],
0, 0, 0
nullptr, nullptr, nullptr
};
if(myUserPaletteDefined)
{
@ -880,7 +880,7 @@ void Console::generateColorLossPalette()
for(int i = 0; i < 9; ++i)
{
if(palette[i] == 0)
if(palette[i] == nullptr)
continue;
// Fill the odd numbered palette entries with gray values (calculated

View File

@ -27,7 +27,7 @@ Controller::Controller(Jack jack, const Event& event, const System& system,
myEvent(event),
mySystem(system),
myType(type),
myOnAnalogPinUpdateCallback(0)
myOnAnalogPinUpdateCallback(nullptr)
{
myDigitalPinState[One] =
myDigitalPinState[Two] =

View File

@ -183,7 +183,7 @@ class Controller : public Serializable
console is about to be destroyed. It may be necessary to override
this method for controllers that need cleanup before exiting.
*/
virtual void close() { };
virtual void close() { }
/**
Determines how this controller will treat values received from the

View File

@ -123,17 +123,17 @@ string FilesystemNode::getShortPathWithExt(const string& ext) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool FilesystemNode::hasParent() const
{
return _realNode ? (_realNode->getParent() != 0) : false;
return _realNode ? (_realNode->getParent() != nullptr) : false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode FilesystemNode::getParent() const
{
if (_realNode == 0)
if (_realNode == nullptr)
return *this;
AbstractFSNode* node = _realNode->getParent();
return (node == 0) ? *this : FilesystemNode(node);
return node ? FilesystemNode(node) : *this;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -178,11 +178,11 @@ void KidVid::openSampleFile()
if(myTape == 4) i -= 3;
mySampleFile = fopen(kvNameTable[i], "rb");
if(mySampleFile != NULL)
if(mySampleFile != nullptr)
{
cerr << "opened file: " << kvNameTable[i] << endl;
mySharedSampleFile = fopen("kvshared.wav", "rb");
if(mySharedSampleFile == NULL)
if(mySharedSampleFile == nullptr)
{
fclose(mySampleFile);
myFileOpened = false;

View File

@ -23,21 +23,21 @@
// Flags for disassembly types
#define DISASM_CODE CartDebug::CODE
#define DISASM_GFX CartDebug::GFX
#define DISASM_PGFX CartDebug::PGFX
// #define DISASM_GFX CartDebug::GFX // TODO - uncomment when needed
// #define DISASM_PGFX CartDebug::PGFX // TODO - uncomment when needed
#define DISASM_DATA CartDebug::DATA
#define DISASM_ROW CartDebug::ROW
// #define DISASM_ROW CartDebug::ROW // TODO - uncomment when needed
#define DISASM_WRITE CartDebug::WRITE
#define DISASM_NONE 0
#else
// Flags for disassembly types
#define DISASM_CODE 0
#define DISASM_GFX 0
#define DISASM_PGFX 0
// #define DISASM_GFX 0 // TODO - uncomment when needed
// #define DISASM_PGFX 0 // TODO - uncomment when needed
#define DISASM_DATA 0
#define DISASM_ROW 0
// #define DISASM_ROW 0 // TODO - uncomment when needed
#define DISASM_NONE 0
#define DISASM_WRITE 0
#define DISASM_WRITE 0
#endif
#include "Settings.hxx"
#include "Vec.hxx"
@ -62,7 +62,7 @@ M6502::M6502(const Settings& settings)
myLastSrcAddressX(-1),
myLastSrcAddressY(-1),
myDataAddressForPoke(0),
myOnHaltCallback(0),
myOnHaltCallback(nullptr),
myHaltRequested(false)
{
#ifdef DEBUGGER_SUPPORT
@ -132,7 +132,7 @@ inline uInt8 M6502::peek(uInt16 address, uInt8 flags)
int cond = evalCondTraps();
if(cond > -1)
{
myJustHitReadTrapFlag = true;
myJustHitReadTrapFlag = true;
myHitTrapInfo.message = "RTrap(" + myTrapCondNames[cond] + "): ";
myHitTrapInfo.address = address;
}
@ -153,8 +153,8 @@ inline void M6502::poke(uInt16 address, uInt8 value, uInt8 flags)
myLastAddress = address;
}
////////////////////////////////////////////////
mySystem->incrementCycles(SYSTEM_CYCLES_PER_CPU);
mySystem->poke(address, value, flags);
mySystem->incrementCycles(SYSTEM_CYCLES_PER_CPU);
mySystem->poke(address, value, flags);
myLastPokeAddress = address;
#ifdef DEBUGGER_SUPPORT
@ -169,7 +169,7 @@ inline void M6502::poke(uInt16 address, uInt8 value, uInt8 flags)
myHitTrapInfo.address = address;
}
}
#endif // DEBUGGER_SUPPORT
#endif // DEBUGGER_SUPPORT
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -204,7 +204,7 @@ bool M6502::execute(uInt32 number)
{
myJustHitReadTrapFlag = myJustHitWriteTrapFlag = false;
if(myDebugger && myDebugger->start(myHitTrapInfo.message, myHitTrapInfo.address, myJustHitReadTrapFlag))
{
{
return true;
}
}
@ -469,7 +469,7 @@ bool M6502::delCondTrap(uInt32 brk)
return true;
}
return false;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6502::clearCondTraps()

View File

@ -103,7 +103,7 @@ class M6502 : public Serializable
/**
Pull RDY high again before the callback was triggered.
*/
void clearHaltRequest() { myHaltRequested = false; };
void clearHaltRequest() { myHaltRequested = false; }
/**
Execute instructions until the specified number of instructions
@ -149,17 +149,17 @@ class M6502 : public Serializable
return myLastPokeAddress ?
(myLastPokeAddress != myLastPeekAddress ? myLastPeekAddress : 0) :
myLastPeekAddress;
}
}
/**
Return the last address that was part of a read/peek.
Return the last address that was part of a read/peek.
@return The address of the last read
*/
uInt16 lastReadBaseAddress() const { return myLastPeekBaseAddress; }
/**
Return the last address that was part of a write/poke.
Return the last address that was part of a write/poke.
@return The address of the last write
*/
@ -395,7 +395,7 @@ class M6502 : public Serializable
return i;
return -1; // no trapif hit
}
}
/// Pointer to the debugger for this processor or the null pointer
Debugger* myDebugger;

View File

@ -41,7 +41,7 @@ M6532::M6532(const Console& console, const Settings& settings)
myInterruptFlag(false),
myEdgeDetectPositive(false),
myRAMAccessBase(nullptr)
{
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -481,15 +481,14 @@ uInt8 M6532::getAccessFlags(uInt16 address) const
{
if (address & IO_BIT)
return myIOAccessBase[address & IO_MASK];
else if (address & STACK_BIT)
else if (address & STACK_BIT)
return myStackAccessBase[address & STACK_MASK];
else
return myRAMAccessBase[address & RAM_MASK];
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void M6532::setAccessFlags(uInt16 address, uInt8 flags)
void M6532::setAccessFlags(uInt16 address, uInt8 flags)
{
// ignore none flag
if (flags != CartDebug::NONE) {
@ -506,4 +505,4 @@ void M6532::setAccessFlags(uInt16 address, uInt8 flags)
}
}
}
#endif // DEBUGGER_SUPPORT
#endif // DEBUGGER_SUPPORT

View File

@ -62,7 +62,7 @@ OSystem::OSystem()
myQuitLoop(false)
{
// Calculate startup time
myMillisAtStart = uInt32(time(NULL) * 1000);
myMillisAtStart = uInt32(time(nullptr) * 1000);
// Get built-in features
#ifdef SOUND_SUPPORT
@ -596,7 +596,7 @@ uInt64 OSystem::getTicks() const
#ifdef HAVE_GETTIMEOFDAY
// Gettimeofday natively refers to the UNIX epoch (a set time in the past)
timeval now;
gettimeofday(&now, 0);
gettimeofday(&now, nullptr);
return uInt64(now.tv_sec) * 1000000 + now.tv_usec;
#else

View File

@ -74,8 +74,8 @@ string TIASound::channels(uInt32 hardware, bool stereo)
case Hardware1: return "Hardware1";
case Hardware2Mono: return "Hardware2Mono";
case Hardware2Stereo: return "Hardware2Stereo";
default: return EmptyString;
}
return EmptyString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -17,7 +17,7 @@
#include <cmath>
#include <algorithm>
#include <math.h>
#include <math.h>
#include "FrameBuffer.hxx"
#include "Settings.hxx"
@ -118,7 +118,7 @@ const FBSurface& TIASurface::baseSurface(GUI::Rect& rect) const
// Get Blargg buffer and width
uInt32 *blarggBuf, blarggPitch;
myTiaSurface->basePtr(blarggBuf, blarggPitch);
double blarggXFactor = (double)blarggPitch / width;
double blarggXFactor = double(blarggPitch) / width;
bool useBlargg = ntscEnabled();
// Fill the surface with pixels from the TIA, scaled 2x horizontally
@ -130,8 +130,8 @@ const FBSurface& TIASurface::baseSurface(GUI::Rect& rect) const
for(uInt32 x = 0; x < width; ++x)
{
if (useBlargg)
*buf_ptr++ = blarggBuf[y * blarggPitch + (uInt32)nearbyint(x * blarggXFactor)];
else
*buf_ptr++ = blarggBuf[y * blarggPitch + uInt32(nearbyint(x * blarggXFactor))];
else
*buf_ptr++ = myPalette[*(myTIA->frameBuffer() + y * tiaw + x / 2)];
}
}
@ -398,7 +398,7 @@ void TIASurface::reRender()
myTiaSurface->basePtr(outPtr, outPitch);
switch (myFilter)
switch (myFilter)
{
// for non-phosphor modes, render the frame again
case Filter::Normal:

View File

@ -133,7 +133,7 @@ class TIASurface
Used to calculate an averaged color for the 'phosphor' effect.
@param c RGB Color 1 (current frame)
@param p RGB Color 2 (previous frame)
@param cp RGB Color 2 (previous frame)
@return Averaged value of the two RGB colors
*/

View File

@ -94,12 +94,11 @@ void Thumbulator::setConsoleTiming(ConsoleTiming timing)
constexpr double PAL = 70.0 / 1.182298; // PAL 6507 clock rate
constexpr double SECAM = 70.0 / 1.187500; // SECAM 6507 clock rate
switch (timing)
switch(timing)
{
case ConsoleTiming::ntsc: timing_factor = NTSC; break;
case ConsoleTiming::secam: timing_factor = SECAM; break;
case ConsoleTiming::pal: timing_factor = PAL; break;
default: timing_factor = NTSC; break;
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -160,4 +160,4 @@ string DelayQueueMember<capacity>::name() const
return "TIA_DelayQueueMember";
}
#endif // TIA_DELAY_QUEUE_MEMBER
#endif // TIA_DELAY_QUEUE_MEMBER

View File

@ -140,8 +140,8 @@ void FrameManager::nextLine()
}
break;
default:
throw runtime_error("frame manager: invalid state");
// default:
// throw runtime_error("frame manager: invalid state");
}
if (myState == State::frame && previousState == State::frame) myY++;
@ -182,8 +182,8 @@ void FrameManager::setVsync(bool vsync)
if (myVsync) setState(State::waitForVsyncEnd);
break;
default:
throw runtime_error("frame manager: invalid state");
// default:
// throw runtime_error("frame manager: invalid state");
}
}
@ -341,8 +341,8 @@ void FrameManager::updateLayout(FrameLayout layout)
myOverscanLines = Metrics::overscanPAL;
break;
default:
throw runtime_error("frame manager: invalid TV mode");
// default:
// throw runtime_error("frame manager: invalid TV mode");
}
myFrameLines = Metrics::vsync + myVblankLines + myKernelLines + myOverscanLines;

View File

@ -74,8 +74,8 @@ class Player : public Serializable
uInt8 getPosition() const;
void setPosition(uInt8 newPosition);
uInt8 getGRPOld() const { return myPatternOld; };
uInt8 getGRPNew() const { return myPatternNew; };
uInt8 getGRPOld() const { return myPatternOld; }
uInt8 getGRPNew() const { return myPatternNew; }
void setGRPOld(uInt8 pattern);

View File

@ -302,7 +302,7 @@ bool Playfield::load(Serializer& in)
myDebugColor = in.getByte();
myDebugEnabled = in.getBool();
myColorMode = (ColorMode)in.getByte();
myColorMode = ColorMode(in.getByte());
myPattern = in.getInt();
myEffectivePattern = in.getInt();

View File

@ -186,7 +186,7 @@ class TIA : public Device
/**
Returns a pointer to the internal frame buffer.
*/
uInt8* frameBuffer() const { return (uInt8*)(myFramebuffer); }
uInt8* frameBuffer() { return static_cast<uInt8*>(myFramebuffer); }
/**
Answers dimensional info about the framebuffer.

View File

@ -207,13 +207,13 @@ bool VblankManager::shouldTransition(bool isGarbageFrame)
// Fixed mode: use external ystart value
case VblankMode::fixed:
transition = (Int32)myCurrentLine >=
transition = Int32(myCurrentLine) >=
std::max<Int32>(myYstart + std::min<Int32>(myJitter, Metrics::maxJitter), 0);
break;
// Final mode: use detected ystart value
case VblankMode::final:
transition = (Int32)myCurrentLine >=
transition = Int32(myCurrentLine) >=
std::max<Int32>(myLastVblankLines + std::min<Int32>(myJitter, Metrics::maxJitter), 0);
break;
}

View File

@ -47,7 +47,7 @@ class VblankManager : public Serializable
bool vblank() const { return myVblank; }
uInt32 currentLine() const { return myCurrentLine; };
uInt32 currentLine() const { return myCurrentLine; }
void setJitter(Int32 jitter);
void setJitterFactor(uInt8 jitterFactor) { myJitterFactor = jitterFactor; }

View File

@ -3353,9 +3353,9 @@ static const FontDesc consoleBDesc = {
30,
97,
consoleB_font_bits,
0, /* no encode table*/
0, /* fixed width*/
0, /* fixed bbox*/
nullptr, /* no encode table*/
nullptr, /* fixed width*/
nullptr, /* fixed bbox*/
32, // Originally 30
sizeof(consoleB_font_bits)/sizeof(uInt16)
};

View File

@ -75,7 +75,7 @@ static const uInt16 console_font_bits[] = {
0x0000,
0b1101101100000000,
0x0000,
0x0000,
0x0000,
/* MODIFIED
Character 30 (0x1e): large centered rounded rectangle
@ -3388,9 +3388,9 @@ static const FontDesc consoleDesc = {
29,
98,
console_font_bits,
0, /* no encode table*/
0, /* fixed width*/
0, /* fixed bbox*/
nullptr, /* no encode table*/
nullptr, /* fixed width*/
nullptr, /* fixed bbox*/
32, // Originally 30
sizeof(console_font_bits)/sizeof(uInt16)
};

View File

@ -3741,9 +3741,9 @@ static const FontDesc consoleMediumBDesc = {
30,
97,
consoleMediumB_font_bits,
0, /* no encode table*/
0, /* fixed width*/
0, /* fixed bbox*/
nullptr, /* no encode table*/
nullptr, /* fixed width*/
nullptr, /* fixed bbox*/
32, // Originally 30
sizeof(consoleMediumB_font_bits)/sizeof(uInt16)
};

View File

@ -3741,9 +3741,9 @@ static const FontDesc consoleMediumDesc = {
30,
97,
consoleMedium_font_bits,
0, /* no encode table*/
0, /* fixed width*/
0, /* fixed bbox*/
nullptr, /* no encode table*/
nullptr, /* fixed width*/
nullptr, /* fixed bbox*/
32, // Originally 30
sizeof(consoleMedium_font_bits)/sizeof(uInt16)
};

View File

@ -398,7 +398,7 @@ void Dialog::handleMouseUp(int x, int y, int button, int clickCount)
w->handleMouseUp(x - (w->getAbsX() - _x), y - (w->getAbsY() - _y),
button, clickCount);
_dragWidget = 0;
_dragWidget = nullptr;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -438,7 +438,7 @@ void Dialog::handleMouseMoved(int x, int y, int button)
}
else if (!mouseInFocusedWidget && _mouseWidget == w)
{
_mouseWidget = 0;
_mouseWidget = nullptr;
w->handleMouseLeft(button);
}

View File

@ -60,7 +60,7 @@ class GuiObject : public CommandReceiver
myDialog(dialog),
_x(x), _y(y), _w(w), _h(h),
_dirty(false),
_firstWidget(0) { }
_firstWidget(nullptr) { }
virtual ~GuiObject() = default;

View File

@ -419,7 +419,6 @@ bool LauncherDialog::matchPattern(const string& s, const string& pattern) const
}
}
}
return false;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -25,6 +25,6 @@
Menu::Menu(OSystem& osystem)
: DialogContainer(osystem)
{
myBaseDialog = new OptionsDialog(myOSystem, *this, 0,
myBaseDialog = new OptionsDialog(myOSystem, *this, nullptr,
FrameBuffer::kFBMinW, FrameBuffer::kFBMinH, false);
}

View File

@ -2713,9 +2713,9 @@ static const FontDesc stellaDesc = {
32,
95,
stella_font_bits,
0, /* no encode table*/
0, /* fixed width*/
0, /* fixed bbox*/
nullptr, /* no encode table*/
nullptr, /* fixed width*/
nullptr, /* fixed bbox*/
32,
sizeof(stella_font_bits)/sizeof(uInt16)
};

View File

@ -4762,9 +4762,9 @@ static const FontDesc stellaLargeDesc = {
29,
98,
stellaLarge_font_bits,
0, /* no encode table*/
0, /* fixed width*/
0, /* fixed bbox*/
nullptr, /* no encode table*/
nullptr, /* fixed width*/
nullptr, /* fixed bbox*/
32,
sizeof(stellaLarge_font_bits)/sizeof(uInt16)
};

View File

@ -4370,9 +4370,9 @@ static const FontDesc stellaMediumDesc = {
29,
98,
stellaMedium_font_bits,
0, /* no encode table*/
0, /* fixed width*/
0, /* fixed bbox*/
nullptr, /* no encode table*/
nullptr, /* fixed width*/
nullptr, /* fixed bbox*/
32, // Originally 30
sizeof(stellaMedium_font_bits)/sizeof(uInt16)
};

View File

@ -333,7 +333,7 @@ void UIDialog::loadConfig()
#ifdef DEBUGGER_SUPPORT
// Debugger size
const GUI::Size& ds = instance().settings().getSize("dbg.res");
w = ds.w, h = ds.h;
w = ds.w; h = ds.h;
w = std::max(w, uInt32(DebuggerDialog::kSmallFontMinW));
h = std::max(h, uInt32(DebuggerDialog::kSmallFontMinH));
w = std::min(w, ds.w);

View File

@ -214,7 +214,7 @@ VideoDialog::VideoDialog(OSystem& osystem, DialogContainer& parent,
VarList::push_back(items, "Bad adjust", NTSCFilter::PRESET_BAD);
VarList::push_back(items, "Custom", NTSCFilter::PRESET_CUSTOM);
lwidth = font.getStringWidth("TV Mode ");
pwidth = font.getStringWidth("Bad adjust"),
pwidth = font.getStringWidth("Bad adjust");
myTVMode =
new PopUpWidget(myTab, font, xpos, ypos, pwidth, lineHeight,
items, "TV Mode ", lwidth, kTVModeChanged);
@ -510,13 +510,13 @@ void VideoDialog::saveConfig()
instance().settings().setValue("tia.aspectp", myPAspectRatioLabel->getLabel());
// Framerate
int i = myFrameRate->getValue();
instance().settings().setValue("framerate", i);
int f = myFrameRate->getValue();
instance().settings().setValue("framerate", f);
if(instance().hasConsole())
{
// Make sure auto-frame calculation is only enabled when necessary
instance().console().tia().enableAutoFrame(i <= 0);
instance().console().setFramerate(float(i));
instance().console().tia().enableAutoFrame(f <= 0);
instance().console().setFramerate(float(f));
}
// Fullscreen

View File

@ -59,7 +59,7 @@ FilesystemNodePOSIX::FilesystemNodePOSIX(const string& p, bool verify)
if(_path[0] == '~')
{
const char* home = getenv("HOME");
if (home != NULL)
if (home != nullptr)
_path.replace(0, 1, home);
}
@ -79,7 +79,7 @@ string FilesystemNodePOSIX::getShortPath() const
{
// If the path starts with the home directory, replace it with '~'
const char* home = getenv("HOME");
if(home != NULL && BSPF::startsWithIgnoreCase(_path, home))
if(home != nullptr && BSPF::startsWithIgnoreCase(_path, home))
{
string path = "~";
const char* offset = _path.c_str() + strlen(home);
@ -99,11 +99,11 @@ bool FilesystemNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode,
DIR* dirp = opendir(_path.c_str());
struct dirent* dp;
if (dirp == NULL)
if (dirp == nullptr)
return false;
// loop over dir entries using readdir
while ((dp = readdir(dirp)) != NULL)
while ((dp = readdir(dirp)) != nullptr)
{
// Skip 'invisible' files if necessary
if (dp->d_name[0] == '.' && !hidden)

View File

@ -35,7 +35,7 @@ OSystemUNIX::OSystemUNIX()
{
// Use XDG_CONFIG_HOME if defined, otherwise use the default
const char* configDir = getenv("XDG_CONFIG_HOME");
if(configDir == NULL) configDir = "~/.config";
if(configDir == nullptr) configDir = "~/.config";
string stellaDir = string(configDir) + "/stella";

View File

@ -45,7 +45,7 @@ const string& errorMessage()
Expression* getResult()
{
lastExp = 0;
lastExp = nullptr;
return result.exp;
}
@ -70,7 +70,7 @@ void setInput(const char *in)
int parse(const char *in)
{
lastExp = 0;
lastExp = nullptr;
errMsg = "(no error)";
setInput(in);
return yyparse();
@ -196,7 +196,7 @@ CpuMethod getCpuSpecial(char* ch)
else if(BSPF::equalsIgnoreCase(ch, "b"))
return &CpuDebug::b;
else
return 0;
return nullptr;
}
// special methods that get Cart RAM/ROM internal state
@ -211,7 +211,7 @@ CartMethod getCartSpecial(char* ch)
else if(BSPF::equalsIgnoreCase(ch, "__lastwrite"))
return &CartDebug::lastWriteBaseAddress;
else
return 0;
return nullptr;
}
// special methods that get TIA internal state
@ -234,7 +234,7 @@ TiaMethod getTiaSpecial(char* ch)
else if(BSPF::equalsIgnoreCase(ch, "_vblank"))
return &TIADebug::vblankAsInt;
else
return 0;
return nullptr;
}
int yylex() {

View File

@ -99,6 +99,6 @@ expression: expression '+' expression { if(DEBUG_EXP) fprintf(stderr, " +"); $$
| CART_METHOD { if(DEBUG_EXP) fprintf(stderr, " (CartMethod)"); $$ = new CartMethodExpression($1); lastExp = $$; }
| TIA_METHOD { if(DEBUG_EXP) fprintf(stderr, " (TiaMethod)"); $$ = new TiaMethodExpression($1); lastExp = $$; }
| FUNCTION { if(DEBUG_EXP) fprintf(stderr, " (DefinedFunction)"); $$ = new FunctionExpression($1); lastExp = $$; }
| ERR { if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((char*)"Invalid label or constant"); return 1; }
| ERR { if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((const char*)"Invalid label or constant"); return 1; }
;
%%

View File

@ -1543,7 +1543,7 @@ yyreduce:
case 36:
#line 102 "stella.y" /* yacc.c:1646 */
{ if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((char*)"Invalid label or constant"); return 1; }
{ if(DEBUG_EXP) fprintf(stderr, " ERR: "); yyerror((const char*)"Invalid label or constant"); return 1; }
#line 1548 "y.tab.c" /* yacc.c:1646 */
break;