mirror of
https://github.com/CTCaer/RetroArch.git
synced 2025-02-21 20:22:43 +00:00
Remove zlib_crc32_adjust - reuse zlib_crc32_calculate for this
This commit is contained in:
parent
c6f7afbd9a
commit
280e10195c
@ -208,13 +208,6 @@ uint32_t zlib_crc32_calculate(uint32_t crc, const uint8_t *data, size_t length)
|
||||
return crc32(crc, data, length);
|
||||
}
|
||||
|
||||
uint32_t zlib_crc32_adjust(uint32_t crc, uint8_t data)
|
||||
{
|
||||
/* zlib and nall have different assumptions on "sign" for this
|
||||
* function. */
|
||||
return ~crc32(~crc, &data, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* zlib_inflate_data_to_file:
|
||||
* @path : filename path of archive.
|
||||
|
@ -75,8 +75,6 @@ typedef int (*zlib_file_cb)(const char *name, const char *valid_exts,
|
||||
|
||||
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);
|
||||
|
||||
/**
|
||||
* zlib_parse_file:
|
||||
* @file : filename path of archive
|
||||
|
10
patch.c
10
patch.c
@ -55,7 +55,7 @@ static uint8_t bps_read(struct bps_data *bps)
|
||||
{
|
||||
uint8_t data = bps->modify_data[bps->modify_offset++];
|
||||
#ifdef HAVE_ZLIB
|
||||
bps->modify_checksum = zlib_crc32_adjust(bps->modify_checksum, data);
|
||||
bps->modify_checksum = ~zlib_crc32_calculate(~bps->modify_checksum, &data, 1);
|
||||
#endif
|
||||
return data;
|
||||
}
|
||||
@ -84,7 +84,7 @@ static void bps_write(struct bps_data *bps, uint8_t data)
|
||||
|
||||
bps->target_data[bps->output_offset++] = data;
|
||||
#ifdef HAVE_ZLIB
|
||||
bps->target_checksum = zlib_crc32_adjust(bps->target_checksum, data);
|
||||
bps->target_checksum = ~zlib_crc32_calculate(~bps->target_checksum, &data, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -220,7 +220,7 @@ static uint8_t ups_patch_read(struct ups_data *data)
|
||||
{
|
||||
uint8_t n = data->patch_data[data->patch_offset++];
|
||||
#ifdef HAVE_ZLIB
|
||||
data->patch_checksum = zlib_crc32_adjust(data->patch_checksum, n);
|
||||
data->patch_checksum = ~zlib_crc32_calculate(~data->patch_checksum, &n, 1);
|
||||
#endif
|
||||
return n;
|
||||
}
|
||||
@ -233,7 +233,7 @@ static uint8_t ups_source_read(struct ups_data *data)
|
||||
{
|
||||
uint8_t n = data->source_data[data->source_offset++];
|
||||
#ifdef HAVE_ZLIB
|
||||
data->source_checksum = zlib_crc32_adjust(data->source_checksum, n);
|
||||
data->source_checksum = ~zlib_crc32_calculate(~data->source_checksum, &n, 1);
|
||||
#endif
|
||||
return n;
|
||||
}
|
||||
@ -246,7 +246,7 @@ static void ups_target_write(struct ups_data *data, uint8_t n)
|
||||
{
|
||||
data->target_data[data->target_offset] = n;
|
||||
#ifdef HAVE_ZLIB
|
||||
data->target_checksum = zlib_crc32_adjust(data->target_checksum, n);
|
||||
data->target_checksum = ~zlib_crc32_calculate(~data->target_checksum, &n, 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user