Some more nullptr and formatting cleanups.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3051 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-11-07 14:26:56 +00:00
parent 5d6ca08617
commit a9aa84e3a3
9 changed files with 32 additions and 33 deletions

View File

@ -26,7 +26,7 @@ class BankRomCheat : public Cheat
{ {
public: public:
BankRomCheat(OSystem& os, const string& name, const string& code); BankRomCheat(OSystem& os, const string& name, const string& code);
~BankRomCheat(); virtual ~BankRomCheat();
bool enable(); bool enable();
bool disable(); bool disable();

View File

@ -53,7 +53,7 @@ class Cheat
{ {
int ret = 0; int ret = 0;
for(unsigned int i=0; i<hex.size(); i++) { for(unsigned int i = 0; i < hex.size(); ++i) {
char c = hex[i]; char c = hex[i];
ret *= 16; ret *= 16;

View File

@ -86,7 +86,7 @@ CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent,
StringList labels; StringList labels;
labels.push_back("Name: "); labels.push_back("Name: ");
labels.push_back("Code: "); labels.push_back("Code: ");
myCheatInput = new InputTextDialog(this, font, labels); myCheatInput = make_ptr<InputTextDialog>(this, font, labels);
myCheatInput->setTarget(this); myCheatInput->setTarget(this);
addToFocusList(wid); addToFocusList(wid);
@ -100,7 +100,6 @@ CheatCodeDialog::CheatCodeDialog(OSystem& osystem, DialogContainer& parent,
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CheatCodeDialog::~CheatCodeDialog() CheatCodeDialog::~CheatCodeDialog()
{ {
delete myCheatInput;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -41,7 +41,7 @@ class CheatCodeDialog : public Dialog
virtual ~CheatCodeDialog(); virtual ~CheatCodeDialog();
protected: protected:
virtual void handleCommand(CommandSender* sender, int cmd, int data, int id); void handleCommand(CommandSender* sender, int cmd, int data, int id);
void loadConfig(); void loadConfig();
void saveConfig(); void saveConfig();
@ -53,7 +53,7 @@ class CheatCodeDialog : public Dialog
private: private:
CheckListWidget* myCheatList; CheckListWidget* myCheatList;
InputTextDialog* myCheatInput; unique_ptr<InputTextDialog> myCheatInput;
ButtonWidget* myEditButton; ButtonWidget* myEditButton;
ButtonWidget* myRemoveButton; ButtonWidget* myRemoveButton;

View File

@ -52,7 +52,7 @@ Cheat* CheatManager::add(const string& name, const string& code,
{ {
Cheat* cheat = createCheat(name, code); Cheat* cheat = createCheat(name, code);
if(!cheat) if(!cheat)
return NULL; return nullptr;
// Delete duplicate entries // Delete duplicate entries
for(unsigned int i = 0; i < myCheatList.size(); i++) for(unsigned int i = 0; i < myCheatList.size(); i++)
@ -129,7 +129,7 @@ void CheatManager::addPerFrame(Cheat* cheat, bool enable)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CheatManager::addOneShot(const string& name, const string& code) void CheatManager::addOneShot(const string& name, const string& code)
{ {
Cheat* cheat = (Cheat*) createCheat(name, code); Cheat* cheat = createCheat(name, code);
if(!cheat) if(!cheat)
return; return;
@ -142,7 +142,7 @@ void CheatManager::addOneShot(const string& name, const string& code)
Cheat* CheatManager::createCheat(const string& name, const string& code) const Cheat* CheatManager::createCheat(const string& name, const string& code) const
{ {
if(!isValidCode(code)) if(!isValidCode(code))
return NULL; return nullptr;
// Create new cheat based on string length // Create new cheat based on string length
switch(code.size()) switch(code.size())
@ -160,7 +160,7 @@ Cheat* CheatManager::createCheat(const string& name, const string& code) const
break; break;
default: default:
return NULL; return nullptr;
} }
} }

View File

@ -26,7 +26,7 @@ class CheetahCheat : public Cheat
{ {
public: public:
CheetahCheat(OSystem& os, const string& name, const string& code); CheetahCheat(OSystem& os, const string& name, const string& code);
~CheetahCheat(); virtual ~CheetahCheat();
bool enable(); bool enable();
bool disable(); bool disable();

View File

@ -38,7 +38,7 @@ using namespace Common;
CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem) CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
: DebuggerSystem(dbg, console), : DebuggerSystem(dbg, console),
myOSystem(osystem), myOSystem(osystem),
myDebugWidget(0), myDebugWidget(nullptr),
myAddrToLineIsROM(true), myAddrToLineIsROM(true),
myRWPortAddress(0), myRWPortAddress(0),
myLabelLength(8) // longest pre-defined label myLabelLength(8) // longest pre-defined label

View File

@ -254,7 +254,7 @@ bool FilesystemNodePOSIX::rename(const string& newfile)
AbstractFSNode* FilesystemNodePOSIX::getParent() const AbstractFSNode* FilesystemNodePOSIX::getParent() const
{ {
if (_path == "/") if (_path == "/")
return 0; return nullptr;
const char *start = _path.c_str(); const char *start = _path.c_str();
const char *end = lastPathComponent(_path); const char *end = lastPathComponent(_path);

View File

@ -300,7 +300,7 @@ bool FilesystemNodeWINDOWS::rename(const string& newfile)
AbstractFSNode* FilesystemNodeWINDOWS::getParent() const AbstractFSNode* FilesystemNodeWINDOWS::getParent() const
{ {
if(!_isValid || _isPseudoRoot) if(!_isValid || _isPseudoRoot)
return 0; return nullptr;
FilesystemNodeWINDOWS* p = new FilesystemNodeWINDOWS(); FilesystemNodeWINDOWS* p = new FilesystemNodeWINDOWS();
if(_path.size() > 3) if(_path.size() > 3)