Fixed more Coverity-reported errors. We're now down to a 0.02 defect

rate (0.5 or so is the average for a codebase of this size)!


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@3237 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2015-12-10 16:34:24 +00:00
parent 336536745f
commit fd8eb1aa1d
3 changed files with 7 additions and 11 deletions

View File

@ -17,9 +17,6 @@
// $Id$
//============================================================================
// NOTE: This code generates many errors in Coverity, and is due to be
// replaced in an upcoming release.
#include <cctype>
#include <cstdlib>
#include <zlib.h>
@ -380,8 +377,9 @@ const ZipHandler::zip_file_header* ZipHandler::zip_file_next_file(zip_file* zip)
return nullptr;
// NULL terminate the filename
zip->header.saved = zip->header.raw[ZIPCFN + zip->header.filename_length];
zip->header.raw[ZIPCFN + zip->header.filename_length] = 0;
uInt32 size = ZIPCFN + zip->header.filename_length;
zip->header.saved = zip->header.raw[size];
zip->header.raw[size] = 0;
// Advance the position
zip->cd_pos += zip->header.rawlength;

View File

@ -62,9 +62,6 @@
This class implements a thin wrapper around the zip file management code
from the MAME project.
NOTE: This code generates many errors in Coverity, and is due to be
replaced in an upcoming release.
@author Wrapper class by Stephen Anthony, with main functionality
by Aaron Giles
*/
@ -247,7 +244,8 @@ class ZipHandler
inline static uInt16 read_word(uInt8* buf)
{
return (buf[1] << 8) | buf[0];
uInt16 p0 = uInt16(buf[0]), p1 = uInt16(buf[1]);
return (p1 << 8) | p0;
}
inline static uInt32 read_dword(uInt8* buf)

View File

@ -460,8 +460,8 @@ void Console::initializeAudio()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Console::fry() const
{
for(int ZPmem = 0; ZPmem < 0x100; ZPmem += rand() % 4)
mySystem->poke(ZPmem, mySystem->peek(ZPmem) & uInt8(rand()) % 256);
for(int i = 0; i < 0x100; i += mySystem->randGenerator().next() % 4)
mySystem->poke(i, mySystem->peek(i) & mySystem->randGenerator().next());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -