[Scummvm-git-logs] scummvm master -> 438bb60d020ca07a98a36928dfb6796a5b79fdcd

dreammaster noreply at scummvm.org
Thu Oct 2 10:25:55 UTC 2025


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

Summary:
bba63deb42 BAGEL: METAGAME: Fix bgen Coverity warnings
c29072c9d7 BAGEL: METAGAME: Fix frame Coverity warnings
7c44a06cfb BAGEL: METAGAME: Fix grand_tour Coverity warnings
4815110d12 BAGEL: METAGAME: Fix gtl Coverity warnings
438bb60d02 BAGEL: METAGAME: Fix misc Coverity warnings


Commit: bba63deb429afd130be742c3529785f76635093f
    https://github.com/scummvm/scummvm/commit/bba63deb429afd130be742c3529785f76635093f
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-02T02:45:08-07:00

Commit Message:
BAGEL: METAGAME: Fix bgen Coverity warnings

Changed paths:
    engines/bagel/hodjnpodj/metagame/bgen/backpack.cpp
    engines/bagel/hodjnpodj/metagame/bgen/backpack.h
    engines/bagel/hodjnpodj/metagame/bgen/bgb.cpp
    engines/bagel/hodjnpodj/metagame/bgen/c1btndlg.h
    engines/bagel/hodjnpodj/metagame/bgen/c2btndlg.h
    engines/bagel/hodjnpodj/metagame/bgen/notebook.cpp
    engines/bagel/hodjnpodj/metagame/bgen/notebook.h


diff --git a/engines/bagel/hodjnpodj/metagame/bgen/backpack.cpp b/engines/bagel/hodjnpodj/metagame/bgen/backpack.cpp
index df5f7e7fa41..c18e76a1d73 100644
--- a/engines/bagel/hodjnpodj/metagame/bgen/backpack.cpp
+++ b/engines/bagel/hodjnpodj/metagame/bgen/backpack.cpp
@@ -287,6 +287,7 @@ bool CBackpack::OnInitDialog() {
 
 	if (m_pParentWnd == nullptr)                                   // get our parent window
 		m_pParentWnd = ((CWnd *)this)->GetParent();            // ... as passed to us or inquired about
+	assert(m_pParentWnd);
 
 	(*m_pParentWnd).GetWindowRect(&myRect);
 	x = myRect.left + (((myRect.right - myRect.left) - BACKPACK_DX) >> 1);
diff --git a/engines/bagel/hodjnpodj/metagame/bgen/backpack.h b/engines/bagel/hodjnpodj/metagame/bgen/backpack.h
index 79ac68bdc5e..4071e3b76b1 100644
--- a/engines/bagel/hodjnpodj/metagame/bgen/backpack.h
+++ b/engines/bagel/hodjnpodj/metagame/bgen/backpack.h
@@ -84,11 +84,11 @@ private:
 	bool CreateWorkAreas(CDC *pDC);
 
 private:
-	bool m_bKeyboardHook;		// whether keyboard hook present
-	CRect OkayRect;				// rectangle bounding the OKAY button
-	CRect BackpackRect;			// x/y (left/right) and dx/dy (right/bottom) for the backpack window
-	CRect ScrollTopRect,		// area spanned by upper scroll curl
-		ScrollBotRect;			// area spanned by lower scroll curl
+	bool m_bKeyboardHook = false;	// whether keyboard hook present
+	CRect OkayRect;					// rectangle bounding the OKAY button
+	CRect BackpackRect;				// x/y (left/right) and dx/dy (right/bottom) for the backpack window
+	CRect ScrollTopRect,			// area spanned by upper scroll curl
+		ScrollBotRect;				// area spanned by lower scroll curl
 
 	// Dialog Data
 		//{{AFX_DATA(CBackpack)
diff --git a/engines/bagel/hodjnpodj/metagame/bgen/bgb.cpp b/engines/bagel/hodjnpodj/metagame/bgen/bgb.cpp
index bba38b5ab90..7c3e1a4c378 100644
--- a/engines/bagel/hodjnpodj/metagame/bgen/bgb.cpp
+++ b/engines/bagel/hodjnpodj/metagame/bgen/bgb.cpp
@@ -709,7 +709,7 @@ unsigned long Sqrt(unsigned long x) {
 		} else {
 			break;
 		}
-		if (abs((long)(lHigh - lLow)) <= 2)
+		if (ABS((long)(lHigh - lLow)) <= 2)
 			break;
 	}
 
diff --git a/engines/bagel/hodjnpodj/metagame/bgen/c1btndlg.h b/engines/bagel/hodjnpodj/metagame/bgen/c1btndlg.h
index e85f247c049..f9145eaf787 100644
--- a/engines/bagel/hodjnpodj/metagame/bgen/c1btndlg.h
+++ b/engines/bagel/hodjnpodj/metagame/bgen/c1btndlg.h
@@ -65,14 +65,14 @@ protected:
 	DECLARE_MESSAGE_MAP()
 
 private:
