[Scummvm-git-logs] scummvm master -> 744ebf17ca1ae20dad7382be384286eaf5396ae2

Strangerke noreply at scummvm.org
Tue Jun 11 21:35:54 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:
744ebf17ca BAGEL: Remove some unused includes, reduce a couple of variable scopes, add missing parenthesis in macro definitions


Commit: 744ebf17ca1ae20dad7382be384286eaf5396ae2
    https://github.com/scummvm/scummvm/commit/744ebf17ca1ae20dad7382be384286eaf5396ae2
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-06-11T22:35:00+01:00

Commit Message:
BAGEL: Remove some unused includes, reduce a couple of variable scopes, add missing parenthesis in macro definitions

Changed paths:
    engines/bagel/baglib/rp_object.h
    engines/bagel/baglib/var.cpp
    engines/bagel/boflib/gfx/bitmap.cpp
    engines/bagel/boflib/gfx/text.h
    engines/bagel/boflib/gui/window.h
    engines/bagel/boflib/misc.h
    engines/bagel/boflib/sound.h
    engines/bagel/boflib/string.h
    engines/bagel/boflib/string_functions.h
    engines/bagel/boflib/vector.h
    engines/bagel/spacebar/sraf_computer.cpp


diff --git a/engines/bagel/baglib/rp_object.h b/engines/bagel/baglib/rp_object.h
index 601c7d9e982..fce662e8fac 100644
--- a/engines/bagel/baglib/rp_object.h
+++ b/engines/bagel/baglib/rp_object.h
@@ -23,7 +23,6 @@
 #ifndef BAGEL_BAGLIB_RP_OBJECT_H
 #define BAGEL_BAGLIB_RP_OBJECT_H
 
-#include "bagel/baglib/character_object.h"
 #include "bagel/baglib/dossier_object.h"
 #include "bagel/baglib/expression.h"
 #include "bagel/baglib/movie_object.h"
