Codechange: make md5sumToString std::string compatible

This commit is contained in:
Rubidium
2023-04-27 22:18:53 +02:00
committed by rubidium42
parent 51c6b8c1e4
commit a312a6c1b2
12 changed files with 24 additions and 54 deletions

View File

@@ -1135,14 +1135,11 @@ static void GRFSaveConfig(IniFile &ini, const char *grpname, const GRFConfig *li
const GRFConfig *c;
for (c = list; c != nullptr; c = c->next) {
/* Hex grfid (4 bytes in nibbles), "|", hex md5sum (16 bytes in nibbles), "|", file system path. */
char key[4 * 2 + 1 + 16 * 2 + 1 + MAX_PATH];
char params[512];
GRFBuildParamList(params, c, lastof(params));
char *pos = key + seprintf(key, lastof(key), "%08X|", BSWAP32(c->ident.grfid));
pos = md5sumToString(pos, lastof(key), c->ident.md5sum);
seprintf(pos, lastof(key), "|%s", c->filename);
std::string key = fmt::format("{:08X}|{}|{}", BSWAP32(c->ident.grfid),
MD5SumToString(c->ident.md5sum), c->filename);
group->GetItem(key, true)->SetValue(params);
}
}