From d5a268a2ac765854bedb14e06eadcac2cc6373c7 Mon Sep 17 00:00:00 2001 From: libretroadmin Date: Tue, 15 Nov 2022 00:24:26 +0100 Subject: [PATCH] * Fix signed/unsigned mismatches * Fix missing IPAddr on MSVC2017 UWP - use ULONG instead since this is just a typedef --- gfx/drivers/d3d11.c | 10 +++++----- gfx/video_thread_wrapper.c | 6 +++--- libretro-common/formats/png/rpng.c | 28 ++++++++++++---------------- libretro-common/net/net_ifinfo.c | 2 +- runloop.c | 2 +- 5 files changed, 22 insertions(+), 26 deletions(-) diff --git a/gfx/drivers/d3d11.c b/gfx/drivers/d3d11.c index 825afda15b..4826541226 100644 --- a/gfx/drivers/d3d11.c +++ b/gfx/drivers/d3d11.c @@ -306,7 +306,7 @@ static void d3d11_render_overlay(d3d11_video_t *d3d11) d3d11->context, 0, 1, &d3d11->samplers[RARCH_FILTER_UNSPEC][RARCH_WRAP_DEFAULT]); - for (i = 0; i < (unsigned)d3d11->overlays.count; i++) + for (i = 0; i < d3d11->overlays.count; i++) { d3d11->context->lpVtbl->PSSetShaderResources( d3d11->context, 0, 1, @@ -495,7 +495,7 @@ static void d3d11_free_shader_preset(d3d11_video_t* d3d11) if (!d3d11->shader_preset) return; - for (i = 0; i < d3d11->shader_preset->passes; i++) + for (i = 0; i < (int)d3d11->shader_preset->passes; i++) { int j; @@ -520,14 +520,14 @@ static void d3d11_free_shader_preset(d3d11_video_t* d3d11) memset(d3d11->pass, 0, sizeof(d3d11->pass)); /* only free the history textures here */ - for (i = 1; i <= (unsigned)d3d11->shader_preset->history_size; i++) + for (i = 1; i <= d3d11->shader_preset->history_size; i++) d3d11_release_texture(&d3d11->frame.texture[i]); memset( &d3d11->frame.texture[1], 0, sizeof(d3d11->frame.texture[1]) * d3d11->shader_preset->history_size); - for (i = 0; i < d3d11->shader_preset->luts; i++) + for (i = 0; i < (int)d3d11->shader_preset->luts; i++) d3d11_release_texture(&d3d11->luts[i]); memset(d3d11->luts, 0, sizeof(d3d11->luts)); @@ -1750,7 +1750,7 @@ static void d3d11_init_render_targets(d3d11_video_t* d3d11, unsigned width, unsi assert(d3d11->shader_preset); - for (i = 0; i < d3d11->shader_preset->passes; i++) + for (i = 0; i < (int)d3d11->shader_preset->passes; i++) { struct video_shader_pass* pass = &d3d11->shader_preset->pass[i]; diff --git a/gfx/video_thread_wrapper.c b/gfx/video_thread_wrapper.c index 25cdd85197..c09521df83 100644 --- a/gfx/video_thread_wrapper.c +++ b/gfx/video_thread_wrapper.c @@ -122,7 +122,7 @@ static void thread_update_driver_state(thread_video_t *thr) if (thr->driver_data && thr->overlay && thr->overlay->set_alpha) { int i; - for (i = 0; i < thr->alpha_mods; i++) + for (i = 0; i < (int)thr->alpha_mods; i++) thr->overlay->set_alpha(thr->driver_data, i, thr->alpha_mod[i]); } thr->flags &= ~THR_FLAG_ALPHA_UPDATE; @@ -263,7 +263,7 @@ static bool video_thread_handle_packet( { /* Avoid temporary garbage data. */ int i; - for (i = 0; i < tmp_alpha_mods; i++) + for (i = 0; i < (int)tmp_alpha_mods; i++) tmp_alpha_mod[i] = 1.0f; thr->alpha_mods = tmp_alpha_mods; thr->alpha_mod = tmp_alpha_mod; @@ -649,7 +649,7 @@ static bool video_thread_frame(void *data, const void *frame_, if (src) { int i; /* TODO/FIXME - increment counter never meaningfully used */ - for (i = 0; i < height; i++, src += pitch, dst += copy_stride) + for (i = 0; i < (int)height; i++, src += pitch, dst += copy_stride) memcpy(dst, src, copy_stride); } diff --git a/libretro-common/formats/png/rpng.c b/libretro-common/formats/png/rpng.c index 322306f526..14bf64c34b 100644 --- a/libretro-common/formats/png/rpng.c +++ b/libretro-common/formats/png/rpng.c @@ -237,7 +237,7 @@ static void rpng_reverse_filter_copy_line_rgb(uint32_t *data, bpp /= 8; - for (i = 0; i < width; i++) + for (i = 0; i < (int)width; i++) { uint32_t r, g, b; @@ -258,7 +258,7 @@ static void rpng_reverse_filter_copy_line_rgba(uint32_t *data, bpp /= 8; - for (i = 0; i < width; i++) + for (i = 0; i < (int)width; i++) { uint32_t r, g, b, a; r = *decoded; @@ -283,7 +283,7 @@ static void rpng_reverse_filter_copy_line_bw(uint32_t *data, if (depth == 16) { - for (i = 0; i < width; i++) + for (i = 0; i < (int)width; i++) { uint32_t val = decoded[i << 1]; data[i] = (val * 0x010101) | (0xffu << 24); @@ -295,7 +295,7 @@ static void rpng_reverse_filter_copy_line_bw(uint32_t *data, mask = (1 << depth) - 1; bit = 0; - for (i = 0; i < width; i++, bit += depth) + for (i = 0; i < (int)width; i++, bit += depth) { unsigned byte = bit >> 3; unsigned val = decoded[byte] >> (8 - depth - (bit & 7)); @@ -335,10 +335,9 @@ static void rpng_reverse_filter_copy_line_plt(uint32_t *data, { case 1: { - unsigned w = width / 8; int i; - - for (i = 0; i < w; i++, decoded++) + unsigned w = width / 8; + for (i = 0; i < (int)w; i++, decoded++) { *data++ = palette[(*decoded >> 7) & 1]; *data++ = palette[(*decoded >> 6) & 1]; @@ -373,10 +372,9 @@ static void rpng_reverse_filter_copy_line_plt(uint32_t *data, case 2: { - unsigned w = width / 4; int i; - - for (i = 0; i < w; i++, decoded++) + unsigned w = width / 4; + for (i = 0; i < (int)w; i++, decoded++) { *data++ = palette[(*decoded >> 6) & 3]; *data++ = palette[(*decoded >> 4) & 3]; @@ -399,10 +397,9 @@ static void rpng_reverse_filter_copy_line_plt(uint32_t *data, case 4: { - unsigned w = width / 2; int i; - - for (i = 0; i < w; i++, decoded++) + unsigned w = width / 2; + for (i = 0; i < (int)w; i++, decoded++) { *data++ = palette[*decoded >> 4]; *data++ = palette[*decoded & 0x0f]; @@ -416,8 +413,7 @@ static void rpng_reverse_filter_copy_line_plt(uint32_t *data, case 8: { int i; - - for (i = 0; i < width; i++, decoded++, data++) + for (i = 0; i < (int)width; i++, decoded++, data++) *data = palette[*decoded]; } break; @@ -1086,7 +1082,7 @@ bool rpng_iterate_image(rpng_t *rpng) buf += 8; palette = rpng->palette; - for (i = 0; i < chunk_size; i++, buf++, palette++) + for (i = 0; i < (int)chunk_size; i++, buf++, palette++) *palette = (*palette & 0x00ffffff) | (unsigned)*buf << 24; } /* TODO: support colorkey in grayscale and truecolor images */ diff --git a/libretro-common/net/net_ifinfo.c b/libretro-common/net/net_ifinfo.c index d107e2f339..81e3552d17 100644 --- a/libretro-common/net/net_ifinfo.c +++ b/libretro-common/net/net_ifinfo.c @@ -350,7 +350,7 @@ bool net_ifinfo_best(const char *dst, void *src, bool ipv6) #ifdef __WINRT__ struct sockaddr_in dst_addr = {0}; #endif - IPAddr dst_ip = inet_addr(dst); + ULONG dst_ip = (ULONG)inet_addr(dst); if (!src) return false; diff --git a/runloop.c b/runloop.c index 2bacff0fb9..ae2a72b3e2 100644 --- a/runloop.c +++ b/runloop.c @@ -370,7 +370,7 @@ void runloop_log_counters( struct retro_perf_counter **counters, unsigned num) { int i; - for (i = 0; i < num; i++) + for (i = 0; i < (int)num; i++) { if (counters[i]->call_cnt) {