[Scummvm-git-logs] scummvm master -> 52b7b09adf1974f27535a9e778422490078d5801
somaen
noreply at scummvm.org
Tue May 9 00:36:59 UTC 2023
This automated email contains information about 12 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e6417cf0b6 WATCHMAKER: Fix resource leak (Coverity)
11387039f1 WATCHMAKER: Fix resource leak (Coverity)
6aee529e33 WATCHMAKER: Fix accidental copy due to auto. (Coverity)
5ac3ab29c9 WATCHMAKER: Fix uninitialized variable (Coverity)
5747d6fa2a WATCHMAKER: Fix potential OOB write (Coverity)
641950ced7 WATCHMAKER: Fix missing destructor logic in t3dMesh (Coverity)
860408c488 WATCHMAKER: Fix resource-leak in FastFile (Coverity)
15a23a4e5c WATCHMAKER: Initialize variable (Coverity)
d35b01de23 WATCHMAKER: Fix resource leak in Game (Coverity)
5d846bd921 WATCHMAKER: Implement destructor for gMovie (Coverity)
4b6f57d002 WATCHMAKER: Initialize gMovie::_startTime (Coverity)
52b7b09adf WATCHMAKER: Fix some unintended auto-related copying (Coverity)
Commit: e6417cf0b6d079c9144f9d8ccd108e05daf308fd
https://github.com/scummvm/scummvm/commit/e6417cf0b6d079c9144f9d8ccd108e05daf308fd
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:35:59+02:00
Commit Message:
WATCHMAKER: Fix resource leak (Coverity)
CID: 1509225
Changed paths:
engines/watchmaker/3d/animation.cpp
diff --git a/engines/watchmaker/3d/animation.cpp b/engines/watchmaker/3d/animation.cpp
index 44c09d26743..1dd238082c9 100644
--- a/engines/watchmaker/3d/animation.cpp
+++ b/engines/watchmaker/3d/animation.cpp
@@ -578,6 +578,7 @@ t3dCHARACTER *t3dLoadCharacter(WGame &game, const char *pname, uint16 num) {
//Try to load animation
if (t3dLoadAnimation(game, pname, b->Mesh, T3D_MESH_DEFAULTANIM) == -1) {
warning("t3dLoadCharacter: Error loading %s", pname);
+ delete[] b;
return nullptr;
}
FixupAnim(b->Mesh, 0, "");
Commit: 11387039f1819d391c96578277ee2082fb08cba7
https://github.com/scummvm/scummvm/commit/11387039f1819d391c96578277ee2082fb08cba7
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:36:10+02:00
Commit Message:
WATCHMAKER: Fix resource leak (Coverity)
CID: 1509207
Changed paths:
engines/watchmaker/3d/loader.cpp
diff --git a/engines/watchmaker/3d/loader.cpp b/engines/watchmaker/3d/loader.cpp
index 60fb0ee90c0..ac45df8b3bb 100644
--- a/engines/watchmaker/3d/loader.cpp
+++ b/engines/watchmaker/3d/loader.cpp
@@ -331,6 +331,7 @@ t3dBODY* RoomManagerImplementation::loadSingleRoom(const Common::String &_pname,
uint16 fileVersion = stream->readByte();
if (fileVersion != T3DFILEVERSION) { // Controlla la versione del file
warning("%s file incompatible: current version: %d.\tFile version: %d", name.c_str(), T3DFILEVERSION, fileVersion);
+ delete b;
return nullptr;
}
@@ -340,6 +341,7 @@ t3dBODY* RoomManagerImplementation::loadSingleRoom(const Common::String &_pname,
j++;
if (j > MAX_LOADED_FILES) {
warning("Too many t3d files loaded!");
+ delete b;
return nullptr;
}
if ((j + 1) > NumLoadedFiles)
Commit: 6aee529e337a0e8581b8668acead4c58a2734b1f
https://github.com/scummvm/scummvm/commit/6aee529e337a0e8581b8668acead4c58a2734b1f
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:36:22+02:00
Commit Message:
WATCHMAKER: Fix accidental copy due to auto. (Coverity)
CID: 1509210
Changed paths:
engines/watchmaker/3d/loader.cpp
diff --git a/engines/watchmaker/3d/loader.cpp b/engines/watchmaker/3d/loader.cpp
index ac45df8b3bb..3696470d04e 100644
--- a/engines/watchmaker/3d/loader.cpp
+++ b/engines/watchmaker/3d/loader.cpp
@@ -592,7 +592,7 @@ void t3dFinalizeMaterialList(t3dBODY *b) {
MaterialPtr Mat = Face.getMaterial();
if (Face.lightmap) {
Mat = nullptr;
- for (auto material : Face.getMaterial()->AddictionalMaterial) {
+ for (const auto &material : Face.getMaterial()->AddictionalMaterial) {
if (material->Texture->ID == Face.lightmap->Texture->ID) {
Mat = material;
break;
@@ -601,7 +601,7 @@ void t3dFinalizeMaterialList(t3dBODY *b) {
if (Mat == nullptr) {
warning("%s: Can't find Lightmap Sub-Material!", Mesh.name.c_str());
warning("%d %d", Face.getMaterial()->NumAddictionalMaterial, Face.lightmap->Texture->ID);
- for (auto material : Face.getMaterial()->AddictionalMaterial) {
+ for (const auto &material : Face.getMaterial()->AddictionalMaterial) {
warning("%d", material->Texture->ID);
}
continue;
Commit: 5ac3ab29c9b674c515a72cb25fc8a425e995e893
https://github.com/scummvm/scummvm/commit/5ac3ab29c9b674c515a72cb25fc8a425e995e893
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:36:27+02:00
Commit Message:
WATCHMAKER: Fix uninitialized variable (Coverity)
CID: 1509217
Changed paths:
engines/watchmaker/ll/ll_regen.cpp
engines/watchmaker/ll/ll_system.cpp
diff --git a/engines/watchmaker/ll/ll_regen.cpp b/engines/watchmaker/ll/ll_regen.cpp
index d5eae7e9572..72fcd30bef5 100644
--- a/engines/watchmaker/ll/ll_regen.cpp
+++ b/engines/watchmaker/ll/ll_regen.cpp
@@ -335,7 +335,7 @@ void Add3DStuff(WGame &game) {
//DisplayDDBitmap( TrecLogo, 800-10-rGetBitmapRealDimX(TrecLogo),0, 0,0, 0,0 );
if (bShowInfo) {
//display version
- uint32 date, time, d, m, yy, h, min;
+ uint32 date = 0, time = 0, d = 0, m = 0, yy = 0, h = 0, min = 0;
t3dForceNOFastFile(1);
if (t3dGetFileDate(&date, &time, "wm.exe ")) {
d = date - (date / 100) * 100;
diff --git a/engines/watchmaker/ll/ll_system.cpp b/engines/watchmaker/ll/ll_system.cpp
index 011994504fb..1a707c5b175 100644
--- a/engines/watchmaker/ll/ll_system.cpp
+++ b/engines/watchmaker/ll/ll_system.cpp
@@ -123,6 +123,8 @@ int t3dAccessFile(char *name) {
bool t3dGetFileDate(uint32 *date, uint32 *time, const char *name) {
warning("TODO: t3dGetFileDate is currently super-inefficient: %s", name);
+ *date = 0;
+ *time = 0;
return checkFileExists(name);
}
Commit: 5747d6fa2aa9f20d1bfb56118fc91a8b69d574e5
https://github.com/scummvm/scummvm/commit/5747d6fa2aa9f20d1bfb56118fc91a8b69d574e5
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:36:28+02:00
Commit Message:
WATCHMAKER: Fix potential OOB write (Coverity)
CID: 1509212
Changed paths:
engines/watchmaker/classes/do_system.cpp
diff --git a/engines/watchmaker/classes/do_system.cpp b/engines/watchmaker/classes/do_system.cpp
index 5cd6c0907be..c7b7fe7ec7b 100644
--- a/engines/watchmaker/classes/do_system.cpp
+++ b/engines/watchmaker/classes/do_system.cpp
@@ -931,9 +931,10 @@ void doSystem(WGame &game) {
break;
case EFFECT_ROOMINFO:
if ((RoomInfo.t_next_letter > TheMessage->wparam1) && ((*RoomInfo.letter_ptr) != '\0')) {
- char name_backup[64];
+ constexpr int nameSize = ARRAYSIZE(RoomInfo.fullstring);
+ char name_backup[nameSize] = {};
- strcpy(name_backup, RoomInfo.fullstring);
+ Common::strlcpy(name_backup, RoomInfo.fullstring, nameSize - 1);
*(RoomInfo.letter_ptr + 1) = '\0';
game._renderer->clearBitmap(RoomInfo.tnum, 0, 0, RoomInfo.dx, RoomInfo.dy, 0, 0, 0);
Commit: 641950ced7629c931e62d8829db673bfe28db18f
https://github.com/scummvm/scummvm/commit/641950ced7629c931e62d8829db673bfe28db18f
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:36:33+02:00
Commit Message:
WATCHMAKER: Fix missing destructor logic in t3dMesh (Coverity)
While at it, also fix mismatched free/delete
CID: 1509187
CID: 1509188
CID: 1509201
CID: 1509208
Changed paths:
engines/watchmaker/3d/t3d_mesh.cpp
engines/watchmaker/3d/t3d_mesh.h
diff --git a/engines/watchmaker/3d/t3d_mesh.cpp b/engines/watchmaker/3d/t3d_mesh.cpp
index e175f21e6b7..3b859f569ec 100644
--- a/engines/watchmaker/3d/t3d_mesh.cpp
+++ b/engines/watchmaker/3d/t3d_mesh.cpp
@@ -187,6 +187,10 @@ t3dMESH::t3dMESH(t3dBODY *b, Common::SeekableReadStream &stream, t3dMESH *&Recei
}
}
+t3dMESH::~t3dMESH() {
+ release();
+}
+
/* -----------------10/06/99 15.39-------------------
* t3dReleaseAnim
* --------------------------------------------------*/
@@ -245,7 +249,7 @@ void t3dMESH::release() { // Will eventually be a destructor.
delete[] this->SavedVertexBuffer;
this->SavedVertexBuffer = nullptr;
- delete[] this->VertsInterpolants;
+ t3dFree(this->VertsInterpolants);
this->VertsInterpolants = nullptr;
// if(mt->VBptr)
diff --git a/engines/watchmaker/3d/t3d_mesh.h b/engines/watchmaker/3d/t3d_mesh.h
index 1ac0579a34a..3386e6d652b 100644
--- a/engines/watchmaker/3d/t3d_mesh.h
+++ b/engines/watchmaker/3d/t3d_mesh.h
@@ -141,6 +141,7 @@ struct t3dMESH {
t3dMESH() = default;
t3dMESH(t3dBODY *b, Common::SeekableReadStream &stream, t3dMESH *&ReceiveRipples, uint8 &Mirror);
+ ~t3dMESH();
void loadFaces(t3dBODY *b, Common::SeekableReadStream &stream, int numFaces);
void release();
void releaseAnim(uint8 flag);
Commit: 860408c488f8c90eabc23ba46ce89b90a0c4dd98
https://github.com/scummvm/scummvm/commit/860408c488f8c90eabc23ba46ce89b90a0c4dd98
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:36:38+02:00
Commit Message:
WATCHMAKER: Fix resource-leak in FastFile (Coverity)
CID: 1509203
Changed paths:
engines/watchmaker/ll/ll_ffile.cpp
engines/watchmaker/ll/ll_ffile.h
diff --git a/engines/watchmaker/ll/ll_ffile.cpp b/engines/watchmaker/ll/ll_ffile.cpp
index 65b264654db..c720e8e2713 100644
--- a/engines/watchmaker/ll/ll_ffile.cpp
+++ b/engines/watchmaker/ll/ll_ffile.cpp
@@ -57,6 +57,10 @@ FastFile::FastFile(const char *path) : _path(path) {
}
}
+FastFile::~FastFile() {
+ delete[] _files;
+}
+
Common::SharedPtr<Common::SeekableReadStream> FastFile::resolve(const char *filename) {
Common::String converted = filename;
int index = -1;
diff --git a/engines/watchmaker/ll/ll_ffile.h b/engines/watchmaker/ll/ll_ffile.h
index 82a76201f23..bbc77407356 100644
--- a/engines/watchmaker/ll/ll_ffile.h
+++ b/engines/watchmaker/ll/ll_ffile.h
@@ -32,10 +32,11 @@ class FastFile {
const char *_path = nullptr;
int _totalSize = 0;
public:
- int _numFiles;
- FileEntry *_files;
+ int _numFiles = 0;
+ FileEntry *_files = nullptr; // TODO: This could just be a Common::Array
FastFile(const char *path);
+ ~FastFile();
Common::SharedPtr<Common::SeekableReadStream> resolve(const char *filename);
};
Commit: 15a23a4e5c88f39fab8debc3f7f8cc72dbba8e7b
https://github.com/scummvm/scummvm/commit/15a23a4e5c88f39fab8debc3f7f8cc72dbba8e7b
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:36:39+02:00
Commit Message:
WATCHMAKER: Initialize variable (Coverity)
CID: 1509194
Changed paths:
engines/watchmaker/t2d/t2d.cpp
engines/watchmaker/windows_hacks.cpp
engines/watchmaker/windows_hacks.h
diff --git a/engines/watchmaker/t2d/t2d.cpp b/engines/watchmaker/t2d/t2d.cpp
index 246a4444f0f..18dbab91571 100644
--- a/engines/watchmaker/t2d/t2d.cpp
+++ b/engines/watchmaker/t2d/t2d.cpp
@@ -46,6 +46,7 @@
#include "watchmaker/ll/ll_sound.h"
#include "watchmaker/ll/ll_system.h"
#include "watchmaker/renderer.h"
+#include "common/system.h"
namespace Watchmaker {
@@ -1272,7 +1273,6 @@ void doT2DMouse(WGame &game) {
char Name[MAX_PATH];
//Variabili per gestione scrolling
int32 StartY = 0, DimY = 0;
- SYSTEMTIME sysTime;
char Text[1000];
int16 mouse_x, mouse_y;
Init &init = game.init;
@@ -2906,9 +2906,12 @@ void doT2DMouse(WGame &game) {
if (optionsSlot == -1) break; //Spazi finiti
- GetLocalTime(&sysTime);
- sprintf(Text, "%02d:%02d.%02d %02d/%02d/%02d", sysTime.hour, sysTime.minutes,
- sysTime.seconds, sysTime.day, sysTime.month, sysTime.year);
+ {
+ TimeDate sysTime;
+ g_system->getTimeAndDate(sysTime);
+ sprintf(Text, "%02d:%02d.%02d %02d/%02d/%02d", sysTime.tm_hour, sysTime.tm_min,
+ sysTime.tm_sec, sysTime.tm_mday, sysTime.tm_mon, sysTime.tm_year);
+ }
if (DataSave(Text, (uint8) optionsSlot)) {
sprintf(Text, "%stemp.tmp", game.workDirs._gameDir.c_str());
sprintf(Name, "%sWmSav%02d.tga", game.workDirs._savesDir.c_str(), optionsSlot);
diff --git a/engines/watchmaker/windows_hacks.cpp b/engines/watchmaker/windows_hacks.cpp
index 9e4c6e9eb75..35e1ca2a8a7 100644
--- a/engines/watchmaker/windows_hacks.cpp
+++ b/engines/watchmaker/windows_hacks.cpp
@@ -20,8 +20,8 @@
*/
#include "watchmaker/windows_hacks.h"
-#include "common/system.h"
#include "watchmaker/types.h"
+#include "common/system.h"
namespace Watchmaker {
@@ -33,11 +33,6 @@ uint32 timeGetTime() {
return g_system->getMillis();
}
-void GetLocalTime(SYSTEMTIME *) {
- warning("STUBBED GetLocalTime");
- return;
-}
-
void CopyFile(char *, char *, bool) {
warning("STUBBED CopyFile");
}
diff --git a/engines/watchmaker/windows_hacks.h b/engines/watchmaker/windows_hacks.h
index 91743ee15af..5f12b605026 100644
--- a/engines/watchmaker/windows_hacks.h
+++ b/engines/watchmaker/windows_hacks.h
@@ -49,11 +49,6 @@ enum KeyCodes {
uint32 timeGetTime();
-struct SYSTEMTIME {
- uint32 hour, minutes, seconds, day, month, year;
-};
-
-void GetLocalTime(SYSTEMTIME *);
void ResetDIKbd();
void CopyFile(char *src, char *dst, bool noOverwrite);
} // End of namespace Watchmaker
Commit: d35b01de23214c6027e1c048fd55482eacac504a
https://github.com/scummvm/scummvm/commit/d35b01de23214c6027e1c048fd55482eacac504a
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:36:39+02:00
Commit Message:
WATCHMAKER: Fix resource leak in Game (Coverity)
CID: 1509172
Changed paths:
engines/watchmaker/game.cpp
diff --git a/engines/watchmaker/game.cpp b/engines/watchmaker/game.cpp
index 235c73501a3..2f7927dc00f 100644
--- a/engines/watchmaker/game.cpp
+++ b/engines/watchmaker/game.cpp
@@ -211,6 +211,7 @@ WGame::~WGame() {
delete sdl;
delete _meshModifiers;
delete _roomManager;
+ delete _rnd;
_vm = nullptr;
}
Commit: 5d846bd9210ce8aaae2ca4f85e6881aacc7bdf5b
https://github.com/scummvm/scummvm/commit/5d846bd9210ce8aaae2ca4f85e6881aacc7bdf5b
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:36:44+02:00
Commit Message:
WATCHMAKER: Implement destructor for gMovie (Coverity)
CID: 1509141
CID: 1509142
CID: 1509154
Changed paths:
engines/watchmaker/3d/movie.cpp
engines/watchmaker/3d/movie.h
diff --git a/engines/watchmaker/3d/movie.cpp b/engines/watchmaker/3d/movie.cpp
index eb74e534498..912396cbf0b 100644
--- a/engines/watchmaker/3d/movie.cpp
+++ b/engines/watchmaker/3d/movie.cpp
@@ -56,6 +56,13 @@ gMovie::gMovie(Common::SharedPtr<Common::SeekableReadStream> stream, Texture *te
}
}
+gMovie::~gMovie() {
+ delete[] _frameOffsets;
+ delete[] _buffer;
+ delete[] _surfaceBuffer;
+ delete _frameStream;
+}
+
Common::SharedPtr<gMovie> gLoadMovie(WorkDirs &workDirs, const char *TextName, Texture *texture) {
//convert .avi name in .wmm
Common::String finalName = replaceExtension(TextName, "wmm");
diff --git a/engines/watchmaker/3d/movie.h b/engines/watchmaker/3d/movie.h
index 2661035bbb8..bb5eb028de5 100644
--- a/engines/watchmaker/3d/movie.h
+++ b/engines/watchmaker/3d/movie.h
@@ -55,15 +55,12 @@ public:
bool _paused = false;
gMovie(Common::SharedPtr<Common::SeekableReadStream> stream, Texture *texture, const Common::String &name);
+ ~gMovie();
bool setFrame(uint16 newFrame);
void loadThisFrameData(uint16 frame);
void buildNewFrame(byte *surf, uint16 frame);
bool updateMovie();
-
- ~gMovie() {
- //warning("TODO: Clean up gMovie properly");
- }
private:
int frameSize(int index);
uint32 bufferSize() const;
Commit: 4b6f57d002d03ee12deca5ae1be5cdb429888436
https://github.com/scummvm/scummvm/commit/4b6f57d002d03ee12deca5ae1be5cdb429888436
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:36:44+02:00
Commit Message:
WATCHMAKER: Initialize gMovie::_startTime (Coverity)
CID: 1509146
Changed paths:
engines/watchmaker/3d/movie.cpp
diff --git a/engines/watchmaker/3d/movie.cpp b/engines/watchmaker/3d/movie.cpp
index 912396cbf0b..f542e840ebd 100644
--- a/engines/watchmaker/3d/movie.cpp
+++ b/engines/watchmaker/3d/movie.cpp
@@ -54,6 +54,8 @@ gMovie::gMovie(Common::SharedPtr<Common::SeekableReadStream> stream, Texture *te
for (int i = 0; i < _numFrames; i++) {
_frameOffsets[i] = _stream->readUint32LE();
}
+
+ _startTime = 0;
}
gMovie::~gMovie() {
Commit: 52b7b09adf1974f27535a9e778422490078d5801
https://github.com/scummvm/scummvm/commit/52b7b09adf1974f27535a9e778422490078d5801
Author: Einar Johan Trøan SømaÌen (somaen at scummvm.org)
Date: 2023-05-09T02:36:44+02:00
Commit Message:
WATCHMAKER: Fix some unintended auto-related copying (Coverity)
CID: 1509143
CID: 1509190
CID: 1509197
CID: 1509205
Changed paths:
engines/watchmaker/3d/animation.cpp
diff --git a/engines/watchmaker/3d/animation.cpp b/engines/watchmaker/3d/animation.cpp
index 1dd238082c9..d2c612158bd 100644
--- a/engines/watchmaker/3d/animation.cpp
+++ b/engines/watchmaker/3d/animation.cpp
@@ -103,7 +103,7 @@ void t3dMatRotXYZ(t3dM3X3F *dest, t3dF32 x, t3dF32 y, t3dF32 z) {
Common::Array<t3dPLIGHT> t3dBODY::getPositionalLight(uint8 pos) {
Common::Array<t3dPLIGHT> result;
- for (auto light : PosLightTable) {
+ for (const auto &light : PosLightTable) {
if (light.Num == pos) {
result.push_back(light);
}
@@ -119,7 +119,7 @@ uint8 GetLightPosition(t3dV3F *dest, uint8 pos) {
auto pLights = t3dCurRoom->getPositionalLight(pos);
dest->y = CurFloorY;
- for (auto light : pLights) {
+ for (const auto &light : pLights) {
if (light.Pos.x && light.Pos.z) {
dest->x = light.Pos.x;
dest->z = light.Pos.z;
@@ -139,7 +139,7 @@ uint8 GetLightDirection(t3dV3F *dest, uint8 pos) {
auto pLights = t3dCurRoom->getPositionalLight(pos);
dest->y = CurFloorY;
- for (auto light : pLights) {
+ for (const auto &light : pLights) {
if (light.Dir.x && light.Dir.z) {
dest->x = light.Dir.x;
dest->z = light.Dir.x;
@@ -662,7 +662,7 @@ uint8 GetFullLightDirection(t3dV3F *dest, uint8 pos) {
if (!pos) return 0;
auto pLights = t3dCurRoom->getPositionalLight(pos);
- for (auto light : pLights) {
+ for (const auto &light : pLights) {
if (light.Dir.x && light.Dir.z) {
*dest = light.Dir;
return pos;
More information about the Scummvm-git-logs
mailing list