Local len variables need to have '_' prefix

This commit is contained in:
LibretroAdmin 2024-12-30 14:03:58 +01:00
parent 707f19640a
commit 1e656261b0
18 changed files with 161 additions and 168 deletions

View File

@ -131,19 +131,12 @@ static void stream_state_cb(pa_stream *s, void *data)
static void stream_request_cb(pa_stream *s, size_t length, void *data) static void stream_request_cb(pa_stream *s, size_t length, void *data)
{ {
pa_t *pa = (pa_t*)data; pa_t *pa = (pa_t*)data;
(void)length;
(void)s;
pa_threaded_mainloop_signal(pa->mainloop, 0); pa_threaded_mainloop_signal(pa->mainloop, 0);
} }
static void stream_latency_update_cb(pa_stream *s, void *data) static void stream_latency_update_cb(pa_stream *s, void *data)
{ {
pa_t *pa = (pa_t*)data; pa_t *pa = (pa_t*)data;
(void)s;
pa_threaded_mainloop_signal(pa->mainloop, 0); pa_threaded_mainloop_signal(pa->mainloop, 0);
} }
@ -364,15 +357,15 @@ static bool pulse_use_float(void *data)
static size_t pulse_write_avail(void *data) static size_t pulse_write_avail(void *data)
{ {
size_t length; size_t _len;
pa_t *pa = (pa_t*)data; pa_t *pa = (pa_t*)data;
pa_threaded_mainloop_lock(pa->mainloop); pa_threaded_mainloop_lock(pa->mainloop);
length = pa_stream_writable_size(pa->stream); _len = pa_stream_writable_size(pa->stream);
audio_driver_set_buffer_size(pa->buffer_size); /* Can change spuriously. */ audio_driver_set_buffer_size(pa->buffer_size); /* Can change spuriously. */
pa_threaded_mainloop_unlock(pa->mainloop); pa_threaded_mainloop_unlock(pa->mainloop);
return length; return _len;
} }
static size_t pulse_buffer_size(void *data) static size_t pulse_buffer_size(void *data)

View File

@ -175,9 +175,9 @@ bool cheat_manager_save(
strlcpy(cheats_file, path, sizeof(cheats_file)); strlcpy(cheats_file, path, sizeof(cheats_file));
else else
{ {
size_t len = fill_pathname_join_special(cheats_file, cheat_database, size_t _len = fill_pathname_join_special(cheats_file, cheat_database,
path, sizeof(cheats_file)); path, sizeof(cheats_file));
strlcpy(cheats_file + len, ".cht", sizeof(cheats_file) - len); strlcpy(cheats_file + _len, ".cht", sizeof(cheats_file) - _len);
} }
if (!overwrite) if (!overwrite)

View File

@ -774,7 +774,7 @@ bool command_read_ram(command_t *cmd, const char *arg)
unsigned int nbytes = 0; unsigned int nbytes = 0;
unsigned int alloc_size = 0; unsigned int alloc_size = 0;
unsigned int addr = -1; unsigned int addr = -1;
size_t len = 0; size_t _len = 0;
if (sscanf(arg, "%x %u", &addr, &nbytes) != 2) if (sscanf(arg, "%x %u", &addr, &nbytes) != 2)
return true; return true;
@ -790,14 +790,14 @@ bool command_read_ram(command_t *cmd, const char *arg)
for (i = 0; i < nbytes; i++) for (i = 0; i < nbytes; i++)
snprintf(reply_at + 3 * i, 4, " %.2X", data[i]); snprintf(reply_at + 3 * i, 4, " %.2X", data[i]);
reply_at[3 * nbytes] = '\n'; reply_at[3 * nbytes] = '\n';
len = reply_at + 3 * nbytes + 1 - reply; _len = reply_at + 3 * nbytes + 1 - reply;
} }
else else
{ {
strlcpy(reply_at, " -1\n", sizeof(reply) - strlen(reply)); strlcpy(reply_at, " -1\n", sizeof(reply) - strlen(reply));
len = reply_at + STRLEN_CONST(" -1\n") - reply; _len = reply_at + STRLEN_CONST(" -1\n") - reply;
} }
cmd->replier(cmd, reply, len); cmd->replier(cmd, reply, _len);
free(reply); free(reply);
return true; return true;
} }

View File

