Mercurial > hg > sidinfo
changeset 166:e6c8a235ce2f
Fix the load address handling in case of new SLDB format.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 16 Feb 2018 22:24:43 +0200 |
parents | eb343ac259f4 |
children | a498edd91bcc |
files | sidlib.c |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/sidlib.c Fri Feb 16 22:08:11 2018 +0200 +++ b/sidlib.c Fri Feb 16 22:24:43 2018 +0200 @@ -48,10 +48,10 @@ static BOOL si_read_hash_data(th_ioctx *ctx, PSIDHeader *psid, - th_md5state_t *state, BOOL first) + th_md5state_t *state, const BOOL newSLDB) { uint8_t *data = NULL; - BOOL ret = FALSE; + BOOL ret = FALSE, first = TRUE; size_t read; if ((data = (uint8_t *) th_malloc(PSID_BUFFER_SIZE)) == NULL) @@ -81,8 +81,12 @@ // Grab the load address psid->loadAddress = TH_LE16_TO_NATIVE(*(uint16_t *) data); - // .. do not include the load address to the hash - th_md5_append(state, &data[2], read - 2); + // .. do not include the load address to the hash if OLD SLDB format + if (newSLDB) + th_md5_append(state, data, read); + else + th_md5_append(state, &data[2], read - 2); + first = FALSE; } else