[Scummvm-git-logs] scummvm master -> 0918486d93cb918bea9fbf0fe3134e8b606a5651

Strangerke noreply at scummvm.org
Thu May 30 21:13:18 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:
0918486d93 BAGEL: Fix some more small issues (useless variables, avoid useless variable initialization, reduce variable scope, ...)


Commit: 0918486d93cb918bea9fbf0fe3134e8b606a5651
    https://github.com/scummvm/scummvm/commit/0918486d93cb918bea9fbf0fe3134e8b606a5651
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-30T22:12:56+01:00

Commit Message:
BAGEL: Fix some more small issues (useless variables, avoid useless variable initialization, reduce variable scope, ...)

Changed paths:
    engines/bagel/baglib/text_object.cpp
    engines/bagel/baglib/variable_object.cpp
    engines/bagel/boflib/dat_file.h
    engines/bagel/boflib/error.h
    engines/bagel/boflib/gfx/bitmap.h
    engines/bagel/boflib/gfx/text.cpp


diff --git a/engines/bagel/baglib/text_object.cpp b/engines/bagel/baglib/text_object.cpp
index 53e1d107715..5f93cde486a 100644
--- a/engines/bagel/baglib/text_object.cpp
+++ b/engines/bagel/baglib/text_object.cpp
@@ -472,15 +472,13 @@ bool CBagTextObject::runObject() {
 
 				update(cDlg.getBackdrop(), cPoint, &cRect);
 
-				CBagPDA *pPDA = nullptr;
 				sStr = "BPDA_WLD";
-				pPDA = (CBagPDA *)g_SDevManager->getStorageDevice(sStr);
+				CBagPDA *pPDA = (CBagPDA *)g_SDevManager->getStorageDevice(sStr);
 
 				// If we're in the zoom pda then put this box at the
 				// bottom of the zoom rect.
-				SBZoomPda *pPDAZ = nullptr;
 				sStr = "BPDAZ_WLD";
-				pPDAZ = (SBZoomPda *)g_SDevManager->getStorageDevice(sStr);
+				SBZoomPda *pPDAZ = (SBZoomPda *)g_SDevManager->getStorageDevice(sStr);
 
 				if (pPDAZ && pPDAZ->getZoomed() == true) {
 					CBofRect zRect = pPDAZ->getViewRect();
diff --git a/engines/bagel/baglib/variable_object.cpp b/engines/bagel/baglib/variable_object.cpp
index 7b5bb0f9b20..cd1ea369e1b 100644
--- a/engines/bagel/baglib/variable_object.cpp
+++ b/engines/bagel/baglib/variable_object.cpp
@@ -64,8 +64,6 @@ ParseCodes CBagVariableObject::setInfo(CBagIfstream &istr) {
 	bool nObjectUpdated = false;
 
 	while (!istr.eof()) {
-		int nChanged = 0;
-
 		istr.eatWhite();
 
 		char ch = (char)istr.peek();
@@ -84,7 +82,6 @@ ParseCodes CBagVariableObject::setInfo(CBagIfstream &istr) {
 				istr.eatWhite();
 				getIntFromStream(istr, _nPointSize);
 				nObjectUpdated = true;
-				nChanged++;
 			} else {
 				putbackStringOnStream(istr, sStr);
 			}
@@ -118,7 +115,6 @@ ParseCodes CBagVariableObject::setInfo(CBagIfstream &istr) {
 					break;
 				}
 				nObjectUpdated = true;
-				nChanged++;
 			} else {
 				putbackStringOnStream(istr, sStr);
 			}
@@ -136,7 +132,7 @@ ParseCodes CBagVariableObject::setInfo(CBagIfstream &istr) {
 
 			if (parseCode == UPDATED_OBJECT) {
 				nObjectUpdated = true;
-			} else if (!nChanged) {
+			} else {
 				if (nObjectUpdated)
 					return UPDATED_OBJECT;
 
diff --git a/engines/bagel/boflib/dat_file.h b/engines/bagel/boflib/dat_file.h
index 1af87bb2a70..d508b536549 100644
--- a/engines/bagel/boflib/dat_file.h
+++ b/engines/bagel/boflib/dat_file.h
@@ -169,7 +169,8 @@ public:
 	 * @param lRecNum           Record number to read
 	 * @param pBuf              Buffer to write data from
 	 * @param lRecSize          Size of buffer
-	 * @param bUpdateHeader     true if header is to be committed to disk
+	 * @param bUpdateHeader     True if header is to be committed to disk
+	 * @param lKey              Hash key
 	 * @return                  Error return code
 	 */
 	ErrorCode writeRecord(int32 lRecNum, void *pBuf, int32 lRecSize = -1, bool bUpdateHeader = false, uint32 lKey = 0xFFFFFFFF);
@@ -192,7 +193,7 @@ public:
 	 * @param pBuf              Buffer to write data from
 	 * @param lRecSize          Size of buffer
 	 * @param bUpdateHeader     true if header is to be committed to disk
-	 * @param key               Key
+	 * @param lKey              hash Key
 	 * @return                  Error return code
 	 */
 	ErrorCode addRecord(void *pBuf, int32 lRecSize, bool bUpdateHeader = false, uint32 lKey = 0xFFFFFFFF);
diff --git a/engines/bagel/boflib/error.h b/engines/bagel/boflib/error.h
index 7dcc8566253..c4a1dc9b1d7 100644
--- a/engines/bagel/boflib/error.h
+++ b/engines/bagel/boflib/error.h
@@ -63,14 +63,16 @@ public:
 	 * @remarks     Sets _errCode to specified error condition, and logs the
 	 *                   error.
 	 * @param errCode       Error to report
-	 * @param format        printf style format string
+	 * @param format        A printf style format string
+	 * @param ...           Additional parameters to be formatted and inserted into the string
 	 */
 	void reportError(ErrorCode errCode, const char *format, ...);
 
 	/**
 	 * Logs specified fatal error to log file and exit the game.
 	 * @param errCode       Error to report
-	 * @param format        printf style format string
+	 * @param format        A printf style format string
+	 * @param ...           Additional parameters to be formatted and inserted into the string
 	 */
 	static void fatalError(ErrorCode errCode, const char *format, ...);
 
diff --git a/engines/bagel/boflib/gfx/bitmap.h b/engines/bagel/boflib/gfx/bitmap.h
index 49b91f270f9..8653ef0b248 100644
--- a/engines/bagel/boflib/gfx/bitmap.h
+++ b/engines/bagel/boflib/gfx/bitmap.h
@@ -220,7 +220,7 @@ public:
 	 * Paints some or all of the bitmap directly to the screen
 	 * @param pWnd          Destination device for painting
 	 * @param x             Destination column
-	 * @param y             Destimation row
+	 * @param y             Destination row
 	 * @param pSrcRect      Source rectangle from bitmap
 	 * @param nMaskColor    Transparency color
 	 * @return              error return code
@@ -251,7 +251,7 @@ public:
 	 * Paints some or all of the bitmap directly to the screen
 	 * @param pBmp          Destination bitmap to paint to
 	 * @param x             Destination column
-	 * @param y             Destimation row
+	 * @param y             Destination row
 	 * @param pSrcRect      Source rectangle from bitmap
 	 * @param nMaskColor    Transparency color
 	 * @return              Error return code
@@ -290,6 +290,7 @@ public:
 	 * @param pBmp          Destination bitmap to paint to
 	 * @param pDstRect      Destination rectangle (for stretching)
 	 * @param pSrcRect      Source rectangle from bitmap
+	 * @param nOptSize
 	 * @return              Error return code
 	 */
 	ErrorCode paintStretchOpt(CBofBitmap *pBmp, CBofRect *pDstRect, CBofRect *pSrcRect, int nOptSize);
diff --git a/engines/bagel/boflib/gfx/text.cpp b/engines/bagel/boflib/gfx/text.cpp
index 564a7311c99..bf79bee6d52 100644
--- a/engines/bagel/boflib/gfx/text.cpp
+++ b/engines/bagel/boflib/gfx/text.cpp
@@ -318,7 +318,6 @@ ErrorCode CBofText::displayTextEx(CBofBitmap *pBmp, const char *pszText, CBofRec
 
 	Graphics::ManagedSurface surface = pBmp->getSurface();
 	Graphics::Font *font = getFont(nFont, nSize, nWeight);
-	CBofRect cRect;
 	int color;
 
 	// Split lines




More information about the Scummvm-git-logs mailing list