diff --git a/frontend/frontend.c b/frontend/frontend.c index 59ae6fbb76..ac25ccf9fa 100644 --- a/frontend/frontend.c +++ b/frontend/frontend.c @@ -183,9 +183,9 @@ bool main_load_content(int argc, char **argv, args_type() args, environment_get_t environ_get, process_args_t process_args) { + unsigned i; bool retval = true; int ret = 0, rarch_argc = 0; - unsigned i; char *rarch_argv[MAX_ARGS] = {NULL}; char *argv_copy [MAX_ARGS] = {NULL}; char **rarch_argv_ptr = (char**)argv; diff --git a/gfx/gfx_common.c b/gfx/gfx_common.c index 70a642f909..24b8ce815c 100644 --- a/gfx/gfx_common.c +++ b/gfx/gfx_common.c @@ -129,6 +129,7 @@ static bool gfx_init_dwm(void) void gfx_set_dwm(void) { + HRESULT ret; if (!gfx_init_dwm()) return; @@ -143,7 +144,7 @@ void gfx_set_dwm(void) return; } - HRESULT ret = composition_enable(!g_settings.video.disable_composition); + ret = composition_enable(!g_settings.video.disable_composition); if (FAILED(ret)) RARCH_ERR("Failed to set composition state ...\n"); dwm_composition_disabled = g_settings.video.disable_composition; @@ -153,8 +154,7 @@ void gfx_set_dwm(void) void gfx_scale_integer(struct rarch_viewport *vp, unsigned width, unsigned height, float aspect_ratio, bool keep_aspect) { - int padding_x = 0; - int padding_y = 0; + int padding_x = 0, padding_y = 0; if (g_settings.video.aspect_ratio_idx == ASPECT_RATIO_CUSTOM) { @@ -169,9 +169,11 @@ void gfx_scale_integer(struct rarch_viewport *vp, unsigned width, } else { + unsigned base_height, base_width; + /* Use system reported sizes as these define the * geometry for the "normal" case. */ - unsigned base_height = g_extern.system.av_info.geometry.base_height; + base_height = g_extern.system.av_info.geometry.base_height; if (base_height == 0) base_height = 1; @@ -182,7 +184,7 @@ void gfx_scale_integer(struct rarch_viewport *vp, unsigned width, * * If square pixels are used, base_height will be equal to * g_extern.system.av_info.base_height. */ - unsigned base_width = (unsigned)roundf(base_height * aspect_ratio); + base_width = (unsigned)roundf(base_height * aspect_ratio); /* Make sure that we don't get 0x scale ... */ if (width >= base_width && height >= base_height) @@ -248,7 +250,7 @@ char rotation_lut[4][32] = void gfx_set_square_pixel_viewport(unsigned width, unsigned height) { - unsigned len, highest, i; + unsigned len, highest, i, aspect_x, aspect_y; if (width == 0 || height == 0) return; @@ -260,8 +262,8 @@ void gfx_set_square_pixel_viewport(unsigned width, unsigned height) highest = i; } - unsigned aspect_x = width / highest; - unsigned aspect_y = height / highest; + aspect_x = width / highest; + aspect_y = height / highest; snprintf(aspectratio_lut[ASPECT_RATIO_SQUARE].name, sizeof(aspectratio_lut[ASPECT_RATIO_SQUARE].name), diff --git a/gfx/state_tracker.c b/gfx/state_tracker.c index f6cc5f7890..7c364cf4a3 100644 --- a/gfx/state_tracker.c +++ b/gfx/state_tracker.c @@ -297,8 +297,10 @@ unsigned state_get_uniform(state_tracker_t *tracker, struct state_tracker_uniform *uniforms, unsigned elem, unsigned frame_count) { - unsigned i; - unsigned elems = tracker->info_elem < elem ? tracker->info_elem : elem; + unsigned i, elems = elem; + + if (tracker->info_elem < elem) + elems = tracker->info_elem; update_input(tracker); diff --git a/gfx/video_filter.c b/gfx/video_filter.c index 68076db3fe..b16c99c2da 100644 --- a/gfx/video_filter.c +++ b/gfx/video_filter.c @@ -52,10 +52,11 @@ static void filter_thread_loop(void *data) for (;;) { + bool die; slock_lock(thr->lock); while (thr->done && !thr->die) scond_wait(thr->cond, thr->lock); - bool die = thr->die; + die = thr->die; slock_unlock(thr->lock); if (die) @@ -97,6 +98,7 @@ static const struct softfilter_implementation * softfilter_find_implementation(rarch_softfilter_t *filt, const char *ident) { unsigned i; + for (i = 0; i < filt->num_plugs; i++) { if (!strcmp(filt->plugs[i].impl->short_ident, ident)) @@ -121,13 +123,12 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt, softfilter_simd_mask_t cpu_features, unsigned threads) { - unsigned input_fmts, input_fmt, output_fmts; - char key[64]; + unsigned input_fmts, input_fmt, output_fmts, i; + char key[64], name[64]; struct config_file_userdata userdata; snprintf(key, sizeof(key), "filter"); - char name[64]; if (!config_get_array(filt->conf, key, name, sizeof(name))) return false; @@ -214,7 +215,6 @@ static bool create_softfilter_graph(rarch_softfilter_t *filt, return false; filt->threads = threads; - unsigned i; for (i = 0; i < threads; i++) { filt->thread_data[i].userdata = filt->impl_data; @@ -245,19 +245,24 @@ static bool append_softfilter_plugs(rarch_softfilter_t *filt, for (i = 0; i < list->size; i++) { + softfilter_get_implementation_t cb; + const struct softfilter_implementation *impl = NULL; + struct rarch_soft_plug *new_plugs = NULL; dylib_t lib = dylib_load(list->elems[i].data); + if (!lib) continue; - softfilter_get_implementation_t cb = (softfilter_get_implementation_t) + cb = (softfilter_get_implementation_t) dylib_proc(lib, "softfilter_get_implementation"); + if (!cb) { dylib_close(lib); continue; } - const struct softfilter_implementation *impl = cb(mask); + impl = cb(mask); if (!impl) { dylib_close(lib); @@ -270,7 +275,7 @@ static bool append_softfilter_plugs(rarch_softfilter_t *filt, continue; } - struct rarch_soft_plug *new_plugs = (struct rarch_soft_plug*) + new_plugs = (struct rarch_soft_plug*) realloc(filt->plugs, sizeof(*filt->plugs) * (filt->num_plugs + 1)); if (!new_plugs) { @@ -325,8 +330,10 @@ static bool append_softfilter_plugs(rarch_softfilter_t *filt, filt->plugs = (struct rarch_soft_plug*) calloc(ARRAY_SIZE(soft_plugs_builtin), sizeof(*filt->plugs)); + if (!filt->plugs) return false; + filt->num_plugs = ARRAY_SIZE(soft_plugs_builtin); for (i = 0; i < ARRAY_SIZE(soft_plugs_builtin); i++)