[Scummvm-git-logs] scummvm master -> d0aea31958a79b531e117844e450b98af36b6c69

yuv422 yuv422 at users.noreply.github.com
Sat Aug 15 04:19:46 UTC 2020


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
d0aea31958 AUDIO: Fixed Soundfont Coverity issues


Commit: d0aea31958a79b531e117844e450b98af36b6c69
    https://github.com/scummvm/scummvm/commit/d0aea31958a79b531e117844e450b98af36b6c69
Author: Eric Fry (yuv422 at users.noreply.github.com)
Date: 2020-08-15T14:17:42+10:00

Commit Message:
AUDIO: Fixed Soundfont Coverity issues

Changed paths:
    audio/soundfont/synthfile.cpp
    audio/soundfont/synthfile.h
    audio/soundfont/vab/psxspu.h
    audio/soundfont/vab/vab.cpp
    audio/soundfont/vab/vab.h
    audio/soundfont/vgmitem.cpp


diff --git a/audio/soundfont/synthfile.cpp b/audio/soundfont/synthfile.cpp
index be68c63a4f..05b2457df9 100644
--- a/audio/soundfont/synthfile.cpp
+++ b/audio/soundfont/synthfile.cpp
@@ -148,7 +148,6 @@ void SynthSampInfo::SetLoopInfo(Loop &loop, VGMSamp *samp) {
 		loop.loopLength = samp->_dataLength - loop.loopStart;
 
 	_cSampleLoops = loop.loopStatus;
-	_ulLoopType = loop.loopType;
 	_ulLoopStart = (loop.loopStartMeasure == LM_BYTES)
 				  ? (uint32) ((loop.loopStart * compressionRatio) / origFormatBytesPerSamp)
 				  : loop.loopStart;
diff --git a/audio/soundfont/synthfile.h b/audio/soundfont/synthfile.h
index 51b3688069..f1f436d1bd 100644
--- a/audio/soundfont/synthfile.h
+++ b/audio/soundfont/synthfile.h
@@ -118,7 +118,9 @@ public:
 
 class SynthArt {
 public:
-	SynthArt() {}
+	SynthArt() : _pan(0.0), _attack_time(0.0), _decay_time(0.0),
+		_sustain_lev(0.0), _sustain_time(0.0), _release_time(0.0),
+		_attack_transform(no_transform), _release_transform(no_transform) {}
 	~SynthArt();
 
 	void AddADSR(double attack, Transform atk_transform, double decay, double sustain_lev,
@@ -143,7 +145,8 @@ private:
 
 class SynthSampInfo {
 public:
-	SynthSampInfo() {}
+	SynthSampInfo() : _usUnityNote(0), _sFineTune(0), _attenuation(0.0),
+		_cSampleLoops(0), _ulLoopStart(0), _ulLoopLength(0) {}
 	~SynthSampInfo() {}
 
 	void SetLoopInfo(Loop &loop, VGMSamp *samp);
@@ -155,7 +158,6 @@ public:
 	double _attenuation;  // in decibels.
 	int8 _cSampleLoops;
 
-	uint32 _ulLoopType;
 	uint32 _ulLoopStart;
 	uint32 _ulLoopLength;
 };
diff --git a/audio/soundfont/vab/psxspu.h b/audio/soundfont/vab/psxspu.h
index 4e662b8240..3b6efd5f01 100644
--- a/audio/soundfont/vab/psxspu.h
+++ b/audio/soundfont/vab/psxspu.h
@@ -168,7 +168,7 @@ void PSXConvADSR(T *realADSR, uint8 Am, uint8 Ar, uint8 Dr, uint8 Sl, uint8 Sm,
 		samples = ceil(0x7FFFFFFF / (double) rate);
 	} else if (Am == 1) {
 		rate = RateTable[RoundToZero((Ar ^ 0x7F) - 0x10) + 32];
-		samples = 0x60000000 / rate;
+		samples = (unsigned long)(0x60000000 / rate);
 		remainder = 0x60000000 % rate;
 		rate = RateTable[RoundToZero((Ar ^ 0x7F) - 0x18) + 32];
 		samples += ceil(fmax(0, 0x1FFFFFFF - (long) remainder) / (double) rate);
@@ -182,7 +182,7 @@ void PSXConvADSR(T *realADSR, uint8 Am, uint8 Ar, uint8 Dr, uint8 Sl, uint8 Sm,
 	envelope_level = 0x7FFFFFFF;
 
 	bool bSustainLevFound = false;
-	uint32 realSustainLevel;
+	uint32 realSustainLevel = 0x7FFFFFFF;
 	// DLS decay rate value is to -96db (silence) not the sustain level
 	for (l = 0; envelope_level > 0; l++) {
 		if (4 * (Dr ^ 0x1F) < 0x18)
diff --git a/audio/soundfont/vab/vab.cpp b/audio/soundfont/vab/vab.cpp
index 9f5e64045a..8824ed1bc9 100644
--- a/audio/soundfont/vab/vab.cpp
+++ b/audio/soundfont/vab/vab.cpp
@@ -189,9 +189,9 @@ bool Vab::GetInstrPointers() {
 
 VabInstr::VabInstr(VGMInstrSet *instrSet, uint32 offset, uint32 length, uint32 theBank,
 				   uint32 theInstrNum, const Common::String &name)
-		: VGMInstr(instrSet, offset, length, theBank, theInstrNum, name), _masterVol(127) {}
+		: VGMInstr(instrSet, offset, length, theBank, theInstrNum, name), _tones(0), _masterVol(127) {}
 
-VabInstr::~VabInstr(void) {}
+VabInstr::~VabInstr() {}
 
 bool VabInstr::LoadInstr() {
 	int8 numRgns = _tones;
@@ -210,7 +210,7 @@ bool VabInstr::LoadInstr() {
 // VabRgn
 // ******
 
-VabRgn::VabRgn(VabInstr *instr, uint32 offset) : VGMRgn(instr, offset) {}
+VabRgn::VabRgn(VabInstr *instr, uint32 offset) : _ADSR1(0), _ADSR2(0), VGMRgn(instr, offset) {}
 
 bool VabRgn::LoadRgn() {
 	VabInstr *instr = (VabInstr *) _parInstr;
diff --git a/audio/soundfont/vab/vab.h b/audio/soundfont/vab/vab.h
index f0bfa7ed16..484ec727ad 100644
--- a/audio/soundfont/vab/vab.h
+++ b/audio/soundfont/vab/vab.h
@@ -49,7 +49,7 @@ class VabInstr : public VGMInstr {
 public:
 	VabInstr(VGMInstrSet *instrSet, uint32 offset, uint32 length, uint32 theBank,
 			 uint32 theInstrNum, const Common::String &name = "Instrument");
-	virtual ~VabInstr(void);
+	virtual ~VabInstr();
 
 	virtual bool LoadInstr();
 
diff --git a/audio/soundfont/vgmitem.cpp b/audio/soundfont/vgmitem.cpp
index 8bad149a23..5c250c17a8 100644
--- a/audio/soundfont/vgmitem.cpp
+++ b/audio/soundfont/vgmitem.cpp
@@ -31,7 +31,7 @@
 
 using namespace std;
 
-VGMItem::VGMItem() {}
+VGMItem::VGMItem() : _dwOffset(0), _unLength(0), _vgmfile(nullptr) {}
 
 VGMItem::VGMItem(VGMFile *thevgmfile, uint32 theOffset, uint32 theLength, const Common::String theName)
 		: _vgmfile(thevgmfile),




More information about the Scummvm-git-logs mailing list