More cleanups from cppcheck.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3021 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-10-26 19:51:02 +00:00
parent bc1308db23
commit d891357cad
23 changed files with 34 additions and 183 deletions

View File

@ -22,7 +22,7 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PackedBitArray::PackedBitArray(uInt32 length) PackedBitArray::PackedBitArray(uInt32 length)
: words(length / wordSize + 1) : words(length / WORD_SIZE + 1)
{ {
bits = new uInt32[ words ]; bits = new uInt32[ words ];
@ -39,8 +39,8 @@ PackedBitArray::~PackedBitArray()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 PackedBitArray::isSet(uInt32 bit) const uInt32 PackedBitArray::isSet(uInt32 bit) const
{ {
uInt32 word = bit / wordSize; uInt32 word = bit / WORD_SIZE;
bit %= wordSize; bit %= WORD_SIZE;
return (bits[word] & (1 << bit)); return (bits[word] & (1 << bit));
} }
@ -48,8 +48,8 @@ uInt32 PackedBitArray::isSet(uInt32 bit) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 PackedBitArray::isClear(uInt32 bit) const uInt32 PackedBitArray::isClear(uInt32 bit) const
{ {
uInt32 word = bit / wordSize; uInt32 word = bit / WORD_SIZE;
bit %= wordSize; bit %= WORD_SIZE;
return !(bits[word] & (1 << bit)); return !(bits[word] & (1 << bit));
} }
@ -57,8 +57,8 @@ uInt32 PackedBitArray::isClear(uInt32 bit) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PackedBitArray::toggle(uInt32 bit) void PackedBitArray::toggle(uInt32 bit)
{ {
uInt32 word = bit / wordSize; uInt32 word = bit / WORD_SIZE;
bit %= wordSize; bit %= WORD_SIZE;
bits[word] ^= (1 << bit); bits[word] ^= (1 << bit);
} }
@ -66,8 +66,8 @@ void PackedBitArray::toggle(uInt32 bit)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PackedBitArray::set(uInt32 bit) void PackedBitArray::set(uInt32 bit)
{ {
uInt32 word = bit / wordSize; uInt32 word = bit / WORD_SIZE;
bit %= wordSize; bit %= WORD_SIZE;
bits[word] |= (1 << bit); bits[word] |= (1 << bit);
} }
@ -75,8 +75,8 @@ void PackedBitArray::set(uInt32 bit)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void PackedBitArray::clear(uInt32 bit) void PackedBitArray::clear(uInt32 bit)
{ {
uInt32 word = bit / wordSize; uInt32 word = bit / WORD_SIZE;
bit %= wordSize; bit %= WORD_SIZE;
bits[word] &= (~(1 << bit)); bits[word] &= (~(1 << bit));
} }

View File

@ -22,8 +22,6 @@
#include "bspf.hxx" #include "bspf.hxx"
#define wordSize ( (sizeof(unsigned int)) * 8)
class PackedBitArray class PackedBitArray
{ {
public: public:
@ -38,11 +36,17 @@ class PackedBitArray
void toggle(uInt32 bit); void toggle(uInt32 bit);
private: private:
// Copy constructor and assignment operator not supported
PackedBitArray(const PackedBitArray&);
PackedBitArray& operator = (const PackedBitArray&);
// number of unsigned ints (size/wordSize): // number of unsigned ints (size/wordSize):
uInt32 words; uInt32 words;
// the array itself: // the array itself:
uInt32* bits; uInt32* bits;
static const uInt32 WORD_SIZE = sizeof(uInt32) * 8;
}; };
#endif #endif

View File

@ -944,20 +944,6 @@ bool Cartridge::isProbablyX07(const uInt8* image, uInt32 size)
return false; return false;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge::Cartridge(const Cartridge& cart)
: mySettings(cart.mySettings)
{
assert(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge& Cartridge::operator = (const Cartridge&)
{
assert(false);
return *this;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Cartridge::myAboutString= ""; string Cartridge::myAboutString= "";

View File

@ -414,10 +414,8 @@ class Cartridge : public Device
// Contains info about this cartridge in string format // Contains info about this cartridge in string format
static string myAboutString; static string myAboutString;
// Copy constructor isn't supported by cartridges so make it private // Copy constructor and assignment operator not supported
Cartridge(const Cartridge&); Cartridge(const Cartridge&);
// Assignment operator isn't supported by cartridges so make it private
Cartridge& operator = (const Cartridge&); Cartridge& operator = (const Cartridge&);
}; };

View File

@ -179,20 +179,3 @@ const Int32 Controller::maximumResistance = 0x7FFFFFFF;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const Int32 Controller::minimumResistance = 0x00000000; const Int32 Controller::minimumResistance = 0x00000000;
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Controller::Controller(const Controller& c)
: myJack(c.myJack),
myEvent(c.myEvent),
mySystem(c.mySystem),
myType(c.myType)
{
assert(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Controller& Controller::operator = (const Controller&)
{
assert(false);
return *this;
}

View File

@ -266,11 +266,9 @@ class Controller : public Serializable
/// The analog value on each analog pin /// The analog value on each analog pin
Int32 myAnalogPinValue[2]; Int32 myAnalogPinValue[2];
protected: private:
// Copy constructor isn't supported by controllers so make it private // Copy constructor and assignment operator not supported
Controller(const Controller&); Controller(const Controller&);
// Assignment operator isn't supported by controllers so make it private
Controller& operator = (const Controller&); Controller& operator = (const Controller&);
}; };

View File

@ -437,18 +437,3 @@ Int32 M6532::intimClocks() const
else else
return timer & 0xff; return timer & 0xff;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M6532::M6532(const M6532& c)
: myConsole(c.myConsole),
mySettings(c.mySettings)
{
assert(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
M6532& M6532::operator = (const M6532&)
{
assert(false);
return *this;
}

View File

@ -206,10 +206,8 @@ class M6532 : public Device
uInt8 myOutTimer[4]; uInt8 myOutTimer[4];
private: private:
// Copy constructor isn't supported by this class so make it private // Copy constructor and assignment operator not supported
M6532(const M6532&); M6532(const M6532&);
// Assignment operator isn't supported by this class so make it private
M6532& operator = (const M6532&); M6532& operator = (const M6532&);
}; };

View File

@ -384,18 +384,3 @@ int MT24LC256::jpee_logproc(char const *st)
cerr << " " << st << endl; cerr << " " << st << endl;
return 0; return 0;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MT24LC256::MT24LC256(const MT24LC256& c)
: mySystem(c.mySystem),
myDataFile(c.myDataFile)
{
assert(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
MT24LC256& MT24LC256::operator = (const MT24LC256&)
{
assert(false);
return *this;
}

View File

@ -114,10 +114,8 @@ class MT24LC256
uInt8 jpee_packet[70]; uInt8 jpee_packet[70];
private: private:
// Copy constructor isn't supported by this class so make it private // Copy constructor and assignment operator not supported
MT24LC256(const MT24LC256&); MT24LC256(const MT24LC256&);
// Assignment operator isn't supported by this class so make it private
MT24LC256& operator = (const MT24LC256&); MT24LC256& operator = (const MT24LC256&);
}; };

View File

@ -776,17 +776,5 @@ void OSystem::mainLoop()
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystem::OSystem(const OSystem& osystem)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OSystem& OSystem::operator = (const OSystem&)
{
assert(false);
return *this;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ZipHandler* OSystem::myZipHandler = 0; ZipHandler* OSystem::myZipHandler = 0;

View File

@ -612,10 +612,8 @@ class OSystem
void validatePath(string& path, const string& setting, void validatePath(string& path, const string& setting,
const string& defaultpath); const string& defaultpath);
// Copy constructor isn't supported by this class so make it private // Copy constructor and assignment operator not supported
OSystem(const OSystem&); OSystem(const OSystem&);
// Assignment operator isn't supported by this class so make it private
OSystem& operator = (const OSystem&); OSystem& operator = (const OSystem&);
}; };

View File

@ -200,6 +200,11 @@ class Serializer
TruePattern = 0xfe, TruePattern = 0xfe,
FalsePattern = 0x01 FalsePattern = 0x01
}; };
private:
// Copy constructor and assignment operator not supported
Serializer(const Serializer&);
Serializer& operator = (const Serializer&);
}; };
#endif #endif

