Some more fixes for warnings from cppcheck.

This commit is contained in:
Stephen Anthony 2018-08-28 14:21:01 -02:30
parent e5fb010631
commit 558b071fbb
51 changed files with 139 additions and 164 deletions

View File

@ -42,7 +42,7 @@ bool CheatManager::add(const string& name, const string& code,
return false;
// Delete duplicate entries
for(uInt32 i = 0; i < myCheatList.size(); i++)
for(uInt32 i = 0; i < myCheatList.size(); ++i)
{
if(myCheatList[i]->name() == name || myCheatList[i]->code() == code)
{
@ -96,7 +96,7 @@ void CheatManager::addPerFrame(const string& name, const string& code, bool enab
// Make sure there are no duplicates
bool found = false;
uInt32 i;
for(i = 0; i < myPerFrameList.size(); i++)
for(i = 0; i < myPerFrameList.size(); ++i)
{
if(myPerFrameList[i]->code() == cheat->code())
{
@ -291,7 +291,7 @@ void CheatManager::loadCheats(const string& md5sum)
void CheatManager::saveCheats(const string& md5sum)
{
ostringstream cheats;
for(uInt32 i = 0; i < myCheatList.size(); i++)
for(uInt32 i = 0; i < myCheatList.size(); ++i)
{
cheats << myCheatList[i]->name() << ":"
<< myCheatList[i]->code() << ":"

View File

@ -34,7 +34,7 @@ AudioQueue::AudioQueue(uInt32 fragmentSize, uInt32 capacity, bool isStereo)
myFragmentBuffer = make_unique<Int16[]>(myFragmentSize * sampleSize * (capacity + 2));
for (uInt32 i = 0; i < capacity; i++)
for (uInt32 i = 0; i < capacity; ++i)
myFragmentQueue[i] = myAllFragments[i] = myFragmentBuffer.get() + i * sampleSize * myFragmentSize;
myAllFragments[capacity] = myFirstFragmentForEnqueue =
@ -92,7 +92,7 @@ Int16* AudioQueue::enqueue(Int16* fragment)
newFragment = myFragmentQueue.at(fragmentIndex);
myFragmentQueue.at(fragmentIndex) = fragment;
if (mySize < capacity) mySize++;
if (mySize < capacity) ++mySize;
else {
myNextFragment = (myNextFragment + 1) % capacity;
if (!myIgnoreOverflows) (cerr << "audio buffer overflow\n").flush();
@ -118,7 +118,7 @@ Int16* AudioQueue::dequeue(Int16* fragment)
Int16* nextFragment = myFragmentQueue.at(myNextFragment);
myFragmentQueue.at(myNextFragment) = fragment;
mySize--;
--mySize;
myNextFragment = (myNextFragment + 1) % myFragmentQueue.size();
return nextFragment;

View File

@ -179,6 +179,7 @@ class RewindManager
// The goal of LinkedObjectPool is to not do any allocations at all
RewindState() : cycles(0) { }
RewindState(const RewindState& rs) : cycles(rs.cycles) { }
RewindState& operator= (const RewindState& rs) { cycles = rs.cycles; return *this; }
// Output object info; used for debugging only
friend ostream& operator<<(ostream& os, const RewindState& s) {

View File

@ -57,12 +57,13 @@ class StringParser
while(std::getline(buf, line, '\n'))
{
size_t beg = 0, len = maxlen, size = line.size();
size_t len = maxlen, size = line.size();
if(size <= len)
myStringList.push_back(line);
else
{
size_t beg = 0;
while((beg+maxlen) < size)
{
size_t spos = line.find_last_of(' ', beg+len);

View File

@ -38,7 +38,7 @@ float ConvolutionBuffer::convoluteWith(float* kernel) const
{
float result = 0.;
for (uInt32 i = 0; i < mySize; i++) {
for (uInt32 i = 0; i < mySize; ++i) {
result += kernel[i] * myData[(myFirstIndex + i) % mySize];
}

View File

@ -29,7 +29,7 @@ namespace {
uInt32 reducedDenominator(uInt32 n, uInt32 d)
{
for (uInt32 i = std::min(n ,d); i > 1; i--) {
for (uInt32 i = std::min(n ,d); i > 1; --i) {
if ((n % i == 0) && (d % i == 0)) {
n /= i;
d /= i;
@ -103,13 +103,13 @@ void LanczosResampler::precomputeKernels()
// timeIndex = time * formatFrom.sampleRate * formatTo.sampleRAte
uInt32 timeIndex = 0;
for (uInt32 i = 0; i < myPrecomputedKernelCount; i++) {
for (uInt32 i = 0; i < myPrecomputedKernelCount; ++i) {
float* kernel = myPrecomputedKernels.get() + myKernelSize * i;
// The kernel is normalized such to be evaluate on time * formatFrom.sampleRate
float center =
static_cast<float>(timeIndex) / static_cast<float>(myFormatTo.sampleRate);
for (uInt32 j = 0; j < 2 * myKernelParameter; j++) {
for (uInt32 j = 0; j < 2 * myKernelParameter; ++j) {
kernel[j] = lanczosKernel(
center - static_cast<float>(j) + static_cast<float>(myKernelParameter) - 1.f, myKernelParameter
) * CLIPPING_FACTOR;
@ -150,7 +150,7 @@ void LanczosResampler::fillFragment(float* fragment, uInt32 length)
const uInt32 outputSamples = myFormatTo.stereo ? (length >> 1) : length;
for (uInt32 i = 0; i < outputSamples; i++) {
for (uInt32 i = 0; i < outputSamples; ++i) {
float* kernel = myPrecomputedKernels.get() + (myCurrentKernelIndex * myKernelSize);
myCurrentKernelIndex = (myCurrentKernelIndex + 1) % myPrecomputedKernelCount;
@ -194,7 +194,7 @@ inline void LanczosResampler::shiftSamples(uInt32 samplesToShift)
else
myBuffer->shift(myHighPass.apply(myCurrentFragment[myFragmentIndex] / static_cast<float>(0x7fff)));
myFragmentIndex++;
++myFragmentIndex;
if (myFragmentIndex >= myFormatFrom.fragmentSize) {
myFragmentIndex %= myFormatFrom.fragmentSize;

View File

@ -33,7 +33,7 @@ class LanczosResampler : public Resampler
uInt32 kernelParameter
);
virtual void fillFragment(float* fragment, uInt32 length);
void fillFragment(float* fragment, uInt32 length) override;
virtual ~LanczosResampler() = default;

View File

@ -51,7 +51,7 @@ void SimpleResampler::fillFragment(float* fragment, uInt32 length)
const uInt32 outputSamples = myFormatTo.stereo ? (length >> 1) : length;
// For the following math, remember that myTimeIndex = time * myFormatFrom.sampleRate * myFormatTo.sampleRate
for (uInt32 i = 0; i < outputSamples; i++) {
for (uInt32 i = 0; i < outputSamples; ++i) {
if (myFormatFrom.stereo) {
float sampleL = static_cast<float>(myCurrentFragment[2*myFragmentIndex]) / static_cast<float>(0x7fff);
float sampleR = static_cast<float>(myCurrentFragment[2*myFragmentIndex + 1]) / static_cast<float>(0x7fff);

View File

@ -30,7 +30,7 @@ class SimpleResampler : public Resampler
Resampler::NextFragmentCallback NextFragmentCallback
);
virtual void fillFragment(float* fragment, uInt32 length);
void fillFragment(float* fragment, uInt32 length) override;
private:

View File

@ -201,7 +201,7 @@ namespace BSPF
if(BSPF::startsWithIgnoreCase(s1, s2.substr(0, 1)))
{
size_t pos = 1;
for(uInt32 j = 1; j < s2.size(); j++)
for(uInt32 j = 1; j < s2.size(); ++j)
{
size_t found = BSPF::findIgnoreCase(s1, s2.substr(j, 1), pos);
if(found == string::npos)

View File

@ -426,8 +426,8 @@ bool DebuggerParser::validateArgs(int cmd)
uInt32 count = 0, argRequiredCount = 0;
while(*p != kARG_END_ARGS && *p != kARG_MULTI_BYTE)
{
count++;
p++;
++count;
++p;
}
// Evil hack: some commands intentionally take multiple arguments
@ -500,8 +500,8 @@ bool DebuggerParser::validateArgs(int cmd)
case kARG_END_ARGS:
break;
}
curCount++;
p++;
++curCount;
++p;
} while(*p != kARG_END_ARGS && curCount < argRequiredCount);
@ -571,7 +571,7 @@ void DebuggerParser::listTraps(bool listCond)
StringList names = debugger.m6502().getCondTrapNames();
commandResult << (listCond ? "trapifs:" : "traps:") << endl;
for(uInt32 i = 0; i < names.size(); i++)
for(uInt32 i = 0; i < names.size(); ++i)
{
bool hasCond = names[i] != "";
if(hasCond == listCond)
@ -753,7 +753,7 @@ void DebuggerParser::executeBreakif()
if(res == 0)
{
string condition = argStrings[0];
for(uInt32 i = 0; i < debugger.m6502().getCondBreakNames().size(); i++)
for(uInt32 i = 0; i < debugger.m6502().getCondBreakNames().size(); ++i)
{
if(condition == debugger.m6502().getCondBreakNames()[i])
{
@ -1164,9 +1164,9 @@ void DebuggerParser::executeExec()
prefix << std::hex << std::setw(8) << std::setfill('0') << uInt32(debugger.myOSystem.getTicks()/1000);
execPrefix = prefix.str();
}
execDepth++;
++execDepth;
commandResult << exec(node);
execDepth--;
--execDepth;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1419,7 +1419,7 @@ void DebuggerParser::executeListbreaks()
if(count)
commandResult << endl;
commandResult << "breakifs:" << endl;
for(uInt32 i = 0; i < conds.size(); i++)
for(uInt32 i = 0; i < conds.size(); ++i)
{
commandResult << Base::toString(i) << ": " << conds[i];
if(i != (conds.size() - 1)) commandResult << endl;
@ -1465,7 +1465,7 @@ void DebuggerParser::executeListsavestateifs()
if(conds.size() > 0)
{
commandResult << "savestateif:" << endl;
for(uInt32 i = 0; i < conds.size(); i++)
for(uInt32 i = 0; i < conds.size(); ++i)
{
commandResult << Base::toString(i) << ": " << conds[i];
if(i != (conds.size() - 1)) commandResult << endl;
@ -1492,7 +1492,7 @@ void DebuggerParser::executeListtraps()
if (names.size() > 0)
{
bool trapFound = false, trapifFound = false;
for(uInt32 i = 0; i < names.size(); i++)
for(uInt32 i = 0; i < names.size(); ++i)
if(names[i] == "")
trapFound = true;
else
@ -1820,7 +1820,7 @@ void DebuggerParser::executeSavestateif()
if(res == 0)
{
string condition = argStrings[0];
for(uInt32 i = 0; i < debugger.m6502().getCondSaveStateNames().size(); i++)
for(uInt32 i = 0; i < debugger.m6502().getCondSaveStateNames().size(); ++i)
{
if(condition == debugger.m6502().getCondSaveStateNames()[i])
{
@ -1997,7 +1997,7 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
{
// duplicates will remove each other
bool add = true;
for(uInt32 i = 0; i < myTraps.size(); i++)
for(uInt32 i = 0; i < myTraps.size(); ++i)
{
if(myTraps[i]->begin == begin && myTraps[i]->end == end &&
myTraps[i]->read == read && myTraps[i]->write == write &&

View File

@ -132,7 +132,7 @@ void DiStella::disasm(uInt32 distart, int pass)
mark(myPC + myOffset, CartDebug::VALID_ENTRY);
if (pass == 3)
outputGraphics();
myPC++;
++myPC;
} else if (checkBits(myPC, CartDebug::DATA,
CartDebug::CODE | CartDebug::GFX | CartDebug::PGFX)) {
if (pass == 2)
@ -140,7 +140,7 @@ void DiStella::disasm(uInt32 distart, int pass)
if (pass == 3)
outputBytes(CartDebug::DATA);
else
myPC++;
++myPC;
} else if (checkBits(myPC, CartDebug::ROW,
CartDebug::CODE | CartDebug::DATA | CartDebug::GFX | CartDebug::PGFX)) {
FIX_LAST:
@ -150,7 +150,7 @@ FIX_LAST:
if (pass == 3)
outputBytes(CartDebug::ROW);
else
myPC++;
++myPC;
} else {
// The following sections must be CODE
@ -177,7 +177,7 @@ FIX_LAST:
else
myDisasmBuf << Base::HEX4 << myPC + myOffset << "' '";
}
myPC++;
++myPC;
// detect labels inside instructions (e.g. BIT masks)
labelFound = false;
@ -252,7 +252,7 @@ FIX_LAST:
else
myDisasmBuf << Base::HEX4 << myPC + myOffset << "' '";
opcode = Debugger::debugger().peek(myPC + myOffset); myPC++;
opcode = Debugger::debugger().peek(myPC + myOffset); ++myPC;
myDisasmBuf << ".byte $" << Base::HEX2 << int(opcode) << " $"
<< Base::HEX4 << myPC + myOffset << "'"
<< Base::HEX2 << int(opcode);
@ -277,7 +277,7 @@ FIX_LAST:
nextLine.str("");
nextLineBytes.str("");
}
myPC++;
++myPC;
myPCEnd = myAppData.end + myOffset;
return;
}
@ -330,7 +330,7 @@ FIX_LAST:
case ZERO_PAGE:
{
d1 = Debugger::debugger().peek(myPC + myOffset); myPC++;
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
labelFound = mark(d1, CartDebug::REFERENCED);
if (pass == 3) {
nextLine << " ";
@ -342,7 +342,7 @@ FIX_LAST:
case IMMEDIATE:
{
d1 = Debugger::debugger().peek(myPC + myOffset); myPC++;
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
if (pass == 3) {
nextLine << " #$" << Base::HEX2 << int(d1) << " ";
nextLineBytes << Base::HEX2 << int(d1);
@ -430,7 +430,7 @@ FIX_LAST:
case INDIRECT_X:
{
d1 = Debugger::debugger().peek(myPC + myOffset); myPC++;
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
if (pass == 3) {
labelFound = mark(d1, 0); // dummy call to get address type
nextLine << " (";
@ -443,7 +443,7 @@ FIX_LAST:
case INDIRECT_Y:
{
d1 = Debugger::debugger().peek(myPC + myOffset); myPC++;
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
if (pass == 3) {
labelFound = mark(d1, 0); // dummy call to get address type
nextLine << " (";
@ -456,7 +456,7 @@ FIX_LAST:
case ZERO_PAGE_X:
{
d1 = Debugger::debugger().peek(myPC + myOffset); myPC++;
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
labelFound = mark(d1, CartDebug::REFERENCED);
if (pass == 3) {
nextLine << " ";
@ -469,7 +469,7 @@ FIX_LAST:
case ZERO_PAGE_Y:
{
d1 = Debugger::debugger().peek(myPC + myOffset); myPC++;
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
labelFound = mark(d1, CartDebug::REFERENCED);
if (pass == 3) {
nextLine << " ";
@ -485,7 +485,7 @@ FIX_LAST:
// SA - 04-06-2010: there seemed to be a bug in distella,
// where wraparound occurred on a 32-bit int, and subsequent
// indexing into the labels array caused a crash
d1 = Debugger::debugger().peek(myPC + myOffset); myPC++;
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
ad = ((myPC + Int8(d1)) & 0xfff) + myOffset;
labelFound = mark(ad, CartDebug::REFERENCED);
@ -607,7 +607,7 @@ void DiStella::disasmPass1(CartDebug::AddressList& debuggerAddresses)
// However, addresses *specifically* marked as DATA/GFX/PGFX
// in the emulation core indicate that the CODE range has finished
// Therefore, we stop at the first such address encountered
for (uInt32 k = pcBeg; k <= myPCEnd; k++) {
for (uInt32 k = pcBeg; k <= myPCEnd; ++k) {
if (checkBits(k, CartDebug::CartDebug::DATA | CartDebug::GFX | CartDebug::PGFX,
CartDebug::CODE)) {
//if (Debugger::debugger().getAccessFlags(k) &
@ -694,7 +694,7 @@ void DiStella::disasmFromAddress(uInt32 distart)
// so this should be code now...
// get opcode
opcode = Debugger::debugger().peek(myPC + myOffset); myPC++;
opcode = Debugger::debugger().peek(myPC + myOffset); ++myPC;
// get address mode for opcode
addrMode = ourLookup[opcode].addr_mode;
@ -716,7 +716,7 @@ void DiStella::disasmFromAddress(uInt32 distart)
case ZERO_PAGE_Y:
case RELATIVE:
if (myPC > myAppData.end) {
myPC++;
++myPC;
myPCEnd = myAppData.end + myOffset;
return;
}
@ -745,7 +745,7 @@ void DiStella::disasmFromAddress(uInt32 distart)
break;
case ZERO_PAGE:
d1 = Debugger::debugger().peek(myPC + myOffset); myPC++;
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
mark(d1, CartDebug::REFERENCED);
break;
@ -772,12 +772,12 @@ void DiStella::disasmFromAddress(uInt32 distart)
break;
case ZERO_PAGE_X:
d1 = Debugger::debugger().peek(myPC + myOffset); myPC++;
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
mark(d1, CartDebug::REFERENCED);
break;
case ZERO_PAGE_Y:
d1 = Debugger::debugger().peek(myPC + myOffset); myPC++;
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
mark(d1, CartDebug::REFERENCED);
break;
@ -785,7 +785,7 @@ void DiStella::disasmFromAddress(uInt32 distart)
// SA - 04-06-2010: there seemed to be a bug in distella,
// where wraparound occurred on a 32-bit int, and subsequent
// indexing into the labels array caused a crash
d1 = Debugger::debugger().peek(myPC + myOffset); myPC++;
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
ad = ((myPC + Int8(d1)) & 0xfff) + myOffset;
mark(ad, CartDebug::REFERENCED);
// do NOT use flags set by debugger, else known CODE will not analyzed statically.
@ -1079,14 +1079,14 @@ void DiStella::outputBytes(CartDebug::DisasmType type)
myDisasmBuf << Base::HEX4 << myPC + myOffset << "'L" << Base::HEX4
<< myPC + myOffset << "'.byte " << "$" << Base::HEX2
<< int(Debugger::debugger().peek(myPC + myOffset));
myPC++;
++myPC;
numBytes = 1;
lineEmpty = false;
} else if (lineEmpty) {
// start a new line without a label
myDisasmBuf << Base::HEX4 << myPC + myOffset << "' '"
<< ".byte $" << Base::HEX2 << int(Debugger::debugger().peek(myPC + myOffset));
myPC++;
++myPC;
numBytes = 1;
lineEmpty = false;
}
@ -1096,7 +1096,7 @@ void DiStella::outputBytes(CartDebug::DisasmType type)
lineEmpty = true;
} else {
myDisasmBuf << ",$" << Base::HEX2 << int(Debugger::debugger().peek(myPC + myOffset));
myPC++;
++myPC;
}
isType = checkBits(myPC, type,
CartDebug::CODE | (type != CartDebug::DATA ? CartDebug::DATA : 0) | CartDebug::GFX | CartDebug::PGFX);

View File

@ -1061,7 +1061,7 @@ string TIADebug::toString()
ostringstream buf;
buf << "00: ";
for (uInt8 j = 0; j < 0x010; j++)
for (uInt8 j = 0; j < 0x010; ++j)
{
buf << Common::Base::HEX2 << int(mySystem.peek(j)) << " ";
if(j == 0x07) buf << "- ";

View File

@ -98,7 +98,7 @@ void AudioWidget::loadConfig()
// AUDF0/1
alist.clear(); vlist.clear(); changed.clear();
for(uInt32 i = 0; i < 2; i++)
for(uInt32 i = 0; i < 2; ++i)
{
alist.push_back(i);
vlist.push_back(state.aud[i]);
@ -108,7 +108,7 @@ void AudioWidget::loadConfig()
// AUDC0/1
alist.clear(); vlist.clear(); changed.clear();
for(uInt32 i = 2; i < 4; i++)
for(uInt32 i = 2; i < 4; ++i)
{
alist.push_back(i-2);
vlist.push_back(state.aud[i]);
@ -118,7 +118,7 @@ void AudioWidget::loadConfig()
// AUDV0/1
alist.clear(); vlist.clear(); changed.clear();
for(uInt32 i = 4; i < 6; i++)
for(uInt32 i = 4; i < 6; ++i)
{
alist.push_back(i-4);
vlist.push_back(state.aud[i]);

View File

@ -122,7 +122,7 @@ void Cartridge3EPlusWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}

View File

@ -90,10 +90,8 @@ void Cartridge3EWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
myOldState.bank = myCart.myCurrentBank;
}

View File

@ -46,10 +46,8 @@ void Cartridge4KSCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -127,10 +127,9 @@ void CartridgeBFSCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
myOldState.bank = myCart.getBank();
}

View File

@ -202,7 +202,7 @@ void CartridgeBUSWidget::saveOldState()
myOldState.internalram.clear();
myOldState.samplepointer.clear();
for(uInt32 i = 0; i < 18; i++)
for(uInt32 i = 0; i < 18; ++i)
{
// Pointers are stored as:
// PPPFF---
@ -221,20 +221,14 @@ void CartridgeBUSWidget::saveOldState()
myOldState.datastreamincrements.push_back(0x100);
}
for(uInt32 i = 0; i < 37; i++) // only 37 map values
{
for(uInt32 i = 0; i < 37; ++i) // only 37 map values
myOldState.addressmaps.push_back(myCart.getAddressMap(i));
}
for(uInt32 i = 37; i < 40; i++) // but need 40 for the grid
{
for(uInt32 i = 37; i < 40; ++i) // but need 40 for the grid
myOldState.addressmaps.push_back(0);
}
for(uInt32 i = 0; i < 3; ++i)
{
myOldState.mcounters.push_back(myCart.myMusicCounters[i]);
}
for(uInt32 i = 0; i < 3; ++i)
{

View File

@ -193,7 +193,7 @@ void CartridgeCDFWidget::saveOldState()
myOldState.internalram.clear();
myOldState.samplepointer.clear();
for(uInt32 i = 0; i < 34; i++)
for(uInt32 i = 0; i < 34; ++i)
{
// Pointers are stored as:
// PPPFF---
@ -210,9 +210,7 @@ void CartridgeCDFWidget::saveOldState()
}
for(uInt32 i = 0; i < 3; ++i)
{
myOldState.mcounters.push_back(myCart.myMusicCounters[i]);
}
for(uInt32 i = 0; i < 3; ++i)
{

View File

@ -153,7 +153,7 @@ void CartridgeCMWidget::saveOldState()
myOldState.column = myCart.column();
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
myOldState.bank = myCart.getBank();

View File

@ -60,10 +60,9 @@ void CartridgeCTYWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
myOldState.bank = myCart.getBank();
}

View File

@ -90,7 +90,8 @@ string CartridgeCVPlusWidget::bankState()
void CartridgeCVPlusWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
myOldState.bank = myCart.getBank();

View File

@ -46,7 +46,8 @@ CartridgeCVWidget::CartridgeCVWidget(
void CartridgeCVWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}

View File

@ -122,7 +122,7 @@ void CartridgeDASHWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}

View File

@ -95,10 +95,8 @@ void CartridgeDFSCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
myOldState.bank = myCart.getBank();
}

View File

@ -30,8 +30,8 @@ class CartridgeE78KWidget : public CartridgeMNetworkWidget
virtual ~CartridgeE78KWidget() = default;
protected:
const char* getSpotLower(int idx);
const char* getSpotUpper(int idx);
const char* getSpotLower(int idx) override;
const char* getSpotUpper(int idx) override;
private:
// Following constructors and assignment operators not supported

View File

@ -30,8 +30,8 @@ class CartridgeE7Widget : public CartridgeMNetworkWidget
virtual ~CartridgeE7Widget() = default;
protected:
const char* getSpotLower(int idx);
const char* getSpotUpper(int idx);
const char* getSpotLower(int idx) override;
const char* getSpotUpper(int idx) override;
private:
// Following constructors and assignment operators not supported

View File

@ -79,10 +79,8 @@ void CartridgeEFSCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
myOldState.bank = myCart.getBank();
}

View File

@ -70,10 +70,9 @@ void CartridgeF4SCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
myOldState.bank = myCart.getBank();
}

View File

@ -66,10 +66,8 @@ void CartridgeF6SCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
myOldState.bank = myCart.getBank();
}

View File

@ -64,10 +64,8 @@ void CartridgeF8SCWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
myOldState.bank = myCart.getBank();
}

View File

@ -102,10 +102,8 @@ void CartridgeFA2Widget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
myOldState.bank = myCart.getBank();
}

View File

@ -65,10 +65,8 @@ void CartridgeFAWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize();i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
myOldState.bank = myCart.getBank();
}

View File

@ -68,10 +68,8 @@ void CartridgeMNetworkWidget::saveOldState()
{
myOldState.internalram.clear();
for(uInt32 i = 0; i < this->internalRamSize(); i++)
{
for(uInt32 i = 0; i < internalRamSize(); ++i)
myOldState.internalram.push_back(myCart.myRAM[i]);
}
myOldState.lowerBank = myCart.myCurrentSlice[0];
myOldState.upperBank = myCart.myCurrentRAM;

View File

@ -148,7 +148,7 @@ void CartRamWidget::InternalRamWidget::fillList(uInt32 start, uInt32 size,
const ByteArray& oldRam = myCart.internalRamOld(start, size);
const ByteArray& currRam = myCart.internalRamCurrent(start, size);
for(uInt32 i = 0; i < size; i++)
for(uInt32 i = 0; i < size; ++i)
{
alist.push_back(i+start);
vlist.push_back(currRam[i]);

View File

@ -69,14 +69,14 @@ class CartRamWidget : public Widget, public CommandSender
virtual ~InternalRamWidget();
private:
uInt8 getValue(int addr) const;
void setValue(int addr, uInt8 value);
string getLabel(int addr) const;
uInt8 getValue(int addr) const override;
void setValue(int addr, uInt8 value) override;
string getLabel(int addr) const override;
void fillList(uInt32 start, uInt32 size, IntArray& alist,
IntArray& vlist, BoolArray& changed) const;
uInt32 readPort(uInt32 start) const;
const ByteArray& currentRam(uInt32 start) const;
IntArray& vlist, BoolArray& changed) const override;
uInt32 readPort(uInt32 start) const override;
const ByteArray& currentRam(uInt32 start) const override;
private:
CartDebugWidget& myCart;

View File

@ -88,22 +88,22 @@ void PointingDeviceWidget::handleCommand(CommandSender* sender, int cmd, int dat
switch(cmd)
{
case kTBLeft:
pDev.myCountH++;
++pDev.myCountH;
pDev.myTrackBallLeft = false;
setGrayCodeH();
break;
case kTBRight:
pDev.myCountH--;
--pDev.myCountH;
pDev.myTrackBallLeft = true;
setGrayCodeH();
break;
case kTBUp:
pDev.myCountV++;
++pDev.myCountV;
pDev.myTrackBallDown = true;
setGrayCodeV();
break;
case kTBDown:
pDev.myCountV--;
--pDev.myCountV;
pDev.myTrackBallDown = false;
setGrayCodeV();
break;

View File

@ -523,7 +523,7 @@ void PromptWidget::loadConfig()
// fill the history from the saved breaks, traps and watches commands
StringList history;
print(instance().debugger().autoExec(&history));
for(uInt32 i = 0; i < history.size(); i++)
for(uInt32 i = 0; i < history.size(); ++i)
{
addToHistory(history[i].c_str());
}
@ -931,9 +931,9 @@ bool PromptWidget::saveBuffer(const FilesystemNode& file)
string PromptWidget::getCompletionPrefix(const StringList& completions)
{
// Find the number of characters matching for each of the completions provided
for(uInt32 len = 1;; len++)
for(uInt32 len = 1;; ++len)
{
for(uInt32 i = 0; i < completions.size(); i++)
for(uInt32 i = 0; i < completions.size(); ++i)
{
string s1 = completions[i];
if(s1.length() < len)
@ -942,7 +942,7 @@ string PromptWidget::getCompletionPrefix(const StringList& completions)
}
string find = s1.substr(0, len);
for(uInt32 j = i + 1; j < completions.size(); j++)
for(uInt32 j = i + 1; j < completions.size(); ++j)
{
if(!BSPF::startsWithIgnoreCase(completions[j], find))
return s1.substr(0, len - 1);

View File

@ -56,7 +56,7 @@ void RiotRamWidget::fillList(uInt32 start, uInt32 size, IntArray& alist,
const CartState& state = static_cast<const CartState&>(myDbg.getState());
const CartState& oldstate = static_cast<const CartState&>(myDbg.getOldState());
for(uInt32 i = 0; i < size; i++)
for(uInt32 i = 0; i < size; ++i)
{
alist.push_back(i+start);
vlist.push_back(state.ram[i]);

View File

@ -37,14 +37,14 @@ class RiotRamWidget : public RamWidget
virtual ~RiotRamWidget() = default;
private:
uInt8 getValue(int addr) const;
void setValue(int addr, uInt8 value);
string getLabel(int addr) const;
uInt8 getValue(int addr) const override;
void setValue(int addr, uInt8 value) override;
string getLabel(int addr) const override;
void fillList(uInt32 start, uInt32 size, IntArray& alist,
IntArray& vlist, BoolArray& changed) const;
uInt32 readPort(uInt32 start) const;
const ByteArray& currentRam(uInt32 start) const;
IntArray& vlist, BoolArray& changed) const override;
uInt32 readPort(uInt32 start) const override;
const ByteArray& currentRam(uInt32 start) const override;
private:
CartDebug& myDbg;

View File

@ -941,7 +941,7 @@ void TiaWidget::loadConfig()
// Color registers
alist.clear(); vlist.clear(); changed.clear();
for(uInt32 i = 0; i < 4; i++)
for(uInt32 i = 0; i < 4; ++i)
{
alist.push_back(i);
vlist.push_back(state.coluRegs[i]);

View File

@ -235,7 +235,7 @@ void Cartridge3EPlus::bankROMSlot(uInt16 bank)
void Cartridge3EPlus::initializeBankState()
{
// Switch in each 512b slot
for(uInt32 b = 0; b < 8; b++)
for(uInt32 b = 0; b < 8; ++b)
{
if(bankInUse[b] == BANK_UNDEFINED)
{

View File

@ -212,8 +212,8 @@ uInt8 CartridgeBUS::peek(uInt16 address)
uInt32 pointer;
uInt8 value;
myFastJumpActive--;
myJMPoperandAddress++;
--myFastJumpActive;
++myJMPoperandAddress;
pointer = getDatastreamPointer(JUMPSTREAM);
value = myDisplayImage[ pointer >> 20 ];

View File

@ -196,8 +196,8 @@ uInt8 CartridgeCDF::peek(uInt16 address)
uInt32 pointer;
uInt8 value;
myFastJumpActive--;
myJMPoperandAddress++;
--myFastJumpActive;
++myJMPoperandAddress;
pointer = getDatastreamPointer(JUMPSTREAM);
value = myDisplayImage[ pointer >> 20 ];

View File

@ -44,7 +44,7 @@ void CartridgeDASH::reset()
// Initialise bank values for all ROM/RAM access
// This is used to reverse-lookup from address to bank location
for(uInt32 b = 0; b < 8; b++)
for(uInt32 b = 0; b < 8; ++b)
{
bankInUse[b] = BANK_UNDEFINED; // bank is undefined and inaccessible!
segmentInUse[b/2] = BANK_UNDEFINED;
@ -69,7 +69,7 @@ void CartridgeDASH::install(System& system)
// Initialise bank values for all ROM/RAM access
// This is used to reverse-lookup from address to bank location
for (uInt32 b = 0; b < 8; b++)
for (uInt32 b = 0; b < 8; ++b)
{
bankInUse[b] = BANK_UNDEFINED; // bank is undefined and inaccessible!
segmentInUse[b/2] = BANK_UNDEFINED;
@ -240,7 +240,7 @@ void CartridgeDASH::bankROMSlot(uInt16 bank)
void CartridgeDASH::initializeBankState()
{
// Switch in each 512b slot
for(uInt32 b = 0; b < 8; b++)
for(uInt32 b = 0; b < 8; ++b)
{
if(bankInUse[b] == BANK_UNDEFINED)
{

View File

@ -639,7 +639,7 @@ void Console::changeYStart(int direction)
myOSystem.frameBuffer().showMessage("YStart at maximum");
return;
}
ystart++;
++ystart;
}
else if(direction == -1) // decrease YStart
{
@ -654,7 +654,7 @@ void Console::changeYStart(int direction)
return;
}
ystart--;
--ystart;
}
else
return;
@ -689,7 +689,7 @@ void Console::changeHeight(int direction)
if(direction == +1) // increase Height
{
height++;
++height;
if(height > TIAConstants::maxViewableHeight || height > dheight)
{
myOSystem.frameBuffer().showMessage("Height at maximum");
@ -698,7 +698,7 @@ void Console::changeHeight(int direction)
}
else if(direction == -1) // decrease Height
{
height--;
--height;
if(height < TIAConstants::minViewableHeight) height = 0;
}
else

View File

@ -62,7 +62,7 @@ class System;
class Controller : public Serializable
{
/**
Riot debug class needs special access to the underlying controller state
Various classes that need special access to the underlying controller state
*/
friend class M6532;
friend class RiotDebug;

View File

@ -61,15 +61,15 @@ void Driving::update()
// Digital events (from keyboard or joystick hats & buttons)
myDigitalPinState[Six] = (myEvent.get(myFireEvent) == 0);
int d_axis = myEvent.get(myXAxisValue);
if(myEvent.get(myCCWEvent) != 0 || d_axis < -16384) myCounter--;
else if(myEvent.get(myCWEvent) != 0 || d_axis > 16384) myCounter++;
if(myEvent.get(myCCWEvent) != 0 || d_axis < -16384) --myCounter;
else if(myEvent.get(myCWEvent) != 0 || d_axis > 16384) ++myCounter;
// Mouse motion and button events
if(myControlID > -1)
{
int m_axis = myEvent.get(Event::MouseAxisXValue);
if(m_axis < -2) myCounter--;
else if(m_axis > 2) myCounter++;
if(m_axis < -2) --myCounter;
else if(m_axis > 2) ++myCounter;
if(myEvent.get(Event::MouseButtonLeftValue) ||
myEvent.get(Event::MouseButtonRightValue))
myDigitalPinState[Six] = false;
@ -81,8 +81,8 @@ void Driving::update()
if(myControlIDX > -1)
{
int m_axis = myEvent.get(Event::MouseAxisXValue);
if(m_axis < -2) myCounter--;
else if(m_axis > 2) myCounter++;
if(m_axis < -2) --myCounter;
else if(m_axis > 2) ++myCounter;
if(myEvent.get(Event::MouseButtonLeftValue))
myDigitalPinState[Six] = false;
}
@ -114,7 +114,7 @@ void Driving::update()
myGrayIndex = 1; // down
else if(yaxis >= 16384-4096)
myGrayIndex = 2; // up + down
else if(yaxis < 16384-4096)
else /* if(yaxis < 16384-4096) */
myGrayIndex = 0; // no movement
}

View File

@ -23,7 +23,7 @@
namespace GUI {
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Font::Font(FontDesc desc)
Font::Font(const FontDesc& desc)
: myFontDesc(desc)
{
}

View File

@ -55,7 +55,7 @@ namespace GUI {
class Font
{
public:
Font(FontDesc desc);
Font(const FontDesc& desc);
const FontDesc& desc() const { return myFontDesc; }