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

dreammaster noreply at scummvm.org
Thu Oct 2 08:18:23 UTC 2025


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

Summary:
ff3dc7fe1d BAGEL: MINIGAMES: Fix hnplibs Coverity warnings


Commit: ff3dc7fe1d255fe67af5a02288470292e45c361a
    https://github.com/scummvm/scummvm/commit/ff3dc7fe1d255fe67af5a02288470292e45c361a
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-10-02T01:18:15-07:00

Commit Message:
BAGEL: MINIGAMES: Fix hnplibs Coverity warnings

Changed paths:
    engines/bagel/hodjnpodj/hnplibs/audiocfg.h
    engines/bagel/hodjnpodj/hnplibs/bitmaps.cpp
    engines/bagel/hodjnpodj/hnplibs/cbofdlg.h
    engines/bagel/hodjnpodj/hnplibs/rules.cpp
    engines/bagel/hodjnpodj/hnplibs/sprite.cpp
    engines/bagel/hodjnpodj/hnplibs/text.h


diff --git a/engines/bagel/hodjnpodj/hnplibs/audiocfg.h b/engines/bagel/hodjnpodj/hnplibs/audiocfg.h
index ee2acda47eb..9b63308868d 100644
--- a/engines/bagel/hodjnpodj/hnplibs/audiocfg.h
+++ b/engines/bagel/hodjnpodj/hnplibs/audiocfg.h
@@ -59,15 +59,15 @@ protected:
 	void OnPaint();
 	DECLARE_MESSAGE_MAP()
 
-	CScrollBar   *m_pScrollBar1;
-	CCheckButton *m_pMusicButton;
-	CCheckButton *m_pSoundButton;
+	CScrollBar   *m_pScrollBar1 = nullptr;
+	CCheckButton *m_pMusicButton = nullptr;
+	CCheckButton *m_pSoundButton = nullptr;
 
-	CText        *m_pTxtVolume;
+	CText        *m_pTxtVolume = nullptr;
 
-	int          m_nVolume;
-	bool         m_bMusic;
-	bool         m_bSound;
+	int          m_nVolume = 0;
+	bool         m_bMusic = false;
+	bool         m_bSound = false;
 };
 
 } // namespace HodjNPodj
