Some minor code cleanups, and converting 0 to nullptr.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3106 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-12-13 21:00:33 +00:00
parent 31ca88d283
commit 6c900cdec5
21 changed files with 32 additions and 32 deletions

View File

@ -28,7 +28,7 @@ FilesystemNodeZIP::FilesystemNodeZIP()
_numFiles(0) _numFiles(0)
{ {
// We need a name, else the node is invalid // We need a name, else the node is invalid
AbstractFSNode* tmp = 0; AbstractFSNode* tmp = nullptr;
_realNode = shared_ptr<AbstractFSNode>(tmp); _realNode = shared_ptr<AbstractFSNode>(tmp);
} }

View File

@ -449,7 +449,7 @@ bool SoundSDL2::load(Serializer& in)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SoundSDL2::RegWriteQueue::RegWriteQueue(uInt32 capacity) SoundSDL2::RegWriteQueue::RegWriteQueue(uInt32 capacity)
: myCapacity(capacity), : myCapacity(capacity),
myBuffer(0), myBuffer(nullptr),
mySize(0), mySize(0),
myHead(0), myHead(0),
myTail(0) myTail(0)

View File

@ -58,7 +58,7 @@
#include "Debugger.hxx" #include "Debugger.hxx"
Debugger* Debugger::myStaticDebugger = 0; Debugger* Debugger::myStaticDebugger = nullptr;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
static const char* builtin_functions[][3] = { static const char* builtin_functions[][3] = {

View File

@ -40,7 +40,7 @@ CartRamWidget::CartRamWidget(
const int bwidth = lfont.getStringWidth("Compare "), const int bwidth = lfont.getStringWidth("Compare "),
bheight = myLineHeight + 2; bheight = myLineHeight + 2;
EditTextWidget* etw = 0; EditTextWidget* etw = nullptr;
ostringstream buf; ostringstream buf;
int xpos = 2, ypos = 5; int xpos = 2, ypos = 5;

View File

@ -26,7 +26,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
RomListSettings::RomListSettings(GuiObject* boss, const GUI::Font& font) RomListSettings::RomListSettings(GuiObject* boss, const GUI::Font& font)
: Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16), : Dialog(boss->instance(), boss->parent()),
CommandSender(boss), CommandSender(boss),
_xorig(0), _xorig(0),
_yorig(0), _yorig(0),

View File

@ -73,7 +73,7 @@
Cartridge* Cartridge::create(const uInt8* image, uInt32 size, string& md5, Cartridge* Cartridge::create(const uInt8* image, uInt32 size, string& md5,
string& dtype, string& id, const OSystem& osystem, Settings& settings) string& dtype, string& id, const OSystem& osystem, Settings& settings)
{ {
Cartridge* cartridge = 0; Cartridge* cartridge = nullptr;
string type = dtype; string type = dtype;
// Collect some info about the ROM // Collect some info about the ROM
@ -313,8 +313,7 @@ Cartridge::Cartridge(const Settings& settings)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge::~Cartridge() Cartridge::~Cartridge()
{ {
if(myCodeAccessBase) delete[] myCodeAccessBase;
delete[] myCodeAccessBase;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -372,7 +371,7 @@ void Cartridge::createCodeAccessBase(uInt32 size)
string Cartridge::autodetectType(const uInt8* image, uInt32 size) string Cartridge::autodetectType(const uInt8* image, uInt32 size)
{ {
// Guess type based on size // Guess type based on size
const char* type = 0; const char* type = nullptr;
if((size % 8448) == 0 || size == 6144) if((size % 8448) == 0 || size == 6144)
{ {

View File

@ -40,7 +40,7 @@ FilesystemNode::FilesystemNode(AbstractFSNode *realNode)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FilesystemNode::FilesystemNode(const string& p) FilesystemNode::FilesystemNode(const string& p)
{ {
AbstractFSNode* tmp = 0; AbstractFSNode* tmp = nullptr;
// Is this potentially a ZIP archive? // Is this potentially a ZIP archive?
if(BSPF_containsIgnoreCase(p, ".zip")) if(BSPF_containsIgnoreCase(p, ".zip"))

View File

@ -206,7 +206,7 @@ class FrameBuffer
@return A pointer to a valid surface object, or nullptr. @return A pointer to a valid surface object, or nullptr.
*/ */
shared_ptr<FBSurface> allocateSurface(int w, int h, const uInt32* data = 0); shared_ptr<FBSurface> allocateSurface(int w, int h, const uInt32* data = nullptr);
/** /**
Returns the current dimensions of the framebuffer image. Returns the current dimensions of the framebuffer image.

View File

@ -347,7 +347,7 @@ string MD5(const uInt8* buffer, uInt32 length)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string MD5(const FilesystemNode& node) string MD5(const FilesystemNode& node)
{ {
uInt8* image = 0; uInt8* image = nullptr;
uInt32 size = 0; uInt32 size = 0;
try try
{ {

View File

@ -479,7 +479,7 @@ unique_ptr<Console> OSystem::openConsole(const FilesystemNode& romfile,
unique_ptr<Console> console; unique_ptr<Console> console;
// Open the cartridge image and read it in // Open the cartridge image and read it in
uInt8* image = 0; uInt8* image = nullptr;
uInt32 size = 0; uInt32 size = 0;
if((image = openROM(romfile, md5, size)) != 0) if((image = openROM(romfile, md5, size)) != 0)
{ {

View File

@ -29,7 +29,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent) CommandDialog::CommandDialog(OSystem& osystem, DialogContainer& parent)
: Dialog(osystem, parent, 0, 0, 16, 16) : Dialog(osystem, parent)
{ {
const GUI::Font& font = instance().frameBuffer().font(); const GUI::Font& font = instance().frameBuffer().font();
const int buttonWidth = font.getStringWidth("Right Diff B") + 20, const int buttonWidth = font.getStringWidth("Right Diff B") + 20,

View File

@ -27,7 +27,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font, ContextMenu::ContextMenu(GuiObject* boss, const GUI::Font& font,
const VariantList& items, int cmd) const VariantList& items, int cmd)
: Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16), : Dialog(boss->instance(), boss->parent()),
CommandSender(boss), CommandSender(boss),
_rowHeight(font.getLineHeight()), _rowHeight(font.getLineHeight()),
_firstEntry(0), _firstEntry(0),

View File

@ -226,7 +226,7 @@ void Dialog::buildCurrentFocusList(int tabID)
// Remember which tab item previously had focus, if applicable // Remember which tab item previously had focus, if applicable
// This only applies if this method was called for a tab change // This only applies if this method was called for a tab change
Widget* tabFocusWidget = 0; Widget* tabFocusWidget = nullptr;
if(tabID >= 0 && tabID < (int)_myTabList.size()) if(tabID >= 0 && tabID < (int)_myTabList.size())
{ {
// Save focus in previously selected tab column, // Save focus in previously selected tab column,

View File

@ -131,7 +131,7 @@ class Dialog : public GuiObject
Widget* widget; Widget* widget;
WidgetArray list; WidgetArray list;
Focus(Widget* w = 0); Focus(Widget* w = nullptr);
virtual ~Focus(); virtual ~Focus();
}; };
using FocusList = vector<Focus>; using FocusList = vector<Focus>;
@ -141,7 +141,7 @@ class Dialog : public GuiObject
FocusList focus; FocusList focus;
uInt32 currentTab; uInt32 currentTab;
TabFocus(TabWidget* w = 0); TabFocus(TabWidget* w = nullptr);
virtual ~TabFocus(); virtual ~TabFocus();
void appendFocusList(WidgetArray& list); void appendFocusList(WidgetArray& list);

View File

@ -31,7 +31,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font, InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
const StringList& labels) const StringList& labels)
: Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16), : Dialog(boss->instance(), boss->parent()),
CommandSender(boss), CommandSender(boss),
myEnableCenter(false), myEnableCenter(false),
myErrorFlag(false), myErrorFlag(false),
@ -45,7 +45,7 @@ InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& font,
InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& lfont, InputTextDialog::InputTextDialog(GuiObject* boss, const GUI::Font& lfont,
const GUI::Font& nfont, const GUI::Font& nfont,
const StringList& labels) const StringList& labels)
: Dialog(boss->instance(), boss->parent(), 0, 0, 16, 16), : Dialog(boss->instance(), boss->parent()),
CommandSender(boss), CommandSender(boss),
myEnableCenter(false), myEnableCenter(false),
myErrorFlag(false), myErrorFlag(false),

View File

@ -28,7 +28,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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()),
myMessage(nullptr), myMessage(nullptr),
mySlider(nullptr), mySlider(nullptr),
myStart(0), myStart(0),

View File

@ -72,7 +72,8 @@ class TabWidget : public Widget, public CommandSender
Widget* parentWidget; Widget* parentWidget;
bool enabled; bool enabled;
Tab(const string& t = "", Widget* first = 0, Widget* parent = 0, bool e = true) Tab(const string& t = "", Widget* first = nullptr, Widget* parent = nullptr,
bool e = true)
: title(t), firstWidget(first), parentWidget(parent), enabled(e) { } : title(t), firstWidget(first), parentWidget(parent), enabled(e) { }
}; };
using TabList = vector<Tab>; using TabList = vector<Tab>;

View File

@ -161,7 +161,7 @@ void Widget::setEnabled(bool e)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Widget* Widget::findWidgetInChain(Widget *w, int x, int y) Widget* Widget::findWidgetInChain(Widget* w, int x, int y)
{ {
while(w) while(w)
{ {
@ -287,7 +287,7 @@ void Widget::setDirtyInChain(Widget* start)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StaticTextWidget::StaticTextWidget(GuiObject *boss, const GUI::Font& font, StaticTextWidget::StaticTextWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, int x, int y, int w, int h,
const string& text, TextAlignment align) const string& text, TextAlignment align)
: Widget(boss, font, x, y, w, h), : Widget(boss, font, x, y, w, h),
@ -330,7 +330,7 @@ void StaticTextWidget::drawWidget(bool hilite)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ButtonWidget::ButtonWidget(GuiObject *boss, const GUI::Font& font, ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, int x, int y, int w, int h,
const string& label, int cmd) const string& label, int cmd)
: StaticTextWidget(boss, font, x, y, w, h, label, kTextAlignCenter), : StaticTextWidget(boss, font, x, y, w, h, label, kTextAlignCenter),
@ -434,7 +434,7 @@ static uInt32 checked_img_circle[8] =
}; };
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CheckboxWidget::CheckboxWidget(GuiObject *boss, const GUI::Font& font, CheckboxWidget::CheckboxWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, const string& label, int x, int y, const string& label,
int cmd) int cmd)
: ButtonWidget(boss, font, x, y, 16, 16, label, cmd), : ButtonWidget(boss, font, x, y, 16, 16, label, cmd),
@ -542,7 +542,7 @@ void CheckboxWidget::drawWidget(bool hilite)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
SliderWidget::SliderWidget(GuiObject *boss, const GUI::Font& font, SliderWidget::SliderWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, int x, int y, int w, int h,
const string& label, int labelWidth, int cmd) const string& label, int labelWidth, int cmd)
: ButtonWidget(boss, font, x, y, w, h, label, cmd), : ButtonWidget(boss, font, x, y, w, h, label, cmd),

View File

@ -251,7 +251,7 @@ class CheckboxWidget : public ButtonWidget
class SliderWidget : public ButtonWidget class SliderWidget : public ButtonWidget
{ {
public: public:
SliderWidget(GuiObject *boss, const GUI::Font& font, SliderWidget(GuiObject* boss, const GUI::Font& font,
int x, int y, int w, int h, const string& label = "", int x, int y, int w, int h, const string& label = "",
int labelWidth = 0, int cmd = 0); int labelWidth = 0, int cmd = 0);

View File

@ -1,7 +1,7 @@
%{ %{
#include <stdio.h> #include <stdio.h>
Expression* lastExp = 0; Expression* lastExp = nullptr;
#define YYERROR_VERBOSE 1 #define YYERROR_VERBOSE 1
@ -20,7 +20,7 @@ void yyerror(const char *e) {
if(lastExp && dynamic_cast<Expression*>(lastExp)) if(lastExp && dynamic_cast<Expression*>(lastExp))
delete lastExp; delete lastExp;
lastExp = 0; lastExp = nullptr;
} }
%} %}

View File

@ -66,7 +66,7 @@
#include <stdio.h> #include <stdio.h>
Expression* lastExp = 0; Expression* lastExp = nullptr;
#define YYERROR_VERBOSE 1 #define YYERROR_VERBOSE 1
@ -85,7 +85,7 @@ void yyerror(const char *e) {
if(lastExp && dynamic_cast<Expression*>(lastExp)) if(lastExp && dynamic_cast<Expression*>(lastExp))
delete lastExp; delete lastExp;
lastExp = 0; lastExp = nullptr;
} }