MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / CheckMD5

Method CheckMD5

src/gfxinit.cpp:423–432  ·  view source on GitHub ↗

* Calculate and check the MD5 hash of the supplied GRF. * @param file The file get the hash of. * @param subdir The sub directory to get the files from. * @return * - #CR_MATCH if the MD5 hash matches * - #CR_MISMATCH if the MD5 does not match * - #CR_NO_FILE if the file misses */ static */

Source from the content-addressed store, hash-verified

421 * - #CR_NO_FILE if the file misses
422 */
423/* static */ MD5File::ChecksumResult GraphicsSet::CheckMD5(const MD5File *file, Subdirectory subdir)
424{
425 size_t size = 0;
426 auto f = FioFOpenFile(file->filename, "rb", subdir, &size);
427 if (!f.has_value()) return MD5File::CR_NO_FILE;
428
429 size_t max = GRFGetSizeOfDataSection(*f);
430
431 return file->CheckMD5(subdir, max);
432}
433
434
435/**

Callers

nothing calls this directly

Calls 4

FioFOpenFileFunction · 0.85
GRFGetSizeOfDataSectionFunction · 0.85
AppendMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected