From 1e0c723ba3e1104dcca5c476ebc5ea082d1decd4 Mon Sep 17 00:00:00 2001 From: "Joseph C. Osborn" Date: Tue, 15 Jul 2025 07:25:09 -0700 Subject: [PATCH] Fix warnings under many platforms, unpack nested ifdefs in includes. --- input/input_driver.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/input/input_driver.c b/input/input_driver.c index c73fd32498..49a77e0746 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -57,12 +57,12 @@ #include "../retroarch.h" #ifdef HAVE_BSV_MOVIE #include "../tasks/task_content.h" - #ifdef HAVE_ZLIB +#endif +#if defined(HAVE_ZLIB) && defined(HAVE_BSV_MOVIE) #include - #endif - #ifdef HAVE_ZSTD +#endif +#if defined(HAVE_ZSTD) && defined(HAVE_BSV_MOVIE) #include - #endif #endif #include "../tasks/tasks_internal.h" #include "../verbosity.h" @@ -6072,7 +6072,6 @@ bool bsv_movie_load_checkpoint(bsv_movie_t *handle, uint8_t compression, uint8_t input_driver_state_t *input_st = input_state_get_ptr(); uint32_t compressed_encoded_size, encoded_size, size; size_t uncompressed_size_big; - uint32_t uncompressed_size; uint8_t *compressed_data = NULL, *encoded_data = NULL, *state = NULL; retro_ctx_serialize_info_t serial_info; bool ret = true; @@ -6117,14 +6116,20 @@ bool bsv_movie_load_checkpoint(bsv_movie_t *handle, uint8_t compression, uint8_t break; #ifdef HAVE_ZLIB case REPLAY_CHECKPOINT2_COMPRESSION_ZLIB: - encoded_data = calloc(encoded_size, sizeof(uint8_t)); - uncompressed_size = encoded_size; - if (uncompress(encoded_data, &uncompressed_size, compressed_data, compressed_encoded_size) != Z_OK) { - ret = false; - goto exit; +#ifdef EMSCRIPTEN + uLongf uncompressed_size_zlib = encoded_size; +#else + uint32_t uncompressed_size_zlib = encoded_size; +#endif + encoded_data = calloc(encoded_size, sizeof(uint8_t)); + if (uncompress(encoded_data, &uncompressed_size_zlib, compressed_data, compressed_encoded_size) != Z_OK) + { + ret = false; + goto exit; + } + break; } - break; #endif #ifdef HAVE_ZSTD case REPLAY_CHECKPOINT2_COMPRESSION_ZSTD: @@ -6141,7 +6146,6 @@ bool bsv_movie_load_checkpoint(bsv_movie_t *handle, uint8_t compression, uint8_t ret = false; goto exit; } - uncompressed_size = uncompressed_size_big; break; #endif default: