diff options
author | michi_cc <michi_cc@openttd.org> | 2012-02-04 13:29:00 +0000 |
---|---|---|
committer | michi_cc <michi_cc@openttd.org> | 2012-02-04 13:29:00 +0000 |
commit | a9b6c5cd86f4f17155695890bfaf2e30404f5921 (patch) | |
tree | 54a16a5b71593df1f2b7d4869cfe5ab71c47e233 /src/base_media_base.h | |
parent | 02d07e68d8c6fc760021ec1c36086877f714152c (diff) | |
download | openttd-a9b6c5cd86f4f17155695890bfaf2e30404f5921.tar.xz |
(svn r23886) -Codechange: Allow limiting the MD5 file hash to the first x bytes of the file.
Diffstat (limited to 'src/base_media_base.h')
-rw-r--r-- | src/base_media_base.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/base_media_base.h b/src/base_media_base.h index e81612d69..f8e9db95e 100644 --- a/src/base_media_base.h +++ b/src/base_media_base.h @@ -33,7 +33,7 @@ struct MD5File { uint8 hash[16]; ///< md5 sum of the file const char *missing_warning; ///< warning when this file is missing - ChecksumResult CheckMD5(Subdirectory subdir) const; + ChecksumResult CheckMD5(Subdirectory subdir, size_t max_size) const; }; /** @@ -129,6 +129,20 @@ struct BaseSet { /* Then fall back */ return this->description.Begin()->second; } + + /** + * Calculate and check the MD5 hash of the supplied file. + * @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 MD5File::ChecksumResult CheckMD5(const MD5File *file, Subdirectory subdir) + { + return file->CheckMD5(subdir, SIZE_MAX); + } }; /** |