diff --git a/engines/bagel/hodjnpodj/hnplibs/bitmaps.cpp b/engines/bagel/hodjnpodj/hnplibs/bitmaps.cpp
index 827c54ddf0b..22d7789e475 100644
--- a/engines/bagel/hodjnpodj/hnplibs/bitmaps.cpp
+++ b/engines/bagel/hodjnpodj/hnplibs/bitmaps.cpp
@@ -538,9 +538,7 @@ bool PaintBitmap(CDC *pDC, CPalette *pPalette, CBitmap *pBitmap, const int x, co
 
 	pWorkDC = new CDC();                                    // create the context and bitmap objects
 
-	if ((pWorkDC != nullptr) &&                                // verify we got what we asked for
-	        (pBitmap != nullptr) &&
-	        (*pWorkDC).CreateCompatibleDC(pDC)) {               // create a context for our bitmap
+	if ((*pWorkDC).CreateCompatibleDC(pDC)) {               // create a context for our bitmap
 		if (pPalette != nullptr) {                             // map the palette into the context
 			pPalOldWork = (*pWorkDC).SelectPalette(pPalette, false);
 			(*pWorkDC).RealizePalette();
diff --git a/engines/bagel/hodjnpodj/hnplibs/cbofdlg.h b/engines/bagel/hodjnpodj/hnplibs/cbofdlg.h
index 8defd473fb4..340df72aba3 100644
--- a/engines/bagel/hodjnpodj/hnplibs/cbofdlg.h
+++ b/engines/bagel/hodjnpodj/hnplibs/cbofdlg.h
@@ -61,13 +61,13 @@ protected:
 	//}}AFX_MSG
 	DECLARE_MESSAGE_MAP()
 
-	CBitmap    *m_pDlgBackground;
-	CPalette   *m_pPalette;
-	const char *m_pBmpFileName;
-	int         m_nBmpID;
-	int         m_nDx;
-	int         m_nDy;
-	bool        m_bSaveBackground;
+	CBitmap    *m_pDlgBackground = nullptr;
+	CPalette   *m_pPalette = nullptr;
+	const char *m_pBmpFileName = nullptr;
+	int         m_nBmpID = 0;
+	int         m_nDx = 0;
+	int         m_nDy = 0;
+	bool        m_bSaveBackground = false;
 };
 
 } // namespace HodjNPodj
diff --git a/engines/bagel/hodjnpodj/hnplibs/rules.cpp b/engines/bagel/hodjnpodj/hnplibs/rules.cpp
index e2f1a7e4c5b..66422e4dcce 100644
--- a/engines/bagel/hodjnpodj/hnplibs/rules.cpp
+++ b/engines/bagel/hodjnpodj/hnplibs/rules.cpp
@@ -1276,6 +1276,8 @@ CDC *CRules::SetupCompatibleContext(CDC *pDC, CBitmap *pBitmap,
 			return (pNewDC);
 	}
 
+	delete pNewDC;
+
 	return nullptr;
 }
 
diff --git a/engines/bagel/hodjnpodj/hnplibs/sprite.cpp b/engines/bagel/hodjnpodj/hnplibs/sprite.cpp
index 26c4567f146..103791b78fc 100644
--- a/engines/bagel/hodjnpodj/hnplibs/sprite.cpp
+++ b/engines/bagel/hodjnpodj/hnplibs/sprite.cpp
@@ -96,6 +96,7 @@ CSprite::CSprite() {
 	m_bLinked = false;                                  // not initially linked into the sprite chain
 	m_pNext = nullptr;                                     // it is not yet in the sprite chain and
 	m_pPrev = nullptr;                                     // ... thus has no links to other sprites
+	m_pZPrev = nullptr;
 }
 
 
@@ -342,10 +343,10 @@ CSprite *CSprite::DuplicateSprite(CDC *pDC) {
 
 	pSprite = new CSprite();                                // create an object for the sprite
 
-	if ((pSprite != nullptr) &&                                // try to duplicate it
-	        DuplicateSprite(pDC, pSprite))
-		return (pSprite);
+	if (DuplicateSprite(pDC, pSprite))
+		return pSprite;
 
+	delete pSprite;
 	return nullptr;                                          // return failure
 }
 
@@ -384,7 +385,7 @@ bool CSprite::DuplicateSprite(CDC *pDC, CSprite *pSprite) {
 			if (m_bRetainContexts) {
 				if (!SetupImage(pDC))
 					return false;
-				SetupMask(pDC);
+				(void)SetupMask(pDC);
 				(*pSprite).m_pImageDC = m_pImageDC;
 				(*pSprite).m_pImageOld = m_pImageOld;
 				(*pSprite).m_pMaskDC = m_pMaskDC;
diff --git a/engines/bagel/hodjnpodj/hnplibs/text.h b/engines/bagel/hodjnpodj/hnplibs/text.h
index d38717abba9..ff44d98f168 100644
--- a/engines/bagel/hodjnpodj/hnplibs/text.h
+++ b/engines/bagel/hodjnpodj/hnplibs/text.h
@@ -79,29 +79,29 @@ private:
 	bool DisplayText(CDC *pDC, const char* pszText, const int nSize, const int nWeight, const bool bShadowed);
 
 private:
-	CDC         *m_pBackgroundDC;   // offscreen bitmap device context for background
-	CBitmap     *m_pBackground;     // bitmap for the text's background
-	CBitmap     *m_pBackgroundOld;  // previous bitmap mapped in the DC
-	CDC         *m_pWorkDC;         // offscreen bitmap device context for work area
-	CBitmap     *m_pWork;           // bitmap for the work area
-	CBitmap     *m_pWorkOld;        // previous bitmap mapped in the DC
-	CPalette    *m_pPalette;        // color palette for the text
-	CPalette    *m_pPalBackOld;     // previous palette mapped to background DC
-	CPalette    *m_pPalWorkOld;     // previous palette mapped to work area DC
-	CPoint      m_cPosition;        // upper left corner of text displayed
-	CSize       m_cSize;            // dx/dy size of the text bitmap
-	CRect       m_cRect;            // bounding rectangle of text area
-	CFont       *m_pFont;           // font to use for the text
-	int         m_nJustify;         // positioning within the rectangle
-	bool        m_bBounded;         // bounded versus free-form text output
-	bool        m_bHaveBackground;  // whether the background has been saved
-	COLORREF    m_cTextColor;       // color to use for the text itself
-	COLORREF    m_cShadowColor;     // color to use for the text's shadow
-	int         m_nShadow_DX;       // horizontal offset for shadow
-	int         m_nShadow_DY;       // vertical offset for shadow
-
-	static  int     m_nTabStop;         // tabstop table
-	static  bool    m_bFontLoaded;      // font loaded flag
+	CDC         *m_pBackgroundDC = nullptr;	// offscreen bitmap device context for background
+	CBitmap     *m_pBackground = nullptr;	// bitmap for the text's background
+	CBitmap     *m_pBackgroundOld = nullptr; // previous bitmap mapped in the DC
+	CDC         *m_pWorkDC = nullptr;		// offscreen bitmap device context for work area
+	CBitmap     *m_pWork = nullptr;			// bitmap for the work area
+	CBitmap     *m_pWorkOld = nullptr;		// previous bitmap mapped in the DC
+	CPalette    *m_pPalette = nullptr;		// color palette for the text
+	CPalette    *m_pPalBackOld = nullptr;	// previous palette mapped to background DC
+	CPalette    *m_pPalWorkOld = nullptr;	// previous palette mapped to work area DC
+	CPoint      m_cPosition;				// upper left corner of text displayed
+	CSize       m_cSize;					// dx/dy size of the text bitmap
+	CRect       m_cRect;					// bounding rectangle of text area
+	CFont       *m_pFont = nullptr;         // font to use for the text
+	int         m_nJustify = 0;				// positioning within the rectangle
+	bool        m_bBounded = false;			// bounded versus free-form text output
+	bool        m_bHaveBackground = false;	// whether the background has been saved
+	COLORREF    m_cTextColor = 0;			// color to use for the text itself
+	COLORREF    m_cShadowColor = 0;			// color to use for the text's shadow
+	int         m_nShadow_DX = 0;			// horizontal offset for shadow
+	int         m_nShadow_DY = 0;			// vertical offset for shadow
+
+	static  int     m_nTabStop;				// tabstop table
+	static  bool    m_bFontLoaded;			// font loaded flag
 };
 
 } // namespace HodjNPodj




More information about the Scummvm-git-logs mailing list