Conventionalize len variables:

* In function arguments, use 'size_t len'
* Inside the function, use '_len'
* If you need a seciondary len variable inside the function, use '__len'
This commit is contained in:
LibretroAdmin 2024-12-27 05:51:33 +01:00
parent bc819bb412
commit ed58e4a8d8
18 changed files with 188 additions and 195 deletions

View File

@ -445,7 +445,7 @@ bool gfx_widget_start_load_content_animation(void)
* > Use db_name, if available */
if (has_db_name)
{
size_t len = fill_pathname(state->icon_file,
fill_pathname(state->icon_file,
state->system_name,
".png",
sizeof(state->icon_file));
@ -476,7 +476,7 @@ bool gfx_widget_start_load_content_animation(void)
if ( !string_is_empty(core_db_name)
&& !string_is_equal(core_db_name, state->system_name))
{
size_t len = fill_pathname(state->icon_file,
fill_pathname(state->icon_file,
core_db_name,
".png",
sizeof(state->icon_file));

View File

@ -380,7 +380,7 @@ static void config_file_get_realpath(char *s, size_t len,
}
static void config_file_add_sub_conf(config_file_t *conf, char *path,
char *real_path, size_t len, config_file_cb_t *cb)
char *s, size_t len, config_file_cb_t *cb)
{
struct config_include_list *head = conf->includes;
struct config_include_list *node = (struct config_include_list*)
@ -403,13 +403,13 @@ static void config_file_add_sub_conf(config_file_t *conf, char *path,
conf->includes = node;
}
config_file_get_realpath(real_path, len, path,
config_file_get_realpath(s, len, path,
conf->path);
}
size_t config_file_add_reference(config_file_t *conf, char *path)
{
size_t len;
size_t _len;
/* It is expected that the conf has it's path already set */
char short_path[NAME_MAX_LENGTH];
if (!conf->references)
@ -418,9 +418,9 @@ size_t config_file_add_reference(config_file_t *conf, char *path)
conf->references->next = NULL;
conf->references->path = NULL;
}
len = fill_pathname_abbreviated_or_relative(short_path, conf->path, path, sizeof(short_path));
_len = fill_pathname_abbreviated_or_relative(short_path, conf->path, path, sizeof(short_path));
path_linked_list_add_path(conf->references, short_path);
return len;
return _len;
}
static int config_file_load_internal(
@ -1338,62 +1338,62 @@ size_t config_set_double(config_file_t *conf, const char *key, double val)
{
char buf[320];
#ifdef __cplusplus
size_t len = snprintf(buf, sizeof(buf), "%f", (float)val);
size_t _len = snprintf(buf, sizeof(buf), "%f", (float)val);
#elif defined(__STDC_VERSION__) && __STDC_VERSION__>=199901L
size_t len = snprintf(buf, sizeof(buf), "%lf", val);
size_t _len = snprintf(buf, sizeof(buf), "%lf", val);
#else
size_t len = snprintf(buf, sizeof(buf), "%f", (float)val);
size_t _len = snprintf(buf, sizeof(buf), "%f", (float)val);
#endif
config_set_string(conf, key, buf);
return len;
return _len;
}
size_t config_set_float(config_file_t *conf, const char *key, float val)
{
char buf[64];
size_t len = snprintf(buf, sizeof(buf), "%f", val);
size_t _len = snprintf(buf, sizeof(buf), "%f", val);
config_set_string(conf, key, buf);
return len;
return _len;
}
size_t config_set_int(config_file_t *conf, const char *key, int val)
{
char buf[16];
size_t len = snprintf(buf, sizeof(buf), "%d", val);
size_t _len = snprintf(buf, sizeof(buf), "%d", val);
config_set_string(conf, key, buf);
return len;
return _len;
}
size_t config_set_uint(config_file_t *conf, const char *key, unsigned int val)
{
char buf[16];
size_t len = snprintf(buf, sizeof(buf), "%u", val);
size_t _len = snprintf(buf, sizeof(buf), "%u", val);
config_set_string(conf, key, buf);
return len;
return _len;
}
size_t config_set_hex(config_file_t *conf, const char *key, unsigned val)
{
char buf[16];
size_t len = snprintf(buf, sizeof(buf), "%x", val);
size_t _len = snprintf(buf, sizeof(buf), "%x", val);
config_set_string(conf, key, buf);
return len;
return _len;
}
size_t config_set_uint64(config_file_t *conf, const char *key, uint64_t val)
{
char buf[32];
size_t len = snprintf(buf, sizeof(buf), "%" PRIu64, val);
size_t _len = snprintf(buf, sizeof(buf), "%" PRIu64, val);
config_set_string(conf, key, buf);
return len;
return _len;
}
size_t config_set_char(config_file_t *conf, const char *key, char val)
{
char buf[2];
size_t len = snprintf(buf, sizeof(buf), "%c", val);
size_t _len = snprintf(buf, sizeof(buf), "%c", val);
config_set_string(conf, key, buf);
return len;
return _len;
}
/**

View File

@ -99,7 +99,7 @@ struct http_connection_t
**/
void net_http_urlencode(char **dest, const char *source)
{
static const char urlencode_lut[256] =
static const char urlencode_lut[256] =
{
0, /* 0 */
0, /* 1 */
@ -360,9 +360,9 @@ void net_http_urlencode(char **dest, const char *source)
};
/* Assume every character will be encoded, so we need 3 times the space. */
size_t len = strlen(source) * 3 + 1;
size_t count = len;
char *enc = (char*)calloc(1, len);
size_t _len = strlen(source) * 3 + 1;
size_t count = _len;
char *enc = (char*)calloc(1, _len);
*dest = enc;
for (; *source; source++)
@ -381,7 +381,7 @@ void net_http_urlencode(char **dest, const char *source)
while (*++enc);
}
(*dest)[len - 1] = '\0';
(*dest)[_len - 1] = '\0';
}
/**
@ -389,8 +389,7 @@ void net_http_urlencode(char **dest, const char *source)
*
* Re-encode a full URL
**/
void net_http_urlencode_full(char *dest,
const char *source, size_t size)
void net_http_urlencode_full(char *s, const char *source, size_t len)
{
size_t buf_pos;
size_t tmp_len;
@ -418,10 +417,10 @@ void net_http_urlencode_full(char *dest,
tmp = NULL;
net_http_urlencode(&tmp, url_path);
buf_pos = strlcpy(dest, url_domain, size);
dest[ buf_pos] = '/';
dest[++buf_pos] = '\0';
strlcpy(dest + buf_pos, tmp, size - buf_pos);
buf_pos = strlcpy(s, url_domain, len);
s[ buf_pos] = '/';
s[++buf_pos] = '\0';
strlcpy(s + buf_pos, tmp, len - buf_pos);
free(tmp);
}
@ -443,7 +442,7 @@ static int net_http_new_socket(struct http_connection_t *conn)
goto done;
}
/* TODO: Properly figure out what's going wrong when the newer
/* TODO: Properly figure out what's going wrong when the newer
timeout/poll code interacts with mbed and winsock
https://github.com/libretro/RetroArch/issues/14742 */
@ -994,7 +993,7 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
state->error = true;
goto error;
}
state->status = (int)strtoul(state->data
state->status = (int)strtoul(state->data
+ STRLEN_CONST("HTTP/1.1 "), NULL, 10);
state->part = P_HEADER;
}
@ -1191,7 +1190,7 @@ error:
* Report HTTP status. 200, 404, or whatever.
*
* Leaf function.
*
*
* @return HTTP status code.
**/
int net_http_status(struct http_t *state)

View File

@ -134,17 +134,17 @@ char *string_trim_whitespace_left(char *const s)
{
if (s && *s)
{
size_t len = strlen(s);
size_t _len = strlen(s);
char *current = s;
while (*current && ISSPACE((unsigned char)*current))
{
++current;
--len;
--_len;
}
if (s != current)
memmove(s, current, len + 1);
memmove(s, current, _len + 1);
}
return s;
@ -159,13 +159,13 @@ char *string_trim_whitespace_right(char *const s)
{
if (s && *s)
{
size_t len = strlen(s);
char *current = s + len - 1;
size_t _len = strlen(s);
char *current = s + _len - 1;
while (current != s && ISSPACE((unsigned char)*current))
{
--current;
--len;
--_len;
}
current[ISSPACE((unsigned char)*current) ? 0 : 1] = '\0';

View File

@ -617,18 +617,18 @@ int64_t retro_vfs_file_size_impl(libretro_vfs_implementation_file *stream)
return 0;
}
int64_t retro_vfs_file_truncate_impl(libretro_vfs_implementation_file *stream, int64_t length)
int64_t retro_vfs_file_truncate_impl(libretro_vfs_implementation_file *stream, int64_t len)
{
#ifdef _WIN32
if (stream && _chsize(_fileno(stream->fp), length) == 0)
if (stream && _chsize(_fileno(stream->fp), len) == 0)
{
stream->size = length;
stream->size = len;
return 0;
}
#elif !defined(VITA) && !defined(PSP) && !defined(PS2) && !defined(ORBIS) && (!defined(SWITCH) || defined(HAVE_LIBNX))
if (stream && ftruncate(fileno(stream->fp), (off_t)length) == 0)
if (stream && ftruncate(fileno(stream->fp), (off_t)len) == 0)
{
stream->size = length;
stream->size = len;
return 0;
}
#endif
@ -863,9 +863,9 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
SceIoStat stat_buf;
int dir_ret;
char *tmp = strdup(path);
size_t len = strlen(tmp);
if (tmp[len-1] == '/')
tmp[len-1] = '\0';
size_t _len = strlen(tmp);
if (tmp[_len-1] == '/')
tmp[_len-1] = '\0';
dir_ret = sceIoGetstat(tmp, &stat_buf);
free(tmp);
@ -922,16 +922,16 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
/* On GEKKO platforms, paths cannot have
* trailing slashes - we must therefore
* remove them */
size_t len;
size_t _len;
char *path_buf = NULL;
struct stat stat_buf;
if (!(path_buf = strdup(path)))
return 0;
if ((len = strlen(path_buf)) > 0)
if (path_buf[len - 1] == '/')
path_buf[len - 1] = '\0';
if ((_len = strlen(path_buf)) > 0)
if (path_buf[_len - 1] == '/')
path_buf[_len - 1] = '\0';
if (stat(path_buf, &stat_buf) < 0)
{
@ -940,7 +940,7 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
}
free(path_buf);
if (size)
*size = (int32_t)stat_buf.st_size;
@ -1007,11 +1007,11 @@ int retro_vfs_mkdir_impl(const char *dir)
if (dir_buf)
{
size_t len = strlen(dir_buf);
size_t _len = strlen(dir_buf);
if (len > 0)
if (dir_buf[len - 1] == '/')
dir_buf[len - 1] = '\0';
if (_len > 0)
if (dir_buf[_len - 1] == '/')
dir_buf[_len - 1] = '\0';
ret = mkdir(dir_buf, 0750);

View File

@ -923,7 +923,7 @@ bool manual_content_scan_get_task_config(
manual_content_scan_task_config_t *task_config,
const char *path_dir_playlist)
{
size_t len;
size_t _len;
if (!task_config)
return false;
@ -983,13 +983,13 @@ bool manual_content_scan_get_task_config(
/* Now we have a valid system name, can generate
* a 'database' name... */
len = strlcpy(
_len = strlcpy(
task_config->database_name,
task_config->system_name,
sizeof(task_config->database_name));
strlcpy(task_config->database_name + len,
strlcpy(task_config->database_name + _len,
".lpl",
sizeof(task_config->database_name) - len);
sizeof(task_config->database_name) - _len);
/* ...which can in turn be used to generate the
* playlist path */

View File

@ -328,14 +328,14 @@ static void contentless_cores_load_icons(contentless_cores_state_t *state)
struct texture_image ti;
const char *icon_name =
core_info->databases_list->elems[0].data;
size_t len = fill_pathname_join_special(
size_t _len = fill_pathname_join_special(
icon_path, icon_directory,
icon_name, sizeof(icon_path));
icon_path[ len] = '.';
icon_path[++len] = 'p';
icon_path[++len] = 'n';
icon_path[++len] = 'g';
icon_path[++len] = '\0';
icon_path[ _len] = '.';
icon_path[++_len] = 'p';
icon_path[++_len] = 'n';
icon_path[++_len] = 'g';
icon_path[++_len] = '\0';
ti.pixels = NULL;
ti.width = 0;

View File

@ -218,14 +218,14 @@ static void ex_arena_free(ex_arena *arena)
/* Hash function */
static uint32_t ex_hash32_nocase_filtered(
const unsigned char* str, size_t len,
const unsigned char *s, size_t len,
unsigned char f_first, unsigned char f_last)
{
const unsigned char *end = NULL;
uint32_t hash = (uint32_t)0x811c9dc5;
for (end = str + len; str != end;)
for (end = s + len; s != end;)
{
unsigned char c = *(str++);
unsigned char c = *(s++);
if (c >= f_first && c <= f_last)
hash = ((hash * (uint32_t)0x01000193)
^ (uint32_t)((c >= 'A' && c <= 'Z')
@ -316,7 +316,7 @@ static void explore_add_unique_string(
for (p = str + 1;; p++)
{
size_t len = 0;
size_t _len = 0;
uint32_t hash = 0;
explore_string_t* entry = NULL;
@ -346,18 +346,18 @@ static void explore_add_unique_string(
p--;
}
len = p - str;
_len = p - str;
hash = ex_hash32_nocase_filtered(
(unsigned char*)str, len, '0', 255);
(unsigned char*)str, _len, '0', 255);
entry = RHMAP_GET(maps[cat], hash);
if (!entry)
{
entry = (explore_string_t*)
ex_arena_alloc(&state->arena,
sizeof(explore_string_t) + len);
memcpy(entry->str, str, len);
entry->str[len] = '\0';
sizeof(explore_string_t) + _len);
memcpy(entry->str, str, _len);
entry->str[_len] = '\0';
RBUF_PUSH(state->by[cat], entry);
RHMAP_SET(maps[cat], hash, entry);
}
@ -400,7 +400,7 @@ static void explore_unload_icons(explore_state_t *state)
static void explore_load_icons(explore_state_t *state)
{
char path[PATH_MAX_LENGTH];
size_t i, pathlen, system_count;
size_t i, _len, system_count;
if (!state)
return;
@ -420,16 +420,16 @@ static void explore_load_icons(explore_state_t *state)
if (string_is_empty(path))
return;
pathlen = fill_pathname_slash(path, sizeof(path));
_len = fill_pathname_slash(path, sizeof(path));
for (i = 0; i != system_count; i++)
{
struct texture_image ti;
size_t _len = pathlen;
_len += strlcpy(path + pathlen,
size_t __len = _len;
__len += strlcpy(path + _len,
state->by[EXPLORE_BY_SYSTEM][i]->str,
sizeof(path) - pathlen);
strlcpy(path + _len, ".png", sizeof(path) - _len);
sizeof(path) - _len);
strlcpy(path + __len, ".png", sizeof(path) - __len);
if (!path_is_valid(path))
continue;
@ -768,22 +768,22 @@ explore_state_t *menu_explore_build_list(const char *directory_playlist,
#ifdef EXPLORE_SHOW_ORIGINAL_TITLE
if (original_title && *original_title)
{
size_t len = strlen(original_title) + 1;
size_t _len = strlen(original_title) + 1;
e->original_title = (char*)
ex_arena_alloc(&state->arena, len);
memcpy(e->original_title, original_title, len);
ex_arena_alloc(&state->arena, _len);
memcpy(e->original_title, original_title, _len);
}
#endif
if (RBUF_LEN(split_buf))
{
size_t len;
size_t _len;
RBUF_PUSH(split_buf, NULL); /* terminator */
len = RBUF_SIZEOF(split_buf);
_len = RBUF_SIZEOF(split_buf);
e->split = (explore_string_t **)
ex_arena_alloc(&state->arena, len);
memcpy(e->split, split_buf, len);
ex_arena_alloc(&state->arena, _len);
memcpy(e->split, split_buf, _len);
RBUF_CLEAR(split_buf);
}
@ -809,14 +809,14 @@ explore_state_t *menu_explore_build_list(const char *directory_playlist,
for (i = 0; i != EXPLORE_CAT_COUNT; i++)
{
uint32_t idx;
size_t len = RBUF_LEN(state->by[i]);
size_t _len = RBUF_LEN(state->by[i]);
if (state->by[i])
qsort(state->by[i], len, sizeof(*state->by[i]),
qsort(state->by[i], _len, sizeof(*state->by[i]),
(explore_by_info[i].is_numeric ?
explore_qsort_func_nums : explore_qsort_func_strings));
for (idx = 0; idx != len; idx++)
for (idx = 0; idx != _len; idx++)
state->by[i][idx]->idx = idx;
RHMAP_FREE(cat_maps[i]);
@ -838,14 +838,13 @@ static int explore_action_get_title(
return 0;
}
static void explore_append_title(explore_state_t *state,
static void explore_append_title(char *s, size_t len,
const char* fmt, ...)
{
va_list ap;
size_t len = strlen(state->title);
size_t _len = strlen(s);
va_start(ap, fmt);
vsnprintf(state->title + len,
sizeof(state->title) - len, fmt, ap);
vsnprintf(s + len, len - _len, fmt, ap);
va_end(ap);
}
@ -1367,27 +1366,27 @@ unsigned menu_displaylist_explore(file_list_t *list, settings_t *settings)
unsigned cat = state->view_cats[i];
explore_string_t **entries = state->by[cat];
explore_string_t *match = state->view_match[i];
explore_append_title(state, "%s%s: ", (i ? " / " : ""),
explore_append_title(state->title, sizeof(state->title), "%s%s: ", (i ? " / " : ""),
msg_hash_to_str(explore_by_info[cat].name_enum));
switch (state->view_op[i])
{
case EXPLORE_OP_EQUAL:
explore_append_title(state, "%s", (match
explore_append_title(state->title, sizeof(state->title), "%s", (match
? match->str
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UNKNOWN)));
break;
case EXPLORE_OP_MIN:
explore_append_title(state, "%s - %s",
explore_append_title(state->title, sizeof(state->title), "%s - %s",
entries[state->view_idx_min[i]]->str,
entries[RBUF_LEN(entries)-1]->str);
break;
case EXPLORE_OP_MAX:
explore_append_title(state, "%s - %s",
explore_append_title(state->title, sizeof(state->title), "%s - %s",
entries[0]->str,
entries[state->view_idx_max[i]]->str);
break;
case EXPLORE_OP_RANGE:
explore_append_title(state, "%s - %s",
explore_append_title(state->title, sizeof(state->title), "%s - %s",
entries[state->view_idx_min[i]]->str,
entries[state->view_idx_max[i]]->str);
break;
@ -1396,7 +1395,7 @@ unsigned menu_displaylist_explore(file_list_t *list, settings_t *settings)
/* append string search to title */
if (*state->view_search)
explore_append_title(state, "%s%s: '%s'",
explore_append_title(state->title, sizeof(state->title), "%s%s: '%s'",
(state->view_levels ? " / " : ""),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME),
state->view_search);
@ -1418,7 +1417,7 @@ unsigned menu_displaylist_explore(file_list_t *list, settings_t *settings)
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_TAB),
sizeof(state->title));
else
explore_append_title(state, " / %s",
explore_append_title(state->title, sizeof(state->title), " / %s",
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADDITIONAL_FILTER));
if (!*state->view_search)
@ -1515,7 +1514,7 @@ unsigned menu_displaylist_explore(file_list_t *list, settings_t *settings)
EXPLORE_TYPE_FILTERNULL, explore_action_ok);
}
explore_append_title(state, "%s",
explore_append_title(state->title, sizeof(state->title), "%s",
msg_hash_to_str(explore_by_info[current_cat].by_enum));
}
else if (current_type < EXPLORE_TYPE_FIRSTITEM
@ -1539,19 +1538,19 @@ unsigned menu_displaylist_explore(file_list_t *list, settings_t *settings)
bool filtered_category_have_unknown = false;
if (is_show_all)
explore_append_title(state,
explore_append_title(state->title, sizeof(state->title),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ALL));
if (is_filtered_category)
{
/* List filtered items in a selected explore by category */
if (!view_levels || view_cats[view_levels - 1] != current_cat)
explore_append_title(state, " / %s",
explore_append_title(state->title, sizeof(state->title), " / %s",
msg_hash_to_str(explore_by_info[current_cat].by_enum));
else
{
/* List all items again when setting a range filter */
explore_append_title(state, " (%s)",
explore_append_title(state->title, sizeof(state->title), " (%s)",
msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_RANGE_FILTER));
view_levels--;
}
@ -1661,7 +1660,7 @@ SKIP_ENTRY:;
qsort(list->list, list->size, sizeof(*list->list),
explore_qsort_func_menulist);
explore_append_title(state,
explore_append_title(state->title, sizeof(state->title),
" (%u)", (unsigned)(list->size - first_list_entry));
if (is_filtered_category && filtered_category_have_unknown)

View File

@ -82,9 +82,9 @@ static void connmanctl_refresh_services(connman_t *connman)
size_t ssid_len;
wifi_network_info_t entry;
struct string_list* list = NULL;
size_t len = strlen(line);
if (len > 0 && line[len-1] == '\n')
line[--len] = '\0';
size_t _len = strlen(line);
if (_len > 0 && line[_len-1] == '\n')
line[--_len] = '\0';
/* Parse lines directly and store net info directly */
memset(&entry, 0, sizeof(entry));

View File

@ -91,14 +91,11 @@ void logger_send(const char *__format,...)
void logger_send_v(const char *__format, va_list args)
{
static char sendbuf[4096];
int len;
vsnprintf(sendbuf,4000,__format, args);
len = strlen(sendbuf);
int _len = vsnprintf(sendbuf,4000,__format, args);
sendto(g_sid,
sendbuf,
len,
_len,
MSG_DONTWAIT,
(struct sockaddr*)&target,
sizeof(target));

View File

@ -549,8 +549,8 @@ static void runtime_log_get_last_played_time(runtime_log_t *runtime_log,
mktime(time_info);
}
static bool runtime_last_played_human(runtime_log_t *runtime_log,
char *str, size_t len)
static size_t runtime_last_played_human(runtime_log_t *runtime_log,
char *s, size_t len)
{
size_t _len;
struct tm time_info;
@ -573,7 +573,7 @@ static bool runtime_last_played_human(runtime_log_t *runtime_log,
float periods[6] = {60.0f, 60.0f, 24.0f, 7.0f, 4.35f, 12.0f};
if (!runtime_log)
return false;
return 0;
/* Get time */
runtime_log_get_last_played_time(runtime_log, &time_info);
@ -582,34 +582,34 @@ static bool runtime_last_played_human(runtime_log_t *runtime_log,
current = time(NULL);
if ((delta = current - last_played) <= 0)
return false;
return 0;
for (i = 0; delta >= periods[i] && i < sizeof(periods) - 1; i++)
delta /= periods[i];
/* Generate string */
_len = snprintf(str, len, "%u ", (int)delta);
_len += strlcpy(str + _len,
_len = snprintf(s, len, "%u ", (int)delta);
_len += strlcpy(s + _len,
msg_hash_to_str((enum msg_hash_enums)units[i][(delta == 1) ? 0 : 1]),
len - _len);
str[ _len] = ' ';
str[++_len] = '\0';
strlcpy(str + _len,
s[ _len] = ' ';
s[++_len] = '\0';
_len += strlcpy(s + _len,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_TIME_UNIT_AGO),
len - _len);
return true;
return _len;
}
/* Gets last played entry value as a pre-formatted string */
void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
char *str, size_t len,
char *s, size_t len,
enum playlist_sublabel_last_played_style_type timedate_style,
enum playlist_sublabel_last_played_date_separator_type date_separator)
{
const char *format_str = "";
size_t _len = strlcpy(str, msg_hash_to_str(
size_t _len = strlcpy(s, msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), len);
if (runtime_log)
@ -752,7 +752,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
/* Get time */
struct tm time_info;
runtime_log_get_last_played_time(runtime_log, &time_info);
strftime_am_pm(str + _len, len - _len, format_str, &time_info);
strftime_am_pm(s + _len, len - _len, format_str, &time_info);
return;
}
@ -772,7 +772,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %04u-%02u-%02u %02u:%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.year,
runtime_log->last_played.month,
runtime_log->last_played.day,
@ -792,7 +792,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %04u-%02u-%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.year,
runtime_log->last_played.month,
runtime_log->last_played.day);
@ -810,7 +810,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %04u-%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.year,
runtime_log->last_played.month);
return;
@ -827,7 +827,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %02u-%02u-%04u %02u:%02u:%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.month,
runtime_log->last_played.day,
runtime_log->last_played.year,
@ -848,7 +848,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %02u-%02u-%04u %02u:%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.month,
runtime_log->last_played.day,
runtime_log->last_played.year,
@ -868,7 +868,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %02u-%02u %02u:%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.month,
runtime_log->last_played.day,
runtime_log->last_played.hour,
@ -887,7 +887,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %02u-%02u-%04u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.month,
runtime_log->last_played.day,
runtime_log->last_played.year);
@ -905,7 +905,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %02u-%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.month,
runtime_log->last_played.day);
return;
@ -922,7 +922,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %02u-%02u-%04u %02u:%02u:%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.day,
runtime_log->last_played.month,
runtime_log->last_played.year,
@ -943,7 +943,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %02u-%02u-%04u %02u:%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.day,
runtime_log->last_played.month,
runtime_log->last_played.year,
@ -963,7 +963,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %02u-%02u %02u:%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.day,
runtime_log->last_played.month,
runtime_log->last_played.hour,
@ -982,7 +982,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %02u-%02u-%04u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.day,
runtime_log->last_played.month,
runtime_log->last_played.year);
@ -1000,14 +1000,14 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %02u-%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.day, runtime_log->last_played.month);
return;
case PLAYLIST_LAST_PLAYED_STYLE_AGO:
str[ _len] = ' ';
str[++_len] = '\0';
if (!(runtime_last_played_human(runtime_log, str + _len, len - _len - 2)))
strlcat(str + _len,
s[ _len] = ' ';
s[++_len] = '\0';
if ((runtime_last_played_human(runtime_log, s + _len, len - _len - 2)) > 0)
strlcat(s + _len,
msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER),
len - _len - 2);
@ -1026,7 +1026,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %04u-%02u-%02u %02u:%02u:%02u";
break;
}
snprintf(str + _len, len - _len, format_str,
snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.year,
runtime_log->last_played.month,
runtime_log->last_played.day,
@ -1037,7 +1037,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
}
}
else
snprintf(str + _len, len - _len,
snprintf(s + _len, len - _len,
" %s", msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER));
}

View File

@ -555,13 +555,13 @@ static bool content_file_list_set_info(
if ((archive_delim = path_get_archive_delim(path)))
{
char archive_path[PATH_MAX_LENGTH];
size_t len = 0;
size_t _len = 0;
/* Extract path of parent archive */
if ((len = (size_t)(1 + archive_delim - path))
if ((_len = (size_t)(1 + archive_delim - path))
>= PATH_MAX_LENGTH)
len = PATH_MAX_LENGTH;
_len = PATH_MAX_LENGTH;
strlcpy(archive_path, path, len * sizeof(char));
strlcpy(archive_path, path, _len * sizeof(char));
if (!string_is_empty(archive_path))
file_info->archive_path = strdup(archive_path);
@ -2867,7 +2867,7 @@ bool content_set_subsystem_by_name(const char* subsystem_name)
return false;
}
void content_get_subsystem_friendly_name(const char* subsystem_name, char* subsystem_friendly_name, size_t len)
void content_get_subsystem_friendly_name(const char* subsystem_name, char *s, size_t len)
{
unsigned i = 0;
runloop_state_t *runloop_st = runloop_state_get_ptr();
@ -2883,12 +2883,10 @@ void content_get_subsystem_friendly_name(const char* subsystem_name, char* subsy
{
if (string_is_equal(subsystem_name, subsystem->ident))
{
strlcpy(subsystem_friendly_name, subsystem->desc, len);
strlcpy(s, subsystem->desc, len);
break;
}
}
return;
}
/* Add a rom to the subsystem ROM buffer */

View File

@ -166,12 +166,12 @@ task_finished:
if (http->handle)
{
size_t len = 0;
char *tmp = (char*)net_http_data(http->handle, &len, false);
size_t _len = 0;
char *tmp = (char*)net_http_data(http->handle, &_len, false);
struct string_list *headers = net_http_headers(http->handle);
if (!tmp)
tmp = (char*)net_http_data(http->handle, &len, true);
tmp = (char*)net_http_data(http->handle, &_len, true);
if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
{
@ -188,7 +188,7 @@ task_finished:
data = (http_transfer_data_t*)malloc(sizeof(*data));
data->data = tmp;
data->headers = headers;
data->len = len;
data->len = _len;
data->status = net_http_status(http->handle);
task_set_data(task, data);
@ -199,9 +199,9 @@ task_finished:
task_set_error(task, strldup("Download failed.",
sizeof("Download failed.")));
}
net_http_delete(http->handle);
} else if (http->error)
}
else if (http->error)
task_set_error(task, strldup("Internal error.",
sizeof("Internal error.")));
@ -408,9 +408,9 @@ void *task_push_webdav_move(const char *url,
const char *dest, bool mute, const char *headers,
retro_task_callback_t cb, void *userdata)
{
size_t _len;
struct http_connection_t *conn;
char dest_header[PATH_MAX_LENGTH + 512];
size_t len;
if (string_is_empty(url))
return NULL;
@ -418,12 +418,12 @@ void *task_push_webdav_move(const char *url,
if (!(conn = net_http_connection_new(url, "MOVE", NULL)))
return NULL;
len = strlcpy(dest_header, "Destination: ", sizeof(dest_header));
len += strlcpy(dest_header + len, dest, sizeof(dest_header) - len);
len += strlcpy(dest_header + len, "\r\n", sizeof(dest_header) - len);
_len = strlcpy(dest_header, "Destination: ", sizeof(dest_header));
_len += strlcpy(dest_header + _len, dest, sizeof(dest_header) - _len);
_len += strlcpy(dest_header + _len, "\r\n", sizeof(dest_header) - _len);
if (headers)
strlcpy(dest_header + len, headers, sizeof(dest_header) - len);
strlcpy(dest_header + _len, headers, sizeof(dest_header) - _len);
net_http_connection_set_headers(conn, dest_header);

View File

@ -296,8 +296,8 @@ bool task_image_load_handler(retro_task_t *task)
case IMAGE_STATUS_TRANSFER_PARSE:
if (image->handle && image->cb)
{
size_t len = 0;
if (image->cb(nbio, len) == -1)
size_t _len = 0;
if (image->cb(nbio, _len) == -1)
return false;
}
if (image->flags & IMAGE_FLAG_IS_BLOCKING_ON_PROCESSING)
@ -322,8 +322,8 @@ bool task_image_load_handler(retro_task_t *task)
case IMAGE_STATUS_PROCESS_TRANSFER_PARSE:
if (image->handle && image->cb)
{
size_t len = 0;
if (image->cb(nbio, len) == -1)
size_t _len = 0;
if (image->cb(nbio, _len) == -1)
return false;
}
if (!(image->flags & IMAGE_FLAG_IS_FINISHED))

View File

@ -450,17 +450,17 @@ static bool content_write_serialized_state(void* buffer,
bool content_serialize_state_rewind(void* buffer, size_t buffer_size)
{
rastate_size_info_t size;
size_t len = content_get_rastate_size(&size, true);
if (len == 0)
size_t _len = content_get_rastate_size(&size, true);
if (_len == 0)
return false;
if (len > buffer_size)
if (_len > buffer_size)
{
#ifdef DEBUG
static size_t last_reported_len = 0;
if (len != last_reported_len)
if (_len != last_reported_len)
{
last_reported_len = len;
RARCH_WARN("Rewind state size exceeds frame size (%zu > %zu).\n", len, buffer_size);
last_reported_len = _len;
RARCH_WARN("Rewind state size exceeds frame size (%zu > %zu).\n", _len, buffer_size);
}
#endif
return false;
@ -468,12 +468,12 @@ bool content_serialize_state_rewind(void* buffer, size_t buffer_size)
return content_write_serialized_state(buffer, &size, true);
}
static void *content_get_serialized_data(size_t* serial_size)
static void *content_get_serialized_data(size_t *serial_size)
{
size_t len;
size_t _len;
void* data;
rastate_size_info_t size;
if ((len = content_get_rastate_size(&size, false)) == 0)
if ((_len = content_get_rastate_size(&size, false)) == 0)
return NULL;
/* Ensure buffer is initialised to zero
@ -481,7 +481,7 @@ static void *content_get_serialized_data(size_t* serial_size)
* sizes when core requests a larger buffer
* than it needs (and leaves the excess
* as uninitialised garbage) */
if (!(data = calloc(len, 1)))
if (!(data = calloc(_len, 1)))
return NULL;
if (!content_write_serialized_state(data, &size, false))

View File

@ -1413,7 +1413,7 @@ void MainWindow::deleteCurrentPlaylistItem()
QString MainWindow::getPlaylistDefaultCore(QString plName)
{
size_t len;
size_t _len;
playlist_config_t playlist_config;
char playlist_path[PATH_MAX_LENGTH];
QByteArray plNameByteArray = plName.toUtf8();
@ -1434,12 +1434,12 @@ QString MainWindow::getPlaylistDefaultCore(QString plName)
return corePath;
/* Get playlist path */
len = fill_pathname_join_special(
_len = fill_pathname_join_special(
playlist_path, settings->paths.directory_playlist,
plNameCString, sizeof(playlist_path));
strlcpy(playlist_path + len,
strlcpy(playlist_path + _len,
".lpl",
sizeof(playlist_path) - len);
sizeof(playlist_path) - _len);
/* Load playlist, if required */
if (cachedPlaylist)

View File

@ -728,7 +728,7 @@ enum
&& icons->size > 1)
{
int i;
size_t len = 0;
size_t _len = 0;
char *options = NULL;
const char *icon_name;
@ -736,12 +736,12 @@ enum
icon_name = [[application alternateIconName] cStringUsingEncoding:kCFStringEncodingUTF8]; /* need to ask uico_st for this */
for (i = 0; i < (int)icons->size; i++)
{
len += strlen(icons->elems[i].data) + 1;
_len += strlen(icons->elems[i].data) + 1;
if (string_is_equal(icon_name, icons->elems[i].data))
appicon_setting->value.target.string = icons->elems[i].data;
}
options = (char*)calloc(len, sizeof(char));
string_list_join_concat(options, len, icons, "|");
options = (char*)calloc(_len, sizeof(char));
string_list_join_concat(options, _len, icons, "|");
if (appicon_setting->values)
free((void*)appicon_setting->values);
appicon_setting->values = options;

View File

@ -2478,14 +2478,14 @@ QVector<QHash<QString, QString> > MainWindow::getCoreInfo()
firmware_info.directory.system = settings->paths.directory_system;
else
{
size_t len = strlen(tmp_path);
size_t _len = strlen(tmp_path);
/* Removes trailing slash (unless root dir), doesn't really matter
* but it's more consistent with how the path is stored and
* displayed without 'System Files are in Content Directory' */
if ( string_count_occurrences_single_character(tmp_path, PATH_DEFAULT_SLASH_C()) > 1
&& tmp_path[len - 1] == PATH_DEFAULT_SLASH_C())
tmp_path[len - 1] = '\0';
&& tmp_path[_len - 1] == PATH_DEFAULT_SLASH_C())
tmp_path[_len - 1] = '\0';
firmware_info.directory.system = tmp_path;
}