mirror of
https://github.com/libretro/RetroArch
synced 2025-02-17 15:41:01 +00:00
Move zlib_set_stream to file_archive_zlib
This commit is contained in:
parent
7d29929819
commit
7130f0c8d8
libretro-common
@ -451,12 +451,8 @@ bool file_archive_inflate_data_to_file_init(
|
||||
if (!stream)
|
||||
goto error;
|
||||
|
||||
zlib_set_stream(stream,
|
||||
csize,
|
||||
size,
|
||||
(const uint8_t*)cdata,
|
||||
handle->data
|
||||
);
|
||||
handle->backend->stream_set(stream, csize, size,
|
||||
(const uint8_t*)cdata, handle->data);
|
||||
|
||||
return true;
|
||||
|
||||
@ -730,8 +726,7 @@ end:
|
||||
*
|
||||
* Returns: string listing of files from archive on success, otherwise NULL.
|
||||
**/
|
||||
struct string_list *file_archive_get_file_list(
|
||||
const char *path,
|
||||
struct string_list *file_archive_get_file_list(const char *path,
|
||||
const char *valid_exts)
|
||||
{
|
||||
struct string_list *list = string_list_new();
|
||||
@ -786,23 +781,3 @@ bool file_archive_perform_mode(const char *path, const char *valid_exts,
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void zlib_set_stream(void *data,
|
||||
uint32_t avail_in,
|
||||
uint32_t avail_out,
|
||||
const uint8_t *next_in,
|
||||
uint8_t *next_out
|
||||
)
|
||||
{
|
||||
z_stream *stream = (z_stream*)data;
|
||||
|
||||
if (!stream)
|
||||
return;
|
||||
|
||||
stream->avail_in = avail_in;
|
||||
stream->avail_out = avail_out;
|
||||
|
||||
stream->next_in = (uint8_t*)next_in;
|
||||
stream->next_out = next_out;
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,25 @@ static void zlib_stream_free(void *data)
|
||||
inflateEnd(ret);
|
||||
}
|
||||
|
||||
static void zlib_stream_set(void *data,
|
||||
uint32_t avail_in,
|
||||
uint32_t avail_out,
|
||||
const uint8_t *next_in,
|
||||
uint8_t *next_out
|
||||
)
|
||||
{
|
||||
z_stream *stream = (z_stream*)data;
|
||||
|
||||
if (!stream)
|
||||
return;
|
||||
|
||||
stream->avail_in = avail_in;
|
||||
stream->avail_out = avail_out;
|
||||
|
||||
stream->next_in = (uint8_t*)next_in;
|
||||
stream->next_out = next_out;
|
||||
}
|
||||
|
||||
static uint32_t zlib_stream_get_avail_in(void *data)
|
||||
{
|
||||
z_stream *stream = (z_stream*)data;
|
||||
@ -113,6 +132,7 @@ static bool zlib_stream_decompress_init(void *data)
|
||||
const struct zlib_file_backend zlib_backend = {
|
||||
zlib_stream_new,
|
||||
zlib_stream_free,
|
||||
zlib_stream_set,
|
||||
zlib_stream_get_avail_in,
|
||||
zlib_stream_get_avail_out,
|
||||
zlib_stream_get_total_out,
|
||||
|
@ -798,7 +798,7 @@ static bool rpng_load_image_argb_process_init(rpng_t *rpng,
|
||||
if (!rpng->process.inflate_buf)
|
||||
return false;
|
||||
|
||||
zlib_set_stream(
|
||||
rpng->process.stream_backend->stream_set(
|
||||
rpng->process.stream,
|
||||
rpng->idat_buf.size,
|
||||
rpng->process.inflate_buf_size,
|
||||
|
@ -328,7 +328,7 @@ static bool rpng_save_image(const char *path,
|
||||
if (!stream)
|
||||
GOTO_END_ERROR();
|
||||
|
||||
zlib_set_stream(
|
||||
stream_backend->stream_set(
|
||||
stream,
|
||||
encode_buf_size,
|
||||
encode_buf_size * 2,
|
||||
|
@ -41,6 +41,8 @@ struct zlib_file_backend
|
||||
{
|
||||
void *(*stream_new)(void);
|
||||
void (*stream_free)(void *);
|
||||
void (*stream_set)(void *, uint32_t, uint32_t,
|
||||
const uint8_t *, uint8_t *);
|
||||
uint32_t (*stream_get_avail_in)(void*);
|
||||
uint32_t (*stream_get_avail_out)(void*);
|
||||
uint64_t (*stream_get_total_out)(void*);
|
||||
@ -163,12 +165,6 @@ struct string_list *compressed_file_list_new(const char *filename,
|
||||
|
||||
void zlib_deflate_init(void *data, int level);
|
||||
|
||||
void zlib_set_stream(void *data,
|
||||
uint32_t avail_in,
|
||||
uint32_t avail_out,
|
||||
const uint8_t *next_in,
|
||||
uint8_t *next_out
|
||||
);
|
||||
|
||||
const struct zlib_file_backend *file_archive_get_default_file_backend(void);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user