More fixes for suggestions from cppcheck.

This commit is contained in:
Stephen Anthony 2018-08-28 16:19:50 -02:30
parent 558b071fbb
commit 7e4dc350f0
32 changed files with 134 additions and 135 deletions

View File

@ -45,25 +45,25 @@ class FilesystemNodeZIP : public AbstractFSNode
*/
FilesystemNodeZIP(const string& path);
bool exists() const { return _realNode && _realNode->exists(); }
const string& getName() const { return _name; }
const string& getPath() const { return _path; }
string getShortPath() const { return _shortPath; }
bool isDirectory() const { return _isDirectory; }
bool isFile() const { return _isFile; }
bool isReadable() const { return _realNode && _realNode->isReadable(); }
bool isWritable() const { return false; }
bool exists() const override { return _realNode && _realNode->exists(); }
const string& getName() const override { return _name; }
const string& getPath() const override { return _path; }
string getShortPath() const override { return _shortPath; }
bool isDirectory() const override { return _isDirectory; }
bool isFile() const override { return _isFile; }
bool isReadable() const override { return _realNode && _realNode->isReadable(); }
bool isWritable() const override { return false; }
//////////////////////////////////////////////////////////
// For now, ZIP files cannot be modified in any way
bool makeDir() { return false; }
bool rename(const string& newfile) { return false; }
bool makeDir() override { return false; }
bool rename(const string& newfile) override { return false; }
//////////////////////////////////////////////////////////
bool getChildren(AbstractFSList& list, ListMode mode, bool hidden) const;
AbstractFSNodePtr getParent() const;
bool getChildren(AbstractFSList& list, ListMode mode, bool hidden) const override;
AbstractFSNodePtr getParent() const override;
uInt32 read(BytePtr& image) const;
uInt32 read(BytePtr& image) const override;
private:
FilesystemNodeZIP(const string& zipfile, const string& virtualpath,

View File

@ -257,38 +257,38 @@ void AtariNTSC::renderWithPhosphorThread(const uInt8* atari_in, const uInt32 in_
{
// Store back into displayed frame buffer (for next frame)
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
}
// finish final pixels
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
#if 0
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++;
++bufofs;
#endif
atari_in += in_width;
@ -334,9 +334,9 @@ void AtariNTSC::init(init_t& impl, const Setup& setup)
initFilters(impl, setup);
/* generate gamma table */
if ( gamma_size > 1 )
if (true) /* was (gamma_size > 1) */
{
float const to_float = 1.0f / (gamma_size - (gamma_size > 1));
float const to_float = 1.0f / (gamma_size - 1/*(gamma_size > 1)*/);
float const gamma = 1.1333f - float(setup.gamma) * 0.5f;
/* match common PC's 2.2 gamma to TV's 2.65 gamma */
int i;
@ -369,8 +369,10 @@ void AtariNTSC::init(init_t& impl, const Setup& setup)
*out++ = i * s + q * c;
}
while ( --n2 );
#if 0 // burst_count is always 0
if ( burst_count > 1 )
ROTATE_IQ( s, c, 0.866025f, -0.5f ); /* +120 degrees */
#endif
}
while ( --n );
}
@ -537,7 +539,7 @@ void AtariNTSC::genKernel(init_t& impl, float y, float i, float q, uInt32* out)
}
}
}
while ( alignment_count > 1 && --alignment_remain );
while ( /*alignment_count > 1 && */ --alignment_remain );
}
while ( --burst_remain );
}

View File

@ -100,7 +100,7 @@ string NTSCFilter::setPreviousAdjustable()
return "'Custom' TV mode not selected";
if(myCurrentAdjustable == 0) myCurrentAdjustable = 9;
else myCurrentAdjustable--;
else --myCurrentAdjustable;
ostringstream buf;
buf << "Custom adjustable '" << ourCustomAdjustables[myCurrentAdjustable].type
<< "' selected";

View File

@ -750,7 +750,7 @@ void DiStella::disasmFromAddress(uInt32 distart)
break;
case IMMEDIATE:
myPC++;
++myPC;
break;
case ABSOLUTE_X:
@ -764,11 +764,11 @@ void DiStella::disasmFromAddress(uInt32 distart)
break;
case INDIRECT_X:
myPC++;
++myPC;
break;
case INDIRECT_Y:
myPC++;
++myPC;
break;
case ZERO_PAGE_X:

View File

