summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
authorskidd13 <skidd13@openttd.org>2007-12-25 13:59:21 +0000
committerskidd13 <skidd13@openttd.org>2007-12-25 13:59:21 +0000
commit7963963d982aed3176d3d05a09bed1293953ef88 (patch)
tree42ac53ed2682fd271d54bb7695ea73ba7053c2af /src/newgrf_config.cpp
parentb3f6c0734b2eba2ab6271ea0fbf669a526a33e3c (diff)
downloadopenttd-7963963d982aed3176d3d05a09bed1293953ef88.tar.xz
(svn r11695) -Codechange: Converted the md5 algorithm to OOP
-Codechange: Adapt the md5 algorithm to the OpenTTD source
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index 80257b4a3..63d314adb 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -32,8 +32,8 @@ GRFConfig *_grfconfig_static;
static bool CalcGRFMD5Sum(GRFConfig *config)
{
FILE *f;
- md5_state_t md5state;
- md5_byte_t buffer[1024];
+ Md5 checksum;
+ uint8 buffer[1024];
size_t len, size;
/* open the file */
@@ -41,12 +41,11 @@ static bool CalcGRFMD5Sum(GRFConfig *config)
if (f == NULL) return false;
/* calculate md5sum */
- md5_init(&md5state);
while ((len = fread(buffer, 1, (size > sizeof(buffer)) ? sizeof(buffer) : size, f)) != 0 && size != 0) {
size -= len;
- md5_append(&md5state, buffer, len);
+ checksum.Append(buffer, len);
}
- md5_finish(&md5state, config->md5sum);
+ checksum.Finish(config->md5sum);
FioFCloseFile(f);