OpenTTD Source 20260421-master-gc2fbc6fdeb
MD5File Struct Reference

Structure holding filename and MD5 information about a single file. More...

#include <base_media_base.h>

Public Types

enum class  ChecksumResult : uint8_t { Unknown , Match , Mismatch , NoFile }
 The result of a checksum check. More...

Public Member Functions

ChecksumResult CheckMD5 (Subdirectory subdir, size_t max_size) const
 Calculate and check the MD5 hash of the supplied filename.

Data Fields

std::string filename
 filename
MD5Hash hash
 md5 sum of the file
std::string missing_warning
 warning when this file is missing
ChecksumResult check_result
 cached result of md5 check

Detailed Description

Structure holding filename and MD5 information about a single file.

Definition at line 25 of file base_media_base.h.

Member Enumeration Documentation

◆ ChecksumResult

enum class MD5File::ChecksumResult : uint8_t
strong

The result of a checksum check.

Enumerator
Unknown 

The file has not been checked yet.

Match 

The file did exist and the md5 checksum did match.

Mismatch 

The file did exist, just the md5 checksum did not match.

NoFile 

The file did not exist.

Definition at line 27 of file base_media_base.h.

Member Function Documentation

◆ CheckMD5()

MD5File::ChecksumResult MD5File::CheckMD5 ( Subdirectory subdir,
size_t max_size ) const

Calculate and check the MD5 hash of the supplied filename.

Parameters
subdirThe sub directory to get the files from
max_sizeOnly calculate the hash for this many bytes from the file start.
Returns

Definition at line 447 of file gfxinit.cpp.

References filename, FioFOpenFile(), hash, Match, Mismatch, and NoFile.

Referenced by BaseSet< T >::CheckMD5(), and GraphicsSet::CheckMD5().

Field Documentation

◆ check_result

ChecksumResult MD5File::check_result

cached result of md5 check

Definition at line 37 of file base_media_base.h.

◆ filename

std::string MD5File::filename

filename

Definition at line 34 of file base_media_base.h.

Referenced by GraphicsSet::CheckMD5(), and CheckMD5().

◆ hash

MD5Hash MD5File::hash

md5 sum of the file

Definition at line 35 of file base_media_base.h.

Referenced by CheckMD5(), and TryGetBaseSetFile().

◆ missing_warning

std::string MD5File::missing_warning

warning when this file is missing

Definition at line 36 of file base_media_base.h.


The documentation for this struct was generated from the following files: