From 89820220b74b9164b95364fcabe371ab6dd2bce5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Mon, 19 Dec 2016 00:12:06 +0100 Subject: [PATCH] (libretro-common) Cleanup/style nits for archive_file_{7z/zlib} --- libretro-common/file/archive_file_7z.c | 12 +++++------- libretro-common/file/archive_file_zlib.c | 14 +++++++++----- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/libretro-common/file/archive_file_7z.c b/libretro-common/file/archive_file_7z.c index b1234eabc9..4a578a0b23 100644 --- a/libretro-common/file/archive_file_7z.c +++ b/libretro-common/file/archive_file_7z.c @@ -58,17 +58,15 @@ static void* sevenzip_stream_new(void) struct sevenzip_context_t *sevenzip_context = (struct sevenzip_context_t*)calloc(1, sizeof(struct sevenzip_context_t)); - memset(sevenzip_context, 0, sizeof(struct sevenzip_context_t)); - /* These are the allocation routines - currently using * the non-standard 7zip choices. */ sevenzip_context->allocImp.Alloc = SzAlloc; sevenzip_context->allocImp.Free = SzFree; sevenzip_context->allocTempImp.Alloc = SzAllocTemp; sevenzip_context->allocTempImp.Free = SzFreeTemp; - sevenzip_context->block_index = 0xFFFFFFFF; - sevenzip_context->output = NULL; - sevenzip_context->handle = NULL; + sevenzip_context->block_index = 0xFFFFFFFF; + sevenzip_context->output = NULL; + sevenzip_context->handle = NULL; return sevenzip_context; } @@ -83,7 +81,7 @@ static void sevenzip_stream_free(void *data) if (sevenzip_context->output) { IAlloc_Free(&sevenzip_context->allocImp, sevenzip_context->output); - sevenzip_context->output = NULL; + sevenzip_context->output = NULL; sevenzip_context->handle->data = NULL; } @@ -262,7 +260,7 @@ static int sevenzip_stream_decompress_data_to_file_iterate(void *data) struct sevenzip_context_t *sevenzip_context = (struct sevenzip_context_t*)data; - SRes res = SZ_ERROR_FAIL; + SRes res = SZ_ERROR_FAIL; size_t output_size = 0; size_t offset = 0; size_t outSizeProcessed = 0; diff --git a/libretro-common/file/archive_file_zlib.c b/libretro-common/file/archive_file_zlib.c index ab4356af43..c52c641637 100644 --- a/libretro-common/file/archive_file_zlib.c +++ b/libretro-common/file/archive_file_zlib.c @@ -57,7 +57,9 @@ static bool zlib_stream_decompress_data_to_file_init( if (!handle) return false; - if (!(handle->stream = zlib_inflate_backend.stream_new())) + handle->stream = zlib_inflate_backend.stream_new(); + + if (!handle->stream) goto error; if (zlib_inflate_backend.define) @@ -123,10 +125,12 @@ static bool zip_file_decompressed_handle( handle, cdata, csize, size)) return false; - do{ + do + { ret = handle->backend->stream_decompress_data_to_file_iterate( handle->stream); }while(ret == 0); + #if 0 handle->real_checksum = handle->backend->stream_crc_calculate(0, handle->data, size); @@ -231,11 +235,11 @@ static int zip_file_read( const char *optional_outfile) { file_archive_transfer_t zlib; - bool returnerr = true; - int ret = 0; struct archive_extract_userdata userdata = {{0}}; + bool returnerr = true; + int ret = 0; - zlib.type = ARCHIVE_TRANSFER_INIT; + zlib.type = ARCHIVE_TRANSFER_INIT; userdata.decomp_state.needle = NULL; userdata.decomp_state.opt_file = NULL;