mirror of https://github.com/stella-emu/stella.git
Fixes for various issues reported by Coverity.
This commit is contained in:
parent
524cec907a
commit
698beaec8b
|
@ -177,7 +177,7 @@ class RewindManager
|
||||||
|
|
||||||
// We do nothing on object instantiation or copy
|
// We do nothing on object instantiation or copy
|
||||||
// The goal of LinkedObjectPool is to not do any allocations at all
|
// The goal of LinkedObjectPool is to not do any allocations at all
|
||||||
RewindState() { }
|
RewindState() : cycles(0) { }
|
||||||
RewindState(const RewindState&) { }
|
RewindState(const RewindState&) { }
|
||||||
|
|
||||||
// Output object info; used for debugging only
|
// Output object info; used for debugging only
|
||||||
|
|
|
@ -131,9 +131,13 @@ int main(int argc, char* argv[])
|
||||||
|
|
||||||
if(theOSystem->settings().getBool("takesnapshot"))
|
if(theOSystem->settings().getBool("takesnapshot"))
|
||||||
{
|
{
|
||||||
theOSystem->logMessage("Taking snapshots with 'takesnapshot' ...", 2);
|
try {
|
||||||
for(int i = 0; i < 30; ++i) theOSystem->frameBuffer().update();
|
theOSystem->logMessage("Taking snapshots with 'takesnapshot' ...", 2);
|
||||||
theOSystem->png().takeSnapshot();
|
for(int i = 0; i < 30; ++i) theOSystem->frameBuffer().update();
|
||||||
|
theOSystem->png().takeSnapshot();
|
||||||
|
} catch(const runtime_error& e) {
|
||||||
|
cout << e.what() << endl;
|
||||||
|
}
|
||||||
return Cleanup();
|
return Cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,8 @@ class AtariNTSC
|
||||||
float artifacts;
|
float artifacts;
|
||||||
float fringing;
|
float fringing;
|
||||||
float kernel [rescale_out * kernel_size * 2];
|
float kernel [rescale_out * kernel_size * 2];
|
||||||
|
|
||||||
|
init_t() : contrast(0.0), brightness(0.0), artifacts(0.0), fringing(0.0) { }
|
||||||
};
|
};
|
||||||
init_t myImpl;
|
init_t myImpl;
|
||||||
|
|
||||||
|
|
|
@ -58,6 +58,7 @@ using std::right;
|
||||||
DebuggerParser::DebuggerParser(Debugger& d, Settings& s)
|
DebuggerParser::DebuggerParser(Debugger& d, Settings& s)
|
||||||
: debugger(d),
|
: debugger(d),
|
||||||
settings(s),
|
settings(s),
|
||||||
|
myCommand(0),
|
||||||
argCount(0),
|
argCount(0),
|
||||||
execDepth(0),
|
execDepth(0),
|
||||||
execPrefix("")
|
execPrefix("")
|
||||||
|
@ -1459,13 +1460,10 @@ void DebuggerParser::executeListfunctions()
|
||||||
void DebuggerParser::executeListsavestateifs()
|
void DebuggerParser::executeListsavestateifs()
|
||||||
{
|
{
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
int count = 0;
|
|
||||||
|
|
||||||
StringList conds = debugger.m6502().getCondSaveStateNames();
|
StringList conds = debugger.m6502().getCondSaveStateNames();
|
||||||
if(conds.size() > 0)
|
if(conds.size() > 0)
|
||||||
{
|
{
|
||||||
if(count)
|
|
||||||
commandResult << endl;
|
|
||||||
commandResult << "savestateif:" << endl;
|
commandResult << "savestateif:" << endl;
|
||||||
for(uInt32 i = 0; i < conds.size(); i++)
|
for(uInt32 i = 0; i < conds.size(); i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,8 +26,11 @@ CartridgeMNetworkWidget::CartridgeMNetworkWidget(
|
||||||
int x, int y, int w, int h,
|
int x, int y, int w, int h,
|
||||||
CartridgeMNetwork& cart)
|
CartridgeMNetwork& cart)
|
||||||
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
: CartDebugWidget(boss, lfont, nfont, x, y, w, h),
|
||||||
myCart(cart)
|
myCart(cart),
|
||||||
{}
|
myLower2K(nullptr),
|
||||||
|
myUpper256B(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void CartridgeMNetworkWidget::initialize(GuiObject* boss, CartridgeMNetwork& cart, ostringstream& info)
|
void CartridgeMNetworkWidget::initialize(GuiObject* boss, CartridgeMNetwork& cart, ostringstream& info)
|
||||||
|
|
|
@ -34,11 +34,11 @@ class CartridgeMNetworkWidget : public CartDebugWidget
|
||||||
virtual ~CartridgeMNetworkWidget() = default;
|
virtual ~CartridgeMNetworkWidget() = default;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
PopUpWidget *myLower2K, *myUpper256B;
|
|
||||||
|
|
||||||
//CartridgeE7& myCart;
|
//CartridgeE7& myCart;
|
||||||
CartridgeMNetwork& myCart;
|
CartridgeMNetwork& myCart;
|
||||||
|
|
||||||
|
PopUpWidget *myLower2K, *myUpper256B;
|
||||||
|
|
||||||
struct CartState
|
struct CartState
|
||||||
{
|
{
|
||||||
ByteArray internalram;
|
ByteArray internalram;
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
FlashWidget::FlashWidget(GuiObject* boss, const GUI::Font& font,
|
FlashWidget::FlashWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, Controller& controller)
|
int x, int y, Controller& controller)
|
||||||
: ControllerWidget(boss, font, x, y, controller)
|
: ControllerWidget(boss, font, x, y, controller),
|
||||||
|
myEEPROMEraseCurrent(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,9 @@ PromptWidget::PromptWidget(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 - kScrollBarWidth, h),
|
: Widget(boss, font, x, y, w - kScrollBarWidth, h),
|
||||||
CommandSender(boss),
|
CommandSender(boss),
|
||||||
|
_historySize(0),
|
||||||
_historyIndex(0),
|
_historyIndex(0),
|
||||||
|
_historyLine(0),
|
||||||
_makeDirty(false),
|
_makeDirty(false),
|
||||||
_firstTime(true),
|
_firstTime(true),
|
||||||
_exitedEarly(false)
|
_exitedEarly(false)
|
||||||
|
|
|
@ -102,6 +102,11 @@ void CartridgeBUS::setInitialState()
|
||||||
// Assuming mode starts out with Fast Fetch off and 3-Voice music,
|
// Assuming mode starts out with Fast Fetch off and 3-Voice music,
|
||||||
// need to confirm with Chris
|
// need to confirm with Chris
|
||||||
myMode = 0xFF;
|
myMode = 0xFF;
|
||||||
|
|
||||||
|
myBankOffset = myBusOverdriveAddress =
|
||||||
|
mySTYZeroPageAddress = myJMPoperandAddress = 0;
|
||||||
|
|
||||||
|
myFastJumpActive = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
|
|
@ -105,6 +105,7 @@ void CartridgeCDF::setInitialState()
|
||||||
// need to confirm with Chris
|
// need to confirm with Chris
|
||||||
myMode = 0xFF;
|
myMode = 0xFF;
|
||||||
|
|
||||||
|
myBankOffset = myLDAimmediateOperandAddress = myJMPoperandAddress = 0;
|
||||||
myFastJumpActive = 0;
|
myFastJumpActive = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,8 +273,6 @@ class CartridgeCDF : public Cartridge
|
||||||
// *and* the next two bytes in ROM are 00 00
|
// *and* the next two bytes in ROM are 00 00
|
||||||
uInt16 myJMPoperandAddress;
|
uInt16 myJMPoperandAddress;
|
||||||
|
|
||||||
TIA* myTIA;
|
|
||||||
|
|
||||||
uInt8 myFastJumpActive;
|
uInt8 myFastJumpActive;
|
||||||
|
|
||||||
// version of CDF
|
// version of CDF
|
||||||
|
|
|
@ -23,7 +23,8 @@ CartridgeMNetwork::CartridgeMNetwork(const BytePtr& image, uInt32 size,
|
||||||
const Settings& settings)
|
const Settings& settings)
|
||||||
: Cartridge(settings),
|
: Cartridge(settings),
|
||||||
mySize(size),
|
mySize(size),
|
||||||
myCurrentRAM(0)
|
myCurrentRAM(0),
|
||||||
|
myRAMSlice(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,9 @@ FrameBuffer::FrameBuffer(OSystem& osystem)
|
||||||
myInitializedCount(0),
|
myInitializedCount(0),
|
||||||
myPausedCount(0),
|
myPausedCount(0),
|
||||||
myStatsEnabled(false),
|
myStatsEnabled(false),
|
||||||
|
myLastScanlines(0),
|
||||||
myLastFrameRate(60),
|
myLastFrameRate(60),
|
||||||
|
myGrabMouse(false),
|
||||||
myCurrentModeList(nullptr),
|
myCurrentModeList(nullptr),
|
||||||
myTotalTime(0),
|
myTotalTime(0),
|
||||||
myTotalFrames(0)
|
myTotalFrames(0)
|
||||||
|
|
|
@ -505,7 +505,9 @@ class FrameBuffer
|
||||||
shared_ptr<FBSurface> surface;
|
shared_ptr<FBSurface> surface;
|
||||||
bool enabled;
|
bool enabled;
|
||||||
|
|
||||||
Message() : counter(0), x(0), y(0), w(0), h(0), color(0), enabled(false) { }
|
Message()
|
||||||
|
: counter(0), x(0), y(0), w(0), h(0), position(MessagePosition::BottomCenter),
|
||||||
|
color(0), enabled(false) { }
|
||||||
};
|
};
|
||||||
Message myMsg;
|
Message myMsg;
|
||||||
Message myStatsMsg;
|
Message myStatsMsg;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
Background::Background()
|
Background::Background()
|
||||||
|
: myTIA(nullptr)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,8 @@ enum Count: Int8 {
|
||||||
Ball::Ball(uInt32 collisionMask)
|
Ball::Ball(uInt32 collisionMask)
|
||||||
: myCollisionMaskDisabled(collisionMask),
|
: myCollisionMaskDisabled(collisionMask),
|
||||||
myCollisionMaskEnabled(0xFFFF),
|
myCollisionMaskEnabled(0xFFFF),
|
||||||
myIsSuppressed(false)
|
myIsSuppressed(false),
|
||||||
|
myTIA(nullptr)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,8 @@ class DelayQueueMember : public Serializable {
|
||||||
struct Entry {
|
struct Entry {
|
||||||
uInt8 address;
|
uInt8 address;
|
||||||
uInt8 value;
|
uInt8 value;
|
||||||
|
|
||||||
|
Entry() : address(0), value(0) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -52,7 +54,6 @@ class DelayQueueMember : public Serializable {
|
||||||
uInt8 mySize;
|
uInt8 mySize;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
DelayQueueMember(const DelayQueueMember<capacity>&) = delete;
|
DelayQueueMember(const DelayQueueMember<capacity>&) = delete;
|
||||||
DelayQueueMember(DelayQueueMember<capacity>&&) = delete;
|
DelayQueueMember(DelayQueueMember<capacity>&&) = delete;
|
||||||
DelayQueueMember<capacity>& operator=(const DelayQueueMember<capacity>&) = delete;
|
DelayQueueMember<capacity>& operator=(const DelayQueueMember<capacity>&) = delete;
|
||||||
|
@ -68,7 +69,8 @@ class DelayQueueMember : public Serializable {
|
||||||
template<unsigned capacity>
|
template<unsigned capacity>
|
||||||
DelayQueueMember<capacity>::DelayQueueMember()
|
DelayQueueMember<capacity>::DelayQueueMember()
|
||||||
: mySize(0)
|
: mySize(0)
|
||||||
{}
|
{
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
template<unsigned capacity>
|
template<unsigned capacity>
|
||||||
|
@ -110,7 +112,7 @@ void DelayQueueMember<capacity>::clear()
|
||||||
template<unsigned capacity>
|
template<unsigned capacity>
|
||||||
bool DelayQueueMember<capacity>::save(Serializer& out) const
|
bool DelayQueueMember<capacity>::save(Serializer& out) const
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
out.putInt(mySize);
|
out.putInt(mySize);
|
||||||
for(uInt8 i = 0; i < mySize; ++i)
|
for(uInt8 i = 0; i < mySize; ++i)
|
||||||
|
|
|
@ -28,7 +28,8 @@ Missile::Missile(uInt32 collisionMask)
|
||||||
: myCollisionMaskDisabled(collisionMask),
|
: myCollisionMaskDisabled(collisionMask),
|
||||||
myCollisionMaskEnabled(0xFFFF),
|
myCollisionMaskEnabled(0xFFFF),
|
||||||
myIsSuppressed(false),
|
myIsSuppressed(false),
|
||||||
myDecodesOffset(0)
|
myDecodesOffset(0),
|
||||||
|
myTIA(nullptr)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,8 @@ Player::Player(uInt32 collisionMask)
|
||||||
: myCollisionMaskDisabled(collisionMask),
|
: myCollisionMaskDisabled(collisionMask),
|
||||||
myCollisionMaskEnabled(0xFFFF),
|
myCollisionMaskEnabled(0xFFFF),
|
||||||
myIsSuppressed(false),
|
myIsSuppressed(false),
|
||||||
myDecodesOffset(0)
|
myDecodesOffset(0),
|
||||||
|
myTIA(nullptr)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,8 @@
|
||||||
Playfield::Playfield(uInt32 collisionMask)
|
Playfield::Playfield(uInt32 collisionMask)
|
||||||
: myCollisionMaskDisabled(collisionMask),
|
: myCollisionMaskDisabled(collisionMask),
|
||||||
myCollisionMaskEnabled(0xFFFF),
|
myCollisionMaskEnabled(0xFFFF),
|
||||||
myIsSuppressed(false)
|
myIsSuppressed(false),
|
||||||
|
myTIA(nullptr)
|
||||||
{
|
{
|
||||||
reset();
|
reset();
|
||||||
}
|
}
|
||||||
|
@ -38,9 +39,11 @@ void Playfield::reset()
|
||||||
myPf1 = 0;
|
myPf1 = 0;
|
||||||
myPf2 = 0;
|
myPf2 = 0;
|
||||||
|
|
||||||
|
myX = 0;
|
||||||
|
|
||||||
myObjectColor = myDebugColor = 0;
|
myObjectColor = myDebugColor = 0;
|
||||||
myColorP0 = 0;
|
myColorLeft = myColorRight = 0;
|
||||||
myColorP1 = 0;
|
myColorP0 = myColorP1 = 0;
|
||||||
myColorMode = ColorMode::normal;
|
myColorMode = ColorMode::normal;
|
||||||
myDebugEnabled = false;
|
myDebugEnabled = false;
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,21 @@ enum Metrics: uInt32 {
|
||||||
};
|
};
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
FrameManager::FrameManager() :
|
FrameManager::FrameManager()
|
||||||
myHeight(0),
|
: myState(State::waitForVsyncStart),
|
||||||
myYStart(0)
|
myLineInState(0),
|
||||||
|
myVsyncLines(0),
|
||||||
|
myY(0), myLastY(0),
|
||||||
|
myVblankLines(0),
|
||||||
|
myKernelLines(0),
|
||||||
|
myOverscanLines(0),
|
||||||
|
myFrameLines(0),
|
||||||
|
myHeight(0),
|
||||||
|
myFixedHeight(0),
|
||||||
|
myYStart(0),
|
||||||
|
myJitterEnabled(false),
|
||||||
|
myStableFrameLines(-1),
|
||||||
|
myStableFrameHeightCountdown(0)
|
||||||
{
|
{
|
||||||
onLayoutChange();
|
onLayoutChange();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,9 +25,12 @@ enum Metrics: uInt32 {
|
||||||
};
|
};
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
JitterEmulation::JitterEmulation() :
|
JitterEmulation::JitterEmulation()
|
||||||
myYStart(0)
|
: myJitterFactor(0),
|
||||||
{}
|
myYStart(0)
|
||||||
|
{
|
||||||
|
reset();
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void JitterEmulation::reset()
|
void JitterEmulation::reset()
|
||||||
|
|
|
@ -51,6 +51,7 @@ Dialog::Dialog(OSystem& instance, DialogContainer& parent, const GUI::Font& font
|
||||||
_mouseWidget(nullptr),
|
_mouseWidget(nullptr),
|
||||||
_focusedWidget(nullptr),
|
_focusedWidget(nullptr),
|
||||||
_dragWidget(nullptr),
|
_dragWidget(nullptr),
|
||||||
|
_defaultWidget(nullptr),
|
||||||
_okWidget(nullptr),
|
_okWidget(nullptr),
|
||||||
_cancelWidget(nullptr),
|
_cancelWidget(nullptr),
|
||||||
_visible(false),
|
_visible(false),
|
||||||
|
|
|
@ -89,7 +89,7 @@ RadioButtonWidget::RadioButtonWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
RadioButtonGroup* group,
|
RadioButtonGroup* group,
|
||||||
int cmd)
|
int cmd)
|
||||||
: CheckboxWidget(boss, font, x, y, label, cmd),
|
: CheckboxWidget(boss, font, x, y, label, cmd),
|
||||||
myGroup(group)
|
myGroup(group)
|
||||||
{
|
{
|
||||||
_flags = WIDGET_ENABLED;
|
_flags = WIDGET_ENABLED;
|
||||||
_bgcolor = _bgcolorhi = kWidColor;
|
_bgcolor = _bgcolorhi = kWidColor;
|
||||||
|
|
|
@ -56,7 +56,7 @@ class RadioButtonWidget : public CheckboxWidget
|
||||||
class RadioButtonGroup
|
class RadioButtonGroup
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
RadioButtonGroup() = default;
|
RadioButtonGroup() : mySelected(0) { }
|
||||||
|
|
||||||
// add widget to group
|
// add widget to group
|
||||||
void addWidget(RadioButtonWidget* widget);
|
void addWidget(RadioButtonWidget* widget);
|
||||||
|
|
|
@ -39,7 +39,8 @@ Widget::Widget(GuiObject* boss, const GUI::Font& font,
|
||||||
_bgcolor(kWidColor),
|
_bgcolor(kWidColor),
|
||||||
_bgcolorhi(kWidColor),
|
_bgcolorhi(kWidColor),
|
||||||
_textcolor(kTextColor),
|
_textcolor(kTextColor),
|
||||||
_textcolorhi(kTextColorHi)
|
_textcolorhi(kTextColorHi),
|
||||||
|
_shadowcolor(kShadowColor)
|
||||||
{
|
{
|
||||||
// Insert into the widget list of the boss
|
// Insert into the widget list of the boss
|
||||||
_next = _boss->_firstWidget;
|
_next = _boss->_firstWidget;
|
||||||
|
@ -354,7 +355,10 @@ ButtonWidget::ButtonWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
: StaticTextWidget(boss, font, x, y, w, h, label, TextAlign::Center),
|
: StaticTextWidget(boss, font, x, y, w, h, label, TextAlign::Center),
|
||||||
CommandSender(boss),
|
CommandSender(boss),
|
||||||
_cmd(cmd),
|
_cmd(cmd),
|
||||||
_useBitmap(false)
|
_useBitmap(false),
|
||||||
|
_bitmap(nullptr),
|
||||||
|
_bmw(0),
|
||||||
|
_bmh(0)
|
||||||
{
|
{
|
||||||
_flags = WIDGET_ENABLED | WIDGET_CLEARBG;
|
_flags = WIDGET_ENABLED | WIDGET_CLEARBG;
|
||||||
_bgcolor = kBtnColor;
|
_bgcolor = kBtnColor;
|
||||||
|
|
Loading…
Reference in New Issue