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); FilesystemNodeZIP(const string& path);
bool exists() const { return _realNode && _realNode->exists(); } bool exists() const override { return _realNode && _realNode->exists(); }
const string& getName() const { return _name; } const string& getName() const override { return _name; }
const string& getPath() const { return _path; } const string& getPath() const override { return _path; }
string getShortPath() const { return _shortPath; } string getShortPath() const override { return _shortPath; }
bool isDirectory() const { return _isDirectory; } bool isDirectory() const override { return _isDirectory; }
bool isFile() const { return _isFile; } bool isFile() const override { return _isFile; }
bool isReadable() const { return _realNode && _realNode->isReadable(); } bool isReadable() const override { return _realNode && _realNode->isReadable(); }
bool isWritable() const { return false; } bool isWritable() const override { return false; }
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
// For now, ZIP files cannot be modified in any way // For now, ZIP files cannot be modified in any way
bool makeDir() { return false; } bool makeDir() override { return false; }
bool rename(const string& newfile) { return false; } bool rename(const string& newfile) override { return false; }
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////
bool getChildren(AbstractFSList& list, ListMode mode, bool hidden) const; bool getChildren(AbstractFSList& list, ListMode mode, bool hidden) const override;
AbstractFSNodePtr getParent() const; AbstractFSNodePtr getParent() const override;
uInt32 read(BytePtr& image) const; uInt32 read(BytePtr& image) const override;
private: private:
FilesystemNodeZIP(const string& zipfile, const string& virtualpath, 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) // Store back into displayed frame buffer (for next frame)
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
} }
// finish final pixels // finish final pixels
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
#if 0 #if 0
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]); rgb_in[bufofs] = getRGBPhosphor(out[bufofs], rgb_in[bufofs]);
bufofs++; ++bufofs;
#endif #endif
atari_in += in_width; atari_in += in_width;
@ -334,9 +334,9 @@ void AtariNTSC::init(init_t& impl, const Setup& setup)
initFilters(impl, setup); initFilters(impl, setup);
/* generate gamma table */ /* 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; float const gamma = 1.1333f - float(setup.gamma) * 0.5f;
/* match common PC's 2.2 gamma to TV's 2.65 gamma */ /* match common PC's 2.2 gamma to TV's 2.65 gamma */
int i; int i;
@ -369,8 +369,10 @@ void AtariNTSC::init(init_t& impl, const Setup& setup)
*out++ = i * s + q * c; *out++ = i * s + q * c;
} }
while ( --n2 ); while ( --n2 );
#if 0 // burst_count is always 0
if ( burst_count > 1 ) if ( burst_count > 1 )
ROTATE_IQ( s, c, 0.866025f, -0.5f ); /* +120 degrees */ ROTATE_IQ( s, c, 0.866025f, -0.5f ); /* +120 degrees */
#endif
} }
while ( --n ); 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 ); while ( --burst_remain );
} }

View File

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

View File

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

View File

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

View File

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

View File

