[Scummvm-git-logs] scummvm master -> 2c562525c1dfc9153cc1cb8112ecfa47f8d1ac56
Strangerke
noreply at scummvm.org
Tue May 21 17:50:52 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:
2c562525c1 BAGEL: Fix several PVS Studio issues
Commit: 2c562525c1dfc9153cc1cb8112ecfa47f8d1ac56
https://github.com/scummvm/scummvm/commit/2c562525c1dfc9153cc1cb8112ecfa47f8d1ac56
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-21T18:50:44+01:00
Commit Message:
BAGEL: Fix several PVS Studio issues
Changed paths:
engines/bagel/spacebar/bibble_window.cpp
engines/bagel/spacebar/computer.cpp
engines/bagel/spacebar/main_window.cpp
engines/bagel/spacebar/master_win.cpp
engines/bagel/spacebar/nav_window.cpp
diff --git a/engines/bagel/spacebar/bibble_window.cpp b/engines/bagel/spacebar/bibble_window.cpp
index 3c44333945a..6a3e7ab1ffb 100644
--- a/engines/bagel/spacebar/bibble_window.cpp
+++ b/engines/bagel/spacebar/bibble_window.cpp
@@ -1073,10 +1073,9 @@ void CBibbleWindow::onLButtonDown(uint32 /*nFlags*/, CBofPoint *pPoint, void *)
ErrorCode CBibbleWindow::highlight(CBetArea *pArea, byte nColor) {
assert(isValidObject(this));
assert(pArea != nullptr);
+ assert(_pBackdrop != nullptr);
CBofBitmap cBmp(pArea->_cRect.width(), pArea->_cRect.height(), _pBackdrop->getPalette());
-
- assert(_pBackdrop != nullptr);
CBofRect r = cBmp.getRect();
_pBackdrop->paint(&cBmp, &r, &pArea->_cRect);
@@ -1110,11 +1109,10 @@ ErrorCode CBibbleWindow::highlight(CBetArea *pArea, byte nColor) {
ErrorCode CBibbleWindow::unHighlight(CBetArea *pArea) {
assert(isValidObject(this));
assert(pArea != nullptr);
+ assert(_pBackdrop != nullptr);
CBofBitmap cBmp(pArea->_cRect.width(), pArea->_cRect.height(), _pBackdrop->getPalette());
- assert(_pBackdrop != nullptr);
-
// Copy bet area
CBofRect r = cBmp.getRect();
_pBackdrop->paint(&cBmp, &r, &pArea->_cRect);
diff --git a/engines/bagel/spacebar/computer.cpp b/engines/bagel/spacebar/computer.cpp
index 8c413f3799b..b4df6d71fc4 100644
--- a/engines/bagel/spacebar/computer.cpp
+++ b/engines/bagel/spacebar/computer.cpp
@@ -95,6 +95,8 @@ SBarComputer::SBarComputer() : CBagStorageDevWnd(),
setCloseup(true);
}
SBarComputer::~SBarComputer() {
+ delete _pDrinkBox;
+ delete _pIngBox;
}
void SBarComputer::onMainLoop() {
@@ -371,21 +373,16 @@ void SBarComputer::createTextBox(CBofString &newText) {
}
void SBarComputer::deleteTextBox() {
- if (_pTBox) {
- delete _pTBox;
- _pTBox = nullptr;
- }
+ delete _pTBox;
+ _pTBox = nullptr;
}
void SBarComputer::deleteListBox() {
- if (_pDrinkBox) {
- delete _pDrinkBox;
- _pDrinkBox = nullptr;
- }
- if (_pIngBox) {
- delete _pIngBox;
- _pIngBox = nullptr;
- }
+ delete _pDrinkBox;
+ _pDrinkBox = nullptr;
+
+ delete _pIngBox;
+ _pIngBox = nullptr;
}
ErrorCode SBarComputer::createDrinksListBox() {
@@ -787,8 +784,6 @@ void SBarComputer::onBofButton(CBofObject *pObject, int nState) {
setIng();
break;
case LISTD:
- setList();
- break;
case LISTI:
setList();
break;
diff --git a/engines/bagel/spacebar/main_window.cpp b/engines/bagel/spacebar/main_window.cpp
index db4a5f1a392..aad46ff8280 100644
--- a/engines/bagel/spacebar/main_window.cpp
+++ b/engines/bagel/spacebar/main_window.cpp
@@ -240,11 +240,9 @@ ErrorCode CMainWindow::attach() {
// be interested in knowing since we already did one above...
//
// Only do it if we're coming from somewhere other than the zoom
- if (bForegroundObj == true) {
- if ((CBagObject *)nullptr == getFGObjects(CBofString(WIELD_WLD))) {
- _pWieldBmp->setAssociateWnd(this);
- insertFGObjects(_pWieldBmp);
- }
+ if ((CBagObject *)nullptr == getFGObjects(CBofString(WIELD_WLD))) {
+ _pWieldBmp->setAssociateWnd(this);
+ insertFGObjects(_pWieldBmp);
}
}
diff --git a/engines/bagel/spacebar/master_win.cpp b/engines/bagel/spacebar/master_win.cpp
index b85a3bda88a..86f37a12ec1 100644
--- a/engines/bagel/spacebar/master_win.cpp
+++ b/engines/bagel/spacebar/master_win.cpp
@@ -253,13 +253,7 @@ void CSBarMasterWin::onNewFilter(CBagStorageDev *pSDev, const int nType) {
break;
case SDEV_DLG:
- pSDev->onSetFilter(filterFunction);
- break;
-
case SDEV_CLOSEP:
- pSDev->onSetFilter(filterFunction);
- break;
-
case SDEV_WND:
pSDev->onSetFilter(filterFunction);
break;
diff --git a/engines/bagel/spacebar/nav_window.cpp b/engines/bagel/spacebar/nav_window.cpp
index cdfa5f90b3e..28ee4cc329d 100644
--- a/engines/bagel/spacebar/nav_window.cpp
+++ b/engines/bagel/spacebar/nav_window.cpp
@@ -263,10 +263,8 @@ ErrorCode CNavWindow::attach() {
_pOldPal = CBofApp::getApp()->getPalette();
_pPal = _pBackdrop->getPalette()->copyPalette();
CBofApp::getApp()->setPalette(_pPal);
- _pCurLoc = new CBofSprite;
- if (_pCurLoc == nullptr)
- fatalError(ERR_MEMORY, "Unable to allocate a CBofSprite");
+ _pCurLoc = new CBofSprite;
_pCurLoc->loadSprite(makeDir(CUR_LOC), 2);
_pCurLoc->setMaskColor(MASK_COLOR);
_pCurLoc->setZOrder(SPRITE_TOPMOST);
@@ -277,8 +275,6 @@ ErrorCode CNavWindow::attach() {
// Build all our buttons
for (i = 0; i < 2; i++) {
_pButtons[i] = new CBofBmpButton;
- if (_pButtons[i] == nullptr)
- fatalError(ERR_MEMORY, "Unable to allocate a CBofBmpButton");
CBofBitmap *pUp = loadBitmap(makeDir(g_navButtons[i]._pszUp), _pPal);
CBofBitmap *pDown = loadBitmap(makeDir(g_navButtons[i]._pszDown), _pPal);
@@ -1305,6 +1301,7 @@ void CNavWindow::calcFuel(double hf) {
// WORKAROUND: _pBackdrop shares it's palette with _pCurLoc,
// so as the backdrop is changed, don't free the palette
+ assert(_pBackdrop != nullptr);
_pBackdrop->setIsOwnPalette(false);
bool isDone = (_level == 3);
@@ -1318,7 +1315,6 @@ void CNavWindow::calcFuel(double hf) {
pause();
CBofString sNebDir(NEBSIM4_BMP);
fixPathName(sNebDir);
- assert(_pBackdrop != nullptr);
_bmptwo = new CBofBitmap(sNebDir.getBuffer(), _pPal);
setBackground(_bmptwo);
_cargo = 125 + 10 + 17 + 8 + 99 + 24;
More information about the Scummvm-git-logs
mailing list