Adjust zlib_crc32_calculate

This commit is contained in:
twinaphex 2016-01-24 06:47:06 +01:00
parent a0e9a4c68e
commit c6f7afbd9a
7 changed files with 9 additions and 9 deletions

View File

@ -98,7 +98,7 @@ static bool read_content_file(unsigned i, const char *path, void **buf,
#ifdef HAVE_ZLIB
content_ctl(CONTENT_CTL_GET_CRC, &content_crc_ptr);
*content_crc_ptr = zlib_crc32_calculate(ret_buf, *length);
*content_crc_ptr = zlib_crc32_calculate(0, ret_buf, *length);
RARCH_LOG("CRC32: 0x%x .\n", (unsigned)*content_crc_ptr);
#endif

View File

@ -400,7 +400,7 @@ static int zip_file_decompressed(const char *name, const char *valid_exts,
ret = zlib_inflate_data_to_file_iterate(handle.stream);
}while(ret == 0);
handle.real_checksum = zlib_crc32_calculate(handle.data, size);
handle.real_checksum = zlib_crc32_calculate(0, handle.data, size);
if (handle.real_checksum != crc32)
{

View File

@ -203,9 +203,9 @@ int zlib_inflate_data_to_file_iterate(void *data)
return 0;
}
uint32_t zlib_crc32_calculate(const uint8_t *data, size_t length)
uint32_t zlib_crc32_calculate(uint32_t crc, const uint8_t *data, size_t length)
{
return crc32(0, data, length);
return crc32(crc, data, length);
}
uint32_t zlib_crc32_adjust(uint32_t crc, uint8_t data)
@ -245,7 +245,7 @@ int zlib_inflate_data_to_file(zlib_file_handle_t *handle,
goto end;
}
handle->real_checksum = zlib_crc32_calculate(handle->data, size);
handle->real_checksum = zlib_crc32_calculate(0, handle->data, size);
#if 0
if (handle->real_checksum != checksum)

View File

@ -48,7 +48,7 @@ static void dword_write_be(uint8_t *buf, uint32_t val)
static bool png_write_crc(RFILE *file, const uint8_t *data, size_t size)
{
uint8_t crc_raw[4] = {0};
uint32_t crc = zlib_crc32_calculate(data, size);
uint32_t crc = zlib_crc32_calculate(0, data, size);
dword_write_be(crc_raw, crc);
return retro_fwrite(file, crc_raw, sizeof(crc_raw)) == sizeof(crc_raw);

View File

@ -73,7 +73,7 @@ typedef int (*zlib_file_cb)(const char *name, const char *valid_exts,
const uint8_t *cdata, unsigned cmode, uint32_t csize, uint32_t size,
uint32_t crc32, void *userdata);
uint32_t zlib_crc32_calculate(const uint8_t *data, size_t length);
uint32_t zlib_crc32_calculate(uint32_t crc, const uint8_t *data, size_t length);
uint32_t zlib_crc32_adjust(uint32_t crc, uint8_t data);

View File

@ -186,7 +186,7 @@ patch_error_t bps_apply_patch(
modify_modify_checksum |= bps_read(&bps) << i;
#ifdef HAVE_ZLIB
bps.source_checksum = zlib_crc32_calculate(bps.source_data, bps.source_length);
bps.source_checksum = zlib_crc32_calculate(0, bps.source_data, bps.source_length);
#else
return PATCH_PATCH_CHECKSUM_INVALID;
#endif

View File

@ -208,7 +208,7 @@ static int database_info_iterate_playlist(
#ifdef HAVE_ZLIB
db_state->crc = zlib_crc32_calculate(db_state->buf, ret);
db_state->crc = zlib_crc32_calculate(0, db_state->buf, ret);
#endif
db->type = DATABASE_TYPE_CRC_LOOKUP;
}