From 216e7bcdaf490db1784130d628414b48f4ddfb4c Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Sun, 26 Feb 2017 21:46:19 +0100 Subject: [PATCH] Silence more warnings on iOS --- audio/audio_driver.c | 6 ++--- cheevos/cheevos.c | 2 +- database_info.c | 2 +- deps/miniupnpc/minisoap.c | 2 +- deps/miniupnpc/minissdpc.c | 11 ++++++---- deps/miniupnpc/miniupnpc.c | 6 ++--- deps/miniupnpc/upnpcommands.c | 2 +- gfx/video_driver.c | 2 +- gfx/video_filter.c | 2 +- gfx/video_filters/2xbr.c | 10 +++++---- gfx/video_filters/2xsai.c | 8 +++---- gfx/video_filters/blargg_ntsc_snes.c | 4 ++-- gfx/video_filters/epx.c | 4 ++-- gfx/video_filters/lq2x.c | 8 +++---- gfx/video_filters/phosphor2x.c | 22 +++++++++---------- gfx/video_filters/scale2x.c | 8 +++---- gfx/video_filters/super2xsai.c | 10 +++++++-- gfx/video_filters/supereagle.c | 10 +++++++-- .../audio/resampler/audio_resampler.c | 2 +- libretro-common/features/features_cpu.c | 2 +- libretro-common/file/archive_file.c | 4 ++-- libretro-common/formats/bmp/rbmp.c | 2 +- libretro-common/formats/bmp/rbmp_encode.c | 2 +- libretro-common/formats/jpeg/rjpeg.c | 2 +- libretro-common/formats/png/rpng.c | 4 ++-- libretro-common/formats/png/rpng_encode.c | 4 ++-- libretro-common/include/gfx/video_frame.h | 2 +- libretro-db/libretrodb.c | 2 +- libretro-db/query.c | 6 ++--- menu/cbs/menu_cbs_down.c | 4 ++-- menu/cbs/menu_cbs_left.c | 2 +- menu/cbs/menu_cbs_ok.c | 2 +- menu/cbs/menu_cbs_right.c | 2 +- menu/cbs/menu_cbs_up.c | 2 +- menu/drivers/rgui.c | 22 +++++++++---------- menu/drivers/xmb.c | 8 +++---- menu/menu_entries.c | 2 +- tasks/task_image.c | 5 +++-- tasks/task_overlay.c | 2 +- 39 files changed, 110 insertions(+), 92 deletions(-) diff --git a/audio/audio_driver.c b/audio/audio_driver.c index a93ac56f7b..fcdf62e783 100644 --- a/audio/audio_driver.c +++ b/audio/audio_driver.c @@ -187,8 +187,8 @@ static void compute_audio_buffer_statistics(void) avg_filled = 1.0f - (float)avg / audio_driver_buffer_size; deviation = (float)stddev / audio_driver_buffer_size; - low_water_size = audio_driver_buffer_size * 3 / 4; - high_water_size = audio_driver_buffer_size / 4; + low_water_size = (unsigned)(audio_driver_buffer_size * 3 / 4); + high_water_size = (unsigned)(audio_driver_buffer_size / 4); for (i = 1; i < samples; i++) { @@ -555,7 +555,7 @@ static bool audio_driver_flush(const int16_t *data, size_t samples) dsp_data.output_frames = 0; dsp_data.input = audio_driver_input_data; - dsp_data.input_frames = samples >> 1; + dsp_data.input_frames = (unsigned)(samples >> 1); performance_counter_init(audio_dsp, "audio_dsp"); performance_counter_start_plus(is_perfcnt_enable, audio_dsp); diff --git a/cheevos/cheevos.c b/cheevos/cheevos.c index 0c74d67490..abb51a8e75 100644 --- a/cheevos/cheevos.c +++ b/cheevos/cheevos.c @@ -1184,7 +1184,7 @@ static void cheevos_parse_var(cheevos_var_t *var, const char **memaddr) str++; } - var->value = strtol(str, &end, base); + var->value = (unsigned)strtol(str, &end, base); *memaddr = end; switch (var->type) diff --git a/database_info.c b/database_info.c index 07ec9a628c..f5625971fc 100644 --- a/database_info.c +++ b/database_info.c @@ -323,7 +323,7 @@ static int database_cursor_iterate(libretrodb_cursor_t *cur, db_info->max_users = (unsigned)val->val.uint_; break; case DB_CURSOR_RELEASEDATE_MONTH: - db_info->releasemonth = val->val.uint_; + db_info->releasemonth = (unsigned)val->val.uint_; break; case DB_CURSOR_RELEASEDATE_YEAR: db_info->releaseyear = (unsigned)val->val.uint_; diff --git a/deps/miniupnpc/minisoap.c b/deps/miniupnpc/minisoap.c index ce7cc3953c..0757245dc2 100644 --- a/deps/miniupnpc/minisoap.c +++ b/deps/miniupnpc/minisoap.c @@ -50,7 +50,7 @@ httpWrite(int fd, const char * body, int bodysize, memcpy(p, headers, headerssize); memcpy(p+headerssize, body, bodysize); /*n = write(fd, p, headerssize+bodysize);*/ - n = send(fd, p, headerssize+bodysize, 0); + n = (int)send(fd, p, headerssize+bodysize, 0); if(n<0) { PRINT_SOCKET_ERROR("send"); } diff --git a/deps/miniupnpc/minissdpc.c b/deps/miniupnpc/minissdpc.c index 5b1de09634..dfb2d43ec7 100644 --- a/deps/miniupnpc/minissdpc.c +++ b/deps/miniupnpc/minissdpc.c @@ -295,19 +295,22 @@ receiveDevicesFromMiniSSDPD(int s, int * error) printf(" urlsize=%u", urlsize); #endif /* DEBUG */ url = (unsigned char*)malloc(urlsize); - if(url == NULL) { + if(url == NULL) + { if (error) *error = MINISSDPC_MEMORY_ERROR; return devlist; } READ_COPY_BUFFER(url, urlsize); - if(n<=0) { + if(n<=0) + { if (error) *error = MINISSDPC_INVALID_SERVER_REPLY; goto free_url_and_return; } DECODELENGTH_READ(stsize, READ_BYTE_BUFFER); - if(n<=0) { + if(n<=0) + { if (error) *error = MINISSDPC_INVALID_SERVER_REPLY; goto free_url_and_return; @@ -768,7 +771,7 @@ ssdpDiscoverDevices(const char * const deviceTypes[], break; } for(p = servinfo; p; p = p->ai_next) { - n = sendto(sudp, bufr, n, 0, p->ai_addr, p->ai_addrlen); + n = (int)sendto(sudp, bufr, n, 0, p->ai_addr, p->ai_addrlen); if (n < 0) { #ifdef DEBUG char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; diff --git a/deps/miniupnpc/miniupnpc.c b/deps/miniupnpc/miniupnpc.c index d2d4e57bbe..abdce5ac9e 100644 --- a/deps/miniupnpc/miniupnpc.c +++ b/deps/miniupnpc/miniupnpc.c @@ -430,13 +430,13 @@ build_absolute_url(const char * baseurl, const char * descURL, &&(url[6] == '/')) return strdup(url); base = (baseurl[0] == '\0') ? descURL : baseurl; - n = strlen(base); + n = (int)strlen(base); if(n > 7) { p = (char*)strchr(base + 7, '/'); if(p) - n = p - base; + n = (int)(p - base); } - l = n + strlen(url) + 1; + l = (int)(n + strlen(url) + 1); if(url[0] != '/') l++; if(scope_id != 0) { diff --git a/deps/miniupnpc/upnpcommands.c b/deps/miniupnpc/upnpcommands.c index 2c162f01ac..25483c0c45 100644 --- a/deps/miniupnpc/upnpcommands.c +++ b/deps/miniupnpc/upnpcommands.c @@ -38,7 +38,7 @@ UPNP_GetTotalBytesSent(const char * controlURL, /*DisplayNameValueList(buffer, bufsize);*/ free(buffer); buffer = NULL; p = GetValueFromNameValueList(&pdata, "NewTotalBytesSent"); - r = my_atoui(p); + r = (unsigned)my_atoui(p); ClearNameValueList(&pdata); return r; } diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 000f3f9e86..1bd0684e8b 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -1613,7 +1613,7 @@ bool video_driver_find_driver(void) driver_ctl(RARCH_DRIVER_CTL_FIND_INDEX, &drv); - i = drv.len; + i = (int)drv.len; if (i >= 0) current_video = (video_driver_t*)video_driver_find_handle(i); diff --git a/gfx/video_filter.c b/gfx/video_filter.c index 7c6a35587b..9c4f1bf740 100644 --- a/gfx/video_filter.c +++ b/gfx/video_filter.c @@ -351,7 +351,7 @@ static bool append_softfilter_plugs(rarch_softfilter_t *filt, struct string_list *list) { unsigned i; - softfilter_simd_mask_t mask = cpu_features_get(); + softfilter_simd_mask_t mask = (softfilter_simd_mask_t)cpu_features_get(); (void)list; diff --git a/gfx/video_filters/2xbr.c b/gfx/video_filters/2xbr.c index 249672723a..c3294ae581 100644 --- a/gfx/video_filters/2xbr.c +++ b/gfx/video_filters/2xbr.c @@ -682,8 +682,9 @@ static void twoxbr_work_cb_rgb565(void *data, void *thread_data) twoxbr_generic_rgb565(data, width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_RGB565, output, - thr->out_pitch / SOFTFILTER_BPP_RGB565); + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), + (unsigned)(output), + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_RGB565)); } static void twoxbr_work_cb_xrgb8888(void *data, void *thread_data) @@ -697,8 +698,9 @@ static void twoxbr_work_cb_xrgb8888(void *data, void *thread_data) twoxbr_generic_xrgb8888(data, width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_XRGB8888, output, - thr->out_pitch / SOFTFILTER_BPP_XRGB8888); + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888), + output, + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_XRGB8888)); } static void twoxbr_generic_packets(void *data, diff --git a/gfx/video_filters/2xsai.c b/gfx/video_filters/2xsai.c index 52716838f1..45fd1194d9 100644 --- a/gfx/video_filters/2xsai.c +++ b/gfx/video_filters/2xsai.c @@ -299,9 +299,9 @@ static void twoxsai_work_cb_rgb565(void *data, void *thread_data) twoxsai_generic_rgb565(width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_RGB565, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), output, - thr->out_pitch / SOFTFILTER_BPP_RGB565); + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_RGB565)); } static void twoxsai_work_cb_xrgb8888(void *data, void *thread_data) @@ -315,9 +315,9 @@ static void twoxsai_work_cb_xrgb8888(void *data, void *thread_data) twoxsai_generic_xrgb8888(width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_XRGB8888, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888), output, - thr->out_pitch / SOFTFILTER_BPP_XRGB8888); + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_XRGB8888)); } static void twoxsai_generic_packets(void *data, diff --git a/gfx/video_filters/blargg_ntsc_snes.c b/gfx/video_filters/blargg_ntsc_snes.c index ec008cfe29..81e9982084 100644 --- a/gfx/video_filters/blargg_ntsc_snes.c +++ b/gfx/video_filters/blargg_ntsc_snes.c @@ -201,9 +201,9 @@ static void blargg_ntsc_snes_work_cb_rgb565(void *data, void *thread_data) blargg_ntsc_snes_rgb565(data, width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_RGB565, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), output, - thr->out_pitch / SOFTFILTER_BPP_RGB565); + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_RGB565)); } static void blargg_ntsc_snes_generic_packets(void *data, diff --git a/gfx/video_filters/epx.c b/gfx/video_filters/epx.c index f3a7c986e4..ec8c031cec 100644 --- a/gfx/video_filters/epx.c +++ b/gfx/video_filters/epx.c @@ -206,9 +206,9 @@ static void epx_work_cb_rgb565(void *data, void *thread_data) epx_generic_rgb565(width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_RGB565, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), output, - thr->out_pitch / SOFTFILTER_BPP_RGB565); + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_RGB565)); } diff --git a/gfx/video_filters/lq2x.c b/gfx/video_filters/lq2x.c index 043dc6761a..643dcefbfc 100644 --- a/gfx/video_filters/lq2x.c +++ b/gfx/video_filters/lq2x.c @@ -204,9 +204,9 @@ static void lq2x_work_cb_rgb565(void *data, void *thread_data) lq2x_generic_rgb565(width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_RGB565, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), output, - thr->out_pitch / SOFTFILTER_BPP_RGB565); + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_RGB565)); } static void lq2x_work_cb_xrgb8888(void *data, void *thread_data) @@ -222,9 +222,9 @@ static void lq2x_work_cb_xrgb8888(void *data, void *thread_data) lq2x_generic_xrgb8888(width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_XRGB8888, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888), output, - thr->out_pitch / SOFTFILTER_BPP_XRGB8888); + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_XRGB8888)); } static void lq2x_generic_packets(void *data, diff --git a/gfx/video_filters/phosphor2x.c b/gfx/video_filters/phosphor2x.c index 7cc3d8d8d1..1d3db0a02c 100644 --- a/gfx/video_filters/phosphor2x.c +++ b/gfx/video_filters/phosphor2x.c @@ -324,12 +324,12 @@ static void phosphor2x_generic_xrgb8888(void *data, for (y = 0; y < height; y++) { - uint32_t *scan_out; unsigned x; + uint32_t *scan_out = NULL; const uint32_t *in_line = (const uint32_t*)(src + y * (src_stride)); /* output in a scanlines fashion. */ - uint32_t *out_line = (uint32_t*)(dst + y * (dst_stride) * 2); + uint32_t *out_line = (uint32_t*)(dst + y * (dst_stride) * 2); /* Bilinear stretch horizontally. */ blit_linear_line_xrgb8888(out_line, in_line, width); @@ -372,9 +372,9 @@ static void phosphor2x_generic_rgb565(void *data, for (y = 0; y < height; y++) { - uint16_t *scan_out; unsigned x; /* Output in a scanlines fashion. */ + uint16_t *scan_out = NULL; uint16_t *out_line = (uint16_t*)(dst + y * (dst_stride) * 2); const uint16_t *in_line = (const uint16_t*)(src + y * (src_stride)); @@ -407,16 +407,16 @@ static void phosphor2x_work_cb_xrgb8888(void *data, void *thread_data) { struct softfilter_thread_data *thr = (struct softfilter_thread_data*)thread_data; - uint32_t *input = (uint32_t*)thr->in_data; - uint32_t *output = (uint32_t*)thr->out_data; - unsigned width = thr->width; - unsigned height = thr->height; + uint32_t *input = (uint32_t*)thr->in_data; + uint32_t *output = (uint32_t*)thr->out_data; + unsigned width = thr->width; + unsigned height = thr->height; phosphor2x_generic_xrgb8888(data, width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_XRGB8888, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888), output, - thr->out_pitch / SOFTFILTER_BPP_XRGB8888); + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_XRGB8888)); } static void phosphor2x_work_cb_rgb565(void *data, void *thread_data) @@ -430,9 +430,9 @@ static void phosphor2x_work_cb_rgb565(void *data, void *thread_data) phosphor2x_generic_rgb565(data, width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_RGB565, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), output, - thr->out_pitch / SOFTFILTER_BPP_RGB565); + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_RGB565)); } static void phosphor2x_generic_packets(void *data, diff --git a/gfx/video_filters/scale2x.c b/gfx/video_filters/scale2x.c index 733f9c8f80..2b71eb5f74 100644 --- a/gfx/video_filters/scale2x.c +++ b/gfx/video_filters/scale2x.c @@ -178,9 +178,9 @@ static void scale2x_work_cb_xrgb8888(void *data, void *thread_data) scale2x_generic_xrgb8888(width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_XRGB8888, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888), output, - thr->out_pitch / SOFTFILTER_BPP_XRGB8888); + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_XRGB8888)); } static void scale2x_work_cb_rgb565(void *data, void *thread_data) @@ -194,9 +194,9 @@ static void scale2x_work_cb_rgb565(void *data, void *thread_data) scale2x_generic_rgb565(width, height, thr->first, thr->last, input, - thr->in_pitch / SOFTFILTER_BPP_RGB565, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), output, - thr->out_pitch / SOFTFILTER_BPP_RGB565); + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_RGB565)); } static void scale2x_generic_packets(void *data, diff --git a/gfx/video_filters/super2xsai.c b/gfx/video_filters/super2xsai.c index 70e670640d..1d5c2bf309 100644 --- a/gfx/video_filters/super2xsai.c +++ b/gfx/video_filters/super2xsai.c @@ -269,7 +269,10 @@ static void supertwoxsai_work_cb_rgb565(void *data, void *thread_data) unsigned height = thr->height; supertwoxsai_generic_rgb565(width, height, - thr->first, thr->last, input, thr->in_pitch / SOFTFILTER_BPP_RGB565, output, thr->out_pitch / SOFTFILTER_BPP_RGB565); + thr->first, thr->last, input, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), + output, + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_RGB565)); } static void supertwoxsai_work_cb_xrgb8888(void *data, void *thread_data) @@ -281,7 +284,10 @@ static void supertwoxsai_work_cb_xrgb8888(void *data, void *thread_data) unsigned height = thr->height; supertwoxsai_generic_xrgb8888(width, height, - thr->first, thr->last, input, thr->in_pitch / SOFTFILTER_BPP_XRGB8888, output, thr->out_pitch / SOFTFILTER_BPP_XRGB8888); + thr->first, thr->last, input, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888), + output, + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_XRGB8888)); } static void supertwoxsai_generic_packets(void *data, diff --git a/gfx/video_filters/supereagle.c b/gfx/video_filters/supereagle.c index d1af9b1597..1901e6a369 100644 --- a/gfx/video_filters/supereagle.c +++ b/gfx/video_filters/supereagle.c @@ -272,7 +272,10 @@ static void supereagle_work_cb_rgb565(void *data, void *thread_data) unsigned height = thr->height; supereagle_generic_rgb565(width, height, - thr->first, thr->last, input, thr->in_pitch / SOFTFILTER_BPP_RGB565, output, thr->out_pitch / SOFTFILTER_BPP_RGB565); + thr->first, thr->last, input, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_RGB565), + output, + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_RGB565)); } static void supereagle_work_cb_xrgb8888(void *data, void *thread_data) @@ -284,7 +287,10 @@ static void supereagle_work_cb_xrgb8888(void *data, void *thread_data) unsigned height = thr->height; supereagle_generic_xrgb8888(width, height, - thr->first, thr->last, input, thr->in_pitch / SOFTFILTER_BPP_XRGB8888, output, thr->out_pitch / SOFTFILTER_BPP_XRGB8888); + thr->first, thr->last, input, + (unsigned)(thr->in_pitch / SOFTFILTER_BPP_XRGB8888), + output, + (unsigned)(thr->out_pitch / SOFTFILTER_BPP_XRGB8888)); } static void supereagle_generic_packets(void *data, diff --git a/libretro-common/audio/resampler/audio_resampler.c b/libretro-common/audio/resampler/audio_resampler.c index e3baa7f70f..06dad76242 100644 --- a/libretro-common/audio/resampler/audio_resampler.c +++ b/libretro-common/audio/resampler/audio_resampler.c @@ -129,7 +129,7 @@ static bool resampler_append_plugs(void **re, const retro_resampler_t **backend, double bw_ratio) { - resampler_simd_mask_t mask = cpu_features_get(); + resampler_simd_mask_t mask = (resampler_simd_mask_t)cpu_features_get(); *re = (*backend)->init(&resampler_config, bw_ratio, mask); diff --git a/libretro-common/features/features_cpu.c b/libretro-common/features/features_cpu.c index 294222f647..86f12095c0 100644 --- a/libretro-common/features/features_cpu.c +++ b/libretro-common/features/features_cpu.c @@ -474,7 +474,7 @@ unsigned cpu_features_get_core_amount(void) long ret = sysconf(_SC_NPROCESSORS_ONLN); if (ret <= 0) return (unsigned)1; - return ret; + return (unsigned)ret; #elif defined(BSD) || defined(__APPLE__) /* BSD */ /* Copypasta from stackoverflow, dunno if it works. */ diff --git a/libretro-common/file/archive_file.c b/libretro-common/file/archive_file.c index e48ebfb8c8..6e37ec2b24 100644 --- a/libretro-common/file/archive_file.c +++ b/libretro-common/file/archive_file.c @@ -301,7 +301,7 @@ static int file_archive_parse_file_init(file_archive_transfer_t *state, if (!state->handle) return -1; - state->archive_size = file_archive_size(state->handle); + state->archive_size = (int32_t)file_archive_size(state->handle); state->data = file_archive_data(state->handle); state->footer = 0; state->directory = 0; @@ -509,7 +509,7 @@ int file_archive_parse_file_progress(file_archive_transfer_t *state) delta = state->directory - state->data; - return delta * 100 / state->archive_size; + return (int)(delta * 100 / state->archive_size); } /** diff --git a/libretro-common/formats/bmp/rbmp.c b/libretro-common/formats/bmp/rbmp.c index f667e68c4f..1f6401f114 100644 --- a/libretro-common/formats/bmp/rbmp.c +++ b/libretro-common/formats/bmp/rbmp.c @@ -588,7 +588,7 @@ int rbmp_process_image(rbmp_t *rbmp, void **buf_data, return IMAGE_PROCESS_ERROR; rbmp->output_image = (uint32_t*)rbmp_load_from_memory(rbmp->buff_data, - size, width, height, &comp, 4); + (int)size, width, height, &comp, 4); *buf_data = rbmp->output_image; rbmp_convert_frame(rbmp->output_image, *width, *height); diff --git a/libretro-common/formats/bmp/rbmp_encode.c b/libretro-common/formats/bmp/rbmp_encode.c index 014deb7c8c..9c2e199ab0 100644 --- a/libretro-common/formats/bmp/rbmp_encode.c +++ b/libretro-common/formats/bmp/rbmp_encode.c @@ -160,7 +160,7 @@ static void dump_content(RFILE *file, const void *frame, { /* BGR24 byte order input matches output. Can directly copy, but... need to make sure we pad it. */ uint32_t zeros = 0; - int pad = line_size-pitch; + int pad = (int)(line_size-pitch); for (j = 0; j < height; j++, u.u8 += pitch) { filestream_write(file, u.u8, pitch); diff --git a/libretro-common/formats/jpeg/rjpeg.c b/libretro-common/formats/jpeg/rjpeg.c index 827f0bf691..28d95bc47f 100644 --- a/libretro-common/formats/jpeg/rjpeg.c +++ b/libretro-common/formats/jpeg/rjpeg.c @@ -2570,7 +2570,7 @@ int rjpeg_process_image(rjpeg_t *rjpeg, void **buf_data, if (!rjpeg) return IMAGE_PROCESS_ERROR; - img = (uint32_t*)rjpeg_load_from_memory(rjpeg->buff_data, size, width, height, &comp, 4); + img = (uint32_t*)rjpeg_load_from_memory(rjpeg->buff_data, (int)size, width, height, &comp, 4); if (!img) return IMAGE_PROCESS_ERROR; diff --git a/libretro-common/formats/png/rpng.c b/libretro-common/formats/png/rpng.c index ab3472485e..3d9877eb6a 100644 --- a/libretro-common/formats/png/rpng.c +++ b/libretro-common/formats/png/rpng.c @@ -898,11 +898,11 @@ static struct rpng_process *rpng_process_init(rpng_t *rpng, unsigned *width, uns process->stream_backend->set_in( process->stream, rpng->idat_buf.data, - rpng->idat_buf.size); + (uint32_t)rpng->idat_buf.size); process->stream_backend->set_out( process->stream, process->inflate_buf, - process->inflate_buf_size); + (uint32_t)process->inflate_buf_size); return process; diff --git a/libretro-common/formats/png/rpng_encode.c b/libretro-common/formats/png/rpng_encode.c index 1f91f4cd80..c0d044ddf8 100644 --- a/libretro-common/formats/png/rpng_encode.c +++ b/libretro-common/formats/png/rpng_encode.c @@ -333,11 +333,11 @@ static bool rpng_save_image(const char *path, stream_backend->set_in( stream, encode_buf, - encode_buf_size); + (unsigned)encode_buf_size); stream_backend->set_out( stream, deflate_buf + 8, - encode_buf_size * 2); + (unsigned)(encode_buf_size * 2)); if (!stream_backend->trans(stream, true, &total_in, &total_out, NULL)) { diff --git a/libretro-common/include/gfx/video_frame.h b/libretro-common/include/gfx/video_frame.h index 70f275940d..6f397fcb90 100644 --- a/libretro-common/include/gfx/video_frame.h +++ b/libretro-common/include/gfx/video_frame.h @@ -195,7 +195,7 @@ static INLINE bool video_pixel_frame_scale( scaler->in_height = height; scaler->out_width = width; scaler->out_height = height; - scaler->in_stride = pitch; + scaler->in_stride = (int)pitch; scaler->out_stride = width * sizeof(uint16_t); scaler_ctx_scale(scaler, output, data); diff --git a/libretro-db/libretrodb.c b/libretro-db/libretrodb.c index 10ad383f14..051a307c58 100644 --- a/libretro-db/libretrodb.c +++ b/libretro-db/libretrodb.c @@ -480,7 +480,7 @@ int libretrodb_create_index(libretrodb_t *db, goto clean; key.type = RDT_STRING; - key.val.string.len = strlen(field_name); + key.val.string.len = (uint32_t)strlen(field_name); key.val.string.buff = (char *) field_name; /* We know we aren't going to change it */ while (libretrodb_cursor_read_item(&cur, &item) == 0) diff --git a/libretro-db/query.c b/libretro-db/query.c index cb2550947e..a47fc4e99e 100644 --- a/libretro-db/query.c +++ b/libretro-db/query.c @@ -525,8 +525,8 @@ static struct buffer query_parse_string(struct buffer buff, if (!*error) { size_t count; - value->type = is_binstr ? RDT_BINARY : RDT_STRING; - value->val.string.len = (buff.data + buff.offset) - str_start - 1; + value->type = is_binstr ? RDT_BINARY : RDT_STRING; + value->val.string.len = (uint32_t)((buff.data + buff.offset) - str_start - 1); count = is_binstr ? (value->val.string.len + 1) / 2 : (value->val.string.len + 1); @@ -867,7 +867,7 @@ static struct buffer query_parse_table(struct buffer buff, if (!*error) { args[argi].a.value.type = RDT_STRING; - args[argi].a.value.val.string.len = ident_len; + args[argi].a.value.val.string.len = (uint32_t)ident_len; args[argi].a.value.val.string.buff = (char*)calloc( ident_len + 1, sizeof(char) diff --git a/menu/cbs/menu_cbs_down.c b/menu/cbs/menu_cbs_down.c index f2a4a26f51..62fefa3497 100644 --- a/menu/cbs/menu_cbs_down.c +++ b/menu/cbs/menu_cbs_down.c @@ -25,12 +25,12 @@ static int action_bind_down_generic(unsigned type, const char *label) { - size_t scroll_accel = 0; + size_t scroll_accel = 0; unsigned scroll_speed = 0; if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel)) return -1; - scroll_speed = (MAX(scroll_accel, 2) - 2) / 4 + 1; + scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1); if (menu_entries_get_size() <= 0) return 0; diff --git a/menu/cbs/menu_cbs_left.c b/menu/cbs/menu_cbs_left.c index 6a27baa27b..9cdeea50c8 100644 --- a/menu/cbs/menu_cbs_left.c +++ b/menu/cbs/menu_cbs_left.c @@ -124,7 +124,7 @@ static int action_left_scroll(unsigned type, const char *label, if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel)) return false; - scroll_speed = (MAX(scroll_accel, 2) - 2) / 4 + 1; + scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1); fast_scroll_speed = 4 + 4 * scroll_speed; if (selection > fast_scroll_speed) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 95ef02f191..6b3964a6cc 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1114,7 +1114,7 @@ static int generic_action_ok(const char *path, break; case ACTION_OK_LOAD_SHADER_PASS: { - struct video_shader_pass *shader_pass = menu_shader_manager_get_pass(hack_shader_pass); + struct video_shader_pass *shader_pass = menu_shader_manager_get_pass((unsigned)hack_shader_pass); flush_char = msg_hash_to_str((enum msg_hash_enums)flush_id); strlcpy( shader_pass->source.path, diff --git a/menu/cbs/menu_cbs_right.c b/menu/cbs/menu_cbs_right.c index e63ec2da2a..501b119f1b 100644 --- a/menu/cbs/menu_cbs_right.c +++ b/menu/cbs/menu_cbs_right.c @@ -134,7 +134,7 @@ static int action_right_scroll(unsigned type, const char *label, if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel)) return false; - scroll_speed = (MAX(scroll_accel, 2) - 2) / 4 + 1; + scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1); fast_scroll_speed = 4 + 4 * scroll_speed; if (selection + fast_scroll_speed < (menu_entries_get_size())) diff --git a/menu/cbs/menu_cbs_up.c b/menu/cbs/menu_cbs_up.c index 01cd0ae5af..23a74e7c14 100644 --- a/menu/cbs/menu_cbs_up.c +++ b/menu/cbs/menu_cbs_up.c @@ -30,7 +30,7 @@ static int action_bind_up_generic(unsigned type, const char *label) if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SCROLL_ACCEL, &scroll_accel)) return -1; - scroll_speed = (MAX(scroll_accel, 2) - 2) / 4 + 1; + scroll_speed = (unsigned)((MAX(scroll_accel, 2) - 2) / 4 + 1); if (menu_entries_get_size() <= 0) return 0; diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index d8f7a8927a..9997dd56fc 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -323,7 +323,7 @@ static void rgui_render_messagebox(const char *message) { unsigned line_width; char *msg = list->elems[i].data; - unsigned msglen = utf8len(msg); + unsigned msglen = (unsigned)utf8len(msg); if (msglen > RGUI_TERM_WIDTH(fb_width)) { @@ -339,7 +339,7 @@ static void rgui_render_messagebox(const char *message) glyphs_width = MAX(glyphs_width, msglen); } - height = FONT_HEIGHT_STRIDE * list->size + 6 + 10; + height = (unsigned)(FONT_HEIGHT_STRIDE * list->size + 6 + 10); x = (fb_width - width) / 2; y = (fb_height - height) / 2; @@ -358,8 +358,8 @@ static void rgui_render_messagebox(const char *message) for (i = 0; i < list->size; i++) { const char *msg = list->elems[i].data; - int offset_x = FONT_WIDTH_STRIDE * (glyphs_width - utf8len(msg)) / 2; - int offset_y = FONT_HEIGHT_STRIDE * i; + int offset_x = (int)(FONT_WIDTH_STRIDE * (glyphs_width - utf8len(msg)) / 2); + int offset_y = (int)(FONT_HEIGHT_STRIDE * i); blit_line(x + 8 + offset_x, y + 8 + offset_y, msg, color); } @@ -385,7 +385,7 @@ static void rgui_blit_cursor(void) static void rgui_frame(void *data, video_frame_info_t *video_info) { rgui_t *rgui = (rgui_t*)data; - rgui->frame_count = video_info->frame_count; + rgui->frame_count = (unsigned)video_info->frame_count; } static void rgui_render(void *data) @@ -447,8 +447,8 @@ static void rgui_render(void *data) menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &old_start); - new_val = menu_input_pointer_state(MENU_POINTER_Y_AXIS) - / 11 - 2 + old_start; + new_val = (unsigned)(menu_input_pointer_state(MENU_POINTER_Y_AXIS) + / (11 - 2 + old_start)); menu_input_ctl(MENU_INPUT_CTL_POINTER_PTR, &new_val); @@ -474,7 +474,7 @@ static void rgui_render(void *data) menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &old_start); - new_mouse_ptr = mouse_y / 11 - 2 + old_start; + new_mouse_ptr = (unsigned)(mouse_y / 11 - 2 + old_start); menu_input_ctl(MENU_INPUT_CTL_MOUSE_PTR, &new_mouse_ptr); } @@ -486,7 +486,7 @@ static void rgui_render(void *data) menu_entries_ctl(MENU_ENTRIES_CTL_SET_START, &start); } - bottom = menu_entries_get_end() - RGUI_TERM_HEIGHT(fb_width, fb_height); + bottom = (int)(menu_entries_get_end() - RGUI_TERM_HEIGHT(fb_width, fb_height)); menu_entries_ctl(MENU_ENTRIES_CTL_START_GET, &old_start); if (old_start > (unsigned)bottom) @@ -535,8 +535,8 @@ static void rgui_render(void *data) strlcpy(title_buf, string_to_upper(title_buf), sizeof(title_buf)); blit_line( - RGUI_TERM_START_X(fb_width) + (RGUI_TERM_WIDTH(fb_width) - - utf8len(title_buf)) * FONT_WIDTH_STRIDE / 2, + (int)(RGUI_TERM_START_X(fb_width) + (RGUI_TERM_WIDTH(fb_width) + - utf8len(title_buf)) * FONT_WIDTH_STRIDE / 2), RGUI_TERM_START_X(fb_width), title_buf, TITLE_COLOR(settings)); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 58b57c8c6c..044a6a428f 100644 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2098,7 +2098,7 @@ static void xmb_draw_items( if (cat_selection_ptr > xmb->system_tab_end) core_node = xmb_get_userdata_from_horizontal_list( - xmb, cat_selection_ptr - (xmb->system_tab_end + 1)); + xmb, (unsigned)(cat_selection_ptr - (xmb->system_tab_end + 1))); end = file_list_get_size(list); @@ -2685,7 +2685,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) snprintf(msg, sizeof(msg), "%d%%", percent); - percent_width = font_driver_get_message_width(xmb->font, msg, utf8len(msg), 1); + percent_width = (unsigned)font_driver_get_message_width(xmb->font, msg, (unsigned)utf8len(msg), 1); xmb_draw_text(menu_disp_info, xmb, msg, width - xmb->margins.title.left - x_pos, @@ -4039,7 +4039,7 @@ static int xmb_pointer_tap(void *userdata, if (y < header_height) { menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); - return menu_entry_action(entry, selection, MENU_ACTION_CANCEL); + return (unsigned)menu_entry_action(entry, (unsigned)selection, MENU_ACTION_CANCEL); } else if (ptr <= (menu_entries_get_size() - 1)) { @@ -4048,7 +4048,7 @@ static int xmb_pointer_tap(void *userdata, menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection); if (ptr == selection && cbs && cbs->action_select) - return menu_entry_action(entry, selection, MENU_ACTION_SELECT); + return (unsigned)menu_entry_action(entry, (unsigned)selection, MENU_ACTION_SELECT); idx = ptr; diff --git a/menu/menu_entries.c b/menu/menu_entries.c index cbcb582f5a..88c745eb1b 100644 --- a/menu/menu_entries.c +++ b/menu/menu_entries.c @@ -307,7 +307,7 @@ file_list_t *menu_entries_get_menu_stack_ptr(size_t idx) menu_entries_ctl(MENU_ENTRIES_CTL_LIST_GET, &menu_list); if (!menu_list) return NULL; - return menu_list_get(menu_list, idx); + return menu_list_get(menu_list, (unsigned)idx); } file_list_t *menu_entries_get_selection_buf_ptr(size_t idx) diff --git a/tasks/task_image.c b/tasks/task_image.c index e6dbf86707..d9240bbb1d 100644 --- a/tasks/task_image.c +++ b/tasks/task_image.c @@ -240,8 +240,9 @@ static int cb_nbio_generic(nbio_handle_t *nbio, size_t *len) image_transfer_set_buffer_ptr(image->handle, nbio->image_type, ptr); image->size = *len; - image->pos_increment = (*len / 2) ? (*len / 2) : 1; - image->processing_pos_increment = (*len / 4) ? (*len / 4) : 1; + image->pos_increment = (*len / 2) ? ((unsigned)(*len / 2)) : 1; + image->processing_pos_increment = (*len / 4) ? + ((unsigned)(*len / 4)) : 1; if (!image_transfer_start(image->handle, nbio->image_type)) goto error; diff --git a/tasks/task_overlay.c b/tasks/task_overlay.c index 8e466d5455..12ed321f06 100644 --- a/tasks/task_overlay.c +++ b/tasks/task_overlay.c @@ -52,7 +52,7 @@ static void task_overlay_image_done(struct overlay *overlay) overlay->pos = 0; /* Divide iteration steps by half of total descs if size is even, * otherwise default to 8 (arbitrary value for now to speed things up). */ - overlay->pos_increment = (overlay->size / 2) ? (overlay->size / 2) : 8; + overlay->pos_increment = (overlay->size / 2) ? ((unsigned)(overlay->size / 2)) : 8; } static void task_overlay_load_desc_image(