@ -27,6 +27,7 @@
CartridgeDPCPlus::CartridgeDPCPlus(const BytePtr& image, uInt32 size,
const Settings& settings)
: Cartridge(settings),
mySize(std::min(size, 32768u)),
myFastFetch(false),
myLDAimmediate(false),
myParameterPointer(0),
@ -37,7 +38,6 @@ CartridgeDPCPlus::CartridgeDPCPlus(const BytePtr& image, uInt32 size,
{
// Image is always 32K, but in the case of ROM > 29K, the image is
// copied to the end of the buffer
mySize = std::min(size, 32768u);
if(mySize < 32768u)
memset(myImage, 0, 32768);
memcpy(myImage + (32768u - mySize), image.get(), size);

View File

@ -89,8 +89,8 @@ void Driving::update()
if(myControlIDY > -1)
{
int m_axis = myEvent.get(Event::MouseAxisYValue);
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::MouseButtonRightValue))
myDigitalPinState[Six] = false;
}

View File

@ -166,7 +166,7 @@ void FrameBuffer::setUIPalette()
FBInitStatus FrameBuffer::createDisplay(const string& title,
uInt32 width, uInt32 height)
{
myInitializedCount++;
++myInitializedCount;
myScreenTitle = title;
// A 'windowed' system is defined as one where the window size can be
@ -1093,7 +1093,7 @@ uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = {
0xc9af7c, 0xf0f0cf, 0xd55941, 0xc80000, // UI elements
0xac3410, 0xd55941, 0x686868, 0xdccfa5, 0xf0f0cf, 0xf0f0cf, // buttons
0xac3410, // checkbox
0xac3410, 0xd55941, // scrollbar
0xac3410, 0xd55941, // scrollbar
0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, // debugger
0xac3410, 0xd55941, 0xdccfa5, 0xf0f0cf, 0xa38c61, // slider
0xffffff, 0xac3410, 0xf0f0cf, 0x686868, 0xdccfa5 // other
@ -1104,7 +1104,7 @@ uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = {
0x000000, 0x000000, 0x00ff00, 0xc80000, // UI elements
0x000000, 0x000000, 0x686868, 0x00ff00, 0x20a020, 0x00ff00, // buttons
0x20a020, // checkbox
0x20a020, 0x00ff00, // scrollbar
0x20a020, 0x00ff00, // scrollbar
0xc80000, 0x00ff00, 0xc8c8ff, 0xc80000, // debugger
0x20a020, 0x00ff00, 0x404040, 0x686868, 0x404040, // slider
0x00ff00, 0x20a020, 0x000000, 0x686868, 0x404040 // other
@ -1115,7 +1115,7 @@ uInt32 FrameBuffer::ourGUIColors[3][kNumColors-256] = {
0xf0f0f0, 0xffffff, 0x0078d7, 0x0f0f0f, // UI elements
0xe1e1e1, 0xe5f1fb, 0x808080, 0x0078d7, 0x000000, 0x000000, // buttons
0x333333, // checkbox
0xc0c0c0, 0x808080, // scrollbar
0xc0c0c0, 0x808080, // scrollbar
0xffc0c0, 0x000000, 0xe00000, 0xc00000, // debugger
0x333333, 0x0078d7, 0xc0c0c0, 0xffffff, 0xc0c0c0, // slider 0xBDDEF9| 0xe1e1e1 | 0xffffff
0xffffff, 0x333333, 0xf0f0f0, 0x808080, 0xc0c0c0 // other

View File

@ -116,8 +116,8 @@ cerr << "myTape = " << myTape << endl;
IOPortA = (IOPortA & 0xf7) | (((ourKVData[myIdx >> 3] << (myIdx & 0x07)) & 0x80) >> 4);
// increase to next bit
myIdx++;
myBlockIdx--;
++myIdx;
--myBlockIdx;
// increase to next block (byte)
if(myBlockIdx == 0)
@ -147,7 +147,7 @@ cerr << "myTape = " << myTape << endl;
}
}
}
myBlock++;
++myBlock;
myBlockIdx = KVBLOCKBITS;
}
}
@ -237,7 +237,7 @@ void KidVid::setNextSong()
; // fseek(mySampleFile, ourSongStart[temp], SEEK_SET);
#endif
myFilePointer++;
++myFilePointer;
myTapeBusy = true;
}
else

View File

