[Scummvm-git-logs] scummvm master -> 687e66656cda591eb9c0e450a32ab7c68c759228

Strangerke noreply at scummvm.org
Sat May 18 15:26:47 UTC 2024


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:
687e66656c BAGEL: Fix 2 other PVS Studio issues + use a constant instead of a hardcoded value in setCorrection


Commit: 687e66656cda591eb9c0e450a32ab7c68c759228
    https://github.com/scummvm/scummvm/commit/687e66656cda591eb9c0e450a32ab7c68c759228
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-18T16:26:41+01:00

Commit Message:
BAGEL: Fix 2 other PVS Studio issues + use a constant instead of a hardcoded value in setCorrection

Changed paths:
    engines/bagel/baglib/dev_dlg.cpp
    engines/bagel/baglib/master_win.cpp


diff --git a/engines/bagel/baglib/dev_dlg.cpp b/engines/bagel/baglib/dev_dlg.cpp
index 3189a2545a1..7a6d388605d 100644
--- a/engines/bagel/baglib/dev_dlg.cpp
+++ b/engines/bagel/baglib/dev_dlg.cpp
@@ -72,12 +72,8 @@ ErrorCode CDevDlg::create(const char *bmp, CBofWindow *wnd, CBofPalette *pal, CB
 
 	CBofBitmap *bitmap = nullptr;
 
-	if (bmp != nullptr) {
+	if (bmp != nullptr)
 		bitmap = new CBofBitmap(bmp, pal);
-		if (bitmap == nullptr) {
-			reportError(ERR_MEMORY, "Unable to allocate a CBofBitmap");
-		}
-	}
 
 	// Fall back to original dialog on failure
 	if (bitmap == nullptr) {
diff --git a/engines/bagel/baglib/master_win.cpp b/engines/bagel/baglib/master_win.cpp
index c2dafcbf022..c60ec1e3401 100644
--- a/engines/bagel/baglib/master_win.cpp
+++ b/engines/bagel/baglib/master_win.cpp
@@ -1591,7 +1591,7 @@ void CBagMasterWin::doRestore(StBagelSave *saveBuf) {
 		}
 	}
 	int n = strlen(closeUpBuf);
-	if (closeUpBuf[n - 1] == '~') {
+	if (n > 2 && closeUpBuf[n - 1] == '~') {
 		closeUpBuf[n - 1] = '\0';
 		closeUpBuf[n - 2] = '\0';
 	}
@@ -1821,7 +1821,7 @@ int CBagMasterWin::getCorrection() {
 void CBagMasterWin::setCorrection(int correction) {
 	assert(correction >= 0 && correction <= 32);
 
-	int actualCorr = 2;
+	int actualCorr;
 
 	switch (correction) {
 	case 0:
@@ -1851,6 +1851,10 @@ void CBagMasterWin::setCorrection(int correction) {
 	case 32:
 		actualCorr = 5;
 		break;
+
+	default:
+		actualCorr = DEFAULT_CORRECTION;
+		break;
 	}
 
 	CBagel *app = CBagel::getBagApp();




More information about the Scummvm-git-logs mailing list