View File

@ -574,7 +574,7 @@ int Settings::setInternal(const string& key, const Variant& value,
{ {
int idx = -1; int idx = -1;
if(pos != -1 && pos >= 0 && pos < (int)myInternalSettings.size() && if(pos >= 0 && pos < (int)myInternalSettings.size() &&
myInternalSettings[pos].key == key) myInternalSettings[pos].key == key)
{ {
idx = pos; idx = pos;
@ -629,7 +629,7 @@ int Settings::setExternal(const string& key, const Variant& value,
{ {
int idx = -1; int idx = -1;
if(pos != -1 && pos >= 0 && pos < (int)myExternalSettings.size() && if(pos >= 0 && pos < (int)myExternalSettings.size() &&
myExternalSettings[pos].key == key) myExternalSettings[pos].key == key)
{ {
idx = pos; idx = pos;
@ -675,17 +675,3 @@ int Settings::setExternal(const string& key, const Variant& value,
return idx; return idx;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Settings::Settings(const Settings& s)
: myOSystem(s.myOSystem)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Settings& Settings::operator = (const Settings&)
{
assert(false);
return *this;
}

View File

@ -106,10 +106,8 @@ class Settings
virtual void saveConfig(); virtual void saveConfig();
private: private:
// Copy constructor isn't supported by this class so make it private // Copy constructor and assignment operator not supported
Settings(const Settings&); Settings(const Settings&);
// Assignment operator isn't supported by this class so make it private
Settings& operator = (const Settings&); Settings& operator = (const Settings&);
// Trim leading and following whitespace from a string // Trim leading and following whitespace from a string

View File

@ -331,16 +331,3 @@ void StateManager::reset()
myActiveMode = kOffMode; myActiveMode = kOffMode;
#endif #endif
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StateManager::StateManager(const StateManager& sm)
: myOSystem(sm.myOSystem)
{
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StateManager& StateManager::operator = (const StateManager&)
{
assert(false);
return *this;
}

View File

@ -99,10 +99,8 @@ class StateManager
void reset(); void reset();
private: private:
// Copy constructor isn't supported by this class so make it private // Copy constructor and assignment operator not supported
StateManager(const StateManager&); StateManager(const StateManager&);
// Assignment operator isn't supported by this class so make it private
StateManager& operator = (const StateManager&); StateManager& operator = (const StateManager&);
private: private:

View File

@ -334,17 +334,3 @@ bool System::load(Serializer& in)
return true; return true;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
System::System(const System& s)
: myOSystem(s.myOSystem)
{
assert(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
System& System::operator = (const System&)
{
assert(false);
return *this;
}

View File

@ -445,10 +445,8 @@ class System : public Serializable
bool mySystemInAutodetect; bool mySystemInAutodetect;
private: private:
// Copy constructor isn't supported by this class so make it private // Copy constructor and assignment operator not supported
System(const System&); System(const System&);
// Assignment operator isn't supported by this class so make it private
System& operator = (const System&); System& operator = (const System&);
}; };

View File

@ -2418,19 +2418,3 @@ inline void TIA::applyPreviousHMOVEMotion(int hpos, Int16& pos, uInt8 motion)
} }
} }
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIA::TIA(const TIA& c)
: myConsole(c.myConsole),
mySound(c.mySound),
mySettings(c.mySettings)
{
assert(false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
TIA& TIA::operator = (const TIA&)
{
assert(false);
return *this;
}

View File

@ -617,10 +617,8 @@ class TIA : public Device
bool myBitsEnabled, myCollisionsEnabled; bool myBitsEnabled, myCollisionsEnabled;
private: private:
// Copy constructor isn't supported by this class so make it private // Copy constructor and assignment operator not supported
TIA(const TIA&); TIA(const TIA&);
// Assignment operator isn't supported by this class so make it private
TIA& operator = (const TIA&); TIA& operator = (const TIA&);
}; };

View File

@ -269,15 +269,6 @@ void LauncherDialog::loadConfig()
myRomInfoWidget->loadConfig(); myRomInfoWidget->loadConfig();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::enableButtons(bool enable)
{
myStartButton->setEnabled(enable);
myPrevDirButton->setEnabled(enable);
myOptionsButton->setEnabled(enable);
myQuitButton->setEnabled(enable);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void LauncherDialog::updateListing(const string& nameToSelect) void LauncherDialog::updateListing(const string& nameToSelect)
{ {

View File

@ -88,7 +88,6 @@ class LauncherDialog : public Dialog
void updateListing(const string& nameToSelect = ""); void updateListing(const string& nameToSelect = "");
private: private:
void enableButtons(bool enable);
void loadDirListing(); void loadDirListing();
void loadRomInfo(); void loadRomInfo();
void handleContextMenu(); void handleContextMenu();