OpenTTD: MD5File Struct Reference

OpenTTD

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- Data Structures
- Class Hierarchy
- Data Fields

Public Types | Public Member Functions | Data Fields
MD5File Struct Reference

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

`#include <base_media_base.h>`

## Public Types
enum | ChecksumResult { CR_MATCH, CR_MISMATCH, CR_NO_FILE }
| 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
const char * | filename
| filename
uint8 | hash [16]
| md5 sum of the file
const char * | missing_warning
| warning when this file is missing

## Detailed Description

Structure holding filename and MD5 information about a single file.

Definition at line 26 of file base_media_base.h.

## Member Enumeration Documentation

enum MD5File::ChecksumResult

The result of a checksum check.

Enumerator:

  CR_MATCH | The file did exist and the md5 checksum did match.
  CR_MISMATCH | The file did exist, just the md5 checksum did not match.
  CR_NO_FILE | The file did not exist.

Definition at line 28 of file base_media_base.h.

## Member Function Documentation

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

Calculate and check the MD5 hash of the supplied filename.

Parameters

  subdir | The sub directory to get the files from
  max_size | Only calculate the hash for this many bytes from the file start.

Returns
  - CR_MATCH if the MD5 hash matches
  - CR_MISMATCH if the MD5 does not match
  - CR_NO_FILE if the file misses

Definition at line 399 of file gfxinit.cpp.

References CR_MATCH, CR_MISMATCH, CR_NO_FILE, filename, FioFCloseFile(), FioFOpenFile(), hash, and min().

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

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

- src/base_media_base.h
- src/gfxinit.cpp