mirror of
https://github.com/libretro/RetroArch
synced 2025-03-23 19:21:03 +00:00
(tasks) * Respect 80-char limit - * Fix leaking of ssid_list in task_wifi.c
This commit is contained in:
parent
b6d1c62933
commit
47274607f4
@ -36,10 +36,13 @@ static void netplay_lan_scan_callback(void *task_data,
|
||||
|
||||
/* Don't push the results if we left the LAN scan menu */
|
||||
if (!string_is_equal(label,
|
||||
msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_NETPLAY_LAN_SCAN_SETTINGS_LIST)))
|
||||
msg_hash_to_str(
|
||||
MENU_ENUM_LABEL_DEFERRED_NETPLAY_LAN_SCAN_SETTINGS_LIST)))
|
||||
return;
|
||||
|
||||
if (netplay_discovery_driver_ctl(RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES, (void *) &netplay_hosts))
|
||||
if (netplay_discovery_driver_ctl(
|
||||
RARCH_NETPLAY_DISCOVERY_CTL_LAN_GET_RESPONSES,
|
||||
(void *) &netplay_hosts))
|
||||
{
|
||||
if (netplay_hosts->size > 0)
|
||||
{
|
||||
@ -63,8 +66,10 @@ static void task_netplay_lan_scan_handler(retro_task_t *task)
|
||||
{
|
||||
if (init_netplay_discovery())
|
||||
{
|
||||
netplay_discovery_driver_ctl(RARCH_NETPLAY_DISCOVERY_CTL_LAN_CLEAR_RESPONSES, NULL);
|
||||
netplay_discovery_driver_ctl(RARCH_NETPLAY_DISCOVERY_CTL_LAN_SEND_QUERY, NULL);
|
||||
netplay_discovery_driver_ctl(
|
||||
RARCH_NETPLAY_DISCOVERY_CTL_LAN_CLEAR_RESPONSES, NULL);
|
||||
netplay_discovery_driver_ctl(
|
||||
RARCH_NETPLAY_DISCOVERY_CTL_LAN_SEND_QUERY, NULL);
|
||||
}
|
||||
|
||||
task->progress = 100;
|
||||
|
@ -119,7 +119,8 @@ static void task_screenshot_handler(retro_task_t *task)
|
||||
video_frame_convert_to_bgr24(
|
||||
scaler,
|
||||
state->out_buffer,
|
||||
(const uint8_t*)state->frame + ((int)state->height - 1) * state->pitch,
|
||||
(const uint8_t*)state->frame + ((int)state->height - 1)
|
||||
* state->pitch,
|
||||
state->width, state->height,
|
||||
-state->pitch);
|
||||
}
|
||||
@ -153,7 +154,8 @@ static void task_screenshot_handler(retro_task_t *task)
|
||||
|
||||
#ifdef HAVE_IMAGEVIEWER
|
||||
if (ret)
|
||||
if (content_push_to_history_playlist(g_defaults.image_history, state->filename,
|
||||
if (content_push_to_history_playlist(g_defaults.image_history,
|
||||
state->filename,
|
||||
"imageviewer", "builtin"))
|
||||
playlist_write_file(g_defaults.image_history);
|
||||
#endif
|
||||
@ -201,9 +203,11 @@ static bool screenshot_dump(
|
||||
fill_str_dated_filename(state->shotname, path_basename(name_base),
|
||||
IMG_EXT, sizeof(state->shotname));
|
||||
else
|
||||
snprintf(state->shotname, sizeof(state->shotname), "%s.png", path_basename(name_base));
|
||||
snprintf(state->shotname, sizeof(state->shotname),
|
||||
"%s.png", path_basename(name_base));
|
||||
|
||||
fill_pathname_join(state->filename, folder, state->shotname, sizeof(state->filename));
|
||||
fill_pathname_join(state->filename, folder,
|
||||
state->shotname, sizeof(state->filename));
|
||||
}
|
||||
|
||||
#ifdef _XBOX1
|
||||
@ -264,7 +268,8 @@ static bool take_screenshot_viewport(const char *name_base, bool savestate)
|
||||
}
|
||||
|
||||
/* Data read from viewport is in bottom-up order, suitable for BMP. */
|
||||
if (!screenshot_dump(name_base, screenshot_dir, buffer, vp.width, vp.height,
|
||||
if (!screenshot_dump(name_base, screenshot_dir,
|
||||
buffer, vp.width, vp.height,
|
||||
vp.width * 3, true, buffer, savestate))
|
||||
goto error;
|
||||
|
||||
|
@ -54,10 +54,10 @@ static void wifi_scan_callback(void *task_data,
|
||||
return;
|
||||
|
||||
file_list = menu_entries_get_selection_buf_ptr(0);
|
||||
ssid_list = string_list_new();
|
||||
|
||||
menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, file_list);
|
||||
|
||||
ssid_list = string_list_new();
|
||||
driver_wifi_get_ssids(ssid_list);
|
||||
|
||||
for (i = 0; i < ssid_list->size; i++)
|
||||
@ -69,6 +69,8 @@ static void wifi_scan_callback(void *task_data,
|
||||
MENU_ENUM_LABEL_CONNECT_WIFI,
|
||||
MENU_WIFI, 0, 0);
|
||||
}
|
||||
|
||||
string_list_free(ssid_list);
|
||||
}
|
||||
|
||||
static void task_wifi_scan_handler(retro_task_t *task)
|
||||
@ -76,7 +78,7 @@ static void task_wifi_scan_handler(retro_task_t *task)
|
||||
driver_wifi_scan();
|
||||
|
||||
task->progress = 100;
|
||||
task->title = strdup(msg_hash_to_str(MSG_WIFI_SCAN_COMPLETE));
|
||||
task->title = strdup(msg_hash_to_str(MSG_WIFI_SCAN_COMPLETE));
|
||||
task->finished = true;
|
||||
|
||||
return;
|
||||
@ -84,20 +86,22 @@ static void task_wifi_scan_handler(retro_task_t *task)
|
||||
|
||||
bool task_push_wifi_scan(void)
|
||||
{
|
||||
retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task));
|
||||
retro_task_t *task = (retro_task_t *)calloc(1, sizeof(*task));
|
||||
wifi_handle_t *state = (wifi_handle_t*)calloc(1, sizeof(*state));
|
||||
|
||||
if (!task || !state)
|
||||
goto error;
|
||||
|
||||
state->ssid_list = string_list_new();
|
||||
state->ssid_list = string_list_new();
|
||||
|
||||
/* blocking means no other task can run while this one is running, which is the default */
|
||||
task->type = TASK_TYPE_BLOCKING;
|
||||
task->state = state;
|
||||
task->handler = task_wifi_scan_handler;
|
||||
task->callback = wifi_scan_callback;
|
||||
task->title = strdup(msg_hash_to_str(MSG_SCANNING_WIRELESS_NETWORKS));
|
||||
/* blocking means no other task can run while this one is running,
|
||||
* which is the default */
|
||||
task->type = TASK_TYPE_BLOCKING;
|
||||
task->state = state;
|
||||
task->handler = task_wifi_scan_handler;
|
||||
task->callback = wifi_scan_callback;
|
||||
task->title = strdup(msg_hash_to_str(
|
||||
MSG_SCANNING_WIRELESS_NETWORKS));
|
||||
|
||||
task_queue_ctl(TASK_QUEUE_CTL_PUSH, task);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user