mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-22 23:49:50 +00:00
iFix warnings picked up by -fanalyzer
This commit is contained in:
parent
b38304cae5
commit
3e85a17d7a
@ -230,7 +230,7 @@ static void command_network_poll(command_t *handle)
|
|||||||
command_t* command_network_new(uint16_t port)
|
command_t* command_network_new(uint16_t port)
|
||||||
{
|
{
|
||||||
struct addrinfo *res = NULL;
|
struct addrinfo *res = NULL;
|
||||||
command_t *cmd = (command_t*)calloc(1, sizeof(command_t));
|
command_t *cmd = (command_t*)calloc(1, sizeof(*cmd));
|
||||||
command_network_t *netcmd = (command_network_t*)calloc(
|
command_network_t *netcmd = (command_network_t*)calloc(
|
||||||
1, sizeof(command_network_t));
|
1, sizeof(command_network_t));
|
||||||
int fd = socket_init(
|
int fd = socket_init(
|
||||||
|
@ -443,7 +443,7 @@ struct retro_core_options_v2 *core_option_manager_convert_v2_intl(
|
|||||||
options_v2_us->categories[i].desc : local_desc;
|
options_v2_us->categories[i].desc : local_desc;
|
||||||
option_v2_cats[i].info = string_is_empty(local_info) ?
|
option_v2_cats[i].info = string_is_empty(local_info) ?
|
||||||
options_v2_us->categories[i].info : local_info;
|
options_v2_us->categories[i].info : local_info;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Loop through options... */
|
/* Loop through options... */
|
||||||
@ -1404,7 +1404,7 @@ bool core_option_manager_get_category_visible(core_option_manager_t *opt,
|
|||||||
nested_list_item_t *category_item = NULL;
|
nested_list_item_t *category_item = NULL;
|
||||||
nested_list_t *option_list = NULL;
|
nested_list_t *option_list = NULL;
|
||||||
|
|
||||||
if ( !opt
|
if ( !opt
|
||||||
|| string_is_empty(key))
|
|| string_is_empty(key))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -1649,7 +1649,7 @@ const char *core_option_manager_get_val_label(core_option_manager_t *opt,
|
|||||||
{
|
{
|
||||||
struct core_option *option = NULL;
|
struct core_option *option = NULL;
|
||||||
|
|
||||||
if ( !opt
|
if ( !opt
|
||||||
|| (idx >= opt->size))
|
|| (idx >= opt->size))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
@ -99,8 +99,12 @@ void libretro_dummy_retro_init(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
dummy_frame_buf = (uint16_t*)calloc(frame_buf_width * frame_buf_height, sizeof(uint16_t));
|
dummy_frame_buf = (uint16_t*)calloc(frame_buf_width * frame_buf_height, sizeof(uint16_t));
|
||||||
for (i = 0; i < (unsigned)(frame_buf_width * frame_buf_height); i++)
|
|
||||||
dummy_frame_buf[i] = 4 << 5;
|
if (dummy_frame_buf)
|
||||||
|
{
|
||||||
|
for (i = 0; i < (unsigned)(frame_buf_width * frame_buf_height); i++)
|
||||||
|
dummy_frame_buf[i] = 4 << 5;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void libretro_dummy_retro_deinit(void)
|
void libretro_dummy_retro_deinit(void)
|
||||||
|
@ -469,11 +469,15 @@ static bool d3d9_hlsl_load_program_from_file(
|
|||||||
error:
|
error:
|
||||||
RARCH_ERR("Cg/HLSL error:\n");
|
RARCH_ERR("Cg/HLSL error:\n");
|
||||||
if (listing_f)
|
if (listing_f)
|
||||||
|
{
|
||||||
RARCH_ERR("Fragment:\n%s\n", (char*)listing_f->lpVtbl->GetBufferPointer(listing_f));
|
RARCH_ERR("Fragment:\n%s\n", (char*)listing_f->lpVtbl->GetBufferPointer(listing_f));
|
||||||
|
listing_f->lpVtbl->Release(listing_f);
|
||||||
|
}
|
||||||
if (listing_v)
|
if (listing_v)
|
||||||
|
{
|
||||||
RARCH_ERR("Vertex:\n%s\n", (char*)listing_v->lpVtbl->GetBufferPointer(listing_v));
|
RARCH_ERR("Vertex:\n%s\n", (char*)listing_v->lpVtbl->GetBufferPointer(listing_v));
|
||||||
listing_f->lpVtbl->Release(listing_f);
|
listing_v->lpVtbl->Release(listing_v);
|
||||||
listing_v->lpVtbl->Release(listing_v);
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -518,12 +522,15 @@ static bool d3d9_hlsl_load_program(
|
|||||||
error:
|
error:
|
||||||
RARCH_ERR("Cg/HLSL error:\n");
|
RARCH_ERR("Cg/HLSL error:\n");
|
||||||
if (listing_f)
|
if (listing_f)
|
||||||
|
{
|
||||||
RARCH_ERR("Fragment:\n%s\n", (char*)listing_f->lpVtbl->GetBufferPointer(listing_f));
|
RARCH_ERR("Fragment:\n%s\n", (char*)listing_f->lpVtbl->GetBufferPointer(listing_f));
|
||||||
|
listing_f->lpVtbl->Release(listing_f);
|
||||||
|
}
|
||||||
if (listing_v)
|
if (listing_v)
|
||||||
|
{
|
||||||
RARCH_ERR("Vertex:\n%s\n", (char*)listing_v->lpVtbl->GetBufferPointer(listing_v));
|
RARCH_ERR("Vertex:\n%s\n", (char*)listing_v->lpVtbl->GetBufferPointer(listing_v));
|
||||||
listing_f->lpVtbl->Release(listing_f);
|
listing_v->lpVtbl->Release(listing_v);
|
||||||
listing_v->lpVtbl->Release(listing_v);
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,21 +92,24 @@ bool file_list_insert(file_list_t *list,
|
|||||||
struct item_file *copy = (struct item_file*)
|
struct item_file *copy = (struct item_file*)
|
||||||
malloc(sizeof(struct item_file));
|
malloc(sizeof(struct item_file));
|
||||||
|
|
||||||
copy->path = NULL;
|
if (copy)
|
||||||
copy->label = NULL;
|
{
|
||||||
copy->alt = NULL;
|
copy->path = NULL;
|
||||||
copy->type = 0;
|
copy->label = NULL;
|
||||||
copy->directory_ptr = 0;
|
copy->alt = NULL;
|
||||||
copy->entry_idx = 0;
|
copy->type = 0;
|
||||||
copy->userdata = NULL;
|
copy->directory_ptr = 0;
|
||||||
copy->actiondata = NULL;
|
copy->entry_idx = 0;
|
||||||
|
copy->userdata = NULL;
|
||||||
|
copy->actiondata = NULL;
|
||||||
|
|
||||||
memcpy(copy, &list->list[i-1], sizeof(struct item_file));
|
memcpy(copy, &list->list[i-1], sizeof(struct item_file));
|
||||||
|
|
||||||
memcpy(&list->list[i-1], &list->list[i], sizeof(struct item_file));
|
memcpy(&list->list[i-1], &list->list[i], sizeof(struct item_file));
|
||||||
memcpy(&list->list[i], copy, sizeof(struct item_file));
|
memcpy(&list->list[i], copy, sizeof(struct item_file));
|
||||||
|
|
||||||
free(copy);
|
free(copy);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list->list[idx].path = NULL;
|
list->list[idx].path = NULL;
|
||||||
@ -318,8 +321,8 @@ bool file_list_search(const file_list_t *list, const char *needle, size_t *idx)
|
|||||||
for (i = 0; i < list->size; i++)
|
for (i = 0; i < list->size; i++)
|
||||||
{
|
{
|
||||||
const char *str = NULL;
|
const char *str = NULL;
|
||||||
const char *alt = list->list[i].alt
|
const char *alt = list->list[i].alt
|
||||||
? list->list[i].alt
|
? list->list[i].alt
|
||||||
: list->list[i].path;
|
: list->list[i].path;
|
||||||
|
|
||||||
if (!alt)
|
if (!alt)
|
||||||
|
@ -37,7 +37,7 @@ static bool string_list_deinitialize_internal(struct string_list *list)
|
|||||||
if (list->elems)
|
if (list->elems)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
for (i = 0; i < list->size; i++)
|
for (i = 0; i < (unsigned)list->size; i++)
|
||||||
{
|
{
|
||||||
if (list->elems[i].data)
|
if (list->elems[i].data)
|
||||||
free(list->elems[i].data);
|
free(list->elems[i].data);
|
||||||
@ -502,12 +502,12 @@ struct string_list *string_list_clone(const struct string_list *src)
|
|||||||
if (!dest)
|
if (!dest)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dest->elems = NULL;
|
dest->elems = NULL;
|
||||||
dest->size = src->size;
|
dest->size = src->size;
|
||||||
if (src->cap < dest->size)
|
if (src->cap < dest->size)
|
||||||
dest->cap = dest->size;
|
dest->cap = dest->size;
|
||||||
else
|
else
|
||||||
dest->cap = src->cap;
|
dest->cap = src->cap;
|
||||||
|
|
||||||
if (!(elems = (struct string_list_elem*)
|
if (!(elems = (struct string_list_elem*)
|
||||||
calloc(dest->cap, sizeof(struct string_list_elem))))
|
calloc(dest->cap, sizeof(struct string_list_elem))))
|
||||||
@ -516,7 +516,7 @@ struct string_list *string_list_clone(const struct string_list *src)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
dest->elems = elems;
|
dest->elems = elems;
|
||||||
|
|
||||||
for (i = 0; i < src->size; i++)
|
for (i = 0; i < src->size; i++)
|
||||||
{
|
{
|
||||||
@ -529,8 +529,11 @@ struct string_list *string_list_clone(const struct string_list *src)
|
|||||||
if (len != 0)
|
if (len != 0)
|
||||||
{
|
{
|
||||||
char *result = (char*)malloc(len + 1);
|
char *result = (char*)malloc(len + 1);
|
||||||
strcpy(result, _src);
|
if (result)
|
||||||
dest->elems[i].data = result;
|
{
|
||||||
|
strcpy(result, _src);
|
||||||
|
dest->elems[i].data = result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,10 @@ int64_t filestream_truncate(RFILE *stream, int64_t length)
|
|||||||
RFILE* filestream_open(const char *path, unsigned mode, unsigned hints)
|
RFILE* filestream_open(const char *path, unsigned mode, unsigned hints)
|
||||||
{
|
{
|
||||||
struct retro_vfs_file_handle *fp = NULL;
|
struct retro_vfs_file_handle *fp = NULL;
|
||||||
RFILE* output = NULL;
|
RFILE* output = (RFILE*)malloc(sizeof(RFILE));
|
||||||
|
|
||||||
|
if (!output)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (filestream_open_cb)
|
if (filestream_open_cb)
|
||||||
fp = (struct retro_vfs_file_handle*)
|
fp = (struct retro_vfs_file_handle*)
|
||||||
@ -165,9 +168,11 @@ RFILE* filestream_open(const char *path, unsigned mode, unsigned hints)
|
|||||||
retro_vfs_file_open_impl(path, mode, hints);
|
retro_vfs_file_open_impl(path, mode, hints);
|
||||||
|
|
||||||
if (!fp)
|
if (!fp)
|
||||||
|
{
|
||||||
|
free(output);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
output = (RFILE*)malloc(sizeof(RFILE));
|
|
||||||
output->error_flag = false;
|
output->error_flag = false;
|
||||||
output->hfile = fp;
|
output->hfile = fp;
|
||||||
return output;
|
return output;
|
||||||
|
@ -243,6 +243,8 @@ bool netstream_write(netstream_t *stream, const void *data, size_t len)
|
|||||||
{
|
{
|
||||||
if (!stream->size)
|
if (!stream->size)
|
||||||
{
|
{
|
||||||
|
if (stream->buf)
|
||||||
|
free(stream->buf);
|
||||||
stream->buf = malloc(len);
|
stream->buf = malloc(len);
|
||||||
if (!stream->buf)
|
if (!stream->buf)
|
||||||
return false;
|
return false;
|
||||||
|
@ -128,12 +128,6 @@ static uint64_t bps_decode(struct bps_data *bps)
|
|||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bps_write(struct bps_data *bps, uint8_t data)
|
|
||||||
{
|
|
||||||
bps->target_data[bps->output_offset++] = data;
|
|
||||||
bps->target_checksum = ~(encoding_crc32(~bps->target_checksum, &data, 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
static enum patch_error bps_apply_patch(
|
static enum patch_error bps_apply_patch(
|
||||||
const uint8_t *modify_data, uint64_t modify_length,
|
const uint8_t *modify_data, uint64_t modify_length,
|
||||||
const uint8_t *source_data, uint64_t source_length,
|
const uint8_t *source_data, uint64_t source_length,
|
||||||
@ -208,12 +202,20 @@ static enum patch_error bps_apply_patch(
|
|||||||
{
|
{
|
||||||
case SOURCE_READ:
|
case SOURCE_READ:
|
||||||
while (length--)
|
while (length--)
|
||||||
bps_write(&bps, bps.source_data[bps.output_offset]);
|
{
|
||||||
|
uint8_t data = bps.source_data[bps.output_offset];
|
||||||
|
bps.target_data[bps.output_offset++] = data;
|
||||||
|
bps.target_checksum = ~(encoding_crc32(~bps.target_checksum, &data, 1));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case TARGET_READ:
|
case TARGET_READ:
|
||||||
while (length--)
|
while (length--)
|
||||||
bps_write(&bps, bps_read(&bps));
|
{
|
||||||
|
uint8_t data = bps_read(&bps);
|
||||||
|
bps.target_data[bps.output_offset++] = data;
|
||||||
|
bps.target_checksum = ~(encoding_crc32(~bps.target_checksum, &data, 1));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SOURCE_COPY:
|
case SOURCE_COPY:
|
||||||
@ -231,13 +233,21 @@ static enum patch_error bps_apply_patch(
|
|||||||
{
|
{
|
||||||
bps.source_offset += offset;
|
bps.source_offset += offset;
|
||||||
while (length--)
|
while (length--)
|
||||||
bps_write(&bps, bps.source_data[bps.source_offset++]);
|
{
|
||||||
|
uint8_t data = bps.source_data[bps.source_offset++];
|
||||||
|
bps.target_data[bps.output_offset++] = data;
|
||||||
|
bps.target_checksum = ~(encoding_crc32(~bps.target_checksum, &data, 1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
bps.target_offset += offset;
|
bps.target_offset += offset;
|
||||||
while (length--)
|
while (length--)
|
||||||
bps_write(&bps, bps.target_data[bps.target_offset++]);
|
{
|
||||||
|
uint8_t data = bps.target_data[bps.target_offset++];
|
||||||
|
bps.target_data[bps.output_offset++] = data;
|
||||||
|
bps.target_checksum = ~(encoding_crc32(~bps.target_checksum, &data, 1));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -239,7 +239,10 @@ static bool screenshot_dump(
|
|||||||
screenshot_task_state_t *state = (screenshot_task_state_t*)
|
screenshot_task_state_t *state = (screenshot_task_state_t*)
|
||||||
calloc(1, sizeof(*state));
|
calloc(1, sizeof(*state));
|
||||||
|
|
||||||
/* If fullpath is true, name_base already contains a
|
if (!state)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
/* If fullpath is true, name_base already contains a
|
||||||
* static path + filename to save the screenshot to. */
|
* static path + filename to save the screenshot to. */
|
||||||
if (fullpath)
|
if (fullpath)
|
||||||
strlcpy(state->filename, name_base, sizeof(state->filename));
|
strlcpy(state->filename, name_base, sizeof(state->filename));
|
||||||
@ -261,7 +264,7 @@ static bool screenshot_dump(
|
|||||||
#endif
|
#endif
|
||||||
if (savestate)
|
if (savestate)
|
||||||
state->flags |= SS_TASK_FLAG_SILENCE;
|
state->flags |= SS_TASK_FLAG_SILENCE;
|
||||||
|
|
||||||
if (history_list_enable)
|
if (history_list_enable)
|
||||||
state->flags |= SS_TASK_FLAG_HISTORY_LIST_ENABLE;
|
state->flags |= SS_TASK_FLAG_HISTORY_LIST_ENABLE;
|
||||||
state->pixel_format_type = pixel_format_type;
|
state->pixel_format_type = pixel_format_type;
|
||||||
@ -329,7 +332,7 @@ static bool screenshot_dump(
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t len = strlcpy(state->shotname,
|
size_t len = strlcpy(state->shotname,
|
||||||
path_basename_nocompression(name_base),
|
path_basename_nocompression(name_base),
|
||||||
sizeof(state->shotname));
|
sizeof(state->shotname));
|
||||||
strlcpy(state->shotname + len,
|
strlcpy(state->shotname + len,
|
||||||
@ -548,7 +551,7 @@ bool take_screenshot(
|
|||||||
bool ret = false;
|
bool ret = false;
|
||||||
uint32_t runloop_flags = runloop_get_flags();
|
uint32_t runloop_flags = runloop_get_flags();
|
||||||
settings_t *settings = config_get_ptr();
|
settings_t *settings = config_get_ptr();
|
||||||
video_driver_state_t *video_st = video_state_get_ptr();
|
video_driver_state_t *video_st = video_state_get_ptr();
|
||||||
bool video_gpu_screenshot = settings->bools.video_gpu_screenshot;
|
bool video_gpu_screenshot = settings->bools.video_gpu_screenshot;
|
||||||
bool supports_viewport_read = video_st->current_video->read_viewport
|
bool supports_viewport_read = video_st->current_video->read_viewport
|
||||||
&& (video_st->current_video->viewport_info);
|
&& (video_st->current_video->viewport_info);
|
||||||
|
@ -121,11 +121,17 @@ static void call_auto_translate_task(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
mode = (int*)malloc(sizeof(int));
|
mode = (int*)malloc(sizeof(int));
|
||||||
*mode = ai_service_mode;
|
|
||||||
|
|
||||||
|
t->user_data = NULL;
|
||||||
t->handler = task_auto_translate_handler;
|
t->handler = task_auto_translate_handler;
|
||||||
t->user_data = mode;
|
|
||||||
t->mute = true;
|
t->mute = true;
|
||||||
|
|
||||||
|
if (mode)
|
||||||
|
{
|
||||||
|
*mode = ai_service_mode;
|
||||||
|
t->user_data = mode;
|
||||||
|
}
|
||||||
|
|
||||||
task_queue_push(t);
|
task_queue_push(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -361,9 +367,10 @@ static void handle_translation_cb(
|
|||||||
((uint32_t) ((uint8_t)raw_image_file_data[23]) << 8) +
|
((uint32_t) ((uint8_t)raw_image_file_data[23]) << 8) +
|
||||||
((uint32_t) ((uint8_t)raw_image_file_data[22]) << 0);
|
((uint32_t) ((uint8_t)raw_image_file_data[22]) << 0);
|
||||||
raw_image_data = (void*)malloc(image_width * image_height * 3 * sizeof(uint8_t));
|
raw_image_data = (void*)malloc(image_width * image_height * 3 * sizeof(uint8_t));
|
||||||
memcpy(raw_image_data,
|
if (raw_image_data)
|
||||||
raw_image_file_data + 54 * sizeof(uint8_t),
|
memcpy(raw_image_data,
|
||||||
image_width * image_height * 3 * sizeof(uint8_t));
|
raw_image_file_data + 54 * sizeof(uint8_t),
|
||||||
|
image_width * image_height * 3 * sizeof(uint8_t));
|
||||||
}
|
}
|
||||||
/* PNG coming back from the url */
|
/* PNG coming back from the url */
|
||||||
else if (raw_image_file_data[1] == 'P'
|
else if (raw_image_file_data[1] == 'P'
|
||||||
@ -835,10 +842,14 @@ bool run_translation_service(settings_t *settings, bool paused)
|
|||||||
lbl = path_basename(path_get(RARCH_PATH_BASENAME));
|
lbl = path_basename(path_get(RARCH_PATH_BASENAME));
|
||||||
lbl_len = strlen(lbl);
|
lbl_len = strlen(lbl);
|
||||||
sys_lbl = (char*)malloc(lbl_len + sys_id_len + 3);
|
sys_lbl = (char*)malloc(lbl_len + sys_id_len + 3);
|
||||||
memcpy(sys_lbl, sys_id, sys_id_len);
|
|
||||||
memcpy(sys_lbl + sys_id_len, "__", 2);
|
if (sys_lbl)
|
||||||
memcpy(sys_lbl + 2 + sys_id_len, lbl, lbl_len);
|
{
|
||||||
sys_lbl[sys_id_len + 2 + lbl_len] = '\0';
|
memcpy(sys_lbl, sys_id, sys_id_len);
|
||||||
|
memcpy(sys_lbl + sys_id_len, "__", 2);
|
||||||
|
memcpy(sys_lbl + 2 + sys_id_len, lbl, lbl_len);
|
||||||
|
sys_lbl[sys_id_len + 2 + lbl_len] = '\0';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!scaler)
|
if (!scaler)
|
||||||
@ -1144,6 +1155,7 @@ finish:
|
|||||||
free(bmp64_buffer);
|
free(bmp64_buffer);
|
||||||
if (sys_lbl)
|
if (sys_lbl)
|
||||||
free(sys_lbl);
|
free(sys_lbl);
|
||||||
|
sys_lbl = NULL;
|
||||||
if (jsonwriter)
|
if (jsonwriter)
|
||||||
rjsonwriter_free(jsonwriter);
|
rjsonwriter_free(jsonwriter);
|
||||||
return !error;
|
return !error;
|
||||||
|
Loading…
Reference in New Issue
Block a user