[Scummvm-git-logs] scummvm master -> 81ad96cd948efe5570c62b13c4397bce26e1cb10
Strangerke
noreply at scummvm.org
Thu May 9 22:24:35 UTC 2024
This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
5d4338aee8 BAGEL: Fix 3 buildstring formats in cache and bofMemAlloc (CID 1544839, 1544848 and 1544872)
81ad96cd94 BAGEL: Remove a couple of unused functions in CBofDataFile, moce assignment out of if statements
Commit: 5d4338aee83c56685f8d5cd7126c38a2754466a4
https://github.com/scummvm/scummvm/commit/5d4338aee83c56685f8d5cd7126c38a2754466a4
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-09T23:24:20+01:00
Commit Message:
BAGEL: Fix 3 buildstring formats in cache and bofMemAlloc (CID 1544839, 1544848 and 1544872)
Changed paths:
engines/bagel/boflib/cache.cpp
engines/bagel/boflib/misc.cpp
diff --git a/engines/bagel/boflib/cache.cpp b/engines/bagel/boflib/cache.cpp
index 4531029b728..f22dbc8386f 100644
--- a/engines/bagel/boflib/cache.cpp
+++ b/engines/bagel/boflib/cache.cpp
@@ -104,7 +104,7 @@ bool CCache::flush() {
}
bool CCache::optimize(uint32 lRequestedFreeSpace) {
- logInfo(buildString("CCache::optimize(%ld)", lRequestedFreeSpace));
+ logInfo(buildString("CCache::optimize(%u)", lRequestedFreeSpace));
bool bSuccess = true;
while (getFreePhysMem() < lRequestedFreeSpace) {
@@ -118,7 +118,7 @@ bool CCache::optimize(uint32 lRequestedFreeSpace) {
if (pCache->_bCached && (pCache->_nLockCount <= 0)) {
nObjects++;
if (pCache->_lAge >= lAvgAge) {
- logInfo(buildString("Freeing Object: %08lx from the Cache list", pCache));
+ logInfo(buildString("Freeing Object: %p from the Cache list", pCache));
pCache->release();
}
}
diff --git a/engines/bagel/boflib/misc.cpp b/engines/bagel/boflib/misc.cpp
index cd08180cc5d..243cce4866b 100644
--- a/engines/bagel/boflib/misc.cpp
+++ b/engines/bagel/boflib/misc.cpp
@@ -77,7 +77,7 @@ void *bofMemAlloc(uint32 nSize, const char *pFile, int nLine, bool bClear) {
}
if (pNewBlock == nullptr) {
- logError(buildString("Could not allocate %ld bytes, file %s, line %d", nSize, pFile, nLine));
+ logError(buildString("Could not allocate %u bytes, file %s, line %d", nSize, pFile, nLine));
}
return pNewBlock;
Commit: 81ad96cd948efe5570c62b13c4397bce26e1cb10
https://github.com/scummvm/scummvm/commit/81ad96cd948efe5570c62b13c4397bce26e1cb10
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-09T23:24:20+01:00
Commit Message:
BAGEL: Remove a couple of unused functions in CBofDataFile, moce assignment out of if statements
Changed paths:
engines/bagel/boflib/dat_file.cpp
engines/bagel/boflib/dat_file.h
diff --git a/engines/bagel/boflib/dat_file.cpp b/engines/bagel/boflib/dat_file.cpp
index 39481c19bb3..be9106209e0 100644
--- a/engines/bagel/boflib/dat_file.cpp
+++ b/engines/bagel/boflib/dat_file.cpp
@@ -56,17 +56,6 @@ CBofDataFile::CBofDataFile() {
_bHeaderDirty = false;
}
-CBofDataFile::CBofDataFile(const char *pszFileName, uint32 lFlags, const char *pPassword) {
- _szFileName[0] = '\0';
- _szPassWord[0] = '\0';
- _lHeaderLength = 0;
- _lNumRecs = 0;
- _pHeader = nullptr;
- _bHeaderDirty = false;
-
- setFile(pszFileName, lFlags, pPassword);
-}
-
ErrorCode CBofDataFile::setFile(const char *pszFileName, uint32 lFlags, const char *pPassword) {
assert(isValidObject(this));
@@ -576,10 +565,12 @@ ErrorCode CBofDataFile::writeRecord(int32 lRecNum, void *pBuf, int32 lSize, bool
byte *pTmpBuf = (byte *)bofAlloc((int)getMaxRecSize());
if (pTmpBuf != nullptr) {
for (int i = (int)lRecNum + 1; i < (int)_lNumRecs - 1; i++) {
- if ((_errCode = readRecord(i, pTmpBuf)) != ERR_NONE)
+ _errCode = readRecord(i, pTmpBuf);
+ if (_errCode != ERR_NONE)
break;
- if ((_errCode = writeRecord(i + 1, pTmpBuf)) != ERR_NONE)
+ _errCode = writeRecord(i + 1, pTmpBuf);
+ if (_errCode != ERR_NONE)
break;
}
@@ -636,7 +627,8 @@ ErrorCode CBofDataFile::verifyAllRecords() {
if (_errCode == ERR_NONE) {
int32 n = getNumberOfRecs();
for (int32 i = 0; i < n; i++) {
- if ((_errCode = verifyRecord(i)) != ERR_NONE) {
+ _errCode = verifyRecord(i);
+ if (_errCode != ERR_NONE) {
break;
}
}
@@ -698,65 +690,6 @@ ErrorCode CBofDataFile::addRecord(void *pBuf, int32 lLength, bool bUpdateHeader,
return _errCode;
}
-ErrorCode CBofDataFile::deleteRecord(int32 lRecNum, bool bUpdateHeader) {
- assert(isValidObject(this));
-
- //
- // I don't think this function works yet!
- //
-
- // Only continue if there is no current error
- if (_errCode == ERR_NONE) {
- // Validate record number
- assert(lRecNum >= 0 && lRecNum < _lNumRecs);
-
- _bHeaderDirty = true;
-
- // Header has moved
- _lHeaderStart -= _pHeader[(int)lRecNum]._lLength;
-
- // Header has changed size
- memmove(_pHeader + lRecNum, _pHeader + lRecNum + 1, (size_t)((_lNumRecs - lRecNum - 1) * HEADER_REC::size()));
-
- // On less record
- _lNumRecs--;
-
- _lHeaderLength = _lNumRecs * HEADER_REC::size();
-
- // Open the data file if it's not already
- if (_stream == nullptr) {
- open();
- }
-
- if (_errCode == ERR_NONE) {
- // Allocate a buffer that could hold the largest record
- byte *pBuf = (byte *)bofAlloc((int)getMaxRecSize());
- if (pBuf != nullptr) {
- // Remove this record from the file
- for (int i = (int)lRecNum; i < (int)_lNumRecs - 1; i++) {
- if ((_errCode = readRecord(i + 1, pBuf)) != ERR_NONE)
- break;
-
- if ((_errCode = writeRecord(i, pBuf)) != ERR_NONE)
- break;
- }
-
- // If we are to update the header now
- if (bUpdateHeader) {
- writeHeader();
- }
-
- bofFree(pBuf);
-
- } else {
- _errCode = ERR_MEMORY;
- }
- }
- }
-
- return _errCode;
-}
-
int32 CBofDataFile::findRecord(uint32 lKey) {
assert(isValidObject(this));
diff --git a/engines/bagel/boflib/dat_file.h b/engines/bagel/boflib/dat_file.h
index eeb115cdf41..b6a1933afa5 100644
--- a/engines/bagel/boflib/dat_file.h
+++ b/engines/bagel/boflib/dat_file.h
@@ -96,15 +96,6 @@ public:
*/
CBofDataFile();
- /**
- * Constructor
- * @param pszFileName Name of .DAT file
- * @param lFlags Flags for open, and ecnryption, etc.
- * @param pPassword Password for encryption
- */
-
- CBofDataFile(const char *pszFileName, uint32 lFlags = CDF_DEFAULT, const char *pPassword = nullptr);
-
/**
* Destructor
*/
@@ -113,7 +104,7 @@ public:
/**
* Initializes a CBofDataFile with specified info
* @param pszFileName Name of .DAT file
- * @param lFlags Flags for open, and ecnryption, etc.
+ * @param lFlags Flags for open, and encryption, etc.
* @param pPassword Password for encryption
* @return Error return code
*/
@@ -207,14 +198,6 @@ public:
*/
ErrorCode addRecord(void *pBuf, int32 lRecSize, bool bUpdateHeader = false, uint32 lKey = 0xFFFFFFFF);
- /**
- * Deletes specified record from data-file.
- * @param lRecNum Record number to read
- * @param bUpdateHeader true if header is to be committed to disk
- * @return Error return code
- */
- ErrorCode deleteRecord(int32 lRecNum, bool bUpdateHeader = false);
-
/**
* Finds record by it's key.
* @param lKey Key to search records with
More information about the Scummvm-git-logs
mailing list