More Coverity fixes.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3236 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2015-12-09 17:08:52 +00:00
parent 8b7043d74a
commit 336536745f
8 changed files with 27 additions and 8 deletions

View File

@ -17,6 +17,9 @@
// $Id$ // $Id$
//============================================================================ //============================================================================
// NOTE: This code generates many errors in Coverity, and is due to be
// replaced in an upcoming release.
#include <cctype> #include <cctype>
#include <cstdlib> #include <cstdlib>
#include <zlib.h> #include <zlib.h>

View File

@ -62,6 +62,9 @@
This class implements a thin wrapper around the zip file management code This class implements a thin wrapper around the zip file management code
from the MAME project. from the MAME project.
NOTE: This code generates many errors in Coverity, and is due to be
replaced in an upcoming release.
@author Wrapper class by Stephen Anthony, with main functionality @author Wrapper class by Stephen Anthony, with main functionality
by Aaron Giles by Aaron Giles
*/ */

View File

@ -290,6 +290,10 @@ bool CartDebug::disassemble(bool force)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool CartDebug::fillDisassemblyList(BankInfo& info, uInt16 search) bool CartDebug::fillDisassemblyList(BankInfo& info, uInt16 search)
{ {
// An empty address list means that DiStella can't do a disassembly
if(info.addressList.size() == 0)
return false;
myDisassembly.list.clear(); myDisassembly.list.clear();
myDisassembly.fieldwidth = 14 + myLabelLength; myDisassembly.fieldwidth = 14 + myLabelLength;
DiStella distella(*this, myDisassembly.list, info, DiStella::settings, DiStella distella(*this, myDisassembly.list, info, DiStella::settings,
@ -993,6 +997,10 @@ string CartDebug::saveDisassembly()
for(int bank = 0; bank < myConsole.cartridge().bankCount(); ++bank) for(int bank = 0; bank < myConsole.cartridge().bankCount(); ++bank)
{ {
BankInfo& info = myBankInfo[bank]; BankInfo& info = myBankInfo[bank];
// An empty address list means that DiStella can't do a disassembly
if(info.addressList.size() == 0)
continue;
// Disassemble bank // Disassemble bank
disasm.list.clear(); disasm.list.clear();
DiStella distella(*this, disasm.list, info, settings, DiStella distella(*this, disasm.list, info, settings,

View File

@ -31,12 +31,13 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
myList(list), myList(list),
mySettings(s), mySettings(s),
myReserved(reserved), myReserved(reserved),
myOffset(0),
myPC(0),
myPCEnd(0),
myLabels(labels), myLabels(labels),
myDirectives(directives) myDirectives(directives)
{ {
CartDebug::AddressList& addresses = info.addressList; CartDebug::AddressList& addresses = info.addressList;
if(addresses.size() == 0)
return;
while(!myAddressQueue.empty()) while(!myAddressQueue.empty())
myAddressQueue.pop(); myAddressQueue.pop();

View File

@ -34,7 +34,9 @@ Cartridge4A50::Cartridge4A50(const uInt8* image, uInt32 size,
mySliceHigh(0), mySliceHigh(0),
myIsRomLow(true), myIsRomLow(true),
myIsRomMiddle(true), myIsRomMiddle(true),
myIsRomHigh(true) myIsRomHigh(true),
myLastAddress(0),
myLastData(0)
{ {
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
// Supported file sizes are 32/64/128K, which are duplicated if necessary // Supported file sizes are 32/64/128K, which are duplicated if necessary

View File

@ -26,17 +26,15 @@
CartridgeFA2::CartridgeFA2(const uInt8* image, uInt32 size, const OSystem& osystem) CartridgeFA2::CartridgeFA2(const uInt8* image, uInt32 size, const OSystem& osystem)
: Cartridge(osystem.settings()), : Cartridge(osystem.settings()),
myOSystem(osystem), myOSystem(osystem),
mySize(28 * 1024),
myRamAccessTimeout(0), myRamAccessTimeout(0),
myCurrentBank(0) myCurrentBank(0)
{ {
// 29/32K version of FA2 has valid data @ 1K - 29K // 29/32K version of FA2 has valid data @ 1K - 29K
if(size >= 29 * 1024) if(size >= 29 * 1024)
{
image += 1024; image += 1024;
mySize = 28 * 1024; else if(size < mySize)
} mySize = size;
else
mySize = BSPF_min(28 * 1024u, size);
// Copy the ROM image into my buffer // Copy the ROM image into my buffer
memcpy(myImage, image, mySize); memcpy(myImage, image, mySize);

View File

@ -88,6 +88,9 @@ ComboDialog::ComboDialog(GuiObject* boss, const GUI::Font& font,
addOKCancelBGroup(wid, font); addOKCancelBGroup(wid, font);
addToFocusList(wid); addToFocusList(wid);
// NOTE: Coverity doesn't yet support lambdas, so it complains that 'myEvents'
// isn't initialized (when it obviously is with ADD_EVENT_POPUP)
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -37,6 +37,7 @@ EventMappingWidget::EventMappingWidget(GuiObject* boss, const GUI::Font& font,
const StringList& actions, EventMode mode) const StringList& actions, EventMode mode)
: Widget(boss, font, x, y, w, h), : Widget(boss, font, x, y, w, h),
CommandSender(boss), CommandSender(boss),
myComboDialog(nullptr),
myEventMode(mode), myEventMode(mode),
myActionSelected(-1), myActionSelected(-1),
myRemapStatus(false), myRemapStatus(false),