remove dead loop (#1700)

This commit is contained in:
David Markowitz 2024-12-28 15:11:44 -08:00 committed by GitHub
parent 08a168de88
commit 1b9f7e44c7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -267,36 +267,26 @@ int main(int argc, char** argv) {
// pre calculate the FDB checksum // pre calculate the FDB checksum
if (Game::config->GetValue("check_fdb") == "1") { if (Game::config->GetValue("check_fdb") == "1") {
static const std::vector<std::string> aliases = { auto cdclient = Game::assetManager->GetFile("cdclient.fdb");
"CDServers.fdb", if (cdclient) {
"cdserver.fdb",
"CDClient.fdb",
"cdclient.fdb",
};
for (const auto& file : aliases) { const int32_t bufferSize = 1024;
auto cdclient = Game::assetManager->GetFile("cdclient.fdb"); MD5 md5;
if (cdclient) {
const int32_t bufferSize = 1024; char fileStreamBuffer[bufferSize] = {};
MD5 md5;
char fileStreamBuffer[1024] = {}; while (!cdclient.eof()) {
memset(fileStreamBuffer, 0, bufferSize);
while (!cdclient.eof()) { cdclient.read(fileStreamBuffer, bufferSize);
memset(fileStreamBuffer, 0, bufferSize); md5.update(fileStreamBuffer, cdclient.gcount());
cdclient.read(fileStreamBuffer, bufferSize);
md5.update(fileStreamBuffer, cdclient.gcount());
}
const char* nullTerminateBuffer = "\0";
md5.update(nullTerminateBuffer, 1); // null terminate the data
md5.finalize();
databaseChecksum = md5.hexdigest();
LOG("FDB Checksum calculated as: %s", databaseChecksum.c_str());
break;
} }
const char* nullTerminateBuffer = "\0";
md5.update(nullTerminateBuffer, 1); // null terminate the data
md5.finalize();
databaseChecksum = md5.hexdigest();
LOG("FDB Checksum calculated as: %s", databaseChecksum.c_str());
} }
if (databaseChecksum.empty()) { if (databaseChecksum.empty()) {
LOG("check_fdb is on but no fdb file found."); LOG("check_fdb is on but no fdb file found.");