Buildfixes and more static code analysis warning fixes

This commit is contained in:
twinaphex 2019-01-10 22:24:43 +01:00
parent b9ff2e4de1
commit c98b2e2292
22 changed files with 134 additions and 88 deletions

View File

@ -1133,6 +1133,9 @@ static struct config_array_setting *populate_settings_array(settings_t *settings
unsigned count = 0; unsigned count = 0;
struct config_array_setting *tmp = (struct config_array_setting*)calloc(1, (*size + 1) * sizeof(struct config_array_setting)); struct config_array_setting *tmp = (struct config_array_setting*)calloc(1, (*size + 1) * sizeof(struct config_array_setting));
if (!tmp)
return NULL;
/* Arrays */ /* Arrays */
SETTING_ARRAY("playlist_names", settings->arrays.playlist_names, false, NULL, true); SETTING_ARRAY("playlist_names", settings->arrays.playlist_names, false, NULL, true);
SETTING_ARRAY("playlist_cores", settings->arrays.playlist_cores, false, NULL, true); SETTING_ARRAY("playlist_cores", settings->arrays.playlist_cores, false, NULL, true);
@ -1178,6 +1181,9 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
global_t *global = global_get_ptr(); global_t *global = global_get_ptr();
struct config_path_setting *tmp = (struct config_path_setting*)calloc(1, (*size + 1) * sizeof(struct config_path_setting)); struct config_path_setting *tmp = (struct config_path_setting*)calloc(1, (*size + 1) * sizeof(struct config_path_setting));
if (!tmp)
return NULL;
/* Paths */ /* Paths */
#ifdef HAVE_XMB #ifdef HAVE_XMB
SETTING_PATH("xmb_font", settings->paths.path_menu_xmb_font, false, NULL, true); SETTING_PATH("xmb_font", settings->paths.path_menu_xmb_font, false, NULL, true);
@ -1566,6 +1572,9 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
unsigned count = 0; unsigned count = 0;
struct config_float_setting *tmp = (struct config_float_setting*)calloc(1, (*size + 1) * sizeof(struct config_float_setting)); struct config_float_setting *tmp = (struct config_float_setting*)calloc(1, (*size + 1) * sizeof(struct config_float_setting));
if (!tmp)
return NULL;
SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, aspect_ratio, false); SETTING_FLOAT("video_aspect_ratio", &settings->floats.video_aspect_ratio, true, aspect_ratio, false);
SETTING_FLOAT("video_scale", &settings->floats.video_scale, false, 0.0f, false); SETTING_FLOAT("video_scale", &settings->floats.video_scale, false, 0.0f, false);
SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, crt_refresh_rate, false); SETTING_FLOAT("crt_video_refresh_rate", &settings->floats.crt_video_refresh_rate, true, crt_refresh_rate, false);
@ -1602,6 +1611,9 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
unsigned count = 0; unsigned count = 0;
struct config_uint_setting *tmp = (struct config_uint_setting*)malloc((*size + 1) * sizeof(struct config_uint_setting)); struct config_uint_setting *tmp = (struct config_uint_setting*)malloc((*size + 1) * sizeof(struct config_uint_setting));
if (!tmp)
return NULL;
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
SETTING_UINT("streaming_mode", &settings->uints.streaming_mode, true, STREAMING_MODE_TWITCH, false); SETTING_UINT("streaming_mode", &settings->uints.streaming_mode, true, STREAMING_MODE_TWITCH, false);
#endif #endif
@ -1727,6 +1739,9 @@ static struct config_size_setting *populate_settings_size(settings_t *settings,
unsigned count = 0; unsigned count = 0;
struct config_size_setting *tmp = (struct config_size_setting*)calloc((*size + 1), sizeof(struct config_size_setting)); struct config_size_setting *tmp = (struct config_size_setting*)calloc((*size + 1), sizeof(struct config_size_setting));
if (!tmp)
return NULL;
SETTING_SIZE("rewind_buffer_size", &settings->sizes.rewind_buffer_size, true, rewind_buffer_size, false); SETTING_SIZE("rewind_buffer_size", &settings->sizes.rewind_buffer_size, true, rewind_buffer_size, false);
*size = count; *size = count;
@ -1739,6 +1754,9 @@ static struct config_int_setting *populate_settings_int(settings_t *settings, in
unsigned count = 0; unsigned count = 0;
struct config_int_setting *tmp = (struct config_int_setting*)calloc((*size + 1), sizeof(struct config_int_setting)); struct config_int_setting *tmp = (struct config_int_setting*)calloc((*size + 1), sizeof(struct config_int_setting));
if (!tmp)
return NULL;
SETTING_INT("state_slot", &settings->ints.state_slot, false, 0 /* TODO */, false); SETTING_INT("state_slot", &settings->ints.state_slot, false, 0 /* TODO */, false);
#ifdef HAVE_NETWORKING #ifdef HAVE_NETWORKING
SETTING_INT("netplay_check_frames", &settings->ints.netplay_check_frames, true, netplay_check_frames, false); SETTING_INT("netplay_check_frames", &settings->ints.netplay_check_frames, true, netplay_check_frames, false);
@ -2718,11 +2736,11 @@ static bool config_load_file(const char *path, bool set_defaults,
while (extra_path) while (extra_path)
{ {
bool ret = config_append_file(conf, extra_path); bool result = config_append_file(conf, extra_path);
RARCH_LOG("Config: appending config \"%s\"\n", extra_path); RARCH_LOG("Config: appending config \"%s\"\n", extra_path);
if (!ret) if (!result)
RARCH_ERR("Config: failed to append config \"%s\"\n", extra_path); RARCH_ERR("Config: failed to append config \"%s\"\n", extra_path);
extra_path = strtok_r(NULL, "|", &save); extra_path = strtok_r(NULL, "|", &save);
} }

View File

@ -201,7 +201,7 @@ static bool core_info_list_iterate(
if (!current_path) if (!current_path)
return false; return false;
info_path_base = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); info_path_base = (char*)malloc(info_path_base_size);
info_path_base[0] = '\0'; info_path_base[0] = '\0';
@ -230,17 +230,15 @@ static bool core_info_list_iterate(
static core_info_list_t *core_info_list_new(const char *path, static core_info_list_t *core_info_list_new(const char *path,
const char *libretro_info_dir, const char *libretro_info_dir,
const char *exts, const char *exts,
bool show_hidden_files) bool dir_show_hidden_files)
{ {
size_t i; size_t i;
core_info_t *core_info = NULL; core_info_t *core_info = NULL;
core_info_list_t *core_info_list = NULL; core_info_list_t *core_info_list = NULL;
const char *path_basedir = libretro_info_dir; const char *path_basedir = libretro_info_dir;
struct string_list *contents = string_list_new(); struct string_list *contents = string_list_new();
bool ok; bool ok = dir_list_append(contents, path, exts,
false, dir_show_hidden_files, false, false);
ok = dir_list_append(contents, path, exts,
false, show_hidden_files, false, false);
#if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP #if defined(__WINRT__) || defined(WINAPI_FAMILY) && WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
/* UWP: browse the optional packages for additional cores */ /* UWP: browse the optional packages for additional cores */
@ -249,7 +247,7 @@ static core_info_list_t *core_info_list_new(const char *path,
for (i = 0; i < core_packages->size; i++) for (i = 0; i < core_packages->size; i++)
{ {
dir_list_append(contents, core_packages->elems[i].data, exts, dir_list_append(contents, core_packages->elems[i].data, exts,
false, show_hidden_files, false, false); false, dir_show_hidden_files, false, false);
} }
string_list_free(core_packages); string_list_free(core_packages);
#else #else
@ -574,7 +572,11 @@ static bool core_info_list_update_missing_firmware_internal(
if (!info) if (!info)
return false; return false;
path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); path = (char*)malloc(path_size);
if (!path)
return false;
path[0] = '\0'; path[0] = '\0';
for (i = 0; i < info->firmware_count; i++) for (i = 0; i < info->firmware_count; i++)
@ -676,12 +678,12 @@ void core_info_deinit_list(void)
} }
bool core_info_init_list(const char *path_info, const char *dir_cores, bool core_info_init_list(const char *path_info, const char *dir_cores,
const char *exts, bool show_hidden_files) const char *exts, bool dir_show_hidden_files)
{ {
if (!(core_info_curr_list = core_info_list_new(dir_cores, if (!(core_info_curr_list = core_info_list_new(dir_cores,
!string_is_empty(path_info) ? path_info : dir_cores, !string_is_empty(path_info) ? path_info : dir_cores,
exts, exts,
show_hidden_files))) dir_show_hidden_files)))
return false; return false;
return true; return true;
} }
@ -797,13 +799,13 @@ void core_info_list_get_supported_cores(core_info_list_t *core_info_list,
void core_info_get_name(const char *path, char *s, size_t len, void core_info_get_name(const char *path, char *s, size_t len,
const char *path_info, const char *dir_cores, const char *path_info, const char *dir_cores,
const char *exts, bool show_hidden_files) const char *exts, bool dir_show_hidden_files)
{ {
size_t i; size_t i;
const char *path_basedir = !string_is_empty(path_info) ? const char *path_basedir = !string_is_empty(path_info) ?
path_info : dir_cores; path_info : dir_cores;
struct string_list *contents = dir_list_new( struct string_list *contents = dir_list_new(
dir_cores, exts, false, show_hidden_files, false, false); dir_cores, exts, false, dir_show_hidden_files, false, false);
if (!contents) if (!contents)
return; return;

View File

@ -1150,11 +1150,11 @@ bool win32_suppress_screensaver(void *data, bool enable)
{ {
#if _WIN32_WINNT >= 0x0601 #if _WIN32_WINNT >= 0x0601
/* Windows 7, 8, 10 codepath */ /* Windows 7, 8, 10 codepath */
typedef HANDLE(WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context);
typedef BOOL(WINAPI * PowerSetRequestPtr)(HANDLE PowerRequest,
POWER_REQUEST_TYPE RequestType);
PowerCreateRequestPtr powerCreateRequest; PowerCreateRequestPtr powerCreateRequest;
PowerSetRequestPtr powerSetRequest; PowerSetRequestPtr powerSetRequest;
typedef HANDLE (WINAPI * PowerCreateRequestPtr)(REASON_CONTEXT *context);
typedef BOOL (WINAPI * PowerSetRequestPtr)(HANDLE PowerRequest,
POWER_REQUEST_TYPE RequestType);
HMODULE kernel32 = GetModuleHandle("kernel32.dll"); HMODULE kernel32 = GetModuleHandle("kernel32.dll");
if (kernel32) if (kernel32)
@ -1165,25 +1165,25 @@ bool win32_suppress_screensaver(void *data, bool enable)
powerSetRequest = powerSetRequest =
(PowerSetRequestPtr)GetProcAddress( (PowerSetRequestPtr)GetProcAddress(
kernel32, "PowerSetRequest"); kernel32, "PowerSetRequest");
}
if (powerCreateRequest && powerSetRequest) if (powerCreateRequest && powerSetRequest)
{ {
POWER_REQUEST_CONTEXT RequestContext; POWER_REQUEST_CONTEXT RequestContext;
HANDLE Request; HANDLE Request;
RequestContext.Version = RequestContext.Version =
POWER_REQUEST_CONTEXT_VERSION; POWER_REQUEST_CONTEXT_VERSION;
RequestContext.Flags = RequestContext.Flags =
POWER_REQUEST_CONTEXT_SIMPLE_STRING; POWER_REQUEST_CONTEXT_SIMPLE_STRING;
RequestContext.Reason.SimpleReasonString = (LPWSTR) RequestContext.Reason.SimpleReasonString = (LPWSTR)
L"RetroArch running"; L"RetroArch running";
Request = Request =
powerCreateRequest(&RequestContext); powerCreateRequest(&RequestContext);
powerSetRequest( Request, PowerRequestDisplayRequired); powerSetRequest( Request, PowerRequestDisplayRequired);
return true; return true;
}
} }
#endif #endif
} }

View File

@ -1403,7 +1403,7 @@ static void video_thread_send_and_wait(thread_video_t *thr,
} }
bool video_thread_font_init(const void **font_driver, void **font_handle, bool video_thread_font_init(const void **font_driver, void **font_handle,
void *data, const char *font_path, float font_size, void *data, const char *font_path, float video_font_size,
enum font_driver_render_api api, custom_font_command_method_t func, enum font_driver_render_api api, custom_font_command_method_t func,
bool is_threaded) bool is_threaded)
{ {
@ -1419,7 +1419,7 @@ bool video_thread_font_init(const void **font_driver, void **font_handle,
pkt.data.font_init.font_handle = font_handle; pkt.data.font_init.font_handle = font_handle;
pkt.data.font_init.video_data = data; pkt.data.font_init.video_data = data;
pkt.data.font_init.font_path = font_path; pkt.data.font_init.font_path = font_path;
pkt.data.font_init.font_size = font_size; pkt.data.font_init.font_size = video_font_size;
pkt.data.font_init.is_threaded = is_threaded; pkt.data.font_init.is_threaded = is_threaded;
pkt.data.font_init.api = api; pkt.data.font_init.api = api;

View File

@ -1406,7 +1406,7 @@ bool input_driver_init_command(void)
if (command_network_new( if (command_network_new(
input_driver_command, input_driver_command,
input_stdin_cmd_enable && !grab_stdin, input_stdin_cmd_enable && !grab_stdin,
network_cmd_enable, input_network_cmd_enable,
settings->uints.network_cmd_port)) settings->uints.network_cmd_port))
return true; return true;

View File

@ -491,9 +491,9 @@ static INLINE bool input_joypad_pressed(
unsigned key) unsigned key)
{ {
/* Auto-binds are per joypad, not per user. */ /* Auto-binds are per joypad, not per user. */
uint64_t joykey = (binds[key].joykey != NO_BTN) const uint64_t joykey = (binds[key].joykey != NO_BTN)
? binds[key].joykey : joypad_info.auto_binds[key].joykey; ? binds[key].joykey : joypad_info.auto_binds[key].joykey;
uint32_t joyaxis = (binds[key].joyaxis != AXIS_NONE) const uint32_t joyaxis = (binds[key].joyaxis != AXIS_NONE)
? binds[key].joyaxis : joypad_info.auto_binds[key].joyaxis; ? binds[key].joyaxis : joypad_info.auto_binds[key].joyaxis;
if ((uint16_t)joykey != NO_BTN && drv->button(joypad_info.joy_idx, (uint16_t)joykey)) if ((uint16_t)joykey != NO_BTN && drv->button(joypad_info.joy_idx, (uint16_t)joykey))

View File

@ -194,6 +194,7 @@ static bool nbio_stdio_iterate(void *data)
static void nbio_stdio_resize(void *data, size_t len) static void nbio_stdio_resize(void *data, size_t len)
{ {
void *new_data = NULL;
struct nbio_stdio_t *handle = (struct nbio_stdio_t*)data; struct nbio_stdio_t *handle = (struct nbio_stdio_t*)data;
if (!handle) if (!handle)
return; return;
@ -209,10 +210,14 @@ static void nbio_stdio_resize(void *data, size_t len)
abort(); abort();
} }
handle->len = len; handle->len = len;
handle->data = realloc(handle->data, handle->len); handle->progress = len;
handle->op = -1; handle->op = -1;
handle->progress = handle->len;
new_data = realloc(handle->data, handle->len);
if (new_data)
handle->data = new_data;
} }
static void *nbio_stdio_get_ptr(void *data, size_t* len) static void *nbio_stdio_get_ptr(void *data, size_t* len)

View File

@ -82,6 +82,10 @@ char *string_replace_substring(const char *in,
outlen = strlen(in) - pattern_len*numhits + replacement_len*numhits; outlen = strlen(in) - pattern_len*numhits + replacement_len*numhits;
out = (char *)malloc(outlen+1); out = (char *)malloc(outlen+1);
if (!out)
return NULL;
outat = out; outat = out;
inat = in; inat = in;
inprev = in; inprev = in;
@ -105,18 +109,17 @@ char *string_trim_whitespace_left(char *const s)
{ {
if(s && *s) if(s && *s)
{ {
size_t len = strlen(s); size_t len = strlen(s);
char *cur = s; char *current = s;
while(*cur && isspace((unsigned char)*cur)) while(*current && isspace((unsigned char)*current))
{ {
++cur; ++current;
--len; --len;
} }
if(s != cur) if(s != current)
memmove(s, cur, len + 1); memmove(s, current, len + 1);
} }
return s; return s;
@ -127,16 +130,16 @@ char *string_trim_whitespace_right(char *const s)
{ {
if(s && *s) if(s && *s)
{ {
size_t len = strlen(s); size_t len = strlen(s);
char *cur = s + len - 1; char *current = s + len - 1;
while(cur != s && isspace((unsigned char)*cur)) while(current != s && isspace((unsigned char)*current))
{ {
--cur; --current;
--len; --len;
} }
cur[isspace((unsigned char)*cur) ? 0 : 1] = '\0'; current[isspace((unsigned char)*current) ? 0 : 1] = '\0';
} }
return s; return s;

View File

@ -2090,7 +2090,6 @@ static int materialui_list_push(void *data, void *userdata,
menu_displaylist_setting(&entry); menu_displaylist_setting(&entry);
#else #else
{ {
settings_t *settings = config_get_ptr();
if (settings->bools.menu_show_online_updater) if (settings->bools.menu_show_online_updater)
{ {
entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER; entry.enum_idx = MENU_ENUM_LABEL_ONLINE_UPDATER;

View File

@ -1206,7 +1206,6 @@ static void rgui_render(void *data, bool is_idle)
if (rgui->mouse_show) if (rgui->mouse_show)
{ {
settings_t *settings = config_get_ptr();
bool cursor_visible = settings->bools.video_fullscreen || bool cursor_visible = settings->bools.video_fullscreen ||
!video_driver_has_windowed(); !video_driver_has_windowed();

View File

@ -495,9 +495,12 @@ static xmb_node_t *xmb_alloc_node(void)
{ {
xmb_node_t *node = (xmb_node_t*)malloc(sizeof(*node)); xmb_node_t *node = (xmb_node_t*)malloc(sizeof(*node));
node->alpha = node->label_alpha = 0; if (!node)
node->zoom = node->x = node->y = 0; return NULL;
node->icon = node->content_icon = 0;
node->alpha = node->label_alpha = 0;
node->zoom = node->x = node->y = 0;
node->icon = node->content_icon = 0;
node->fullpath = NULL; node->fullpath = NULL;
return node; return node;
@ -546,6 +549,9 @@ static xmb_node_t *xmb_copy_node(const xmb_node_t *old_node)
{ {
xmb_node_t *new_node = (xmb_node_t*)malloc(sizeof(*new_node)); xmb_node_t *new_node = (xmb_node_t*)malloc(sizeof(*new_node));
if (!new_node)
return NULL;
*new_node = *old_node; *new_node = *old_node;
new_node->fullpath = old_node->fullpath ? strdup(old_node->fullpath) : NULL; new_node->fullpath = old_node->fullpath ? strdup(old_node->fullpath) : NULL;

View File

@ -45,14 +45,14 @@ static void* menu_display_d3d11_get_default_mvp(video_frame_info_t *video_info)
static void menu_display_d3d11_blend_begin(video_frame_info_t *video_info) static void menu_display_d3d11_blend_begin(video_frame_info_t *video_info)
{ {
d3d11_video_t* d3d11 = video_info ? (d3d11_video_t*)video_info->userdata : NULL; d3d11_video_t* d3d11 = (d3d11_video_t*)video_info->userdata;
D3D11SetBlendState(d3d11->context, D3D11SetBlendState(d3d11->context,
d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK); d3d11->blend_enable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
} }
static void menu_display_d3d11_blend_end(video_frame_info_t *video_info) static void menu_display_d3d11_blend_end(video_frame_info_t *video_info)
{ {
d3d11_video_t* d3d11 = video_info ? (d3d11_video_t*)video_info->userdata : NULL; d3d11_video_t* d3d11 = (d3d11_video_t*)video_info->userdata;
D3D11SetBlendState(d3d11->context, D3D11SetBlendState(d3d11->context,
d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK); d3d11->blend_disable, NULL, D3D11_DEFAULT_SAMPLE_MASK);
} }

View File

@ -45,15 +45,15 @@ static void* menu_display_d3d12_get_default_mvp(video_frame_info_t *video_info)
static void menu_display_d3d12_blend_begin(video_frame_info_t *video_info) static void menu_display_d3d12_blend_begin(video_frame_info_t *video_info)
{ {
d3d12_video_t* d3d12 = video_info ? (d3d12_video_t*)video_info->userdata : NULL; d3d12_video_t* d3d12 = (d3d12_video_t*)video_info->userdata;
d3d12->sprites.pipe = d3d12->sprites.pipe_blend; d3d12->sprites.pipe = d3d12->sprites.pipe_blend;
D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe);
} }
static void menu_display_d3d12_blend_end(video_frame_info_t *video_info) static void menu_display_d3d12_blend_end(video_frame_info_t *video_info)
{ {
d3d12_video_t* d3d12 = video_info ? (d3d12_video_t*)video_info->userdata : NULL; d3d12_video_t* d3d12 = (d3d12_video_t*)video_info->userdata;
d3d12->sprites.pipe = d3d12->sprites.pipe_noblend; d3d12->sprites.pipe = d3d12->sprites.pipe_noblend;
D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe); D3D12SetPipelineState(d3d12->queue.cmd, d3d12->sprites.pipe);

View File

@ -137,12 +137,12 @@ static void menu_display_gdi_clear_color(
static bool menu_display_gdi_font_init_first( static bool menu_display_gdi_font_init_first(
void **font_handle, void *video_data, void **font_handle, void *video_data,
const char *font_path, float font_size, const char *font_path, float gdi_font_size,
bool is_threaded) bool is_threaded)
{ {
font_data_t **handle = (font_data_t**)font_handle; font_data_t **handle = (font_data_t**)font_handle;
if (!(*handle = font_driver_init_first(video_data, if (!(*handle = font_driver_init_first(video_data,
font_path, font_size, true, font_path, gdi_font_size, true,
is_threaded, is_threaded,
FONT_DRIVER_RENDER_GDI))) FONT_DRIVER_RENDER_GDI)))
return false; return false;

View File

@ -349,21 +349,21 @@ static bool menu_display_vk_font_init_first(
static void menu_display_vk_scissor_begin(video_frame_info_t *video_info, static void menu_display_vk_scissor_begin(video_frame_info_t *video_info,
int x, int y, unsigned width, unsigned height) int x, int y, unsigned width, unsigned height)
{ {
vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL; vk_t *vk = (vk_t*)video_info->userdata;
vk->tracker.use_scissor = true; vk->tracker.use_scissor = true;
vk->tracker.scissor.offset.x = x; vk->tracker.scissor.offset.x = x;
vk->tracker.scissor.offset.y = y; vk->tracker.scissor.offset.y = y;
vk->tracker.scissor.extent.width = width; vk->tracker.scissor.extent.width = width;
vk->tracker.scissor.extent.height = height; vk->tracker.scissor.extent.height = height;
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT; vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
} }
static void menu_display_vk_scissor_end(video_frame_info_t *video_info) static void menu_display_vk_scissor_end(video_frame_info_t *video_info)
{ {
vk_t *vk = video_info ? (vk_t*)video_info->userdata : NULL; vk_t *vk = (vk_t*)video_info->userdata;
vk->tracker.use_scissor = false; vk->tracker.use_scissor = false;
vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT; vk->tracker.dirty |= VULKAN_DIRTY_DYNAMIC_BIT;
} }
menu_display_ctx_driver_t menu_display_ctx_vulkan = { menu_display_ctx_driver_t menu_display_ctx_vulkan = {

View File

@ -451,7 +451,7 @@ void menu_display_font_free(font_data_t *font)
* to the menu driver */ * to the menu driver */
font_data_t *menu_display_font( font_data_t *menu_display_font(
enum application_special_type type, enum application_special_type type,
float font_size, float menu_font_size,
bool is_threaded) bool is_threaded)
{ {
char fontpath[PATH_MAX_LENGTH]; char fontpath[PATH_MAX_LENGTH];
@ -464,10 +464,10 @@ font_data_t *menu_display_font(
fill_pathname_application_special( fill_pathname_application_special(
fontpath, sizeof(fontpath), type); fontpath, sizeof(fontpath), type);
return menu_display_font_file(fontpath, font_size, is_threaded); return menu_display_font_file(fontpath, menu_font_size, is_threaded);
} }
font_data_t *menu_display_font_file(char* fontpath, float font_size, bool is_threaded) font_data_t *menu_display_font_file(char* fontpath, float menu_font_size, bool is_threaded)
{ {
font_data_t *font_data = NULL; font_data_t *font_data = NULL;
if (!menu_disp) if (!menu_disp)
@ -475,7 +475,7 @@ font_data_t *menu_display_font_file(char* fontpath, float font_size, bool is_thr
if (!menu_disp->font_init_first((void**)&font_data, if (!menu_disp->font_init_first((void**)&font_data,
video_driver_get_ptr(false), video_driver_get_ptr(false),
fontpath, font_size, is_threaded)) fontpath, menu_font_size, is_threaded))
return NULL; return NULL;
return font_data; return font_data;

View File

@ -511,7 +511,6 @@ static bool playlist_read_file(
for (playlist->size = 0; playlist->size < playlist->cap; ) for (playlist->size = 0; playlist->size < playlist->cap; )
{ {
unsigned i;
struct playlist_entry *entry = NULL; struct playlist_entry *entry = NULL;
for (i = 0; i < PLAYLIST_ENTRIES; i++) for (i = 0; i < PLAYLIST_ENTRIES; i++)
{ {

View File

@ -373,8 +373,8 @@ static void global_free(void)
{ {
if (!string_is_empty(global->name.remapfile)) if (!string_is_empty(global->name.remapfile))
free(global->name.remapfile); free(global->name.remapfile);
memset(global, 0, sizeof(struct global));
} }
memset(global, 0, sizeof(struct global));
retroarch_override_setting_free_state(); retroarch_override_setting_free_state();
} }

View File

@ -60,9 +60,9 @@ static void *runahead_save_state_alloc(void)
return savestate; return savestate;
} }
static void runahead_save_state_free(void *state) static void runahead_save_state_free(void *data)
{ {
retro_ctx_serialize_info_t *savestate = (retro_ctx_serialize_info_t*)state; retro_ctx_serialize_info_t *savestate = (retro_ctx_serialize_info_t*)data;
if (!savestate) if (!savestate)
return; return;
free(savestate->data); free(savestate->data);

View File

@ -52,17 +52,24 @@ void clear_controller_port_map(void);
static char *get_temp_directory_alloc(void) static char *get_temp_directory_alloc(void)
{ {
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
char *path = NULL; char *path = NULL;
#ifdef _WIN32 #ifdef _WIN32
#ifdef LEGACY_WIN32 #ifdef LEGACY_WIN32
DWORD pathLength = GetTempPath(0, NULL) + 1; DWORD pathLength = GetTempPath(0, NULL) + 1;
path = (char*)malloc(pathLength * sizeof(char)); path = (char*)malloc(pathLength * sizeof(char));
path[pathLength - 1] = 0; if (!path)
return NULL;
path[pathLength - 1] = 0;
GetTempPath(pathLength, path); GetTempPath(pathLength, path);
#else #else
DWORD pathLength = GetTempPathW(0, NULL) + 1; DWORD pathLength = GetTempPathW(0, NULL) + 1;
wchar_t *wideStr = (wchar_t*)malloc(pathLength * sizeof(wchar_t)); wchar_t *wideStr = (wchar_t*)malloc(pathLength * sizeof(wchar_t));
if (!wideStr)
return NULL;
wideStr[pathLength - 1] = 0; wideStr[pathLength - 1] = 0;
GetTempPathW(pathLength, wideStr); GetTempPathW(pathLength, wideStr);

View File

@ -1310,7 +1310,7 @@ bool task_push_dbscan(
const char *content_database, const char *content_database,
const char *fullpath, const char *fullpath,
bool directory, bool directory,
bool show_hidden_files, bool db_dir_show_hidden_files,
retro_task_callback_t cb) retro_task_callback_t cb)
{ {
retro_task_t *t = (retro_task_t*)calloc(1, sizeof(*t)); retro_task_t *t = (retro_task_t*)calloc(1, sizeof(*t));
@ -1324,7 +1324,7 @@ bool task_push_dbscan(
t->callback = cb; t->callback = cb;
t->title = strdup(msg_hash_to_str(MSG_PREPARING_FOR_CONTENT_SCAN)); t->title = strdup(msg_hash_to_str(MSG_PREPARING_FOR_CONTENT_SCAN));
db->show_hidden_files = show_hidden_files; db->show_hidden_files = db_dir_show_hidden_files;
db->is_directory = directory; db->is_directory = directory;
db->playlist_directory = NULL; db->playlist_directory = NULL;
db->fullpath = strdup(fullpath); db->fullpath = strdup(fullpath);

View File

@ -69,6 +69,14 @@ void task_push_get_powerstate(void)
retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task)); retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task));
powerstate_t *state = (powerstate_t*)calloc(1, sizeof(*state)); powerstate_t *state = (powerstate_t*)calloc(1, sizeof(*state));
if (!task)
return;
if (!state)
{
free(task);
return;
}
task->type = TASK_TYPE_NONE; task->type = TASK_TYPE_NONE;
task->state = state; task->state = state;
task->handler = task_powerstate_handler; task->handler = task_powerstate_handler;