[Scummvm-git-logs] scummvm master -> 4f3b53679a92621e2044e55c7e6ec417a70a5b17

sev- sev at scummvm.org
Wed Oct 27 20:51:43 UTC 2021


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:
4f3b53679a SAGA2: Replace unsafe function with proper implementation


Commit: 4f3b53679a92621e2044e55c7e6ec417a70a5b17
    https://github.com/scummvm/scummvm/commit/4f3b53679a92621e2044e55c7e6ec417a70a5b17
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2021-10-27T23:51:28+03:00

Commit Message:
SAGA2: Replace unsafe function with proper implementation

Changed paths:
    engines/saga2/video.cpp


diff --git a/engines/saga2/video.cpp b/engines/saga2/video.cpp
index b735958500..e3fd9dfb79 100644
--- a/engines/saga2/video.cpp
+++ b/engines/saga2/video.cpp
@@ -33,21 +33,17 @@ namespace Saga2 {
 
 #define VIDEO_EXT ".SMK"
 
-static bool nameCheck(char name[], const char ext[], int len) {
-	size_t l = strlen(name);
-	if (l < 5 || 0 != scumm_stricmp(name + (l - strlen(ext)), ext))
-		Common::strlcat(name, ext, len);
-	return true;
-}
-
 void Saga2Engine::startVideo(const char *fileName, int x, int y) {
-	nameCheck((char *)fileName, VIDEO_EXT, 260);
+	Common::String fname = fileName;
+
+	if (!fname.hasSuffix(VIDEO_EXT))
+		fname += VIDEO_EXT;
 
 	if (!_smkDecoder)
 		_smkDecoder = new Video::SmackerDecoder();
 
-	if (!_smkDecoder->loadFile(fileName)) {
-		warning("startVideo: Cannot open file %s", fileName);
+	if (!_smkDecoder->loadFile(fname)) {
+		warning("startVideo: Cannot open file %s", fname.c_str());
 
 		return;
 	}




More information about the Scummvm-git-logs mailing list