diff --git a/engines/bagel/baglib/var.cpp b/engines/bagel/baglib/var.cpp
index e771181811e..9b923486991 100644
--- a/engines/bagel/baglib/var.cpp
+++ b/engines/bagel/baglib/var.cpp
@@ -332,8 +332,6 @@ ErrorCode CBagVarManager::releaseVariables(bool bIncludeGlobals) {
 }
 
 CBagVar *CBagVarManager::getVariable(const CBofString &sName) {
-	CBagVar *pVar = nullptr;
-
 	// Use the hash table to find the variable.
 	char szLocalBuff[256];
 	CBofString varStr(szLocalBuff, 256);
@@ -343,7 +341,7 @@ CBagVar *CBagVarManager::getVariable(const CBofString &sName) {
 
 	CBofList<CBagVar *> *pVarList = &_xVarHashList[nHashVal];
 	for (int i = 0; i < pVarList->getCount(); ++i) {
-		pVar = pVarList->getNodeItem(i);
+		CBagVar *pVar = pVarList->getNodeItem(i);
 		if (pVar != nullptr && (pVar->getName().getLength() == sName.getLength()) && !pVar->getName().find(sName)) {
 			return pVar;
 		}
diff --git a/engines/bagel/boflib/gfx/bitmap.cpp b/engines/bagel/boflib/gfx/bitmap.cpp
index fecbbd8e788..8f26987ffd2 100644
--- a/engines/bagel/boflib/gfx/bitmap.cpp
+++ b/engines/bagel/boflib/gfx/bitmap.cpp
@@ -588,15 +588,13 @@ ErrorCode CBofBitmap::captureScreen(CBofWindow *pWnd, CBofRect *pSrcRect, CBofRe
 	assert(pWnd != nullptr);
 	assert(pSrcRect != nullptr);
 
-	CBofRect cDestRect(0, 0, _nDX - 1, _nDY - 1);
-	CBofRect cSrcRect(0, 0, _nDX - 1, _nDY - 1);
-
 	if (_errCode == ERR_NONE) {
+		CBofRect cDestRect(0, 0, _nDX - 1, _nDY - 1);
 		if (pDstRect != nullptr) {
 			cDestRect = *pDstRect;
 		}
 
-		cSrcRect = *pSrcRect;
+		CBofRect cSrcRect = *pSrcRect;
 		CBofBitmap *pBackdrop = pWnd->getBackdrop();
 
 		// If we're capturing the screen, we have to convert the format first.
diff --git a/engines/bagel/boflib/gfx/text.h b/engines/bagel/boflib/gfx/text.h
index a0dda34db83..44908ba17c6 100644
--- a/engines/bagel/boflib/gfx/text.h
+++ b/engines/bagel/boflib/gfx/text.h
@@ -108,7 +108,7 @@ enum {
 #define FORMAT_MULTI_LINE       DT_WORDBREAK
 #define FORMAT_DEFAULT          ( FORMAT_TOP_LEFT | FORMAT_MULTI_LINE )
 
-#define FONT_DEFAULT_SIZE       -14
+#define FONT_DEFAULT_SIZE       (-14)
 #define FONT_8POINT             8
 #define FONT_10POINT            10
 #define FONT_12POINT            12
diff --git a/engines/bagel/boflib/gui/window.h b/engines/bagel/boflib/gui/window.h
index cc49c5fa43f..1f9d8f4a8a7 100644
--- a/engines/bagel/boflib/gui/window.h
+++ b/engines/bagel/boflib/gui/window.h
@@ -42,7 +42,7 @@ namespace Bagel {
 class CBofString;
 
 #define MAX_TITLE 64
-#define USE_DEFAULT -1
+#define USE_DEFAULT (-1)
 
 class CBofBitmap;
 class CBofTimerPacket;
diff --git a/engines/bagel/boflib/misc.h b/engines/bagel/boflib/misc.h
index c751e4cdd59..4faa2c69b5d 100644
--- a/engines/bagel/boflib/misc.h
+++ b/engines/bagel/boflib/misc.h
@@ -55,7 +55,7 @@ extern Fixed fixedDivide(Fixed Dividend, Fixed Divisor);
 extern Fixed fixedMultiply(Fixed Multiplicand, Fixed Multiplier);
 
 #define intToFixed(i) (Fixed)(((long)(i)) << 16)
-#define fixedToInt(f) (int)(((long)f) >> 16)
+#define fixedToInt(f) (int)(((long)(f)) >> 16)
 
 //////////////////////////////////////////////////////////////////////////////
 //
diff --git a/engines/bagel/boflib/sound.h b/engines/bagel/boflib/sound.h
index 285a896d627..d3d83eba119 100644
--- a/engines/bagel/boflib/sound.h
+++ b/engines/bagel/boflib/sound.h
@@ -42,8 +42,8 @@ namespace Bagel {
 #define VOLUME_INDEX_DEFAULT 10
 
 // Convert to ScummVM scale
-#define VOLUME_SVM(x) (x * Audio::Mixer::kMaxChannelVolume / VOLUME_INDEX_MAX)
-#define SVM_VOLUME(x) ((x >= 252) ? VOLUME_INDEX_MAX : x * VOLUME_INDEX_MAX / 252)
+#define VOLUME_SVM(x) ((x) * Audio::Mixer::kMaxChannelVolume / VOLUME_INDEX_MAX)
+#define SVM_VOLUME(x) (((x) >= 252) ? VOLUME_INDEX_MAX : (x) * VOLUME_INDEX_MAX / 252)
 
 #define SOUND_BUFFERED 0x0001
 #define SOUND_ASYNCH 0x0002
diff --git a/engines/bagel/boflib/string.h b/engines/bagel/boflib/string.h
index 309786ec475..969eab2c82e 100644
--- a/engines/bagel/boflib/string.h
+++ b/engines/bagel/boflib/string.h
@@ -32,7 +32,7 @@ namespace Bagel {
 // of the buffer size to tell us if it is stack memory being used.
 #define mUseStackMem 0x8000
 #define NORMALIZEBUFFERSIZE() (_nBufferSize & ~mUseStackMem)
-#define SETBUFFERSIZE(size, usestackmem) (_nBufferSize = (uint16)(size + (usestackmem ? mUseStackMem : 0)))
+#define SETBUFFERSIZE(size, usestackmem) (_nBufferSize = (uint16)((size) + ((usestackmem) ? mUseStackMem : 0)))
 #define USESSTACKMEM() (_nBufferSize & mUseStackMem)
 
 class CBofString : public CBofObject {
diff --git a/engines/bagel/boflib/string_functions.h b/engines/bagel/boflib/string_functions.h
index 22f4a22c943..ea1fc9fcb64 100644
--- a/engines/bagel/boflib/string_functions.h
+++ b/engines/bagel/boflib/string_functions.h
@@ -23,8 +23,6 @@
 #ifndef BAGEL_BOFLIB_STRING_FUNCTIONS_H
 #define BAGEL_BOFLIB_STRING_FUNCTIONS_H
 
-#include "bagel/boflib/stdinc.h"
-
 namespace Bagel {
 
 /**
diff --git a/engines/bagel/boflib/vector.h b/engines/bagel/boflib/vector.h
index 1dd01fa3de0..16d4a3655fe 100644
--- a/engines/bagel/boflib/vector.h
+++ b/engines/bagel/boflib/vector.h
@@ -31,8 +31,8 @@ namespace Bagel {
 #define PI (double)3.141592653
 #define RADCNVT ((double)180 / PI) // PI is 180 degrees
 
-#define Deg2Rad(d) (d / RADCNVT) // Converts degrees to radians
-#define Rad2Deg(r) (r * RADCNVT) // Converts radians to degrees
+#define Deg2Rad(d) ((d) / RADCNVT) // Converts degrees to radians
+#define Rad2Deg(r) ((r) * RADCNVT) // Converts radians to degrees
 
 class CVector : public CBofObject, public Vector {
 public:
diff --git a/engines/bagel/spacebar/sraf_computer.cpp b/engines/bagel/spacebar/sraf_computer.cpp
index 8dbeddc4f94..2b3f754bb0e 100644
--- a/engines/bagel/spacebar/sraf_computer.cpp
+++ b/engines/bagel/spacebar/sraf_computer.cpp
@@ -60,14 +60,14 @@ namespace SpaceBar {
 #define kStandardDoubleIndentation  8
 
 // Buyer bids summary
-#define kFirstMineralColumn 12
+#define kFirstMineralColumn     12
 
 #define kBuyerBidsPointSize     14
 #define kOtherPointSize         13
 #define kMineralColWidth        4
 
-#define kBuyerBidsPointWidth                6
-#define kLineItemHeight kBuyerBidsPointSize + 4
+#define kBuyerBidsPointWidth    6
+#define kLineItemHeight         (kBuyerBidsPointSize + 4)
 
 // Add instructions to the main screen
 




More information about the Scummvm-git-logs mailing list