@ -166,7 +166,7 @@ void FrameBuffer::setUIPalette()
FBInitStatus FrameBuffer::createDisplay(const string& title, FBInitStatus FrameBuffer::createDisplay(const string& title,
uInt32 width, uInt32 height) uInt32 width, uInt32 height)
{ {
myInitializedCount++; ++myInitializedCount;
myScreenTitle = title; myScreenTitle = title;
// A 'windowed' system is defined as one where the window size can be // A 'windowed' system is defined as one where the window size can be

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -140,7 +140,7 @@ void Player::nusiz(uInt8 value, bool hblank)
setDivider(myDividerPending); setDivider(myDividerPending);
} else if (delta < (hblank ? 6 : 5)) { } else if (delta < (hblank ? 6 : 5)) {
setDivider(myDividerPending); setDivider(myDividerPending);
myRenderCounter--; --myRenderCounter;
} else { } else {
myDividerChangeCounter = (hblank ? 0 : 1); myDividerChangeCounter = (hblank ? 0 : 1);
} }
@ -282,12 +282,12 @@ void Player::tick()
mySampleCounter = 0; mySampleCounter = 0;
myRenderCounter = Count::renderCounterOffset; myRenderCounter = Count::renderCounterOffset;
} else if (myIsRendering) { } else if (myIsRendering) {
myRenderCounter++; ++myRenderCounter;
switch (myDivider) { switch (myDivider) {
case 1: case 1:
if (myRenderCounter > 0) if (myRenderCounter > 0)
mySampleCounter++; ++mySampleCounter;
if (myRenderCounter >= 0 && myDividerChangeCounter >= 0 && myDividerChangeCounter-- == 0) if (myRenderCounter >= 0 && myDividerChangeCounter >= 0 && myDividerChangeCounter-- == 0)
setDivider(myDividerPending); setDivider(myDividerPending);
@ -296,7 +296,7 @@ void Player::tick()
default: default:
if (myRenderCounter > 1 && (((myRenderCounter - 1) % myDivider) == 0)) if (myRenderCounter > 1 && (((myRenderCounter - 1) % myDivider) == 0))
mySampleCounter++; ++mySampleCounter;
if (myRenderCounter > 0 && myDividerChangeCounter >= 0 && myDividerChangeCounter-- == 0) if (myRenderCounter > 0 && myDividerChangeCounter >= 0 && myDividerChangeCounter-- == 0)
setDivider(myDividerPending); 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); updatePaddle(i);
} }
@ -1205,7 +1205,7 @@ void TIA::onFrameComplete()
myFrontBufferScanlines = scanlinesLastFrame(); myFrontBufferScanlines = scanlinesLastFrame();
myFramesSinceLastRender++; ++myFramesSinceLastRender;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -1219,7 +1219,7 @@ void TIA::onHalt()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void TIA::cycle(uInt32 colorClocks) void TIA::cycle(uInt32 colorClocks)
{ {
for (uInt32 i = 0; i < colorClocks; i++) for (uInt32 i = 0; i < colorClocks; ++i)
{ {
myDelayQueue.execute( myDelayQueue.execute(
[this] (uInt8 address, uInt8 value) {delayedWrite(address, value);} [this] (uInt8 address, uInt8 value) {delayedWrite(address, value);}
@ -1244,7 +1244,7 @@ void TIA::cycle(uInt32 colorClocks)
myAudio.tick(); myAudio.tick();
myTimestamp++; ++myTimestamp;
} }
} }
@ -1267,7 +1267,7 @@ void TIA::tickMovement()
myMovementInProgress = m; myMovementInProgress = m;
myCollisionUpdateRequired = m; myCollisionUpdateRequired = m;
myMovementClock++; ++myMovementClock;
} }
} }
@ -1331,7 +1331,7 @@ void TIA::nextLine()
myHctr = 0; myHctr = 0;
if (!myMovementInProgress && myLinesSinceChange < 2) myLinesSinceChange++; if (!myMovementInProgress && myLinesSinceChange < 2) ++myLinesSinceChange;
myHstate = HState::blank; myHstate = HState::blank;
myHctrDelta = 0; myHctrDelta = 0;
@ -1448,7 +1448,7 @@ void TIA::flushLineCache()
if (wasCaching) { if (wasCaching) {
const auto rewindCycles = myHctr; const auto rewindCycles = myHctr;
for (myHctr = 0; myHctr < rewindCycles; myHctr++) { for (myHctr = 0; myHctr < rewindCycles; ++myHctr) {
if (myHstate == HState::blank) if (myHstate == HState::blank)
tickHblank(); tickHblank();
else else

View File

@ -44,7 +44,7 @@ void AbstractFrameManager::reset()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void AbstractFrameManager::nextLine() void AbstractFrameManager::nextLine()
{ {
myCurrentFrameTotalLines++; ++myCurrentFrameTotalLines;
onNextLine(); onNextLine();
} }
@ -96,7 +96,7 @@ void AbstractFrameManager::notifyFrameComplete()
myPreviousFrameFinalLines = myCurrentFrameFinalLines; myPreviousFrameFinalLines = myCurrentFrameFinalLines;
myCurrentFrameFinalLines = myCurrentFrameTotalLines; myCurrentFrameFinalLines = myCurrentFrameTotalLines;
myCurrentFrameTotalLines = 0; myCurrentFrameTotalLines = 0;
myTotalFrames++; ++myTotalFrames;
if (myOnFrameComplete) myOnFrameComplete(); 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 // 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). // the "ideal" frame size (corrected by the three scanlines spent in vsync).
if (myCurrentFrameTotalLines > frameLines - 3 || myTotalFrames == 0) if (myCurrentFrameTotalLines > frameLines - 3 || myTotalFrames == 0)
myLinesWaitingForVsyncToStart++; ++myLinesWaitingForVsyncToStart;
if (myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncEnd); if (myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncEnd);
@ -137,11 +137,11 @@ void FrameLayoutDetector::finalizeFrame()
switch (layout()) { switch (layout()) {
case FrameLayout::ntsc: case FrameLayout::ntsc:
myNtscFrames++; ++myNtscFrames;
break; break;
case FrameLayout::pal: case FrameLayout::pal:
myPalFrames++; ++myPalFrames;
break; break;
default: default:

View File

@ -70,13 +70,13 @@ void FrameManager::onNextLine()
Int32 jitter; Int32 jitter;
State previousState = myState; State previousState = myState;
myLineInState++; ++myLineInState;
switch (myState) switch (myState)
{ {
case State::waitForVsyncStart: case State::waitForVsyncStart:
if ((myCurrentFrameTotalLines > myFrameLines - 3) || myTotalFrames == 0) if ((myCurrentFrameTotalLines > myFrameLines - 3) || myTotalFrames == 0)
myVsyncLines++; ++myVsyncLines;
if (myVsyncLines > Metrics::maxLinesVsync) setState(State::waitForFrameStart); if (myVsyncLines > Metrics::maxLinesVsync) setState(State::waitForFrameStart);
@ -107,7 +107,7 @@ void FrameManager::onNextLine()
throw runtime_error("frame manager: invalid state"); 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 // 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). // the "ideal" frame size (corrected by the three scanlines spent in vsync).
if (myCurrentFrameTotalLines > frameLines - 3 || myTotalFrames == 0) if (myCurrentFrameTotalLines > frameLines - 3 || myTotalFrames == 0)
myLinesWaitingForVsyncToStart++; ++myLinesWaitingForVsyncToStart;
if (myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncEnd); if (myLinesWaitingForVsyncToStart > Metrics::waitForVsync) setState(State::waitForVsyncEnd);
@ -97,7 +97,7 @@ void YStartDetector::onNextLine()
case State::waitForFrameStart: case State::waitForFrameStart:
if (shouldTransitionToFrame()) setState(State::waitForVsyncStart); if (shouldTransitionToFrame()) setState(State::waitForVsyncStart);
else myCurrentVblankLines++; else ++myCurrentVblankLines;
break; break;
@ -126,7 +126,7 @@ bool YStartDetector::shouldTransitionToFrame()
// Is this same scanline in which the transition ocurred last frame? // Is this same scanline in which the transition ocurred last frame?
if (myTotalFrames > Metrics::initialGarbageFrames && myCurrentVblankLines == myLastVblankLines) if (myTotalFrames > Metrics::initialGarbageFrames && myCurrentVblankLines == myLastVblankLines)
// Yes? -> Increase the number of stable frames // Yes? -> Increase the number of stable frames
myStableVblankFrames++; ++myStableVblankFrames;
else else
// No? -> Frame start shifted again, set the number of consecutive stable frames to zero // No? -> Frame start shifted again, set the number of consecutive stable frames to zero
myStableVblankFrames = 0; myStableVblankFrames = 0;
@ -160,7 +160,7 @@ bool YStartDetector::shouldTransitionToFrame()
myVblankViolations = 0; myVblankViolations = 0;
else { else {
// Record a violation if it wasn't recorded before // Record a violation if it wasn't recorded before
if (!myVblankViolated) myVblankViolations++; if (!myVblankViolated) ++myVblankViolations;
myVblankViolated = true; myVblankViolated = true;
} }
@ -169,7 +169,7 @@ bool YStartDetector::shouldTransitionToFrame()
// The algorithm tells us to transition although we haven't reached the trip line before // The algorithm tells us to transition although we haven't reached the trip line before
} else if (shouldTransition) { } else if (shouldTransition) {
// Record a violation if it wasn't recorded before // Record a violation if it wasn't recorded before
if (!myVblankViolated) myVblankViolations++; if (!myVblankViolated) ++myVblankViolations;
myVblankViolated = true; myVblankViolated = true;
} }

View File

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

View File

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

View File

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

View File

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

View File

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