-	CText        *m_cTextMessage1;
-	CText        *m_cTextMessage2;
-	CText        *m_cTextMessage3;
-	const char   *m_pszMessage1;
-	const char   *m_pszMessage2;
-	const char   *m_pszMessage3;
-	const char   *m_pszButton1Text;
-	CColorButton *m_pButton1;
+	CText        *m_cTextMessage1 = nullptr;
+	CText        *m_cTextMessage2 = nullptr;
+	CText        *m_cTextMessage3 = nullptr;
+	const char   *m_pszMessage1 = nullptr;
+	const char   *m_pszMessage2 = nullptr;
+	const char   *m_pszMessage3 = nullptr;
+	const char   *m_pszButton1Text = nullptr;
+	CColorButton *m_pButton1 = nullptr;
 };
 
 } // namespace Metagame
diff --git a/engines/bagel/hodjnpodj/metagame/bgen/c2btndlg.h b/engines/bagel/hodjnpodj/metagame/bgen/c2btndlg.h
index 180079d8995..2dd3c6fb986 100644
--- a/engines/bagel/hodjnpodj/metagame/bgen/c2btndlg.h
+++ b/engines/bagel/hodjnpodj/metagame/bgen/c2btndlg.h
@@ -67,16 +67,16 @@ protected:
 	DECLARE_MESSAGE_MAP()
 
 private:
-	CText        *m_cTextMessage1;
-	CText        *m_cTextMessage2;
-	CText        *m_cTextMessage3;
-	const char   *m_pszMessage1;
-	const char   *m_pszMessage2;
-	const char   *m_pszMessage3;
-	const char   *m_pszButton1Text;
-	const char   *m_pszButton2Text;
-	CColorButton *m_pButton1;
-	CColorButton *m_pButton2;
+	CText        *m_cTextMessage1 = nullptr;
+	CText        *m_cTextMessage2 = nullptr;
+	CText        *m_cTextMessage3 = nullptr;
+	const char   *m_pszMessage1 = nullptr;
+	const char   *m_pszMessage2 = nullptr;
+	const char   *m_pszMessage3 = nullptr;
+	const char   *m_pszButton1Text = nullptr;
+	const char   *m_pszButton2Text = nullptr;
+	CColorButton *m_pButton1 = nullptr;
+	CColorButton *m_pButton2 = nullptr;
 };
 
 } // namespace Metagame
