mirror of https://github.com/stella-emu/stella.git
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:
parent
5d6ca08617
commit
a9aa84e3a3
|
@ -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();
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -121,8 +121,8 @@ bool FilesystemNodePOSIX::getChildren(AbstractFSList& myList, ListMode mode,
|
||||||
{
|
{
|
||||||
assert(_isDirectory);
|
assert(_isDirectory);
|
||||||
|
|
||||||
DIR *dirp = opendir(_path.c_str());
|
DIR* dirp = opendir(_path.c_str());
|
||||||
struct dirent *dp;
|
struct dirent* dp;
|
||||||
|
|
||||||
if (dirp == NULL)
|
if (dirp == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
@ -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);
|
||||||
|
|
|
@ -63,10 +63,10 @@ const char* lastPathComponent(const string& str)
|
||||||
if(str.empty())
|
if(str.empty())
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
const char *start = str.c_str();
|
const char* start = str.c_str();
|
||||||
const char *cur = start + str.size() - 2;
|
const char* cur = start + str.size() - 2;
|
||||||
|
|
||||||
while (cur >= start && *cur != '\\')
|
while(cur >= start && *cur != '\\')
|
||||||
--cur;
|
--cur;
|
||||||
|
|
||||||
return cur + 1;
|
return cur + 1;
|
||||||
|
@ -103,7 +103,7 @@ void FilesystemNodeWINDOWS::setFlags()
|
||||||
// Check whether it is a directory, and whether the file actually exists
|
// Check whether it is a directory, and whether the file actually exists
|
||||||
DWORD fileAttribs = GetFileAttributes(toUnicode(_path.c_str()));
|
DWORD fileAttribs = GetFileAttributes(toUnicode(_path.c_str()));
|
||||||
|
|
||||||
if (fileAttribs == INVALID_FILE_ATTRIBUTES)
|
if(fileAttribs == INVALID_FILE_ATTRIBUTES)
|
||||||
{
|
{
|
||||||
_isDirectory = _isFile = _isValid = false;
|
_isDirectory = _isFile = _isValid = false;
|
||||||
}
|
}
|
||||||
|
@ -129,14 +129,14 @@ void FilesystemNodeWINDOWS::addFile(AbstractFSList& list, ListMode mode,
|
||||||
bool isDirectory, isFile;
|
bool isDirectory, isFile;
|
||||||
|
|
||||||
// Skip local directory (.) and parent (..)
|
// Skip local directory (.) and parent (..)
|
||||||
if (!strncmp(asciiName, ".", 1) || !strncmp(asciiName, "..", 2))
|
if(!strncmp(asciiName, ".", 1) || !strncmp(asciiName, "..", 2))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false);
|
isDirectory = (find_data->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ? true : false);
|
||||||
isFile = !isDirectory;//(find_data->dwFileAttributes & FILE_ATTRIBUTE_NORMAL ? true : false);
|
isFile = !isDirectory;//(find_data->dwFileAttributes & FILE_ATTRIBUTE_NORMAL ? true : false);
|
||||||
|
|
||||||
if ((isFile && mode == FilesystemNode::kListDirectoriesOnly) ||
|
if((isFile && mode == FilesystemNode::kListDirectoriesOnly) ||
|
||||||
(isDirectory && mode == FilesystemNode::kListFilesOnly))
|
(isDirectory && mode == FilesystemNode::kListFilesOnly))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
entry._isDirectory = isDirectory;
|
entry._isDirectory = isDirectory;
|
||||||
|
@ -144,7 +144,7 @@ void FilesystemNodeWINDOWS::addFile(AbstractFSList& list, ListMode mode,
|
||||||
entry._displayName = asciiName;
|
entry._displayName = asciiName;
|
||||||
entry._path = base;
|
entry._path = base;
|
||||||
entry._path += asciiName;
|
entry._path += asciiName;
|
||||||
if (entry._isDirectory)
|
if(entry._isDirectory)
|
||||||
entry._path += "\\";
|
entry._path += "\\";
|
||||||
entry._isValid = true;
|
entry._isValid = true;
|
||||||
entry._isPseudoRoot = false;
|
entry._isPseudoRoot = false;
|
||||||
|
@ -224,14 +224,14 @@ bool FilesystemNodeWINDOWS::
|
||||||
|
|
||||||
//TODO: honor the hidden flag
|
//TODO: honor the hidden flag
|
||||||
|
|
||||||
if (_isPseudoRoot)
|
if(_isPseudoRoot)
|
||||||
{
|
{
|
||||||
// Drives enumeration
|
// Drives enumeration
|
||||||
TCHAR drive_buffer[100];
|
TCHAR drive_buffer[100];
|
||||||
GetLogicalDriveStrings(sizeof(drive_buffer) / sizeof(TCHAR), drive_buffer);
|
GetLogicalDriveStrings(sizeof(drive_buffer) / sizeof(TCHAR), drive_buffer);
|
||||||
|
|
||||||
for (TCHAR *current_drive = drive_buffer; *current_drive;
|
for(TCHAR *current_drive = drive_buffer; *current_drive;
|
||||||
current_drive += _tcslen(current_drive) + 1)
|
current_drive += _tcslen(current_drive) + 1)
|
||||||
{
|
{
|
||||||
FilesystemNodeWINDOWS entry;
|
FilesystemNodeWINDOWS entry;
|
||||||
char drive_name[2];
|
char drive_name[2];
|
||||||
|
@ -258,12 +258,12 @@ bool FilesystemNodeWINDOWS::
|
||||||
|
|
||||||
handle = FindFirstFile(toUnicode(searchPath), &desc);
|
handle = FindFirstFile(toUnicode(searchPath), &desc);
|
||||||
|
|
||||||
if (handle == INVALID_HANDLE_VALUE)
|
if(handle == INVALID_HANDLE_VALUE)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
addFile(myList, mode, _path.c_str(), &desc);
|
addFile(myList, mode, _path.c_str(), &desc);
|
||||||
|
|
||||||
while (FindNextFile(handle, &desc))
|
while(FindNextFile(handle, &desc))
|
||||||
addFile(myList, mode, _path.c_str(), &desc);
|
addFile(myList, mode, _path.c_str(), &desc);
|
||||||
|
|
||||||
FindClose(handle);
|
FindClose(handle);
|
||||||
|
@ -299,14 +299,14 @@ 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)
|
||||||
{
|
{
|
||||||
const char *start = _path.c_str();
|
const char* start = _path.c_str();
|
||||||
const char *end = lastPathComponent(_path);
|
const char* end = lastPathComponent(_path);
|
||||||
|
|
||||||
p->_path = string(start, end - start);
|
p->_path = string(start, end - start);
|
||||||
p->_isValid = true;
|
p->_isValid = true;
|
||||||
|
|
Loading…
Reference in New Issue