@ -131,7 +131,7 @@ inline uInt8 M6502::peek(uInt16 address, uInt8 flags)
// TODO - move this logic directly into CartAR
if(address != myLastAddress)
{
myNumberOfDistinctAccesses++;
++myNumberOfDistinctAccesses;
myLastAddress = address;
}
////////////////////////////////////////////////
@ -168,7 +168,7 @@ inline void M6502::poke(uInt16 address, uInt8 value, uInt8 flags)
// TODO - move this logic directly into CartAR
if(address != myLastAddress)
{
myNumberOfDistinctAccesses++;
++myNumberOfDistinctAccesses;
myLastAddress = address;
}
////////////////////////////////////////////////

View File

@ -287,7 +287,7 @@ static void Encode(uInt8* output, uInt32* input, uInt32 len)
{
uInt32 i, j;
for (i = 0, j = 0; j < len; i++, j += 4) {
for (i = 0, j = 0; j < len; ++i, j += 4) {
output[j] = uInt8(input[i] & 0xff);
output[j+1] = uInt8((input[i] >> 8) & 0xff);
output[j+2] = uInt8((input[i] >> 16) & 0xff);
@ -301,7 +301,7 @@ static void Decode(uInt32* output, const uInt8* input, uInt32 len)
{
uInt32 i, j;
for (i = 0, j = 0; j < len; i++, j += 4)
for (i = 0, j = 0; j < len; ++i, j += 4)
output[i] = (uInt32(input[j])) | ((uInt32(input[j+1])) << 8) |
((uInt32(input[j+2])) << 16) | ((uInt32(input[j+3])) << 24);
}

View File

@ -164,7 +164,7 @@ void MT24LC256::eraseAll()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void MT24LC256::eraseCurrent()
{
for(uInt32 page = 0; page < PAGE_NUM; page++)
for(uInt32 page = 0; page < PAGE_NUM; ++page)
{
if(myPageHit[page])
{
@ -369,7 +369,7 @@ void MT24LC256::jpee_clock_fall()
{
jpee_state = 4;
jpee_sdat = 1;
jpee_address++;
++jpee_address;
}
break;

View File

@ -49,8 +49,8 @@ uInt8 PointingDevice::read()
// Loop over all missed changes
while(myScanCountH < scanline)
{
if(myTrackBallLeft) myCountH--;
else myCountH++;
if(myTrackBallLeft) --myCountH;
else ++myCountH;
// Define scanline of next change
myScanCountH += myTrackBallLinesH;
@ -59,8 +59,8 @@ uInt8 PointingDevice::read()
// Loop over all missed changes
while(myScanCountV < scanline)
{
if(myTrackBallDown) myCountV++;
else myCountV--;
if(myTrackBallDown) ++myCountV;
else --myCountV;
// Define scanline of next change
myScanCountV += myTrackBallLinesV;

View File

@ -350,9 +350,9 @@ void TIASurface::render()
{
// Store back into displayed frame buffer (for next frame)
rgbIn[bufofs] = out[pos++] = getRGBPhosphor(myPalette[tiaIn[bufofs]], rgbIn[bufofs]);
bufofs++;
++bufofs;
rgbIn[bufofs] = out[pos++] = getRGBPhosphor(myPalette[tiaIn[bufofs]], rgbIn[bufofs]);
bufofs++;
++bufofs;
}
screenofsY += outPitch;
}

View File

@ -167,7 +167,7 @@ void Thumbulator::dump_regs()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 Thumbulator::fetch16(uInt32 addr)
{
fetches++;
++fetches;
uInt32 data;
switch(addr & 0xF0000000)
@ -229,7 +229,7 @@ void Thumbulator::write16(uInt32 addr, uInt32 data)
if(addr & 1)
fatalError("write16", addr, "abort - misaligned");
writes++;
++writes;
DO_DBUG(statusMsg << "write16(" << Base::HEX8 << addr << "," << Base::HEX8 << data << ")" << endl);
@ -369,7 +369,7 @@ uInt32 Thumbulator::read16(uInt32 addr)
if(addr & 1)
fatalError("read16", addr, "abort - misaligned");
reads++;
++reads;
switch(addr & 0xF0000000)
{
@ -597,7 +597,7 @@ int Thumbulator::execute()
write_register(15, pc);
DO_DISS(statusMsg << Base::HEX8 << (pc-5) << ": " << Base::HEX4 << inst << " ");
instructions++;
++instructions;
//ADC
if((inst & 0xFFC0) == 0x4140)
@ -609,7 +609,7 @@ int Thumbulator::execute()
rb = read_register(rm);
rc = ra + rb;
if(cpsr & CPSR_C)
rc++;
++rc;
write_register(rd, rc);
do_nflag(rc);
do_zflag(rc);
@ -909,8 +909,8 @@ int Thumbulator::execute()
case 0xA: //b ge N == V
DO_DISS(statusMsg << "bge 0x" << Base::HEX8 << (rb-3) << endl);
ra = 0;
if( (cpsr & CPSR_N) && (cpsr & CPSR_V) ) ra++;
if((!(cpsr & CPSR_N)) && (!(cpsr & CPSR_V))) ra++;
if( (cpsr & CPSR_N) && (cpsr & CPSR_V) ) ++ra;
if((!(cpsr & CPSR_N)) && (!(cpsr & CPSR_V))) ++ra;
if(ra)
write_register(15, rb);
return 0;
@ -918,8 +918,8 @@ int Thumbulator::execute()
case 0xB: //b lt N != V
DO_DISS(statusMsg << "blt 0x" << Base::HEX8 << (rb-3) << endl);
ra = 0;
if((!(cpsr & CPSR_N)) && (cpsr & CPSR_V)) ra++;
if((!(cpsr & CPSR_V)) && (cpsr & CPSR_N)) ra++;
if((!(cpsr & CPSR_N)) && (cpsr & CPSR_V)) ++ra;
if((!(cpsr & CPSR_V)) && (cpsr & CPSR_N)) ++ra;
if(ra)
write_register(15, rb);
return 0;
@ -927,8 +927,8 @@ int Thumbulator::execute()
case 0xC: //b gt Z==0 and N == V
DO_DISS(statusMsg << "bgt 0x" << Base::HEX8 << (rb-3) << endl);
ra = 0;
if( (cpsr & CPSR_N) && (cpsr & CPSR_V) ) ra++;
if((!(cpsr & CPSR_N)) && (!(cpsr & CPSR_V))) ra++;
if( (cpsr & CPSR_N) && (cpsr & CPSR_V) ) ++ra;
if((!(cpsr & CPSR_N)) && (!(cpsr & CPSR_V))) ++ra;
if(cpsr & CPSR_Z) ra = 0;
if(ra)
write_register(15, rb);
@ -937,9 +937,9 @@ int Thumbulator::execute()
case 0xD: //b le Z==1 or N != V
DO_DISS(statusMsg << "ble 0x" << Base::HEX8 << (rb-3) << endl);
ra = 0;
if((!(cpsr & CPSR_N)) && (cpsr & CPSR_V)) ra++;
if((!(cpsr & CPSR_V)) && (cpsr & CPSR_N)) ra++;
if(cpsr & CPSR_Z) ra++;
if((!(cpsr & CPSR_N)) && (cpsr & CPSR_V)) ++ra;
if((!(cpsr & CPSR_V)) && (cpsr & CPSR_N)) ++ra;
if(cpsr & CPSR_Z) ++ra;
if(ra)
write_register(15, rb);
return 0;
@ -1394,7 +1394,7 @@ int Thumbulator::execute()
rn = (inst >> 8) & 0x7;
#if defined(THUMB_DISS)
statusMsg << "ldmia r" << dec << rn << "!,{";
for(ra=0,rb=0x01,rc=0;rb;rb=(rb<<1)&0xFF,ra++)
for(ra=0,rb=0x01,rc=0;rb;rb=(rb<<1)&0xFF,++ra)
{
if(inst&rb)
{
@ -1406,7 +1406,7 @@ int Thumbulator::execute()
statusMsg << "}" << endl;
#endif
sp = read_register(rn);
for(ra = 0, rb = 0x01; rb; rb = (rb << 1) & 0xFF, ra++)
for(ra = 0, rb = 0x01; rb; rb = (rb << 1) & 0xFF, ++ra)
{
if(inst & rb)
{
@ -1816,7 +1816,7 @@ int Thumbulator::execute()
{
#if defined(THUMB_DISS)
statusMsg << "pop {";
for(ra=0,rb=0x01,rc=0;rb;rb=(rb<<1)&0xFF,ra++)
for(ra=0,rb=0x01,rc=0;rb;rb=(rb<<1)&0xFF,++ra)
{
if(inst&rb)
{
@ -1834,7 +1834,7 @@ int Thumbulator::execute()
#endif
sp = read_register(13);
for(ra = 0, rb = 0x01; rb; rb = (rb << 1) & 0xFF, ra++)
for(ra = 0, rb = 0x01; rb; rb = (rb << 1) & 0xFF, ++ra)
{
if(inst & rb)
{
@ -1858,7 +1858,7 @@ int Thumbulator::execute()
{
#if defined(THUMB_DISS)
statusMsg << "push {";
for(ra=0,rb=0x01,rc=0;rb;rb=(rb<<1)&0xFF,ra++)
for(ra=0,rb=0x01,rc=0;rb;rb=(rb<<1)&0xFF,++ra)
{
if(inst&rb)
{
@ -1877,18 +1877,18 @@ int Thumbulator::execute()
sp = read_register(13);
//fprintf(stderr,"sp 0x%08X\n",sp);
for(ra = 0, rb = 0x01, rc = 0; rb; rb = (rb << 1) & 0xFF, ra++)
for(ra = 0, rb = 0x01, rc = 0; rb; rb = (rb << 1) & 0xFF, ++ra)
{
if(inst & rb)
{
rc++;
++rc;
}
}
if(inst & 0x100) rc++;
if(inst & 0x100) ++rc;
rc <<= 2;
sp -= rc;
rd = sp;
for(ra = 0, rb = 0x01; rb; rb = (rb << 1) & 0xFF, ra++)
for(ra = 0, rb = 0x01; rb; rb = (rb << 1) & 0xFF, ++ra)
{
if(inst & rb)
{
@ -1996,7 +1996,7 @@ int Thumbulator::execute()
ra = read_register(rd);
rb = read_register(rm);
rc = ra - rb;
if(!(cpsr & CPSR_C)) rc--;
if(!(cpsr & CPSR_C)) --rc;
write_register(rd, rc);
do_nflag(rc);
do_zflag(rc);
@ -2026,7 +2026,7 @@ int Thumbulator::execute()
rn = (inst >> 8) & 0x7;
#if defined(THUMB_DISS)
statusMsg << "stmia r" << dec << rn << "!,{";
for(ra=0,rb=0x01,rc=0;rb;rb=(rb<<1)&0xFF,ra++)
for(ra=0,rb=0x01,rc=0;rb;rb=(rb<<1)&0xFF,++ra)
{
if(inst & rb)
{
@ -2039,7 +2039,7 @@ int Thumbulator::execute()
#endif
sp = read_register(rn);
for(ra = 0, rb = 0x01; rb; rb = (rb << 1) & 0xFF, ra++)
for(ra = 0, rb = 0x01; rb; rb = (rb << 1) & 0xFF, ++ra)
{
if(inst & rb)
{

View File

@ -38,8 +38,8 @@ Audio::Audio()
: myAudioQueue(nullptr),
myCurrentFragment(nullptr)
{
for (uInt8 i = 0; i <= 0x1e; i++) myMixingTableSum[i] = mixingTableEntry(i, 0x1e);
for (uInt8 i = 0; i <= 0x0f; i++) myMixingTableIndividual[i] = mixingTableEntry(i, 0x0f);
for (uInt8 i = 0; i <= 0x1e; ++i) myMixingTableSum[i] = mixingTableEntry(i, 0x1e);
for (uInt8 i = 0; i <= 0x0f; ++i) myMixingTableIndividual[i] = mixingTableEntry(i, 0x0f);
reset();
}

View File

@ -75,7 +75,7 @@ void AudioChannel::phase0()
if (myDivCounter == myAudf || myDivCounter == 0x1f) {
myDivCounter = 0;
} else {
myDivCounter++;
++myDivCounter;
}
}

View File

@ -185,7 +185,7 @@ void Ball::tick(bool isReceivingMclock)
myRenderCounter = Count::renderCounterOffset;
uInt8 starfieldDelta = (myCounter + 160 - myLastMovementTick) % 4;
if (starfieldEffect && starfieldDelta == 3 && myWidth < 4) myRenderCounter++;
if (starfieldEffect && starfieldDelta == 3 && myWidth < 4) ++myRenderCounter;
switch (starfieldDelta) {
case 3:

View File

@ -96,7 +96,7 @@ void DelayQueue<length, capacity>::push(uInt8 address, uInt8 value, uInt8 delay)
template<unsigned length, unsigned capacity>
void DelayQueue<length, capacity>::reset()
{
for (uInt8 i = 0; i < length; i++)
for (uInt8 i = 0; i < length; ++i)
myMembers[i].clear();
myIndex = 0;
@ -110,7 +110,7 @@ void DelayQueue<length, capacity>::execute(T executor)
{
DelayQueueMember<capacity>& currentMember = myMembers[myIndex];
for (uInt8 i = 0; i < currentMember.mySize; i++) {
for (uInt8 i = 0; i < currentMember.mySize; ++i) {
executor(currentMember.myEntries[i].address, currentMember.myEntries[i].value);
myIndices[currentMember.myEntries[i].address] = 0xFF;
}
@ -128,7 +128,7 @@ bool DelayQueue<length, capacity>::save(Serializer& out) const
{
out.putInt(length);
for (uInt8 i = 0; i < length; i++)
for (uInt8 i = 0; i < length; ++i)
myMembers[i].save(out);
out.putByte(myIndex);
@ -151,7 +151,7 @@ bool DelayQueue<length, capacity>::load(Serializer& in)
{
if (in.getInt() != length) throw runtime_error("delay queue length mismatch");
for (uInt8 i = 0; i < length; i++)
for (uInt8 i = 0; i < length; ++i)
myMembers[i].load(in);
myIndex = in.getByte();

View File

@ -119,7 +119,7 @@ bool DelayQueueIteratorImpl<length, capacity>::next()
myIndex = 0;
do {
myDelayCycle++;
++myDelayCycle;
} while (myDelayQueue.myMembers[currentIndex()].mySize == 0 && isValid());
return isValid();

View File

@ -88,16 +88,16 @@ void DelayQueueMember<capacity>::remove(uInt8 address)
{
uInt8 index;
for (index = 0; index < mySize; index++) {
for (index = 0; index < mySize; ++index) {
if (myEntries[index].address == address) break;
}
if (index < mySize) {
for (uInt8 i = index + 1; i < mySize; i++) {
for (uInt8 i = index + 1; i < mySize; ++i) {
myEntries[i-1] = myEntries[i];
}
mySize--;
--mySize;
}
}

View File

@ -100,7 +100,7 @@ void Missile::resm(uInt8 counter, bool hblank)
case 2:
if (hblank) myIsRendering = myRenderCounter > 1;
else if (myRenderCounter == 0) myRenderCounter++;
else if (myRenderCounter == 0) ++myRenderCounter;
break;
@ -193,7 +193,7 @@ void Missile::tick(uInt8 hclock, bool isReceivingMclock)
switch ((hclock + 1) % 4) {
case 3:
myEffectiveWidth = myWidth == 1 ? 2 : myWidth;
if (myWidth < 4) myRenderCounter++;
if (myWidth < 4) ++myRenderCounter;
break;
case 2:

View File

@ -140,7 +140,7 @@ void Player::nusiz(uInt8 value, bool hblank)
setDivider(myDividerPending);
} else if (delta < (hblank ? 6 : 5)) {
setDivider(myDividerPending);
myRenderCounter--;
--myRenderCounter;
} else {
myDividerChangeCounter = (hblank ? 0 : 1);
}
@ -282,12 +282,12 @@ void Player::tick()
mySampleCounter = 0;
myRenderCounter = Count::renderCounterOffset;
} else if (myIsRendering) {
myRenderCounter++;
++myRenderCounter;
switch (myDivider) {
case 1:
if (myRenderCounter > 0)
mySampleCounter++;
++mySampleCounter;
if (myRenderCounter >= 0 && myDividerChangeCounter >= 0 && myDividerChangeCounter-- == 0)
setDivider(myDividerPending);
@ -296,7 +296,7 @@ void Player::tick()
default:
if (myRenderCounter > 1 && (((myRenderCounter - 1) % myDivider) == 0))
mySampleCounter++;
++mySampleCounter;
if (myRenderCounter > 0 && myDividerChangeCounter >= 0 && myDividerChangeCounter-- == 0)
setDivider(myDividerPending);

View File

@ -410,7 +410,7 @@ void TIA::bindToControllers()
}
);
for (uInt8 i = 0; i < 4; i++)
for (uInt8 i = 0; i < 4; ++i)
updatePaddle(i);
}
@ -1205,7 +1205,7 @@ void TIA::onFrameComplete()
myFrontBufferScanlines = scanlinesLastFrame();
myFramesSinceLastRender++;
++myFramesSinceLastRender;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1219,7 +1219,7 @@ void TIA::onHalt()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::cycle(uInt32 colorClocks)
{
for (uInt32 i = 0; i < colorClocks; i++)
for (uInt32 i = 0; i < colorClocks; ++i)
{
myDelayQueue.execute(
[this] (uInt8 address, uInt8 value) {delayedWrite(address, value);}
@ -1244,7 +1244,7 @@ void TIA::cycle(uInt32 colorClocks)
myAudio.tick();
myTimestamp++;
++myTimestamp;
}
}
@ -1267,7 +1267,7 @@ void TIA::tickMovement()
myMovementInProgress = m;
myCollisionUpdateRequired = m;
myMovementClock++;
++myMovementClock;
}
}
@ -1331,7 +1331,7 @@ void TIA::nextLine()
myHctr = 0;
if (!myMovementInProgress && myLinesSinceChange < 2) myLinesSinceChange++;
if (!myMovementInProgress && myLinesSinceChange < 2) ++myLinesSinceChange;
myHstate = HState::blank;
myHctrDelta = 0;
@ -1448,7 +1448,7 @@ void TIA::flushLineCache()
if (wasCaching) {
const auto rewindCycles = myHctr;
for (myHctr = 0; myHctr < rewindCycles; myHctr++) {
for (myHctr = 0; myHctr < rewindCycles; ++myHctr) {
if (myHstate == HState::blank)
tickHblank();
else

View File

@ -44,7 +44,7 @@ void AbstractFrameManager::reset()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AbstractFrameManager::nextLine()
{
myCurrentFrameTotalLines++;
++myCurrentFrameTotalLines;
onNextLine();
}
@ -96,7 +96,7 @@ void AbstractFrameManager::notifyFrameComplete()
myPreviousFrameFinalLines = myCurrentFrameFinalLines;
myCurrentFrameFinalLines = myCurrentFrameTotalLines;
myCurrentFrameTotalLines = 0;
myTotalFrames++;
++myTotalFrames;
if (myOnFrameComplete) myOnFrameComplete();
}

View File

@ -69,7 +69,7 @@ void FrameLayoutDetector::onNextLine()
// We start counting the number of "lines spent while waiting for vsync start" from
// the "ideal" frame size (corrected by the three scanlines spent in vsync).
if (myCurrentFrameTotalLines > frameLines - 3 || myTotalFrames == 0)
myLinesWaitingForVsyncToStart++;
++myLinesWaitingForVsyncToStart;
if (myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncEnd);
@ -137,11 +137,11 @@ void FrameLayoutDetector::finalizeFrame()
switch (layout()) {
case FrameLayout::ntsc:
myNtscFrames++;
++myNtscFrames;
break;
case FrameLayout::pal:
myPalFrames++;
++myPalFrames;
break;
default:

View File

@ -70,13 +70,13 @@ void FrameManager::onNextLine()
Int32 jitter;
State previousState = myState;
myLineInState++;
++myLineInState;
switch (myState)
{
case State::waitForVsyncStart:
if ((myCurrentFrameTotalLines > myFrameLines - 3) || myTotalFrames == 0)
myVsyncLines++;
++myVsyncLines;
if (myVsyncLines > Metrics::maxLinesVsync) setState(State::waitForFrameStart);
@ -107,7 +107,7 @@ void FrameManager::onNextLine()
throw runtime_error("frame manager: invalid state");
}
if (myState == State::frame && previousState == State::frame) myY++;
if (myState == State::frame && previousState == State::frame) ++myY;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -84,7 +84,7 @@ void YStartDetector::onNextLine()
// We start counting the number of "lines spent while waiting for vsync start" from
// the "ideal" frame size (corrected by the three scanlines spent in vsync).
if (myCurrentFrameTotalLines > frameLines - 3 || myTotalFrames == 0)
myLinesWaitingForVsyncToStart++;
++myLinesWaitingForVsyncToStart;
if (myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncEnd);
@ -97,7 +97,7 @@ void YStartDetector::onNextLine()
case State::waitForFrameStart:
if (shouldTransitionToFrame()) setState(State::waitForVsyncStart);
else myCurrentVblankLines++;
else ++myCurrentVblankLines;
break;
@ -126,7 +126,7 @@ bool YStartDetector::shouldTransitionToFrame()
// Is this same scanline in which the transition ocurred last frame?
if (myTotalFrames > Metrics::initialGarbageFrames && myCurrentVblankLines == myLastVblankLines)
// Yes? -> Increase the number of stable frames
myStableVblankFrames++;
++myStableVblankFrames;
else
// No? -> Frame start shifted again, set the number of consecutive stable frames to zero
myStableVblankFrames = 0;
@ -160,7 +160,7 @@ bool YStartDetector::shouldTransitionToFrame()
myVblankViolations = 0;
else {
// Record a violation if it wasn't recorded before
if (!myVblankViolated) myVblankViolations++;
if (!myVblankViolated) ++myVblankViolations;
myVblankViolated = true;
}
@ -169,7 +169,7 @@ bool YStartDetector::shouldTransitionToFrame()
// The algorithm tells us to transition although we haven't reached the trip line before
} else if (shouldTransition) {
// Record a violation if it wasn't recorded before
if (!myVblankViolated) myVblankViolations++;
if (!myVblankViolated) ++myVblankViolations;
myVblankViolated = true;
}

View File

@ -978,7 +978,7 @@ void DeveloperDialog::handleSize()
}
}
if(!found)
interval--;
--interval;
} while(!found);
if(size < uncompressed)

View File

@ -67,7 +67,7 @@ HelpDialog::HelpDialog(OSystem& osystem, DialogContainer& parent,
int lwidth = 12 * fontWidth;
xpos += 5; ypos += lineHeight + 4;
for(uInt8 i = 0; i < kLINES_PER_PAGE; i++)
for(uInt8 i = 0; i < kLINES_PER_PAGE; ++i)
{
myKey[i] =
new StaticTextWidget(this, font, xpos, ypos, lwidth,
@ -179,7 +179,7 @@ void HelpDialog::displayInfo()
updateStrings(myPage, kLINES_PER_PAGE, titleStr);
myTitle->setLabel(titleStr);
for(uInt8 i = 0; i < kLINES_PER_PAGE; i++)
for(uInt8 i = 0; i < kLINES_PER_PAGE; ++i)
{
myKey[i]->setLabel(myKeyStr[i]);
myDesc[i]->setLabel(myDescStr[i]);
@ -193,7 +193,7 @@ void HelpDialog::handleCommand(CommandSender* sender, int cmd,
switch(cmd)
{
case GuiObject::kNextCmd:
myPage++;
++myPage;
if(myPage >= myNumPages)
myNextButton->clearFlags(WIDGET_ENABLED);
if(myPage >= 2)
@ -203,7 +203,7 @@ void HelpDialog::handleCommand(CommandSender* sender, int cmd,
break;
case GuiObject::kPrevCmd:
myPage--;
--myPage;
if(myPage <= myNumPages)
myNextButton->setFlags(WIDGET_ENABLED);
if(myPage <= 1)

View File

@ -198,7 +198,7 @@ void RadioButtonGroup::select(RadioButtonWidget* widget)
setSelected(i);
break;
}
i++;
++i;
}
}
@ -211,7 +211,6 @@ void RadioButtonGroup::setSelected(uInt32 selected)
for(const auto& w : myWidgets)
{
(static_cast<RadioButtonWidget*>(w))->setState(i == mySelected);
i++;
++i;
}
}

View File

@ -38,9 +38,8 @@ struct Point
Point() : x(0), y(0) { }
Point(const Point& p) : x(p.x), y(p.y) { }
explicit Point(uInt32 x1, uInt32 y1) : x(x1), y(y1) { }
Point(const string& p) {
Point(const string& p) : x(0), y(0) {
char c = '\0';
x = y = 0;
istringstream buf(p);
buf >> x >> c >> y;
if(c != 'x')
@ -64,9 +63,8 @@ struct Size
Size() : w(0), h(0) { }
Size(const Size& s) : w(s.w), h(s.h) { }
explicit Size(uInt32 w1, uInt32 h1) : w(w1), h(h1) { }
Size(const string& s) {
Size(const string& s) : w(0), h(0) {
char c = '\0';
w = h = 0;
istringstream buf(s);
buf >> w >> c >> h;
if(c != 'x')

View File

@ -132,7 +132,7 @@ void RomAuditDialog::auditRoms()
// Create a entry for the GameList for each file
Properties props;
int renamed = 0, notfound = 0;
for(uInt32 idx = 0; idx < files.size(); idx++)
for(uInt32 idx = 0; idx < files.size(); ++idx)
{
string extension;
if(files[idx].isFile() &&