Just when I thought there were no more cleanups to do ...

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3059 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-11-09 03:05:19 +00:00
parent 4f91fd96ed
commit 92aa5c2e36
39 changed files with 126 additions and 131 deletions

View File

@ -52,7 +52,7 @@ class CheatManager
@param enable Whether to enable this cheat right away @param enable Whether to enable this cheat right away
@param idx Index at which to insert the cheat @param idx Index at which to insert the cheat
@return The cheat (if was created), else NULL. @return The cheat (if was created), else nullptr.
*/ */
Cheat* add(const string& name, const string& code, Cheat* add(const string& name, const string& code,
bool enable = true, int idx = -1); bool enable = true, int idx = -1);
@ -134,7 +134,7 @@ class CheatManager
@param name Name of the cheat (not absolutely required) @param name Name of the cheat (not absolutely required)
@param code The actual cheatcode (in hex) @param code The actual cheatcode (in hex)
@return The cheat (if was created), else NULL. @return The cheat (if was created), else nullptr.
*/ */
Cheat* createCheat(const string& name, const string& code) const; Cheat* createCheat(const string& name, const string& code) const;

View File

@ -1256,7 +1256,6 @@ void CartDebug::getCompletions(const char* in, StringList& completions) const
completions.push_back(ourZPMnemonic[addr]); completions.push_back(ourZPMnemonic[addr]);
// Now scan user-defined labels // Now scan user-defined labels
LabelToAddr::const_iterator iter;
for(const auto& iter: myUserAddresses) for(const auto& iter: myUserAddresses)
{ {
const char* l = iter.first.c_str(); const char* l = iter.first.c_str();

View File

@ -302,7 +302,6 @@ class CartDebug : public DebuggerSystem
<< ", offset=$" << HEX4 << b.offset << ", size=" << dec << b.size << ", offset=$" << HEX4 << b.offset << ", size=" << dec << b.size
<< endl << endl
<< "addrlist: "; << "addrlist: ";
AddressList::const_iterator i;
for(const auto& i: addressList) for(const auto& i: addressList)
os << HEX4 << i << " "; os << HEX4 << i << " ";
return os; return os;

View File

@ -46,7 +46,7 @@ class CartDebugWidget : public Widget, public CommandSender
myFontHeight(lfont.getFontHeight()), myFontHeight(lfont.getFontHeight()),
myLineHeight(lfont.getLineHeight()), myLineHeight(lfont.getLineHeight()),
myButtonHeight(myLineHeight + 4), myButtonHeight(myLineHeight + 4),
myDesc(NULL) { } myDesc(nullptr) { }
virtual ~CartDebugWidget() { }; virtual ~CartDebugWidget() { };

View File

@ -24,13 +24,13 @@ DataGridOpsWidget::DataGridOpsWidget(GuiObject* boss, const GUI::Font& font,
int x, int y) int x, int y)
: Widget(boss, font, x, y, 16, 16), : Widget(boss, font, x, y, 16, 16),
CommandSender(boss), CommandSender(boss),
_zeroButton(NULL), _zeroButton(nullptr),
_invButton(NULL), _invButton(nullptr),
_negButton(NULL), _negButton(nullptr),
_incButton(NULL), _incButton(nullptr),
_decButton(NULL), _decButton(nullptr),
_shiftLeftButton(NULL), _shiftLeftButton(nullptr),
_shiftRightButton(NULL) _shiftRightButton(nullptr)
{ {
const int bwidth = _font.getMaxCharWidth() * 4, const int bwidth = _font.getMaxCharWidth() * 4,
bheight = _font.getFontHeight() + 3, bheight = _font.getFontHeight() + 3,

View File

@ -46,8 +46,8 @@ DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
_base(base), _base(base),
_selectedItem(0), _selectedItem(0),
_currentKeyDown(KBDK_UNKNOWN), _currentKeyDown(KBDK_UNKNOWN),
_opsWidget(NULL), _opsWidget(nullptr),
_scrollBar(NULL) _scrollBar(nullptr)
{ {
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | _flags = WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS |
WIDGET_WANTS_RAWDATA; WIDGET_WANTS_RAWDATA;

View File

@ -48,11 +48,11 @@
DebuggerDialog::DebuggerDialog(OSystem& osystem, DialogContainer& parent, DebuggerDialog::DebuggerDialog(OSystem& osystem, DialogContainer& parent,
int x, int y, int w, int h) int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h), : Dialog(osystem, parent, x, y, w, h),
myTab(NULL), myTab(nullptr),
myRomTab(NULL), myRomTab(nullptr),
myLFont(NULL), myLFont(nullptr),
myNFont(NULL), myNFont(nullptr),
myFatalError(NULL) myFatalError(nullptr)
{ {
createFont(); // Font is sized according to available space createFont(); // Font is sized according to available space

View File

@ -31,7 +31,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont, const GUI::Font& nfont,
int x, int y, int w, int h) int x, int y, int w, int h)
: EditableWidget(boss, nfont, x, y, 16, 16), : EditableWidget(boss, nfont, x, y, 16, 16),
myMenu(NULL), myMenu(nullptr),
_rows(0), _rows(0),
_cols(0), _cols(0),
_currentPos(0), _currentPos(0),
@ -77,7 +77,7 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& lfont,
_rows = h / _fontHeight; _rows = h / _fontHeight;
// Create a CheckboxWidget for each row in the list // Create a CheckboxWidget for each row in the list
CheckboxWidget* t = NULL; CheckboxWidget* t = nullptr;
for(int i = 0; i < _rows; ++i) for(int i = 0; i < _rows; ++i)
{ {
t = new CheckboxWidget(boss, lfont, _x + 2, ypos, "", kCheckActionCmd); t = new CheckboxWidget(boss, lfont, _x + 2, ypos, "", kCheckActionCmd);

View File

@ -38,8 +38,8 @@ TiaOutputWidget::TiaOutputWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h) int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h), : Widget(boss, font, x, y, w, h),
CommandSender(boss), CommandSender(boss),
myMenu(NULL), myMenu(nullptr),
myZoom(NULL), myZoom(nullptr),
myClickX(0), myClickX(0),
myClickY(0) myClickY(0)
{ {

View File

@ -32,7 +32,7 @@ TiaZoomWidget::TiaZoomWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h) int x, int y, int w, int h)
: Widget(boss, font, x, y, 16, 16), : Widget(boss, font, x, y, 16, 16),
CommandSender(boss), CommandSender(boss),
myMenu(NULL) myMenu(nullptr)
{ {
_flags = WIDGET_ENABLED | WIDGET_CLEARBG | _flags = WIDGET_ENABLED | WIDGET_CLEARBG |
WIDGET_RETAIN_FOCUS | WIDGET_TRACK_MOUSE; WIDGET_RETAIN_FOCUS | WIDGET_TRACK_MOUSE;

View File

@ -302,7 +302,7 @@ Cartridge::Cartridge(const Settings& settings)
: mySettings(settings), : mySettings(settings),
myStartBank(0), myStartBank(0),
myBankChanged(true), myBankChanged(true),
myCodeAccessBase(NULL), myCodeAccessBase(nullptr),
myBankLocked(false) myBankLocked(false)
{ {
} }
@ -361,7 +361,7 @@ void Cartridge::createCodeAccessBase(uInt32 size)
myCodeAccessBase = new uInt8[size]; myCodeAccessBase = new uInt8[size];
memset(myCodeAccessBase, CartDebug::ROW, size); memset(myCodeAccessBase, CartDebug::ROW, size);
#else #else
myCodeAccessBase = NULL; myCodeAccessBase = nullptr;
#endif #endif
} }

View File

@ -208,7 +208,7 @@ class Cartridge : public Device
of each cart type can be very different from each other. of each cart type can be very different from each other.
*/ */
virtual CartDebugWidget* debugWidget(GuiObject* boss, const GUI::Font& lfont, virtual CartDebugWidget* debugWidget(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont, int x, int y, int w, int h) { return NULL; } const GUI::Font& nfont, int x, int y, int w, int h) { return nullptr; }
// Info about the various bankswitch schemes, useful for displaying // Info about the various bankswitch schemes, useful for displaying
// in GUI dropdown boxes, etc // in GUI dropdown boxes, etc

View File

@ -57,7 +57,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandler::EventHandler(OSystem& osystem) EventHandler::EventHandler(OSystem& osystem)
: myOSystem(osystem), : myOSystem(osystem),
myOverlay(NULL), myOverlay(nullptr),
myState(S_NONE), myState(S_NONE),
myAllowAllDirectionsFlag(false), myAllowAllDirectionsFlag(false),
myFryingFlag(false), myFryingFlag(false),
@ -248,7 +248,7 @@ void EventHandler::poll(uInt64 time)
void EventHandler::handleTextEvent(char text) void EventHandler::handleTextEvent(char text)
{ {
// Text events are only used in GUI mode // Text events are only used in GUI mode
if(myOverlay != NULL) if(myOverlay != nullptr)
myOverlay->handleTextEvent(text); myOverlay->handleTextEvent(text);
} }
@ -546,7 +546,7 @@ void EventHandler::handleKeyEvent(StellaKey key, StellaMod mod, bool state)
// Otherwise, let the event handler deal with it // Otherwise, let the event handler deal with it
if(myState == S_EMULATE) if(myState == S_EMULATE)
handleEvent(myKeyTable[key][kEmulationMode], state); handleEvent(myKeyTable[key][kEmulationMode], state);
else if(myOverlay != NULL) else if(myOverlay != nullptr)
myOverlay->handleKeyEvent(key, mod, state); myOverlay->handleKeyEvent(key, mod, state);
} }
@ -612,7 +612,7 @@ void EventHandler::handleJoyEvent(int stick, int button, uInt8 state)
// Determine which mode we're in, then send the event to the appropriate place // Determine which mode we're in, then send the event to the appropriate place
if(myState == S_EMULATE) if(myState == S_EMULATE)
handleEvent(joy->btnTable[button][kEmulationMode], state); handleEvent(joy->btnTable[button][kEmulationMode], state);
else if(myOverlay != NULL) else if(myOverlay != nullptr)
myOverlay->handleJoyEvent(stick, button, state); myOverlay->handleJoyEvent(stick, button, state);
break; // Regular button break; // Regular button
@ -715,7 +715,7 @@ void EventHandler::handleJoyAxisEvent(int stick, int axis, int value)
} }
} }
} }
else if(myOverlay != NULL) else if(myOverlay != nullptr)
{ {
// First, clamp the values to simulate digital input // First, clamp the values to simulate digital input
// (the only thing that the underlying code understands) // (the only thing that the underlying code understands)
@ -782,7 +782,7 @@ void EventHandler::handleJoyHatEvent(int stick, int hat, int value)
handleEvent(joy->hatTable[hat][EVENT_HATLEFT][kEmulationMode], handleEvent(joy->hatTable[hat][EVENT_HATLEFT][kEmulationMode],
value & EVENT_HATLEFT_M); value & EVENT_HATLEFT_M);
} }
else if(myOverlay != NULL) else if(myOverlay != nullptr)
{ {
if(value == EVENT_HATCENTER_M) if(value == EVENT_HATCENTER_M)
myOverlay->handleJoyHatEvent(stick, hat, EVENT_HATCENTER); myOverlay->handleJoyHatEvent(stick, hat, EVENT_HATCENTER);
@ -1030,7 +1030,7 @@ bool EventHandler::eventStateChange(Event::Type type)
void EventHandler::setActionMappings(EventMode mode) void EventHandler::setActionMappings(EventMode mode)
{ {
int listsize = 0; int listsize = 0;
ActionList* list = NULL; ActionList* list = nullptr;
switch(mode) switch(mode)
{ {
@ -1053,7 +1053,7 @@ void EventHandler::setActionMappings(EventMode mode)
for(int i = 0; i < listsize; ++i) for(int i = 0; i < listsize; ++i)
{ {
Event::Type event = list[i].event; Event::Type event = list[i].event;
free(list[i].key); list[i].key = NULL; free(list[i].key); list[i].key = nullptr;
list[i].key = strdup("None"); list[i].key = strdup("None");
string key = ""; string key = "";
for(int j = 0; j < KBDK_LAST; ++j) // key mapping for(int j = 0; j < KBDK_LAST; ++j) // key mapping
@ -1161,7 +1161,7 @@ void EventHandler::setActionMappings(EventMode mode)
if(key != "") if(key != "")
{ {
free(list[i].key); list[i].key = NULL; free(list[i].key); list[i].key = nullptr;
list[i].key = strdup(key.c_str()); list[i].key = strdup(key.c_str());
} }
} }
@ -1913,7 +1913,7 @@ void EventHandler::setEventState(State state)
switch(myState) switch(myState)
{ {
case S_EMULATE: case S_EMULATE:
myOverlay = NULL; myOverlay = nullptr;
myOSystem.sound().mute(false); myOSystem.sound().mute(false);
enableTextEvents(false); enableTextEvents(false);
if(myOSystem.console().leftController().type() == Controller::CompuMate) if(myOSystem.console().leftController().type() == Controller::CompuMate)
@ -1921,7 +1921,7 @@ void EventHandler::setEventState(State state)
break; break;
case S_PAUSE: case S_PAUSE:
myOverlay = NULL; myOverlay = nullptr;
myOSystem.sound().mute(true); myOSystem.sound().mute(true);
enableTextEvents(false); enableTextEvents(false);
break; break;
@ -1949,7 +1949,7 @@ void EventHandler::setEventState(State state)
#endif #endif
default: default:
myOverlay = NULL; myOverlay = nullptr;
break; break;
} }

View File

@ -437,7 +437,7 @@ class EventHandler
void saveMapping(); void saveMapping();
const StellaJoystick* joy(int id) const { const StellaJoystick* joy(int id) const {
return id < (int)mySticks.size() ? mySticks[id] : NULL; return id < (int)mySticks.size() ? mySticks[id] : nullptr;
} }
private: private:
@ -445,7 +445,7 @@ class EventHandler
struct StickInfo struct StickInfo
{ {
StickInfo(const string& map = EmptyString, StellaJoystick* stick = NULL) StickInfo(const string& map = EmptyString, StellaJoystick* stick = nullptr)
: mapping(map), joy(stick) {} : mapping(map), joy(stick) {}
string mapping; string mapping;

View File

@ -35,20 +35,20 @@ EventHandler::StellaJoystick::StellaJoystick()
numAxes(0), numAxes(0),
numButtons(0), numButtons(0),
numHats(0), numHats(0),
axisTable(NULL), axisTable(nullptr),
btnTable(NULL), btnTable(nullptr),
hatTable(NULL), hatTable(nullptr),
axisLastValue(NULL) axisLastValue(nullptr)
{ {
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
EventHandler::StellaJoystick::~StellaJoystick() EventHandler::StellaJoystick::~StellaJoystick()
{ {
delete[] axisTable; axisTable = NULL; delete[] axisTable; axisTable = nullptr;
delete[] btnTable; btnTable = NULL; delete[] btnTable; btnTable = nullptr;
delete[] hatTable; hatTable = NULL; delete[] hatTable; hatTable = nullptr;
delete[] axisLastValue; axisLastValue = NULL; delete[] axisLastValue; axisLastValue = nullptr;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -358,7 +358,7 @@ int EventHandler::JoystickHandler::remove(int index)
// Sticks that are removed must have initially been added // Sticks that are removed must have initially been added
// So we use the 'active' joystick list to access them // So we use the 'active' joystick list to access them
if(index >= 0 && index < (int)mySticks.size() && mySticks[index] != NULL) if(index >= 0 && index < (int)mySticks.size() && mySticks[index] != nullptr)
{ {
StellaJoystick* stick = mySticks[index]; StellaJoystick* stick = mySticks[index];
@ -372,8 +372,8 @@ int EventHandler::JoystickHandler::remove(int index)
// Remove joystick, but remember mapping // Remove joystick, but remember mapping
it->second.mapping = stick->getMap(); it->second.mapping = stick->getMap();
delete it->second.joy; it->second.joy = NULL; delete it->second.joy; it->second.joy = nullptr;
mySticks[index] = NULL; mySticks[index] = nullptr;
return index; return index;
} }

View File

@ -22,7 +22,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FBSurface::FBSurface() FBSurface::FBSurface()
: myPixels(NULL), : myPixels(nullptr),
myPitch(0) myPitch(0)
{ {
// NOTE: myPixels and myPitch MUST be set in child classes that inherit // NOTE: myPixels and myPitch MUST be set in child classes that inherit
@ -284,4 +284,4 @@ void FBSurface::drawString(const GUI::Font& font, const string& s,
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const uInt32* FBSurface::myPalette = 0; const uInt32* FBSurface::myPalette = nullptr;

View File

@ -933,7 +933,7 @@ FrameBuffer::VideoModeList::~VideoModeList()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void FrameBuffer::VideoModeList::add(const VideoMode& mode) void FrameBuffer::VideoModeList::add(const VideoMode& mode)
{ {
myModeList.push_back(mode); myModeList.emplace_back(mode);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -213,7 +213,7 @@ class FrameBuffer
Retrieve the surface associated with the given ID. Retrieve the surface associated with the given ID.
@param id The ID for the surface to retrieve. @param id The ID for the surface to retrieve.
@return A pointer to a valid surface object, or NULL. @return A pointer to a valid surface object, or nullptr.
*/ */
FBSurface* surface(uInt32 id) const; FBSurface* surface(uInt32 id) const;
@ -494,9 +494,8 @@ class FrameBuffer
friend ostream& operator<<(ostream& os, const VideoModeList& l) friend ostream& operator<<(ostream& os, const VideoModeList& l)
{ {
for(vector<VideoMode>::const_iterator i = l.myModeList.begin(); for(const auto& vm: l.myModeList)
i != l.myModeList.end(); ++i) os << "-----\n" << vm << endl << "-----\n";
os << "-----\n" << *i << endl << "-----\n";
return os; return os;
} }

View File

@ -65,10 +65,10 @@ M6502::M6502(const Settings& settings)
myDataAddressForPoke(0) myDataAddressForPoke(0)
{ {
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
myDebugger = NULL; myDebugger = nullptr;
myBreakPoints = NULL; myBreakPoints = nullptr;
myReadTraps = NULL; myReadTraps = nullptr;
myWriteTraps = NULL; myWriteTraps = nullptr;
myJustHitTrapFlag = false; myJustHitTrapFlag = false;
#endif #endif
@ -150,7 +150,7 @@ inline uInt8 M6502::peek(uInt16 address, uInt8 flags)
mySystem->incrementCycles(SYSTEM_CYCLES_PER_CPU); mySystem->incrementCycles(SYSTEM_CYCLES_PER_CPU);
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
if(myReadTraps != NULL && myReadTraps->isSet(address)) if(myReadTraps != nullptr && myReadTraps->isSet(address))
{ {
myJustHitTrapFlag = true; myJustHitTrapFlag = true;
myHitTrapInfo.message = "RTrap: "; myHitTrapInfo.message = "RTrap: ";
@ -179,7 +179,7 @@ inline void M6502::poke(uInt16 address, uInt8 value)
mySystem->incrementCycles(SYSTEM_CYCLES_PER_CPU); mySystem->incrementCycles(SYSTEM_CYCLES_PER_CPU);
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
if(myWriteTraps != NULL && myWriteTraps->isSet(address)) if(myWriteTraps != nullptr && myWriteTraps->isSet(address))
{ {
myJustHitTrapFlag = true; myJustHitTrapFlag = true;
myHitTrapInfo.message = "WTrap: "; myHitTrapInfo.message = "WTrap: ";
@ -213,7 +213,7 @@ bool M6502::execute(uInt32 number)
} }
} }
if(myBreakPoints != NULL) if(myBreakPoints != nullptr)
{ {
if(myBreakPoints->isSet(PC)) if(myBreakPoints->isSet(PC))
{ {

View File

@ -194,7 +194,7 @@ void OSystem::saveConfig()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void OSystem::createDebugger(Console& console) void OSystem::createDebugger(Console& console)
{ {
delete myDebugger; myDebugger = NULL; delete myDebugger; myDebugger = nullptr;
myDebugger = new Debugger(*this, console); myDebugger = new Debugger(*this, console);
myDebugger->initialize(); myDebugger->initialize();
} }
@ -437,9 +437,9 @@ void OSystem::deleteConsole()
<< endl; << endl;
logMessage(buf.str(), 1); logMessage(buf.str(), 1);
delete myConsole; myConsole = NULL; delete myConsole; myConsole = nullptr;
#ifdef DEBUGGER_SUPPORT #ifdef DEBUGGER_SUPPORT
delete myDebugger; myDebugger = NULL; delete myDebugger; myDebugger = nullptr;
#endif #endif
} }
} }
@ -520,7 +520,7 @@ Console* OSystem::openConsole(const FilesystemNode& romfile, string& md5,
s = mySettings->getString(cl_name); \ s = mySettings->getString(cl_name); \
if(s != "") props.set(prop_name, s); if(s != "") props.set(prop_name, s);
Console* console = (Console*) NULL; Console* console = nullptr;
// Open the cartridge image and read it in // Open the cartridge image and read it in
uInt8* image = 0; uInt8* image = 0;

View File

@ -129,7 +129,7 @@ class OSystem
@return The console object @return The console object
*/ */
Console& console() const { return *myConsole; } Console& console() const { return *myConsole; }
bool hasConsole() const { return myConsole != NULL; } bool hasConsole() const { return myConsole != nullptr; }
/** /**
Get the serial port of the system. Get the serial port of the system.
@ -564,7 +564,7 @@ class OSystem
@param type The bankswitch type of the ROM @param type The bankswitch type of the ROM
@param id The additional id (if any) used by the ROM @param id The additional id (if any) used by the ROM
@return The actual Console object, otherwise NULL @return The actual Console object, otherwise nullptr
(calling method is responsible for deleting it) (calling method is responsible for deleting it)
*/ */
Console* openConsole(const FilesystemNode& romfile, string& md5, Console* openConsole(const FilesystemNode& romfile, string& md5,

View File

@ -25,7 +25,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serializer::Serializer(const string& filename, bool readonly) Serializer::Serializer(const string& filename, bool readonly)
: myStream(NULL), : myStream(nullptr),
myUseFilestream(true) myUseFilestream(true)
{ {
if(readonly) if(readonly)
@ -70,7 +70,7 @@ Serializer::Serializer(const string& filename, bool readonly)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serializer::Serializer() Serializer::Serializer()
: myStream(NULL), : myStream(nullptr),
myUseFilestream(false) myUseFilestream(false)
{ {
myStream = new stringstream(ios::in | ios::out | ios::binary); myStream = new stringstream(ios::in | ios::out | ios::binary);
@ -88,20 +88,20 @@ Serializer::Serializer()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Serializer::~Serializer() Serializer::~Serializer()
{ {
if(myStream != NULL) if(myStream != nullptr)
{ {
if(myUseFilestream) if(myUseFilestream)
((fstream*)myStream)->close(); ((fstream*)myStream)->close();
delete myStream; delete myStream;
myStream = NULL; myStream = nullptr;
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Serializer::valid() const bool Serializer::valid() const
{ {
return myStream != NULL; return myStream != nullptr;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -33,7 +33,7 @@ CheckListWidget::CheckListWidget(GuiObject* boss, const GUI::Font& font,
_rows = h / _fontHeight; _rows = h / _fontHeight;
// Create a CheckboxWidget for each row in the list // Create a CheckboxWidget for each row in the list
CheckboxWidget* t = NULL; CheckboxWidget* t = nullptr;
for(int i = 0; i < _rows; ++i) for(int i = 0; i < _rows; ++i)
{ {
t = new CheckboxWidget(boss, font, _x + 2, ypos, "", kCheckActionCmd); t = new CheckboxWidget(boss, font, _x + 2, ypos, "", kCheckActionCmd);

View File

@ -33,10 +33,10 @@ ConfigPathDialog::ConfigPathDialog(
OSystem& osystem, DialogContainer& parent, OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, GuiObject* boss, const GUI::Font& font, GuiObject* boss,
int max_w, int max_h) int max_w, int max_h)
: Dialog(osystem, parent, 0, 0, 0, 0), : Dialog(osystem, parent),
CommandSender(boss), CommandSender(boss),
myBrowser(NULL), myBrowser(nullptr),
myIsGlobal(boss != 0) myIsGlobal(boss != nullptr)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = font.getMaxCharWidth(),

View File

@ -59,7 +59,7 @@ Dialog::~Dialog()
_myTabList.clear(); _myTabList.clear();
delete _firstWidget; delete _firstWidget;
_firstWidget = NULL; _firstWidget = nullptr;
_buttonGroup.clear(); _buttonGroup.clear();
} }
@ -70,7 +70,7 @@ void Dialog::open(bool refresh)
// Make sure we have a valid surface to draw into // Make sure we have a valid surface to draw into
// Technically, this shouldn't be needed until drawDialog(), but some // Technically, this shouldn't be needed until drawDialog(), but some
// dialogs cause drawing to occur within loadConfig() // dialogs cause drawing to occur within loadConfig()
if(_surface == NULL) if(_surface == nullptr)
{ {
uInt32 surfaceID = instance().frameBuffer().allocateSurface(_w, _h); uInt32 surfaceID = instance().frameBuffer().allocateSurface(_w, _h);
_surface = instance().frameBuffer().surface(surfaceID); _surface = instance().frameBuffer().surface(surfaceID);

View File

@ -48,7 +48,7 @@ class Dialog : public GuiObject
public: public:
Dialog(OSystem& instance, DialogContainer& parent, Dialog(OSystem& instance, DialogContainer& parent,
int x, int y, int w, int h); int x = 0, int y = 0, int w = 0, int h = 0);
virtual ~Dialog(); virtual ~Dialog();

View File

@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DialogContainer::DialogContainer(OSystem& osystem) DialogContainer::DialogContainer(OSystem& osystem)
: myOSystem(osystem), : myOSystem(osystem),
myBaseDialog(NULL), myBaseDialog(nullptr),
myTime(0) myTime(0)
{ {
reset(); reset();
@ -37,8 +37,7 @@ DialogContainer::DialogContainer(OSystem& osystem)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DialogContainer::~DialogContainer() DialogContainer::~DialogContainer()
{ {
if(myBaseDialog) delete myBaseDialog;
delete myBaseDialog;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -98,7 +98,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
myComboDialog = new ComboDialog(boss, font, combolist); myComboDialog = new ComboDialog(boss, font, combolist);
} }
else else
myComboButton = NULL; myComboButton = nullptr;
// Show message for currently selected event // Show message for currently selected event
xpos = 10; ypos = 5 + myActionsList->getHeight() + 5; xpos = 10; ypos = 5 + myActionsList->getHeight() + 5;

View File

@ -46,8 +46,8 @@ typedef struct
int size; /* font size in glyphs */ int size; /* font size in glyphs */
const uInt16* bits; /* 16-bit right-padded bitmap data */ const uInt16* bits; /* 16-bit right-padded bitmap data */
const uInt32* offset; /* offsets into bitmap data*/ const uInt32* offset; /* offsets into bitmap data*/
const uInt8* width; /* character widths or NULL if fixed */ const uInt8* width; /* character widths or nullptr if fixed */
const BBX* bbx; /* character bounding box or NULL if fixed */ const BBX* bbx; /* character bounding box or nullptr if fixed */
int defaultchar; /* default char (not glyph index) */ int defaultchar; /* default char (not glyph index) */
long bits_size; /* # words of bitmap_t bits */ long bits_size; /* # words of bitmap_t bits */
} FontDesc; } FontDesc;

View File

@ -48,18 +48,18 @@
LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent, LauncherDialog::LauncherDialog(OSystem& osystem, DialogContainer& parent,
int x, int y, int w, int h) int x, int y, int w, int h)
: Dialog(osystem, parent, x, y, w, h), : Dialog(osystem, parent, x, y, w, h),
myStartButton(NULL), myStartButton(nullptr),
myPrevDirButton(NULL), myPrevDirButton(nullptr),
myOptionsButton(NULL), myOptionsButton(nullptr),
myQuitButton(NULL), myQuitButton(nullptr),
myList(NULL), myList(nullptr),
myGameList(NULL), myGameList(nullptr),
myRomInfoWidget(NULL), myRomInfoWidget(nullptr),
myMenu(NULL), myMenu(nullptr),
myGlobalProps(NULL), myGlobalProps(nullptr),
myFilters(NULL), myFilters(nullptr),
myFirstRunMsg(NULL), myFirstRunMsg(nullptr),
myRomDir(NULL), myRomDir(nullptr),
mySelectedItem(0) mySelectedItem(0)
{ {
const GUI::Font& font = instance().frameBuffer().launcherFont(); const GUI::Font& font = instance().frameBuffer().launcherFont();

View File

@ -38,7 +38,7 @@
LoggerDialog::LoggerDialog(OSystem& osystem, DialogContainer& parent, LoggerDialog::LoggerDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h) const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, 0, 0, 0, 0), : Dialog(osystem, parent, 0, 0, 0, 0),
myLogInfo(NULL) myLogInfo(nullptr)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
buttonWidth = font.getStringWidth("Save log to disk") + 20, buttonWidth = font.getStringWidth("Save log to disk") + 20,

View File

@ -48,18 +48,18 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent, OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
GuiObject* boss, int max_w, int max_h, bool global) GuiObject* boss, int max_w, int max_h, bool global)
: Dialog(osystem, parent, 0, 0, 0, 0), : Dialog(osystem, parent),
myVideoDialog(NULL), myVideoDialog(nullptr),
myAudioDialog(NULL), myAudioDialog(nullptr),
myInputDialog(NULL), myInputDialog(nullptr),
myUIDialog(NULL), myUIDialog(nullptr),
mySnapshotDialog(NULL), mySnapshotDialog(nullptr),
myConfigPathDialog(NULL), myConfigPathDialog(nullptr),
myGameInfoDialog(NULL), myGameInfoDialog(nullptr),
myCheatCodeDialog(NULL), myCheatCodeDialog(nullptr),
myLoggerDialog(NULL), myLoggerDialog(nullptr),
myHelpDialog(NULL), myHelpDialog(nullptr),
myAboutDialog(NULL), myAboutDialog(nullptr),
myIsGlobal(global) myIsGlobal(global)
{ {
const GUI::Font& font = instance().frameBuffer().font(); const GUI::Font& font = instance().frameBuffer().font();
@ -72,7 +72,7 @@ OptionsDialog::OptionsDialog(OSystem& osystem, DialogContainer& parent,
int xoffset = 10, yoffset = 10; int xoffset = 10, yoffset = 10;
WidgetArray wid; WidgetArray wid;
ButtonWidget* b = NULL; ButtonWidget* b = nullptr;
b = addODButton("Video Settings", kVidCmd); b = addODButton("Video Settings", kVidCmd);
wid.push_back(b); wid.push_back(b);

View File

@ -29,8 +29,8 @@
ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font, ProgressDialog::ProgressDialog(GuiObject* boss, const GUI::Font& font,
const string& message) const string& message)
: Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16), : Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16),
myMessage(NULL), myMessage(nullptr),
mySlider(NULL), mySlider(nullptr),
myStart(0), myStart(0),
myFinish(0), myFinish(0),
myStep(0), myStep(0),

View File

@ -36,9 +36,9 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent, RomAuditDialog::RomAuditDialog(OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, int max_w, int max_h) const GUI::Font& font, int max_w, int max_h)
: Dialog(osystem, parent, 0, 0, 0, 0), : Dialog(osystem, parent),
myBrowser(NULL), myBrowser(nullptr),
myConfirmMsg(NULL), myConfirmMsg(nullptr),
myMaxWidth(max_w), myMaxWidth(max_w),
myMaxHeight(max_h) myMaxHeight(max_h)
{ {

View File

@ -28,7 +28,7 @@
RomInfoWidget::RomInfoWidget(GuiObject* boss, const GUI::Font& font, RomInfoWidget::RomInfoWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h) int x, int y, int w, int h)
: Widget(boss, font, x, y, w, h), : Widget(boss, font, x, y, w, h),
mySurface(NULL), mySurface(nullptr),
mySurfaceIsValid(false), mySurfaceIsValid(false),
myHaveProperties(false), myHaveProperties(false),
myAvail(w > 400 ? GUI::Size(640, 512) : GUI::Size(320, 256)) myAvail(w > 400 ? GUI::Size(640, 512) : GUI::Size(320, 256))
@ -90,7 +90,7 @@ void RomInfoWidget::parseProperties()
// Check if a surface has ever been created; if so, we use it // Check if a surface has ever been created; if so, we use it
// The surface will always be the maximum size, but sometimes we'll // The surface will always be the maximum size, but sometimes we'll
// only draw certain parts of it // only draw certain parts of it
if(mySurface == NULL) if(mySurface == nullptr)
{ {
uInt32 ID = instance().frameBuffer().allocateSurface(320*2, 256*2); uInt32 ID = instance().frameBuffer().allocateSurface(320*2, 256*2);
mySurface = instance().frameBuffer().surface(ID); mySurface = instance().frameBuffer().surface(ID);

View File

@ -33,8 +33,8 @@ SnapshotDialog::SnapshotDialog(
OSystem& osystem, DialogContainer& parent, OSystem& osystem, DialogContainer& parent,
const GUI::Font& font, GuiObject* boss, const GUI::Font& font, GuiObject* boss,
int max_w, int max_h) int max_w, int max_h)
: Dialog(osystem, parent, 0, 0, 0, 0), : Dialog(osystem, parent),
myBrowser(NULL) myBrowser(nullptr)
{ {
const int lineHeight = font.getLineHeight(), const int lineHeight = font.getLineHeight(),
fontWidth = font.getMaxCharWidth(), fontWidth = font.getMaxCharWidth(),
@ -128,13 +128,12 @@ SnapshotDialog::SnapshotDialog(
addToFocusList(wid); addToFocusList(wid);
// Create file browser dialog // Create file browser dialog
myBrowser = new BrowserDialog(this, font, max_w, max_h); myBrowser = make_ptr<BrowserDialog>(this, font, max_w, max_h);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SnapshotDialog::~SnapshotDialog() SnapshotDialog::~SnapshotDialog()
{ {
delete myBrowser;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -56,7 +56,7 @@ class SnapshotDialog : public Dialog
kSnapLoadDirChosenCmd = 'snlc' // snap chosen (load files) kSnapLoadDirChosenCmd = 'snlc' // snap chosen (load files)
}; };
BrowserDialog* myBrowser; unique_ptr<BrowserDialog> myBrowser;
// Config paths // Config paths
EditTextWidget* mySnapSavePath; EditTextWidget* mySnapSavePath;

View File

@ -59,7 +59,7 @@ Widget::Widget(GuiObject* boss, const GUI::Font& font,
Widget::~Widget() Widget::~Widget()
{ {
delete _next; delete _next;
_next = NULL; _next = nullptr;
_focusList.clear(); _focusList.clear();
} }

View File

@ -24,7 +24,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SerialPortWINDOWS::SerialPortWINDOWS() SerialPortWINDOWS::SerialPortWINDOWS()
: SerialPort(), : SerialPort(),
myHandle(NULL) myHandle(0)
{ {
} }
@ -73,7 +73,7 @@ void SerialPortWINDOWS::closePort()
if(myHandle) if(myHandle)
{ {
CloseHandle(myHandle); CloseHandle(myHandle);
myHandle = NULL; myHandle = 0;
} }
} }