@ -4814,9 +4814,9 @@ static void save_keybind_joykey(config_file_t *conf,
const struct retro_keybind *bind, bool save_empty) const struct retro_keybind *bind, bool save_empty)
{ {
char key[64]; char key[64];
size_t len = fill_pathname_join_delim(key, prefix, size_t _len = fill_pathname_join_delim(key, prefix,
base, '_', sizeof(key)); base, '_', sizeof(key));
strlcpy(key + len, "_btn", sizeof(key) - len); strlcpy(key + _len, "_btn", sizeof(key) - _len);
if (bind->joykey == NO_BTN) if (bind->joykey == NO_BTN)
{ {
@ -4835,8 +4835,8 @@ static void save_keybind_axis(config_file_t *conf,
const struct retro_keybind *bind, bool save_empty) const struct retro_keybind *bind, bool save_empty)
{ {
char key[64]; char key[64];
size_t len = fill_pathname_join_delim(key, prefix, base, '_', sizeof(key)); size_t _len = fill_pathname_join_delim(key, prefix, base, '_', sizeof(key));
strlcpy(key + len, "_axis", sizeof(key) - len); strlcpy(key + _len, "_axis", sizeof(key) - _len);
if (bind->joyaxis == AXIS_NONE) if (bind->joyaxis == AXIS_NONE)
{ {
@ -4869,9 +4869,9 @@ static void save_keybind_mbutton(config_file_t *conf,
const struct retro_keybind *bind, bool save_empty) const struct retro_keybind *bind, bool save_empty)
{ {
char key[64]; char key[64];
size_t len = fill_pathname_join_delim(key, prefix, size_t _len = fill_pathname_join_delim(key, prefix,
base, '_', sizeof(key)); base, '_', sizeof(key));
strlcpy(key + len, "_mbtn", sizeof(key) - len); strlcpy(key + _len, "_mbtn", sizeof(key) - _len);
switch (bind->mbutton) switch (bind->mbutton)
{ {

View File

@ -204,7 +204,7 @@ bool disk_index_file_init(
const char *content_path, const char *content_path,
const char *dir_savefile) const char *dir_savefile)
{ {
size_t len; size_t _len;
char content_name[NAME_MAX_LENGTH]; char content_name[NAME_MAX_LENGTH];
char disk_index_file_dir[DIR_MAX_LENGTH]; char disk_index_file_dir[DIR_MAX_LENGTH];
@ -245,12 +245,12 @@ bool disk_index_file_init(
} }
/* > Generate final path */ /* > Generate final path */
len = fill_pathname_join_special( _len = fill_pathname_join_special(
disk_index_file->file_path, disk_index_file_dir, disk_index_file->file_path, disk_index_file_dir,
content_name, sizeof(disk_index_file->file_path)); content_name, sizeof(disk_index_file->file_path));
strlcpy(disk_index_file->file_path + len, strlcpy(disk_index_file->file_path + _len,
".ldci", ".ldci",
sizeof(disk_index_file->file_path) - len); sizeof(disk_index_file->file_path) - _len);
/* All is well - reset disk_index_file_t and /* All is well - reset disk_index_file_t and
* attempt to load values from file */ * attempt to load values from file */

View File

@ -406,10 +406,10 @@ static bool check_egl_client_extension(const char *name, size_t name_len)
/* Use strspn and strcspn to find the start position and length of each /* Use strspn and strcspn to find the start position and length of each
* token in the extension string. Using strtok could also work, but * token in the extension string. Using strtok could also work, but
* that would require allocating a copy of the string. */ * that would require allocating a copy of the string. */
size_t len = strcspn(str, " "); size_t _len = strcspn(str, " ");
if (len == name_len && strncmp(str, name, name_len) == 0) if (_len == name_len && strncmp(str, name, name_len) == 0)
return true; return true;
str += len; str += _len;
str += strspn(str, " "); str += strspn(str, " ");
} }
} }

View File

@ -729,13 +729,13 @@ static bool vulkan_context_init_device(gfx_ctx_vulkan_data_t *vk)
{ {
char version_str[128]; char version_str[128];
size_t len = snprintf(version_str , sizeof(version_str) , "%u", VK_VERSION_MAJOR(vk->context.gpu_properties.apiVersion)); size_t _len = snprintf(version_str , sizeof(version_str) , "%u", VK_VERSION_MAJOR(vk->context.gpu_properties.apiVersion));
version_str[ len] = '.'; version_str[ _len] = '.';
version_str[++len] = '\0'; version_str[++_len] = '\0';
len += snprintf(version_str + len, sizeof(version_str) - len, "%u", VK_VERSION_MINOR(vk->context.gpu_properties.apiVersion)); _len += snprintf(version_str + _len, sizeof(version_str) - _len, "%u", VK_VERSION_MINOR(vk->context.gpu_properties.apiVersion));
version_str[ len] = '.'; version_str[ _len] = '.';
version_str[++len] = '\0'; version_str[++_len] = '\0';
snprintf(version_str + len, sizeof(version_str) - len, "%u", VK_VERSION_PATCH(vk->context.gpu_properties.apiVersion)); snprintf(version_str + _len, sizeof(version_str) - _len, "%u", VK_VERSION_PATCH(vk->context.gpu_properties.apiVersion));
video_driver_set_gpu_api_version_string(version_str); video_driver_set_gpu_api_version_string(version_str);
} }

View File

@ -4322,17 +4322,17 @@ static void *gl2_init(const video_info_t *video,
} }
{ {
size_t len = 0; size_t _len = 0;
if (!string_is_empty(vendor)) if (!string_is_empty(vendor))
{ {
len = strlcpy(gl->device_str, vendor, sizeof(gl->device_str)); _len = strlcpy(gl->device_str, vendor, sizeof(gl->device_str));
gl->device_str[ len] = ' '; gl->device_str[ _len] = ' ';
gl->device_str[++len] = '\0'; gl->device_str[++_len] = '\0';
} }
if (!string_is_empty(renderer)) if (!string_is_empty(renderer))
strlcpy(gl->device_str + len, renderer, sizeof(gl->device_str) - len); strlcpy(gl->device_str + _len, renderer, sizeof(gl->device_str) - _len);
if (!string_is_empty(version)) if (!string_is_empty(version))
video_driver_set_gpu_api_version_string(version); video_driver_set_gpu_api_version_string(version);
@ -5070,13 +5070,12 @@ static void gl2_apply_state_changes(void *data)
} }
static void gl2_get_video_output_size(void *data, static void gl2_get_video_output_size(void *data,
unsigned *width, unsigned *height, char *desc, size_t desc_len) unsigned *width, unsigned *height, char *s, size_t len)
{ {
gl2_t *gl = (gl2_t*)data; gl2_t *gl = (gl2_t*)data;
if (gl && gl->ctx_driver && gl->ctx_driver->get_video_output_size) if (gl && gl->ctx_driver && gl->ctx_driver->get_video_output_size)
gl->ctx_driver->get_video_output_size( gl->ctx_driver->get_video_output_size(
gl->ctx_data, gl->ctx_data, width, height, s, len);
width, height, desc, desc_len);
} }
static void gl2_get_video_output_prev(void *data) static void gl2_get_video_output_prev(void *data)

View File

@ -1138,12 +1138,12 @@ bool gfx_animation_ticker(gfx_animation_ctx_ticker_t *ticker)
if (!ticker->selected) if (!ticker->selected)
{ {
size_t len = utf8cpy(ticker->s, size_t _len = utf8cpy(ticker->s,
PATH_MAX_LENGTH, ticker->str, ticker->len - 3); PATH_MAX_LENGTH, ticker->str, ticker->len - 3);
ticker->s[ len] = '.'; ticker->s[ _len] = '.';
ticker->s[++len] = '.'; ticker->s[++_len] = '.';
ticker->s[++len] = '.'; ticker->s[++_len] = '.';
ticker->s[++len] = '\0'; ticker->s[++_len] = '\0';
return false; return false;
} }

View File

@ -205,7 +205,7 @@ static int64_t sevenzip_file_read(
for (i = 0; i < db.NumFiles; i++) for (i = 0; i < db.NumFiles; i++)
{ {
size_t len; size_t _len;
char infile[PATH_MAX_LENGTH]; char infile[PATH_MAX_LENGTH];
size_t offset = 0; size_t offset = 0;
size_t outSizeProcessed = 0; size_t outSizeProcessed = 0;
@ -215,14 +215,14 @@ static int64_t sevenzip_file_read(
if (SzArEx_IsDir(&db, i)) if (SzArEx_IsDir(&db, i))
continue; continue;
len = SzArEx_GetFileNameUtf16(&db, i, NULL); _len = SzArEx_GetFileNameUtf16(&db, i, NULL);
if (len > temp_size) if (_len > temp_size)
{ {
if (temp) if (temp)
free(temp); free(temp);
temp_size = len; temp_size = _len;
temp = (uint16_t *)malloc(temp_size * sizeof(temp[0])); temp = (uint16_t *)malloc(temp_size * sizeof(temp[0]));
if (temp == 0) if (temp == 0)
{ {

View File

@ -211,10 +211,10 @@ static struct rmsgpack_dom_value query_func_between(
if (argc != 2) if (argc != 2)
return res; return res;
if ( argv[0].type != AT_VALUE if ( argv[0].type != AT_VALUE
|| argv[1].type != AT_VALUE) || argv[1].type != AT_VALUE)
return res; return res;
if ( argv[0].a.value.type != RDT_INT if ( argv[0].a.value.type != RDT_INT
|| argv[1].a.value.type != RDT_INT) || argv[1].a.value.type != RDT_INT)
return res; return res;
@ -301,7 +301,7 @@ static void query_argument_free(struct argument *arg)
} }
static struct buffer query_parse_integer( static struct buffer query_parse_integer(
char *s, size_t len, char *s, size_t len,
struct buffer buff, struct buffer buff,
struct rmsgpack_dom_value *value, struct rmsgpack_dom_value *value,
const char **error) const char **error)
@ -495,7 +495,7 @@ static struct buffer query_parse_value(
} }
else if ( else if (
query_peek(buff, "b", STRLEN_CONST("b")) query_peek(buff, "b", STRLEN_CONST("b"))
|| query_peek(buff, "\"", STRLEN_CONST("\"")) || query_peek(buff, "\"", STRLEN_CONST("\""))
|| query_peek(buff, "'", STRLEN_CONST("'"))) || query_peek(buff, "'", STRLEN_CONST("'")))
buff = query_parse_string(s, len, buff = query_parse_string(s, len,
buff, value, error); buff, value, error);

View File

@ -9090,15 +9090,15 @@ static void ozone_cache_footer_label(
{ {
const char *str = msg_hash_to_str(enum_idx); const char *str = msg_hash_to_str(enum_idx);
/* Determine pixel width */ /* Determine pixel width */
size_t length = strlen(str); size_t _len = strlen(str);
/* Assign string */ /* Assign string */
label->str = str; label->str = str;
label->width = font_driver_get_message_width(ozone->fonts.footer.font, label->str, length, 1.0f); label->width = font_driver_get_message_width(ozone->fonts.footer.font, label->str, _len, 1.0f);
/* If font_driver_get_message_width() fails, /* If font_driver_get_message_width() fails,
* use predetermined glyph_width as a fallback */ * use predetermined glyph_width as a fallback */
if (label->width < 0) if (label->width < 0)
label->width = length * ozone->fonts.footer.glyph_width; label->width = _len * ozone->fonts.footer.glyph_width;
} }
/* Assigns footer label strings (based on current /* Assigns footer label strings (based on current

View File

@ -3036,13 +3036,13 @@ static void rgui_update_dynamic_theme_path(
if ( (rgui->flags & RGUI_FLAG_IS_PLAYLIST) if ( (rgui->flags & RGUI_FLAG_IS_PLAYLIST)
&& (!string_is_empty(rgui->menu_title))) && (!string_is_empty(rgui->menu_title)))
{ {
size_t len = fill_pathname_join_special(rgui->theme_dynamic_path, theme_dir, size_t _len = fill_pathname_join_special(rgui->theme_dynamic_path, theme_dir,
rgui->menu_title, sizeof(rgui->theme_dynamic_path)); rgui->menu_title, sizeof(rgui->theme_dynamic_path));
rgui->theme_dynamic_path[ len] = '.'; rgui->theme_dynamic_path[ _len] = '.';
rgui->theme_dynamic_path[++len] = 'c'; rgui->theme_dynamic_path[++_len] = 'c';
rgui->theme_dynamic_path[++len] = 'f'; rgui->theme_dynamic_path[++_len] = 'f';
rgui->theme_dynamic_path[++len] = 'g'; rgui->theme_dynamic_path[++_len] = 'g';
rgui->theme_dynamic_path[++len] = '\0'; rgui->theme_dynamic_path[++_len] = '\0';
use_playlist_theme = path_is_valid(rgui->theme_dynamic_path); use_playlist_theme = path_is_valid(rgui->theme_dynamic_path);
} }

View File

@ -1163,17 +1163,17 @@ static char *xmb_path_dynamic_wallpaper(xmb_handle_t *xmb)
if (settings->bools.menu_dynamic_wallpaper_enable) if (settings->bools.menu_dynamic_wallpaper_enable)
{ {
const char *dir_dynamic_wallpapers = settings->paths.directory_dynamic_wallpapers; const char *dir_dynamic_wallpapers = settings->paths.directory_dynamic_wallpapers;
size_t len = fill_pathname_join_special( size_t _len = fill_pathname_join_special(
path, path,
dir_dynamic_wallpapers, dir_dynamic_wallpapers,
xmb->title_name, xmb->title_name,
sizeof(path)); sizeof(path));
path[ len] = '.'; path[ _len] = '.';
path[++len] = 'p'; path[++_len] = 'p';
path[++len] = 'n'; path[++_len] = 'n';
path[++len] = 'g'; path[++_len] = 'g';
path[++len] = '\0'; path[++_len] = '\0';
} }
if (!string_is_empty(path) && path_is_valid(path)) if (!string_is_empty(path) && path_is_valid(path))

View File

@ -658,9 +658,9 @@ static uint32_t netplay_impl_magic(void)
size_t i; size_t i;
uint32_t res = 0; uint32_t res = 0;
const char *ver = PACKAGE_VERSION; const char *ver = PACKAGE_VERSION;
size_t len = strlen(ver); size_t _len = strlen(ver);
for (i = 0; i < len; i++) for (i = 0; i < _len; i++)
res ^= ver[i] << (i & 0xf); res ^= ver[i] << (i & 0xf);
res ^= NETPLAY_PROTOCOL_VERSION << (i & 0xf); res ^= NETPLAY_PROTOCOL_VERSION << (i & 0xf);
@ -3549,13 +3549,13 @@ static int handle_mitm_connection(netplay_t *netplay, netplay_address_t *addr,
case MITM_PING_MAGIC: case MITM_PING_MAGIC:
{ {
/* Tunnel server requested for us to reply to a ping request. */ /* Tunnel server requested for us to reply to a ping request. */
void *ping = &netplay->mitm_handler->id_buf.magic; void *ping = &netplay->mitm_handler->id_buf.magic;
size_t len = sizeof(netplay->mitm_handler->id_buf.magic); size_t _len = sizeof(netplay->mitm_handler->id_buf.magic);
netplay->mitm_handler->id_recvd = 0; netplay->mitm_handler->id_recvd = 0;
if (socket_send_all_nonblocking(netplay->listen_fd, if (socket_send_all_nonblocking(netplay->listen_fd,
ping, len, true) != (ssize_t)len) ping, _len, true) != (ssize_t)_len)
{ {
/* We couldn't send our ping reply in one call. Assume error. */ /* We couldn't send our ping reply in one call. Assume error. */
RARCH_ERR("[Netplay] Tunnel ping reply failed.\n"); RARCH_ERR("[Netplay] Tunnel ping reply failed.\n");

View File

@ -291,10 +291,10 @@ static playlist_path_id_t *playlist_path_id_init(const char *path)
if (archive_delim) if (archive_delim)
{ {
char archive_path[PATH_MAX_LENGTH]; char archive_path[PATH_MAX_LENGTH];
size_t len = (1 + archive_delim - real_path); size_t _len = (1 + archive_delim - real_path);
if (len >= PATH_MAX_LENGTH) if (_len >= PATH_MAX_LENGTH)
len = PATH_MAX_LENGTH; _len = PATH_MAX_LENGTH;
strlcpy(archive_path, real_path, len * sizeof(char)); strlcpy(archive_path, real_path, _len * sizeof(char));
path_id->archive_path = strdup(archive_path); path_id->archive_path = strdup(archive_path);
path_id->archive_path_hash = playlist_path_hash(archive_path); path_id->archive_path_hash = playlist_path_hash(archive_path);
@ -642,14 +642,14 @@ static void playlist_free_entry(struct playlist_entry *entry)
void playlist_delete_index(playlist_t *playlist, void playlist_delete_index(playlist_t *playlist,
size_t idx) size_t idx)
{ {
size_t len; size_t _len;
struct playlist_entry *entry_to_delete; struct playlist_entry *entry_to_delete;
if (!playlist) if (!playlist)
return; return;
len = RBUF_LEN(playlist->entries); _len = RBUF_LEN(playlist->entries);
if (idx >= len) if (idx >= _len)
return; return;
/* Free unwanted entry */ /* Free unwanted entry */
@ -659,9 +659,9 @@ void playlist_delete_index(playlist_t *playlist,
/* Shift remaining entries to fill the gap */ /* Shift remaining entries to fill the gap */
memmove(playlist->entries + idx, playlist->entries + idx + 1, memmove(playlist->entries + idx, playlist->entries + idx + 1,
(len - 1 - idx) * sizeof(struct playlist_entry)); (_len - 1 - idx) * sizeof(struct playlist_entry));
RBUF_RESIZE(playlist->entries, len - 1); RBUF_RESIZE(playlist->entries, _len - 1);
playlist->flags |= CNT_PLAYLIST_FLG_MOD; playlist->flags |= CNT_PLAYLIST_FLG_MOD;
} }
@ -1140,7 +1140,7 @@ enum playlist_thumbnail_name_flags playlist_get_next_thumbnail_name_flag(playlis
* install (iOS) * install (iOS)
**/ **/
void playlist_resolve_path(enum playlist_file_mode mode, void playlist_resolve_path(enum playlist_file_mode mode,
bool is_core, char *path, size_t len) bool is_core, char *s, size_t len)
{ {
#ifdef HAVE_COCOATOUCH #ifdef HAVE_COCOATOUCH
char tmp[PATH_MAX_LENGTH]; char tmp[PATH_MAX_LENGTH];
@ -1148,20 +1148,20 @@ void playlist_resolve_path(enum playlist_file_mode mode,
if (mode == PLAYLIST_LOAD) if (mode == PLAYLIST_LOAD)
{ {
if (is_core && if ( is_core
string_starts_with(path, ":/modules/") && && string_starts_with(s, ":/modules/")
string_ends_with(path, ".dylib")) && string_ends_with(s, ".dylib"))
{ {
/* iOS cores used to be packaged as .dylib files in the modules /* iOS cores used to be packaged as .dylib files in the modules
* directory; App Store rules require turning them into Frameworks and * directory; App Store rules require turning them into Frameworks and
* putting them in the Frameworks directory. Because some playlists * putting them in the Frameworks directory. Because some playlists
* include the old core path, we'll translate it here. * include the old core path, we'll translate it here.
*/ */
path[string_index_last_occurance(path, '.')] = '\0'; s[string_index_last_occurance(s, '.')] = '\0';
if (string_ends_with(path, "_ios")) if (string_ends_with(s, "_ios"))
path[string_index_last_occurance(path, '_')] = '\0'; s[string_index_last_occurance(s, '_')] = '\0';
_len += strlcpy(tmp + _len, ":/Frameworks/", STRLEN_CONST(":/Frameworks/") + 1); _len += strlcpy(tmp + _len, ":/Frameworks/", STRLEN_CONST(":/Frameworks/") + 1);
_len += strlcpy(tmp + _len, path + STRLEN_CONST(":/modules/"), sizeof(tmp) - _len); _len += strlcpy(tmp + _len, s + STRLEN_CONST(":/modules/"), sizeof(tmp) - _len);
/* iOS framework names, to quote Apple: /* iOS framework names, to quote Apple:
* "must contain only alphanumerics, dots, hyphens and must not end with a dot." * "must contain only alphanumerics, dots, hyphens and must not end with a dot."
* *
@ -1170,12 +1170,12 @@ void playlist_resolve_path(enum playlist_file_mode mode,
*/ */
string_replace_all_chars(tmp, '_', '.'); string_replace_all_chars(tmp, '_', '.');
strlcpy(tmp + _len, ".framework", sizeof(tmp)); strlcpy(tmp + _len, ".framework", sizeof(tmp));
fill_pathname_expand_special(path, tmp, len); fill_pathname_expand_special(s, tmp, len);
} }
else else
{ {
fill_pathname_expand_special(tmp, path, sizeof(tmp)); fill_pathname_expand_special(tmp, s, sizeof(tmp));
strlcpy(path, tmp, len); strlcpy(s, tmp, len);
} }
} }
else else
@ -1187,9 +1187,9 @@ void playlist_resolve_path(enum playlist_file_mode mode,
* a playlist from another playlist (ex: content history to favorites) * a playlist from another playlist (ex: content history to favorites)
*/ */
char tmp2[PATH_MAX_LENGTH]; char tmp2[PATH_MAX_LENGTH];
fill_pathname_expand_special(tmp, path, sizeof(tmp)); fill_pathname_expand_special(tmp, s, sizeof(tmp));
realpath(tmp, tmp2); realpath(tmp, tmp2);
fill_pathname_abbreviate_special(path, tmp2, len); fill_pathname_abbreviate_special(s, tmp2, len);
} }
#else #else
bool resolve_symlinks = true; bool resolve_symlinks = true;
@ -1207,7 +1207,7 @@ void playlist_resolve_path(enum playlist_file_mode mode,
resolve_symlinks = !play_feature_delivery_enabled(); resolve_symlinks = !play_feature_delivery_enabled();
#endif #endif
path_resolve_realpath(path, len, resolve_symlinks); path_resolve_realpath(s, len, resolve_symlinks);
#endif #endif
} }
@ -1235,7 +1235,7 @@ bool playlist_content_path_is_valid(const char *path)
{ {
char archive_path[PATH_MAX_LENGTH]; char archive_path[PATH_MAX_LENGTH];
const char *delim = path_get_archive_delim(path); const char *delim = path_get_archive_delim(path);
size_t len = 0; size_t _len = 0;
struct string_list *archive_list = NULL; struct string_list *archive_list = NULL;
const char *content_file = NULL; const char *content_file = NULL;
bool content_found = false; bool content_found = false;
@ -1244,9 +1244,12 @@ bool playlist_content_path_is_valid(const char *path)
return false; return false;
/* Get path of 'parent' archive file */ /* Get path of 'parent' archive file */
len = (size_t)(1 + delim - path); _len = (size_t)(1 + delim - path);
strlcpy(archive_path, path, if (_len < PATH_MAX_LENGTH)
(len < PATH_MAX_LENGTH ? len : PATH_MAX_LENGTH) * sizeof(char)); strlcpy(archive_path, path, _len * sizeof(char));
else
strlcpy(archive_path, path,
PATH_MAX_LENGTH * sizeof(char));
/* Check if archive itself exists */ /* Check if archive itself exists */
if (!path_is_valid(archive_path)) if (!path_is_valid(archive_path))
@ -1300,7 +1303,7 @@ bool playlist_content_path_is_valid(const char *path)
bool playlist_push(playlist_t *playlist, bool playlist_push(playlist_t *playlist,
const struct playlist_entry *entry) const struct playlist_entry *entry)
{ {
size_t i, len; size_t i, _len;
char real_core_path[PATH_MAX_LENGTH]; char real_core_path[PATH_MAX_LENGTH];
playlist_path_id_t *path_id = NULL; playlist_path_id_t *path_id = NULL;
const char *core_name = entry->core_name; const char *core_name = entry->core_name;
@ -1347,8 +1350,8 @@ bool playlist_push(playlist_t *playlist,
} }
} }
len = RBUF_LEN(playlist->entries); _len = RBUF_LEN(playlist->entries);
for (i = 0; i < len; i++) for (i = 0; i < _len; i++)
{ {
struct playlist_entry tmp; struct playlist_entry tmp;
bool equal_path = (string_is_empty(path_id->real_path) bool equal_path = (string_is_empty(path_id->real_path)
@ -1475,24 +1478,24 @@ bool playlist_push(playlist_t *playlist,
if (playlist->config.capacity == 0) if (playlist->config.capacity == 0)
goto error; goto error;
if (len == playlist->config.capacity) if (_len == playlist->config.capacity)
{ {
struct playlist_entry *last_entry = &playlist->entries[len - 1]; struct playlist_entry *last_entry = &playlist->entries[_len - 1];
playlist_free_entry(last_entry); playlist_free_entry(last_entry);
len--; _len--;
} }
else else
{ {
/* Allocate memory to fit one more item and resize the buffer */ /* Allocate memory to fit one more item and resize the buffer */
if (!RBUF_TRYFIT(playlist->entries, len + 1)) if (!RBUF_TRYFIT(playlist->entries, _len + 1))
goto error; /* out of memory */ goto error; /* out of memory */
RBUF_RESIZE(playlist->entries, len + 1); RBUF_RESIZE(playlist->entries, _len + 1);
} }
if (playlist->entries) if (playlist->entries)
{ {
memmove(playlist->entries + 1, playlist->entries, memmove(playlist->entries + 1, playlist->entries,
len * sizeof(struct playlist_entry)); _len * sizeof(struct playlist_entry));
playlist->entries[0].path = NULL; playlist->entries[0].path = NULL;
playlist->entries[0].label = NULL; playlist->entries[0].label = NULL;
@ -1564,7 +1567,7 @@ error:
void playlist_write_runtime_file(playlist_t *playlist) void playlist_write_runtime_file(playlist_t *playlist)
{ {
size_t i, len; size_t i, _len;
intfstream_t *file = NULL; intfstream_t *file = NULL;
rjsonwriter_t* writer; rjsonwriter_t* writer;
@ -1600,7 +1603,7 @@ void playlist_write_runtime_file(playlist_t *playlist)
rjsonwriter_raw(writer, "[", 1); rjsonwriter_raw(writer, "[", 1);
rjsonwriter_raw(writer, "\n", 1); rjsonwriter_raw(writer, "\n", 1);
for (i = 0, len = RBUF_LEN(playlist->entries); i < len; i++) for (i = 0, _len = RBUF_LEN(playlist->entries); i < _len; i++)
{ {
rjsonwriter_add_spaces(writer, 4); rjsonwriter_add_spaces(writer, 4);
rjsonwriter_raw(writer, "{", 1); rjsonwriter_raw(writer, "{", 1);
@ -1696,7 +1699,7 @@ void playlist_write_runtime_file(playlist_t *playlist)
rjsonwriter_add_spaces(writer, 4); rjsonwriter_add_spaces(writer, 4);
rjsonwriter_raw(writer, "}", 1); rjsonwriter_raw(writer, "}", 1);
if (i < len - 1) if (i < _len - 1)
rjsonwriter_raw(writer, ",", 1); rjsonwriter_raw(writer, ",", 1);
rjsonwriter_raw(writer, "\n", 1); rjsonwriter_raw(writer, "\n", 1);
@ -1721,7 +1724,7 @@ end:
void playlist_write_file(playlist_t *playlist) void playlist_write_file(playlist_t *playlist)
{ {
size_t i, len; size_t i, _len;
intfstream_t *file = NULL; intfstream_t *file = NULL;
bool compressed = false; bool compressed = false;
@ -1765,7 +1768,7 @@ void playlist_write_file(playlist_t *playlist)
#ifdef RARCH_INTERNAL #ifdef RARCH_INTERNAL
if (playlist->config.old_format) if (playlist->config.old_format)
{ {
for (i = 0, len = RBUF_LEN(playlist->entries); i < len; i++) for (i = 0, _len = RBUF_LEN(playlist->entries); i < _len; i++)
intfstream_printf(file, "%s\n%s\n%s\n%s\n%s\n%s\n", intfstream_printf(file, "%s\n%s\n%s\n%s\n%s\n%s\n",
playlist->entries[i].path ? playlist->entries[i].path : "", playlist->entries[i].path ? playlist->entries[i].path : "",
playlist->entries[i].label ? playlist->entries[i].label : "", playlist->entries[i].label ? playlist->entries[i].label : "",
@ -1965,7 +1968,7 @@ void playlist_write_file(playlist_t *playlist)
rjsonwriter_raw(writer, "[", 1); rjsonwriter_raw(writer, "[", 1);
rjsonwriter_raw(writer, "\n", 1); rjsonwriter_raw(writer, "\n", 1);
for (i = 0, len = RBUF_LEN(playlist->entries); i < len; i++) for (i = 0, _len = RBUF_LEN(playlist->entries); i < _len; i++)
{ {
rjsonwriter_add_spaces(writer, 4); rjsonwriter_add_spaces(writer, 4);
rjsonwriter_raw(writer, "{", 1); rjsonwriter_raw(writer, "{", 1);
@ -2090,7 +2093,7 @@ void playlist_write_file(playlist_t *playlist)
rjsonwriter_add_spaces(writer, 4); rjsonwriter_add_spaces(writer, 4);
rjsonwriter_raw(writer, "}", 1); rjsonwriter_raw(writer, "}", 1);
if (i < len - 1) if (i < _len - 1)
rjsonwriter_raw(writer, ",", 1); rjsonwriter_raw(writer, ",", 1);
rjsonwriter_raw(writer, "\n", 1); rjsonwriter_raw(writer, "\n", 1);
@ -2131,7 +2134,7 @@ end:
*/ */
void playlist_free(playlist_t *playlist) void playlist_free(playlist_t *playlist)
{ {
size_t i, len; size_t i, _len;
if (!playlist) if (!playlist)
return; return;
@ -2162,7 +2165,7 @@ void playlist_free(playlist_t *playlist)
if (playlist->entries) if (playlist->entries)
{ {
for (i = 0, len = RBUF_LEN(playlist->entries); i < len; i++) for (i = 0, _len = RBUF_LEN(playlist->entries); i < _len; i++)
{ {
struct playlist_entry *entry = &playlist->entries[i]; struct playlist_entry *entry = &playlist->entries[i];
@ -2184,11 +2187,11 @@ void playlist_free(playlist_t *playlist)
**/ **/
void playlist_clear(playlist_t *playlist) void playlist_clear(playlist_t *playlist)
{ {
size_t i, len; size_t i, _len;
if (!playlist) if (!playlist)
return; return;
for (i = 0, len = RBUF_LEN(playlist->entries); i < len; i++) for (i = 0, _len = RBUF_LEN(playlist->entries); i < _len; i++)
{ {
struct playlist_entry *entry = &playlist->entries[i]; struct playlist_entry *entry = &playlist->entries[i];
@ -2266,17 +2269,17 @@ static bool JSONStartObjectHandler(void *context)
(pCtx->array_depth == 1) (pCtx->array_depth == 1)
&& !(pCtx->flags & JSON_CTX_FLG_CAPACITY_EXCEEDED)) && !(pCtx->flags & JSON_CTX_FLG_CAPACITY_EXCEEDED))
{ {
size_t len = RBUF_LEN(pCtx->playlist->entries); size_t _len = RBUF_LEN(pCtx->playlist->entries);
if (len < pCtx->playlist->config.capacity) if (_len < pCtx->playlist->config.capacity)
{ {
/* Allocate memory to fit one more item but don't resize the /* Allocate memory to fit one more item but don't resize the
* buffer just yet, wait until JSONEndObjectHandler for that */ * buffer just yet, wait until JSONEndObjectHandler for that */
if (!RBUF_TRYFIT(pCtx->playlist->entries, len + 1)) if (!RBUF_TRYFIT(pCtx->playlist->entries, _len + 1))
{ {
pCtx->flags |= JSON_CTX_FLG_OOM; pCtx->flags |= JSON_CTX_FLG_OOM;
return false; return false;
} }
pCtx->current_entry = &pCtx->playlist->entries[len]; pCtx->current_entry = &pCtx->playlist->entries[_len];
memset(pCtx->current_entry, 0, sizeof(*pCtx->current_entry)); memset(pCtx->current_entry, 0, sizeof(*pCtx->current_entry));
} }
else else
@ -2317,7 +2320,7 @@ static bool JSONEndObjectHandler(void *context)
return true; return true;
} }
static bool JSONStringHandler(void *context, const char *pValue, size_t length) static bool JSONStringHandler(void *context, const char *pValue, size_t len)
{ {
JSONContext *pCtx = (JSONContext *)context; JSONContext *pCtx = (JSONContext *)context;
@ -2326,7 +2329,7 @@ static bool JSONStringHandler(void *context, const char *pValue, size_t length)
&& (pCtx->object_depth == 2) && (pCtx->object_depth == 2)
&& (pCtx->array_depth == 2)) && (pCtx->array_depth == 2))
{ {
if (length && !string_is_empty(pValue)) if (len && !string_is_empty(pValue))
{ {
union string_list_elem_attr attr = {0}; union string_list_elem_attr attr = {0};
@ -2342,7 +2345,7 @@ static bool JSONStringHandler(void *context, const char *pValue, size_t length)
if (pCtx->array_depth == 1) if (pCtx->array_depth == 1)
{ {
if ( pCtx->current_string_val if ( pCtx->current_string_val
&& length && len
&& !string_is_empty(pValue)) && !string_is_empty(pValue))
{ {
if (*pCtx->current_string_val) if (*pCtx->current_string_val)
@ -2356,7 +2359,7 @@ static bool JSONStringHandler(void *context, const char *pValue, size_t length)
if (pCtx->array_depth == 0) if (pCtx->array_depth == 0)
{ {
if ( pCtx->current_string_val if ( pCtx->current_string_val
&& length && len
&& !string_is_empty(pValue)) && !string_is_empty(pValue))
{ {
/* handle any top-level playlist metadata here */ /* handle any top-level playlist metadata here */
@ -2372,7 +2375,7 @@ static bool JSONStringHandler(void *context, const char *pValue, size_t length)
return true; return true;
} }
static bool JSONNumberHandler(void *context, const char *pValue, size_t length) static bool JSONNumberHandler(void *context, const char *pValue, size_t len)
{ {
JSONContext *pCtx = (JSONContext *)context; JSONContext *pCtx = (JSONContext *)context;
@ -2380,7 +2383,7 @@ static bool JSONNumberHandler(void *context, const char *pValue, size_t length)
&& (pCtx->object_depth == 2)) && (pCtx->object_depth == 2))
{ {
if ( (pCtx->array_depth == 1) if ( (pCtx->array_depth == 1)
&& length && len
&& !string_is_empty(pValue)) && !string_is_empty(pValue))
{ {
if (pCtx->current_entry_uint_val) if (pCtx->current_entry_uint_val)
@ -2391,7 +2394,7 @@ static bool JSONNumberHandler(void *context, const char *pValue, size_t length)
{ {
if (pCtx->array_depth == 0) if (pCtx->array_depth == 0)
{ {
if (length && !string_is_empty(pValue)) if (len && !string_is_empty(pValue))
{ {
/* handle any top-level playlist metadata here */ /* handle any top-level playlist metadata here */
if (pCtx->current_meta_label_display_mode_val) if (pCtx->current_meta_label_display_mode_val)
@ -2430,7 +2433,7 @@ static bool JSONBoolHandler(void *context, bool value)
return true; return true;
} }
static bool JSONObjectMemberHandler(void *context, const char *pValue, size_t length) static bool JSONObjectMemberHandler(void *context, const char *pValue, size_t len)
{ {
JSONContext *pCtx = (JSONContext *)context; JSONContext *pCtx = (JSONContext *)context;
@ -2443,7 +2446,7 @@ static bool JSONObjectMemberHandler(void *context, const char *pValue, size_t le
if (pCtx->current_string_val) if (pCtx->current_string_val)
return false; return false;
if (length && (!(pCtx->flags & JSON_CTX_FLG_CAPACITY_EXCEEDED))) if (len && (!(pCtx->flags & JSON_CTX_FLG_CAPACITY_EXCEEDED)))
{ {
pCtx->current_string_val = NULL; pCtx->current_string_val = NULL;
pCtx->current_entry_uint_val = NULL; pCtx->current_entry_uint_val = NULL;
@ -2508,7 +2511,7 @@ static bool JSONObjectMemberHandler(void *context, const char *pValue, size_t le
} }
else if ((pCtx->object_depth == 1) else if ((pCtx->object_depth == 1)
&& (pCtx->array_depth == 0) && (pCtx->array_depth == 0)
&& length) && len)
{ {
pCtx->current_string_val = NULL; pCtx->current_string_val = NULL;
pCtx->current_meta_label_display_mode_val = NULL; pCtx->current_meta_label_display_mode_val = NULL;
@ -2686,7 +2689,7 @@ static bool playlist_read_file(playlist_t *playlist)
} }
else else
{ {
size_t len = RBUF_LEN(playlist->entries); size_t _len = RBUF_LEN(playlist->entries);
char line_buf[PLAYLIST_ENTRIES][PATH_MAX_LENGTH] = {{0}}; char line_buf[PLAYLIST_ENTRIES][PATH_MAX_LENGTH] = {{0}};
/* Unnecessary, but harmless */ /* Unnecessary, but harmless */
@ -2694,7 +2697,7 @@ static bool playlist_read_file(playlist_t *playlist)
line_buf[i][0] = '\0'; line_buf[i][0] = '\0';
/* Read playlist entries */ /* Read playlist entries */
while (len < playlist->config.capacity) while (_len < playlist->config.capacity)
{ {
size_t i; size_t i;
size_t lines_read = 0; size_t lines_read = 0;
@ -2721,13 +2724,13 @@ static bool playlist_read_file(playlist_t *playlist)
{ {
struct playlist_entry* entry; struct playlist_entry* entry;
if (!RBUF_TRYFIT(playlist->entries, len + 1)) if (!RBUF_TRYFIT(playlist->entries, _len + 1))
{ {
res = false; /* out of memory */ res = false; /* out of memory */
goto end; goto end;
} }
RBUF_RESIZE(playlist->entries, len + 1); RBUF_RESIZE(playlist->entries, _len + 1);
entry = &playlist->entries[len++]; entry = &playlist->entries[_len++];
memset(entry, 0, sizeof(*entry)); memset(entry, 0, sizeof(*entry));
@ -2962,16 +2965,16 @@ playlist_t *playlist_init(const playlist_config_t *config)
/* Try auto-fixing paths if enabled, and playlist /* Try auto-fixing paths if enabled, and playlist
* base content directory is different */ * base content directory is different */
if (config->autofix_paths && if ( config->autofix_paths
!string_is_equal(playlist->base_content_directory, && !string_is_equal(playlist->base_content_directory,
config->base_content_directory)) config->base_content_directory))
{ {
if (!string_is_empty(playlist->base_content_directory)) if (!string_is_empty(playlist->base_content_directory))
{ {
size_t i, j, len; size_t i, j, _len;
char tmp_entry_path[PATH_MAX_LENGTH]; char tmp_entry_path[PATH_MAX_LENGTH];
for (i = 0, len = RBUF_LEN(playlist->entries); i < len; i++) for (i = 0, _len = RBUF_LEN(playlist->entries); i < _len; i++)
{ {
struct playlist_entry* entry = &playlist->entries[i]; struct playlist_entry* entry = &playlist->entries[i];
@ -3251,16 +3254,16 @@ bool playlist_entries_are_equal(
bool playlist_index_entries_are_equal( bool playlist_index_entries_are_equal(
playlist_t *playlist, size_t idx_a, size_t idx_b) playlist_t *playlist, size_t idx_a, size_t idx_b)
{ {
size_t len; size_t _len;
struct playlist_entry *entry_a = NULL; struct playlist_entry *entry_a = NULL;
struct playlist_entry *entry_b = NULL; struct playlist_entry *entry_b = NULL;
if (!playlist) if (!playlist)
return false; return false;
len = RBUF_LEN(playlist->entries); _len = RBUF_LEN(playlist->entries);
if ((idx_a >= len) || (idx_b >= len)) if ((idx_a >= _len) || (idx_b >= _len))
return false; return false;
/* Fetch entries */ /* Fetch entries */

View File

@ -141,17 +141,17 @@ void runahead_set_load_content_info(void *data,
#if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB) #if defined(HAVE_DYNAMIC) || defined(HAVE_DYLIB)
static void strcat_alloc(char **dst, const char *s) static void strcat_alloc(char **dst, const char *s)
{ {
size_t len1; size_t _len;
char *src = *dst; char *src = *dst;
if (!src) if (!src)
{ {
if (s) if (s)
{ {
size_t len = strlen(s); size_t __len = strlen(s);
if (len != 0) if (__len != 0)
{ {
char *_dst= (char*)malloc(len + 1); char *_dst= (char*)malloc(__len + 1);
strcpy_literal(_dst, s); strcpy_literal(_dst, s);
src = _dst; src = _dst;
} }
@ -168,13 +168,13 @@ static void strcat_alloc(char **dst, const char *s)
if (!s) if (!s)
return; return;
len1 = strlen(src); _len = strlen(src);
if (!(src = (char*)realloc(src, len1 + strlen(s) + 1))) if (!(src = (char*)realloc(src, _len + strlen(s) + 1)))
return; return;
*dst = src; *dst = src;
strcpy_literal(src + len1, s); strcpy_literal(src + _len, s);
} }
void runahead_secondary_core_destroy(void *data) void runahead_secondary_core_destroy(void *data)
@ -241,10 +241,10 @@ static char *get_tmpdir_alloc(const char *override_dir)
#endif #endif
if (src) if (src)
{ {
size_t len = strlen(src); size_t _len = strlen(src);
if (len != 0) if (_len != 0)
{ {
char *dst = (char*)malloc(len + 1); char *dst = (char*)malloc(_len + 1);
strcpy_literal(dst, src); strcpy_literal(dst, src);
path = dst; path = dst;
} }
@ -270,10 +270,10 @@ static bool write_file_with_random_name(char **temp_dll_path,
if (src) if (src)
{ {
size_t len = strlen(src); size_t _len = strlen(src);
if (len != 0) if (_len != 0)
{ {
char *dst = (char*)malloc(len + 1); char *dst = (char*)malloc(_len + 1);
strcpy_literal(dst, src); strcpy_literal(dst, src);
ext = dst; ext = dst;
} }
@ -1400,10 +1400,10 @@ static const char* preempt_allocate(runloop_state_t *runloop_st,
**/ **/
void preempt_deinit(void *data) void preempt_deinit(void *data)
{ {
size_t i;
runloop_state_t *runloop_st = (runloop_state_t*)data; runloop_state_t *runloop_st = (runloop_state_t*)data;
preempt_t *preempt = runloop_st->preempt_data; preempt_t *preempt = runloop_st->preempt_data;
struct retro_core_t *current_core = &runloop_st->current_core; struct retro_core_t *current_core = &runloop_st->current_core;
size_t i;
if (!preempt) if (!preempt)
return; return;

View File

@ -139,7 +139,6 @@ static void task_cdrom_dump_handler(retro_task_t *task)
} }
case DUMP_STATE_WRITE_CUE: case DUMP_STATE_WRITE_CUE:
{ {
size_t _len;
char output_file[PATH_MAX_LENGTH]; char output_file[PATH_MAX_LENGTH];
char cue_filename[PATH_MAX_LENGTH]; char cue_filename[PATH_MAX_LENGTH];
settings_t *settings = config_get_ptr(); settings_t *settings = config_get_ptr();
@ -159,8 +158,7 @@ static void task_cdrom_dump_handler(retro_task_t *task)
filestream_close(state->file); filestream_close(state->file);
_len = fill_pathname(cue_filename, fill_pathname(cue_filename, state->title,
state->title,
".cue", sizeof(cue_filename)); ".cue", sizeof(cue_filename));
fill_pathname_join_special(output_file, fill_pathname_join_special(output_file,