diff --git a/engines/bagel/hodjnpodj/metagame/bgen/notebook.cpp b/engines/bagel/hodjnpodj/metagame/bgen/notebook.cpp
index e8b260b9ad9..a064c47678c 100644
--- a/engines/bagel/hodjnpodj/metagame/bgen/notebook.cpp
+++ b/engines/bagel/hodjnpodj/metagame/bgen/notebook.cpp
@@ -455,7 +455,6 @@ void CNotebook::UpdateContent(CDC *pDC) {
 
 	if (pNoteList == nullptr) {                                    // empty notebook
 		if (pKeyNote == nullptr) {                                 // ... so just say so and leave
-			pText = new CText();
 			myRect.SetRect(NOTE_TEXT_DX,                        // calculate where to put it
 				NOTE_TEXT_DY,
 				NOTE_TEXT_DX + NOTE_TEXT_DDX,
diff --git a/engines/bagel/hodjnpodj/metagame/bgen/notebook.h b/engines/bagel/hodjnpodj/metagame/bgen/notebook.h
index 0ea7d5a65db..6a15893b94d 100644
--- a/engines/bagel/hodjnpodj/metagame/bgen/notebook.h
+++ b/engines/bagel/hodjnpodj/metagame/bgen/notebook.h
@@ -103,14 +103,14 @@ private:
 	bool CreateWorkAreas(CDC *pDC);
 
 private:
-	bool m_bKeyboardHook;		// whether keyboard hook present
-	CRect OkayRect;				// rectangle bounding the OKAY button
-
-	CRect NotebookRect;			// x/y (left/right) and dx/dy (right/bottom) for the notebook window
-	CRect PersonRect,			// bounding rectangle for person bitmap
-		PlaceRect;				// bounding rectangle for place bitmap
-	CRect ScrollTopRect,		// area spanned by upper scroll curl
-		ScrollBotRect;			// area spanned by lower scroll curl
+	bool m_bKeyboardHook = false;	// whether keyboard hook present
+	CRect OkayRect;					// rectangle bounding the OKAY button
+
+	CRect NotebookRect;				// x/y (left/right) and dx/dy (right/bottom) for the notebook window
+	CRect PersonRect,				// bounding rectangle for person bitmap
+		PlaceRect;					// bounding rectangle for place bitmap
+	CRect ScrollTopRect,			// area spanned by upper scroll curl
+		ScrollBotRect;				// area spanned by lower scroll curl
 
 	// Dialog Data
 		//{{AFX_DATA(CNotebook)


Commit: c29072c9d7f12d1ee4747eae521cf7646ed57273
    https://github.com/scummvm/scummvm/commit/c29072c9d7f12d1ee4747eae521cf7646ed57273
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-02T02:48:16-07:00

Commit Message:
BAGEL: METAGAME: Fix frame Coverity warnings

Changed paths:
    engines/bagel/hodjnpodj/metagame/frame/hodjpodj.cpp


diff --git a/engines/bagel/hodjnpodj/metagame/frame/hodjpodj.cpp b/engines/bagel/hodjnpodj/metagame/frame/hodjpodj.cpp
index de1e3589a81..6716f39c657 100644
--- a/engines/bagel/hodjnpodj/metagame/frame/hodjpodj.cpp
+++ b/engines/bagel/hodjnpodj/metagame/frame/hodjpodj.cpp
@@ -554,12 +554,11 @@ bool CHodjPodjWindow::OnCommand(WPARAM wParam, LPARAM lParam) {
 	// this must be before the CMainGameDlg constructor
 	PositionAtHomePath();
 
-	bool            bSuccess;
-	CMainGameDlg    cMainDlg((CWnd *)this, pGamePalette);
-	int             nMainDlgReturn = 0;
-	CDC            *pDC = nullptr;
-	CWnd           *pWnd = nullptr;
-	int                         nMovieId;
+	bool bSuccess;
+	CMainGameDlg cMainDlg((CWnd *)this, pGamePalette);
+	int nMainDlgReturn = 0;
+	CWnd *pWnd = nullptr;
+	int nMovieId;
 
 	switch (wParam) {
 	case MOVIE_OVER:
@@ -692,9 +691,6 @@ bool CHodjPodjWindow::OnCommand(WPARAM wParam, LPARAM lParam) {
 		break;
 	}
 
-	if (pDC != nullptr)
-		ReleaseDC(pDC);
-
 	return true;
 }
 
@@ -965,6 +961,9 @@ void    CHodjPodjWindow::LoadNewDLL(LPARAM lParam) {
 			}
 		}
 	}
+
+	if (!bSuccess)
+		error("LoadNewDLL call failed");
 }
 
 


Commit: 7c44a06cfb2be11fdd9b25e1495a75a8d3f0f803
    https://github.com/scummvm/scummvm/commit/7c44a06cfb2be11fdd9b25e1495a75a8d3f0f803
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-02T02:50:59-07:00

Commit Message:
BAGEL: METAGAME: Fix grand_tour Coverity warnings

Changed paths:
    engines/bagel/hodjnpodj/metagame/grand_tour/grand_tour.cpp


diff --git a/engines/bagel/hodjnpodj/metagame/grand_tour/grand_tour.cpp b/engines/bagel/hodjnpodj/metagame/grand_tour/grand_tour.cpp
index d95478e7ecb..6c8e1c9d3db 100644
--- a/engines/bagel/hodjnpodj/metagame/grand_tour/grand_tour.cpp
+++ b/engines/bagel/hodjnpodj/metagame/grand_tour/grand_tour.cpp
@@ -1173,7 +1173,7 @@ void CMainGTWindow::OnChar(unsigned int nChar, unsigned int nRepCnt, unsigned in
 								int j;
 
 								nNewRank = i;
-								for (j = 10; j > i; j--) {
+								for (j = 9; j > i; j--) {
 									Common::strcpy_s(astTopTenScores[j].acName, astTopTenScores[j - 1].acName);
 									astTopTenScores[j].nScore = astTopTenScores[j - 1].nScore;
 									astTopTenScores[j].nSkillLevel = astTopTenScores[j - 1].nSkillLevel;


Commit: 4815110d1248ef7044b57531f7b261cc2b5ab95d
    https://github.com/scummvm/scummvm/commit/4815110d1248ef7044b57531f7b261cc2b5ab95d
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-02T03:23:40-07:00

Commit Message:
BAGEL: METAGAME: Fix gtl Coverity warnings

Changed paths:
    engines/bagel/hodjnpodj/metagame/gtl/citemdlg.h
    engines/bagel/hodjnpodj/metagame/gtl/cmapdlg.h
    engines/bagel/hodjnpodj/metagame/gtl/cturndlg.h
    engines/bagel/hodjnpodj/metagame/gtl/gtldat.h
    engines/bagel/hodjnpodj/metagame/gtl/gtlfrm.h
    engines/bagel/hodjnpodj/metagame/gtl/gtlmgm.cpp
    engines/bagel/hodjnpodj/metagame/gtl/gtlmve.cpp
    engines/bagel/hodjnpodj/metagame/gtl/gtlui.cpp
    engines/bagel/hodjnpodj/metagame/gtl/optdlg.h
    engines/bagel/hodjnpodj/metagame/gtl/pawn.cpp
    engines/bagel/hodjnpodj/metagame/gtl/pawn.h
    engines/bagel/hodjnpodj/metagame/gtl/rules.cpp
    engines/bagel/hodjnpodj/metagame/gtl/rules.h
    engines/bagel/hodjnpodj/metagame/gtl/spinner.cpp
    engines/bagel/hodjnpodj/metagame/gtl/spinner.h
    engines/bagel/hodjnpodj/metagame/gtl/store.cpp
    engines/bagel/hodjnpodj/metagame/gtl/store.h


diff --git a/engines/bagel/hodjnpodj/metagame/gtl/citemdlg.h b/engines/bagel/hodjnpodj/metagame/gtl/citemdlg.h
index d347ad48575..a8e1a2862e8 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/citemdlg.h
+++ b/engines/bagel/hodjnpodj/metagame/gtl/citemdlg.h
@@ -57,13 +57,13 @@ namespace Gtl {
 
 class CItemDialog : public CBmpDialog {
 private:
-	CText *m_pTextDescription;
-	CText *m_pTextMessage;
-	CColorButton *m_pOKButton;          // OKAY button on scroll
-	CItem *m_pItem;
-	bool            m_bHodj;
-	bool            m_bGain;
-	long            m_lAmount;
+	CText *m_pTextDescription = nullptr;
+	CText *m_pTextMessage = nullptr;
+	CColorButton *m_pOKButton = nullptr;          // OKAY button on scroll
+	CItem *m_pItem = nullptr;
+	bool m_bHodj = false;
+	bool m_bGain = false;
+	long m_lAmount = 0;
 
 public:
 
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/cmapdlg.h b/engines/bagel/hodjnpodj/metagame/gtl/cmapdlg.h
index e97394ead6f..d3a0cc77bda 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/cmapdlg.h
+++ b/engines/bagel/hodjnpodj/metagame/gtl/cmapdlg.h
@@ -57,10 +57,10 @@ namespace Gtl {
 
 class CMapDialog : public CBmpDialog {
 private:
-	POINT         m_HodjLoc, m_PodjLoc;
-	POINT         m_ptZoomHodj, m_ptZoomPodj;
-	CText        *m_pTextMessage;
-	CColorButton *m_pOKButton;          // OKAY button on scroll
+	POINT         m_HodjLoc = { 0, 0 }, m_PodjLoc = { 0, 0 };
+	POINT         m_ptZoomHodj = { 0, 0 }, m_ptZoomPodj = { 0, 0 };
+	CText        *m_pTextMessage = nullptr;
+	CColorButton *m_pOKButton = nullptr;		// OKAY button on scroll
 
 public:
 
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/cturndlg.h b/engines/bagel/hodjnpodj/metagame/gtl/cturndlg.h
index 5e80d07ec79..31756c4c7f9 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/cturndlg.h
+++ b/engines/bagel/hodjnpodj/metagame/gtl/cturndlg.h
@@ -52,11 +52,11 @@ namespace Gtl {
 
 class CTurnDialog : public CBmpDialog {
 private:
-	CColorButton *m_pOKButton;      // OKAY button on scroll
-	CText        *m_pTextMessage;
-	bool          m_bHodj;
-	bool          m_bGain;
-	bool          m_bTurn;          // True: win/lose turn, False: win/lose Game
+	CColorButton *m_pOKButton = nullptr;      // OKAY button on scroll
+	CText        *m_pTextMessage = nullptr;
+	bool          m_bHodj = false;
+	bool          m_bGain = false;
+	bool          m_bTurn = false;          // True: win/lose turn, False: win/lose Game
 
 public:
 
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/gtldat.h b/engines/bagel/hodjnpodj/metagame/gtl/gtldat.h
index e665b4c233d..bb409a818b4 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/gtldat.h
+++ b/engines/bagel/hodjnpodj/metagame/gtl/gtldat.h
@@ -146,9 +146,9 @@ public:
 	CMemDC();
 	~CMemDC();
 
-	CDC      *m_pDC;
-	CPalette *m_pPalOld;
-	HBITMAP   m_hBmpOld;
+	CDC      *m_pDC = nullptr;
+	CPalette *m_pPalOld = nullptr;
+	HBITMAP   m_hBmpOld = nullptr;
 };
 
 // CLexElement -- lexical element class
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/gtlfrm.h b/engines/bagel/hodjnpodj/metagame/gtl/gtlfrm.h
index 3a8e4e8876b..9d5241cfc44 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/gtlfrm.h
+++ b/engines/bagel/hodjnpodj/metagame/gtl/gtlfrm.h
@@ -55,12 +55,12 @@ public:
 	void ShowOptions(CPalette *);
 	bool ShowClue(CPalette *, CNote *);
 
-	class CGtlView *m_xpcLastFocusView ;        // last view with focus
-	class CGtlView *m_xpcLastMouseView ;        // last view touched by mouse
-	class CGtlDoc *m_xpDocument ;
-	class CBfcMgr *m_lpBfcMgr ;         // interface class
-	bool m_bExitDll ;           // if turned on, exit meta game DLL
-	int         m_nReturnCode;
+	class CGtlView *m_xpcLastFocusView = nullptr;	// last view with focus
+	class CGtlView *m_xpcLastMouseView = nullptr;	// last view touched by mouse
+	class CGtlDoc *m_xpDocument = nullptr;
+	class CBfcMgr *m_lpBfcMgr = nullptr;			// interface class
+	bool m_bExitDll = false;						// if turned on, exit meta game DLL
+	int m_nReturnCode = 0;
 
 	virtual ~CGtlFrame();
 
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/gtlmgm.cpp b/engines/bagel/hodjnpodj/metagame/gtl/gtlmgm.cpp
index f350680e9cd..01564a74766 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/gtlmgm.cpp
+++ b/engines/bagel/hodjnpodj/metagame/gtl/gtlmgm.cpp
@@ -414,7 +414,7 @@ int CGtlData::DoSpecialTravel(int iVisitId, bool bHodj) {
 		ErrorLog("ERROR.LOG", "File not found: %s", pCurPlayer->m_szFileName);
 
 	assert(FileExists(pCurPlayer->m_szFileName));
-	((CSprite *)pCurPlayer->m_pObject)->LoadCels(m_cBgbMgr.m_xpDc, pCurPlayer->m_szFileName, pCurPlayer->m_nCels);
+	(void)((CSprite *)pCurPlayer->m_pObject)->LoadCels(m_cBgbMgr.m_xpDc, pCurPlayer->m_szFileName, pCurPlayer->m_nCels);
 
 	// move from node to node
 	//
@@ -714,7 +714,7 @@ void CGtlData::LoadCharDirection(CBgbObject *pBgbSprite, CPoint ptOld, CPoint pt
 				pBgbSprite->m_szFileName[7] = chNewChar;
 
 				// load new pictures
-				((CSprite *)pBgbSprite->m_pObject)->LoadCels(m_cBgbMgr.m_xpDc, pBgbSprite->m_szFileName, pBgbSprite->m_nCels);
+				(void)((CSprite *)pBgbSprite->m_pObject)->LoadCels(m_cBgbMgr.m_xpDc, pBgbSprite->m_szFileName, pBgbSprite->m_nCels);
 			}
 		}
 	}
@@ -882,6 +882,11 @@ int *CGtlData::FindShortestPath(CNode FAR * lpNode1,
 	//long lTimeDiff ;            // time difference
 
 	struct DIST FAR * lpDist = new FAR struct DIST[m_iNodes] ;
+	for (i = 0; i < m_iNodes; ++i) {
+		auto &d = lpDist[i];
+		d.m_iDistance = d.m_iWeight = d.m_iLength = 0;
+		d.m_iFrom = d.m_iCount = 0;
+	}
 
 	cStartPoint = NodeToPoint(lpNode1, nullptr) ;
 	cTargetPoint = NodeToPoint(lpNode2, nullptr) ;
@@ -1024,18 +1029,15 @@ done:
 
 cleanup:
 
-	if (lpDist) {
-		delete [] lpDist ;
-		lpDist = nullptr ;
-	}
+	delete[] lpDist;
 
-	if (iError && lpiPath) {
-		delete [] lpiPath ;
-		lpiPath = nullptr ;
+	if (iError) {
+		delete[] lpiPath;
+		lpiPath = nullptr;
 	}
 
-	JXELEAVE(CGtlData::FindShortestPath) ;
-	RETURN(lpiPath) ;
+	JXELEAVE(CGtlData::FindShortestPath);
+	return lpiPath;
 }
 
 //* CGtlData::PositionCharacters -- set positions for Hodj and Podj
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/gtlmve.cpp b/engines/bagel/hodjnpodj/metagame/gtl/gtlmve.cpp
index 096d21f432c..1831a2602e1 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/gtlmve.cpp
+++ b/engines/bagel/hodjnpodj/metagame/gtl/gtlmve.cpp
@@ -714,7 +714,7 @@ void CGtlData::DoTransport(CXodj *pXodj, int iNode) {
 
 	// use stars animation bitmap
 	Common::strcpy_s(pCurPlayer->m_szFileName, pXodj->m_pszStarsFile);
-	((CSprite *)pCurPlayer->m_pObject)->LoadCels(m_cBgbMgr.m_xpDc, pCurPlayer->m_szFileName, pCurPlayer->m_nCels);
+	(void)((CSprite *)pCurPlayer->m_pObject)->LoadCels(m_cBgbMgr.m_xpDc, pCurPlayer->m_szFileName, pCurPlayer->m_nCels);
 
 	((CSprite *)pCurPlayer->m_pObject)->SetAnimated(true);
 
@@ -3355,10 +3355,8 @@ bool CGtlData::DetermineInfoEligibility(CXodj * xpXodj, int iLocationCode, bool
 				bEligibility = true ;   // then we're indeed eligible
 				// to get information from this location
 				if (bExecute)   // if we want to execute on eligibility
-					for (iK = iFound ; (uint)iK < DIMENSION(xpXodj->m_iSecondaryLoc)
-					        ; ++iK)
-						xpXodj->m_iSecondaryLoc[iK] =
-						    xpXodj->m_iSecondaryLoc[iK + 1] ;
+					for (iK = iFound ; (uint)iK < DIMENSION(xpXodj->m_iSecondaryLoc) - 1; ++iK)
+						xpXodj->m_iSecondaryLoc[iK] = xpXodj->m_iSecondaryLoc[iK + 1];
 				// remove location from table
 			}
 		}
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/gtlui.cpp b/engines/bagel/hodjnpodj/metagame/gtl/gtlui.cpp
index 385c7cf618e..191bada89d3 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/gtlui.cpp
+++ b/engines/bagel/hodjnpodj/metagame/gtl/gtlui.cpp
@@ -159,6 +159,7 @@ void CGtlData::PaintOffScreenBmp() {
 		}
 	}
 }
+
 CMemDC::CMemDC() {
 	m_pDC = new CDC;
 	assert(m_pDC != nullptr);
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/optdlg.h b/engines/bagel/hodjnpodj/metagame/gtl/optdlg.h
index 52dabc5d89f..21e60763e5c 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/optdlg.h
+++ b/engines/bagel/hodjnpodj/metagame/gtl/optdlg.h
@@ -37,18 +37,18 @@ namespace Gtl {
 //////////////////////////////////////////////////////////////////////////////
 class CMetaOptDlg : public CBmpDialog {
 private:
-	CWnd         *m_pParent;
-	CPalette     *m_pPalette;
-	CBfcMgr      *m_pBfcMgr;
-	CColorButton *m_pRulesGameButton;
-	CColorButton *m_pSaveGameButton;
-	CColorButton *m_pLeaveGameButton;
-	CColorButton *m_pContinueGameButton;
-	CColorButton *m_pOptionsGameButton;
+	CWnd         *m_pParent = nullptr;
+	CPalette     *m_pPalette = nullptr;
+	CBfcMgr      *m_pBfcMgr = nullptr;
+	CColorButton *m_pRulesGameButton = nullptr;
+	CColorButton *m_pSaveGameButton = nullptr;
+	CColorButton *m_pLeaveGameButton = nullptr;
+	CColorButton *m_pContinueGameButton = nullptr;
+	CColorButton *m_pOptionsGameButton = nullptr;
 
-	bool         m_bMusic;
-	bool         m_bSoundFX;
-	bool         m_bScrolling;
+	bool         m_bMusic = false;
+	bool         m_bSoundFX = false;
+	bool         m_bScrolling = false;
 
 public:
 	CMetaOptDlg(CWnd* pParent = nullptr, CPalette *pPalette = nullptr);
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/pawn.cpp b/engines/bagel/hodjnpodj/metagame/gtl/pawn.cpp
index d878d771b9d..64f4bffe86a 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/pawn.cpp
+++ b/engines/bagel/hodjnpodj/metagame/gtl/pawn.cpp
@@ -296,6 +296,7 @@ bool CPawnShop::OnInitDialog() {
 
 	if (m_pParentWnd == nullptr)                                   // get our parent window
 		m_pParentWnd = ((CWnd *) this)->GetParent();            // ... as passed to us or inquired about
+	assert(m_pParentWnd);
 
 	(*m_pParentWnd).GetWindowRect(&myRect);
 	x = myRect.left + (((myRect.right - myRect.left) - PAWN_DX) >> 1);
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/pawn.h b/engines/bagel/hodjnpodj/metagame/gtl/pawn.h
index 59d3eba7e36..899281814c2 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/pawn.h
+++ b/engines/bagel/hodjnpodj/metagame/gtl/pawn.h
@@ -90,11 +90,11 @@ private:
 	bool CreateWorkAreas(CDC *pDC);
 
 private:
-	bool m_bKeyboardHook;		// whether keyboard hook present
-	CRect OkayRect;				// rectangle bounding the OKAY button
-	CRect PawnRect;				// x/y (left/right) and dx/dy (right/bottom) for the pawn window
-	CRect ScrollTopRect,		// area spanned by upper scroll curl
-		ScrollBotRect;			// area spanned by lower scroll curl
+	bool m_bKeyboardHook = false;	// whether keyboard hook present
+	CRect OkayRect;					// rectangle bounding the OKAY button
+	CRect PawnRect;					// x/y (left/right) and dx/dy (right/bottom) for the pawn window
+	CRect ScrollTopRect,			// area spanned by upper scroll curl
+		ScrollBotRect;				// area spanned by lower scroll curl
 
 // Dialog Data
 	//{{AFX_DATA(CPawnShop)
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/rules.cpp b/engines/bagel/hodjnpodj/metagame/gtl/rules.cpp
index 18b3aa311c9..0e2b0541370 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/rules.cpp
+++ b/engines/bagel/hodjnpodj/metagame/gtl/rules.cpp
@@ -1294,6 +1294,7 @@ CDC *CRules::SetupCompatibleContext(CDC *pDC, CBitmap *pBitmap, CBitmap * &pBitm
 			return (pNewDC);
 	}
 
+	delete pNewDC;
 	return nullptr;
 }
 
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/rules.h b/engines/bagel/hodjnpodj/metagame/gtl/rules.h
index f107e9b7f41..13b1a376d10 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/rules.h
+++ b/engines/bagel/hodjnpodj/metagame/gtl/rules.h
@@ -70,15 +70,15 @@ private:
 	void Sleep(clock_t wait);
 
 private:
-	bool m_bKeyboardHook;		// whether keyboard hook present
-	CRect OkayRect;				// rectangle bounding the OKAY button
-	CRect ScrollRect,			// x/y (left/right) and dx/dy (right/bottom) for the scroll window
-		ScrollTopRect,			// rectangle bounding the scroll top section
-		ScrollBotRect,			// rectangle bounding the scroll bottom section
-		ScrollMidRect;			// rectangle bounding the scroll middle section
-
-	CRect ScrollTopCurlRect,	// current location of top curl for mouse clicks
-		ScrollBotCurlRect;		// current location of bottom curl for mouse clicks
+	bool m_bKeyboardHook = false;	// whether keyboard hook present
+	CRect OkayRect;					// rectangle bounding the OKAY button
+	CRect ScrollRect,				// x/y (left/right) and dx/dy (right/bottom) for the scroll window
+		ScrollTopRect,				// rectangle bounding the scroll top section
+		ScrollBotRect,				// rectangle bounding the scroll bottom section
+		ScrollMidRect;				// rectangle bounding the scroll middle section
+
+	CRect ScrollTopCurlRect,		// current location of top curl for mouse clicks
+		ScrollBotCurlRect;			// current location of bottom curl for mouse clicks
 
 	// Dialog Data
 	//{{AFX_DATA(CRules)
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/spinner.cpp b/engines/bagel/hodjnpodj/metagame/gtl/spinner.cpp
index e4cffbf44be..23ee5fcc4b4 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/spinner.cpp
+++ b/engines/bagel/hodjnpodj/metagame/gtl/spinner.cpp
@@ -419,11 +419,9 @@ int CSpinner::Spin() {
 
 	app->pause();
 
-	if (pSound != nullptr) {                               // terminate the sound gracefully
-		(*pSound).stop();
-		delete pSound;
-		pSound = nullptr;
-	}
+	(*pSound).stop();
+	delete pSound;
+	pSound = nullptr;
 
 punt:
 	if (pBitmap != nullptr)                                // release the resources we used
@@ -431,8 +429,7 @@ punt:
 	if (pPalette != nullptr)
 		delete pPalette;
 
-	if (pSound != nullptr)
-		delete pSound;
+	delete pSound;
 
 	if (bSuccess)                                      // return value if all went well
 		return (nValue);
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/spinner.h b/engines/bagel/hodjnpodj/metagame/gtl/spinner.h
index 219218ad5b8..97996d576e1 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/spinner.h
+++ b/engines/bagel/hodjnpodj/metagame/gtl/spinner.h
@@ -74,14 +74,14 @@ private:
 	static bool HandleMessages();
 
 private:
-	CWnd    *m_pWnd;            // window for messages
-	CDC     *m_pDC;             // context for display
-	CSprite *m_pSprite;         // sprite for spinner
-	int     m_nValue;           // current spinner value
-	int     m_nX;               // x location of sprite
-	int     m_nY;               // y location of sprite
-	bool    m_bVisible;         // whether spinner is visible
-	bool    m_bHodj;            // which character is active
+	CWnd    *m_pWnd = nullptr;		// window for messages
+	CDC     *m_pDC = nullptr;		// context for display
+	CSprite *m_pSprite = nullptr;	// sprite for spinner
+	int     m_nValue = 0;			// current spinner value
+	int     m_nX = 0;				// x location of sprite
+	int     m_nY = 0;				// y location of sprite
+	bool    m_bVisible = false;		// whether spinner is visible
+	bool    m_bHodj = false;		// which character is active
 };
 
 } // namespace Gtl
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/store.cpp b/engines/bagel/hodjnpodj/metagame/gtl/store.cpp
index 5577490d72f..b1c72949f9c 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/store.cpp
+++ b/engines/bagel/hodjnpodj/metagame/gtl/store.cpp
@@ -298,6 +298,7 @@ bool CGeneralStore::OnInitDialog() {
 
 	if (m_pParentWnd == nullptr)                                   // get our parent window
 		m_pParentWnd = ((CWnd *) this)->GetParent();            // ... as passed to us or inquired about
+	assert(m_pParentWnd);
 
 	(*m_pParentWnd).GetWindowRect(&myRect);
 	x = myRect.left + (((myRect.right - myRect.left) - STORE_DX) >> 1);
diff --git a/engines/bagel/hodjnpodj/metagame/gtl/store.h b/engines/bagel/hodjnpodj/metagame/gtl/store.h
index d05d7bde3b8..3ad930be5d6 100644
--- a/engines/bagel/hodjnpodj/metagame/gtl/store.h
+++ b/engines/bagel/hodjnpodj/metagame/gtl/store.h
@@ -91,11 +91,11 @@ private:
 	bool CreateWorkAreas(CDC *pDC);
 
 private:
-	bool m_bKeyboardHook;		// whether keyboard hook present
-	CRect OkayRect;				// rectangle bounding the OKAY button
-	CRect StoreRect;			// x/y (left/right) and dx/dy (right/bottom) for the store window
-	CRect ScrollTopRect,		// area spanned by upper scroll curl
-		ScrollBotRect;			// area spanned by lower scroll curl
+	bool m_bKeyboardHook = false;	// whether keyboard hook present
+	CRect OkayRect;					// rectangle bounding the OKAY button
+	CRect StoreRect;				// x/y (left/right) and dx/dy (right/bottom) for the store window
+	CRect ScrollTopRect,			// area spanned by upper scroll curl
+		ScrollBotRect;				// area spanned by lower scroll curl
 
 	// Dialog Data
 	//{{AFX_DATA(CGeneralStore)


Commit: 438bb60d020ca07a98a36928dfb6796a5b79fdcd
    https://github.com/scummvm/scummvm/commit/438bb60d020ca07a98a36928dfb6796a5b79fdcd
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-02T03:25:45-07:00

Commit Message:
BAGEL: METAGAME: Fix misc Coverity warnings

Changed paths:
    engines/bagel/hodjnpodj/metagame/saves/savedlg.h
    engines/bagel/hodjnpodj/metagame/zoom/zoommap.cpp


diff --git a/engines/bagel/hodjnpodj/metagame/saves/savedlg.h b/engines/bagel/hodjnpodj/metagame/saves/savedlg.h
index 2a3c476433a..36af2f11445 100644
--- a/engines/bagel/hodjnpodj/metagame/saves/savedlg.h
+++ b/engines/bagel/hodjnpodj/metagame/saves/savedlg.h
@@ -52,13 +52,13 @@ protected:
 private:
 	bool OnInitDialog() override;
 
-	CColorButton *m_pSlotButtons[MAX_SAVEGAMES];
-	CEdit        *m_pSlotText[MAX_SAVEGAMES];
-	CColorButton *m_pQuitButton;
-	CColorButton *m_pOkButton;
-	CText        *m_pTxtSave;
-	char         *m_pszDescriptions[MAX_SAVEGAMES];
-	int           m_nCurSlot;
+	CColorButton *m_pSlotButtons[MAX_SAVEGAMES] = {};
+	CEdit *m_pSlotText[MAX_SAVEGAMES] = {};
+	CColorButton *m_pQuitButton = nullptr;
+	CColorButton *m_pOkButton = nullptr;
+	CText *m_pTxtSave = nullptr;
+	char *m_pszDescriptions[MAX_SAVEGAMES] = {};
+	int m_nCurSlot = 0;
 };
 
 } // namespace Saves
diff --git a/engines/bagel/hodjnpodj/metagame/zoom/zoommap.cpp b/engines/bagel/hodjnpodj/metagame/zoom/zoommap.cpp
index 40add6c1b56..0975049b201 100644
--- a/engines/bagel/hodjnpodj/metagame/zoom/zoommap.cpp
+++ b/engines/bagel/hodjnpodj/metagame/zoom/zoommap.cpp
@@ -578,12 +578,12 @@ void CMainZoomWindow::OnTimer(uintptr nEventID) {
 	// Add Quit and Slide Show buttons
 	CRect ssRect((GAME_WIDTH / 2) - 120, 450, (GAME_WIDTH / 2) - 20, 470);
 	pSlideshowButton = new CColorButton();
-	pSlideshowButton->Create("Slide Show", BS_OWNERDRAW | WS_CHILD | WS_VISIBLE, ssRect, this, IDC_LEAVE);
+	(void)pSlideshowButton->Create("Slide Show", BS_OWNERDRAW | WS_CHILD | WS_VISIBLE, ssRect, this, IDC_LEAVE);
 	pSlideshowButton->SetPalette(pGamePalette);
 
 	CRect quitRect((GAME_WIDTH / 2) + 20, 450, (GAME_WIDTH / 2) + 120, 470);
 	pReturnButton = new CColorButton();
-	pReturnButton->Create("Quit", BS_OWNERDRAW | WS_CHILD | WS_VISIBLE, quitRect, this, IDC_QUIT);
+	(void)pReturnButton->Create("Quit", BS_OWNERDRAW | WS_CHILD | WS_VISIBLE, quitRect, this, IDC_QUIT);
 	pReturnButton->SetPalette(pGamePalette);
 
 	// Set the screen to redraw




More information about the Scummvm-git-logs mailing list