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 */ * > Use db_name, if available */
if (has_db_name) if (has_db_name)
{ {
size_t len = fill_pathname(state->icon_file, fill_pathname(state->icon_file,
state->system_name, state->system_name,
".png", ".png",
sizeof(state->icon_file)); sizeof(state->icon_file));
@ -476,7 +476,7 @@ bool gfx_widget_start_load_content_animation(void)
if ( !string_is_empty(core_db_name) if ( !string_is_empty(core_db_name)
&& !string_is_equal(core_db_name, state->system_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, core_db_name,
".png", ".png",
sizeof(state->icon_file)); 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, 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 *head = conf->includes;
struct config_include_list *node = (struct config_include_list*) 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; conf->includes = node;
} }
config_file_get_realpath(real_path, len, path, config_file_get_realpath(s, len, path,
conf->path); conf->path);
} }
size_t config_file_add_reference(config_file_t *conf, char *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 */ /* It is expected that the conf has it's path already set */
char short_path[NAME_MAX_LENGTH]; char short_path[NAME_MAX_LENGTH];
if (!conf->references) 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->next = NULL;
conf->references->path = 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); path_linked_list_add_path(conf->references, short_path);
return len; return _len;
} }
static int config_file_load_internal( 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]; char buf[320];
#ifdef __cplusplus #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 #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 #else
size_t len = snprintf(buf, sizeof(buf), "%f", (float)val); size_t _len = snprintf(buf, sizeof(buf), "%f", (float)val);
#endif #endif
config_set_string(conf, key, buf); config_set_string(conf, key, buf);
return len; return _len;
} }
size_t config_set_float(config_file_t *conf, const char *key, float val) size_t config_set_float(config_file_t *conf, const char *key, float val)
{ {
char buf[64]; 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); config_set_string(conf, key, buf);
return len; return _len;
} }
size_t config_set_int(config_file_t *conf, const char *key, int val) size_t config_set_int(config_file_t *conf, const char *key, int val)
{ {
char buf[16]; 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); 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) size_t config_set_uint(config_file_t *conf, const char *key, unsigned int val)
{ {
char buf[16]; 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); config_set_string(conf, key, buf);
return len; return _len;
} }
size_t config_set_hex(config_file_t *conf, const char *key, unsigned val) size_t config_set_hex(config_file_t *conf, const char *key, unsigned val)
{ {
char buf[16]; 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); 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) size_t config_set_uint64(config_file_t *conf, const char *key, uint64_t val)
{ {
char buf[32]; 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); config_set_string(conf, key, buf);
return len; return _len;
} }
size_t config_set_char(config_file_t *conf, const char *key, char val) size_t config_set_char(config_file_t *conf, const char *key, char val)
{ {
char buf[2]; 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); 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) void net_http_urlencode(char **dest, const char *source)
{ {
static const char urlencode_lut[256] = static const char urlencode_lut[256] =
{ {
0, /* 0 */ 0, /* 0 */
0, /* 1 */ 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. */ /* Assume every character will be encoded, so we need 3 times the space. */
size_t len = strlen(source) * 3 + 1; size_t _len = strlen(source) * 3 + 1;
size_t count = len; size_t count = _len;
char *enc = (char*)calloc(1, len); char *enc = (char*)calloc(1, _len);
*dest = enc; *dest = enc;
for (; *source; source++) for (; *source; source++)
@ -381,7 +381,7 @@ void net_http_urlencode(char **dest, const char *source)
while (*++enc); 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 * Re-encode a full URL
**/ **/
void net_http_urlencode_full(char *dest, void net_http_urlencode_full(char *s, const char *source, size_t len)
const char *source, size_t size)
{ {
size_t buf_pos; size_t buf_pos;
size_t tmp_len; size_t tmp_len;
@ -418,10 +417,10 @@ void net_http_urlencode_full(char *dest,
tmp = NULL; tmp = NULL;
net_http_urlencode(&tmp, url_path); net_http_urlencode(&tmp, url_path);
buf_pos = strlcpy(dest, url_domain, size); buf_pos = strlcpy(s, url_domain, len);
dest[ buf_pos] = '/'; s[ buf_pos] = '/';
dest[++buf_pos] = '\0'; s[++buf_pos] = '\0';
strlcpy(dest + buf_pos, tmp, size - buf_pos); strlcpy(s + buf_pos, tmp, len - buf_pos);
free(tmp); free(tmp);
} }
@ -443,7 +442,7 @@ static int net_http_new_socket(struct http_connection_t *conn)
goto done; 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 timeout/poll code interacts with mbed and winsock
https://github.com/libretro/RetroArch/issues/14742 */ 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; state->error = true;
goto error; goto error;
} }
state->status = (int)strtoul(state->data state->status = (int)strtoul(state->data
+ STRLEN_CONST("HTTP/1.1 "), NULL, 10); + STRLEN_CONST("HTTP/1.1 "), NULL, 10);
state->part = P_HEADER; state->part = P_HEADER;
} }
@ -1191,7 +1190,7 @@ error:
* Report HTTP status. 200, 404, or whatever. * Report HTTP status. 200, 404, or whatever.
* *
* Leaf function. * Leaf function.
* *
* @return HTTP status code. * @return HTTP status code.
**/ **/
int net_http_status(struct http_t *state) 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) if (s && *s)
{ {
size_t len = strlen(s); size_t _len = strlen(s);
char *current = s; char *current = s;
while (*current && ISSPACE((unsigned char)*current)) while (*current && ISSPACE((unsigned char)*current))
{ {
++current; ++current;
--len; --_len;
} }
if (s != current) if (s != current)
memmove(s, current, len + 1); memmove(s, current, _len + 1);
} }
return s; return s;
@ -159,13 +159,13 @@ char *string_trim_whitespace_right(char *const s)
{ {
if (s && *s) if (s && *s)
{ {
size_t len = strlen(s); size_t _len = strlen(s);
char *current = s + len - 1; char *current = s + _len - 1;
while (current != s && ISSPACE((unsigned char)*current)) while (current != s && ISSPACE((unsigned char)*current))
{ {
--current; --current;
--len; --_len;
} }
current[ISSPACE((unsigned char)*current) ? 0 : 1] = '\0'; 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; 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 #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; return 0;
} }
#elif !defined(VITA) && !defined(PSP) && !defined(PS2) && !defined(ORBIS) && (!defined(SWITCH) || defined(HAVE_LIBNX)) #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; return 0;
} }
#endif #endif
@ -863,9 +863,9 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
SceIoStat stat_buf; SceIoStat stat_buf;
int dir_ret; int dir_ret;
char *tmp = strdup(path); char *tmp = strdup(path);
size_t len = strlen(tmp); size_t _len = strlen(tmp);
if (tmp[len-1] == '/') if (tmp[_len-1] == '/')
tmp[len-1] = '\0'; tmp[_len-1] = '\0';
dir_ret = sceIoGetstat(tmp, &stat_buf); dir_ret = sceIoGetstat(tmp, &stat_buf);
free(tmp); free(tmp);
@ -922,16 +922,16 @@ int retro_vfs_stat_impl(const char *path, int32_t *size)
/* On GEKKO platforms, paths cannot have /* On GEKKO platforms, paths cannot have
* trailing slashes - we must therefore * trailing slashes - we must therefore
* remove them */ * remove them */
size_t len; size_t _len;
char *path_buf = NULL; char *path_buf = NULL;
struct stat stat_buf; struct stat stat_buf;
if (!(path_buf = strdup(path))) if (!(path_buf = strdup(path)))
return 0; return 0;
if ((len = strlen(path_buf)) > 0) if ((_len = strlen(path_buf)) > 0)
if (path_buf[len - 1] == '/') if (path_buf[_len - 1] == '/')
path_buf[len - 1] = '\0'; path_buf[_len - 1] = '\0';
if (stat(path_buf, &stat_buf) < 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); free(path_buf);
if (size) if (size)
*size = (int32_t)stat_buf.st_size; *size = (int32_t)stat_buf.st_size;
@ -1007,11 +1007,11 @@ int retro_vfs_mkdir_impl(const char *dir)
if (dir_buf) if (dir_buf)
{ {
size_t len = strlen(dir_buf); size_t _len = strlen(dir_buf);
if (len > 0) if (_len > 0)
if (dir_buf[len - 1] == '/') if (dir_buf[_len - 1] == '/')
dir_buf[len - 1] = '\0'; dir_buf[_len - 1] = '\0';
ret = mkdir(dir_buf, 0750); 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, manual_content_scan_task_config_t *task_config,
const char *path_dir_playlist) const char *path_dir_playlist)
{ {
size_t len; size_t _len;
if (!task_config) if (!task_config)
return false; return false;
@ -983,13 +983,13 @@ bool manual_content_scan_get_task_config(
/* Now we have a valid system name, can generate /* Now we have a valid system name, can generate
* a 'database' name... */ * a 'database' name... */
len = strlcpy( _len = strlcpy(
task_config->database_name, task_config->database_name,
task_config->system_name, task_config->system_name,
sizeof(task_config->database_name)); sizeof(task_config->database_name));
strlcpy(task_config->database_name + len, strlcpy(task_config->database_name + _len,
".lpl", ".lpl",
sizeof(task_config->database_name) - len); sizeof(task_config->database_name) - _len);
/* ...which can in turn be used to generate the /* ...which can in turn be used to generate the
* playlist path */ * playlist path */

View File

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

View File

@ -218,14 +218,14 @@ static void ex_arena_free(ex_arena *arena)
/* Hash function */ /* Hash function */
static uint32_t ex_hash32_nocase_filtered( 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) unsigned char f_first, unsigned char f_last)
{ {
const unsigned char *end = NULL; const unsigned char *end = NULL;
uint32_t hash = (uint32_t)0x811c9dc5; 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) if (c >= f_first && c <= f_last)
hash = ((hash * (uint32_t)0x01000193) hash = ((hash * (uint32_t)0x01000193)
^ (uint32_t)((c >= 'A' && c <= 'Z') ^ (uint32_t)((c >= 'A' && c <= 'Z')
@ -316,7 +316,7 @@ static void explore_add_unique_string(
for (p = str + 1;; p++) for (p = str + 1;; p++)
{ {
size_t len = 0; size_t _len = 0;
uint32_t hash = 0; uint32_t hash = 0;
explore_string_t* entry = NULL; explore_string_t* entry = NULL;
@ -346,18 +346,18 @@ static void explore_add_unique_string(
p--; p--;
} }
len = p - str; _len = p - str;
hash = ex_hash32_nocase_filtered( hash = ex_hash32_nocase_filtered(
(unsigned char*)str, len, '0', 255); (unsigned char*)str, _len, '0', 255);
entry = RHMAP_GET(maps[cat], hash); entry = RHMAP_GET(maps[cat], hash);
if (!entry) if (!entry)
{ {
entry = (explore_string_t*) entry = (explore_string_t*)
ex_arena_alloc(&state->arena, ex_arena_alloc(&state->arena,
sizeof(explore_string_t) + len); sizeof(explore_string_t) + _len);
memcpy(entry->str, str, len); memcpy(entry->str, str, _len);
entry->str[len] = '\0'; entry->str[_len] = '\0';
RBUF_PUSH(state->by[cat], entry); RBUF_PUSH(state->by[cat], entry);
RHMAP_SET(maps[cat], hash, 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) static void explore_load_icons(explore_state_t *state)
{ {
char path[PATH_MAX_LENGTH]; char path[PATH_MAX_LENGTH];
size_t i, pathlen, system_count; size_t i, _len, system_count;
if (!state) if (!state)
return; return;
@ -420,16 +420,16 @@ static void explore_load_icons(explore_state_t *state)
if (string_is_empty(path)) if (string_is_empty(path))
return; return;
pathlen = fill_pathname_slash(path, sizeof(path)); _len = fill_pathname_slash(path, sizeof(path));
for (i = 0; i != system_count; i++) for (i = 0; i != system_count; i++)
{ {
struct texture_image ti; struct texture_image ti;
size_t _len = pathlen; size_t __len = _len;
_len += strlcpy(path + pathlen, __len += strlcpy(path + _len,
state->by[EXPLORE_BY_SYSTEM][i]->str, state->by[EXPLORE_BY_SYSTEM][i]->str,
sizeof(path) - pathlen); sizeof(path) - _len);
strlcpy(path + _len, ".png", sizeof(path) - _len); strlcpy(path + __len, ".png", sizeof(path) - __len);
if (!path_is_valid(path)) if (!path_is_valid(path))
continue; continue;
@ -768,22 +768,22 @@ explore_state_t *menu_explore_build_list(const char *directory_playlist,
#ifdef EXPLORE_SHOW_ORIGINAL_TITLE #ifdef EXPLORE_SHOW_ORIGINAL_TITLE
if (original_title && *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*) e->original_title = (char*)
ex_arena_alloc(&state->arena, len); ex_arena_alloc(&state->arena, _len);
memcpy(e->original_title, original_title, len); memcpy(e->original_title, original_title, _len);
} }
#endif #endif
if (RBUF_LEN(split_buf)) if (RBUF_LEN(split_buf))
{ {
size_t len; size_t _len;
RBUF_PUSH(split_buf, NULL); /* terminator */ RBUF_PUSH(split_buf, NULL); /* terminator */
len = RBUF_SIZEOF(split_buf); _len = RBUF_SIZEOF(split_buf);
e->split = (explore_string_t **) e->split = (explore_string_t **)
ex_arena_alloc(&state->arena, len); ex_arena_alloc(&state->arena, _len);
memcpy(e->split, split_buf, len); memcpy(e->split, split_buf, _len);
RBUF_CLEAR(split_buf); 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++) for (i = 0; i != EXPLORE_CAT_COUNT; i++)
{ {
uint32_t idx; uint32_t idx;
size_t len = RBUF_LEN(state->by[i]); size_t _len = RBUF_LEN(state->by[i]);
if (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_by_info[i].is_numeric ?
explore_qsort_func_nums : explore_qsort_func_strings)); 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; state->by[i][idx]->idx = idx;
RHMAP_FREE(cat_maps[i]); RHMAP_FREE(cat_maps[i]);
@ -838,14 +838,13 @@ static int explore_action_get_title(
return 0; return 0;
} }
static void explore_append_title(explore_state_t *state, static void explore_append_title(char *s, size_t len,
const char* fmt, ...) const char* fmt, ...)
{ {
va_list ap; va_list ap;
size_t len = strlen(state->title); size_t _len = strlen(s);
va_start(ap, fmt); va_start(ap, fmt);
vsnprintf(state->title + len, vsnprintf(s + len, len - _len, fmt, ap);
sizeof(state->title) - len, fmt, ap);
va_end(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]; unsigned cat = state->view_cats[i];
explore_string_t **entries = state->by[cat]; explore_string_t **entries = state->by[cat];
explore_string_t *match = state->view_match[i]; 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)); msg_hash_to_str(explore_by_info[cat].name_enum));
switch (state->view_op[i]) switch (state->view_op[i])
{ {
case EXPLORE_OP_EQUAL: case EXPLORE_OP_EQUAL:
explore_append_title(state, "%s", (match explore_append_title(state->title, sizeof(state->title), "%s", (match
? match->str ? match->str
: msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UNKNOWN))); : msg_hash_to_str(MENU_ENUM_LABEL_VALUE_UNKNOWN)));
break; break;
case EXPLORE_OP_MIN: 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[state->view_idx_min[i]]->str,
entries[RBUF_LEN(entries)-1]->str); entries[RBUF_LEN(entries)-1]->str);
break; break;
case EXPLORE_OP_MAX: case EXPLORE_OP_MAX:
explore_append_title(state, "%s - %s", explore_append_title(state->title, sizeof(state->title), "%s - %s",
entries[0]->str, entries[0]->str,
entries[state->view_idx_max[i]]->str); entries[state->view_idx_max[i]]->str);
break; break;
case EXPLORE_OP_RANGE: 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_min[i]]->str,
entries[state->view_idx_max[i]]->str); entries[state->view_idx_max[i]]->str);
break; break;
@ -1396,7 +1395,7 @@ unsigned menu_displaylist_explore(file_list_t *list, settings_t *settings)
/* append string search to title */ /* append string search to title */
if (*state->view_search) 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 ? " / " : ""), (state->view_levels ? " / " : ""),
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_RDB_ENTRY_NAME),
state->view_search); 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), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_TAB),
sizeof(state->title)); sizeof(state->title));
else 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)); msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ADDITIONAL_FILTER));
if (!*state->view_search) 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_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)); msg_hash_to_str(explore_by_info[current_cat].by_enum));
} }
else if (current_type < EXPLORE_TYPE_FIRSTITEM 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; bool filtered_category_have_unknown = false;
if (is_show_all) 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)); msg_hash_to_str(MENU_ENUM_LABEL_VALUE_EXPLORE_ALL));
if (is_filtered_category) if (is_filtered_category)
{ {
/* List filtered items in a selected explore by category */ /* List filtered items in a selected explore by category */
if (!view_levels || view_cats[view_levels - 1] != current_cat) 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)); msg_hash_to_str(explore_by_info[current_cat].by_enum));
else else
{ {
/* List all items again when setting a range filter */ /* 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)); msg_hash_to_str(MENU_ENUM_LABEL_EXPLORE_RANGE_FILTER));
view_levels--; view_levels--;
} }
@ -1661,7 +1660,7 @@ SKIP_ENTRY:;
qsort(list->list, list->size, sizeof(*list->list), qsort(list->list, list->size, sizeof(*list->list),
explore_qsort_func_menulist); explore_qsort_func_menulist);
explore_append_title(state, explore_append_title(state->title, sizeof(state->title),
" (%u)", (unsigned)(list->size - first_list_entry)); " (%u)", (unsigned)(list->size - first_list_entry));
if (is_filtered_category && filtered_category_have_unknown) 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; size_t ssid_len;
wifi_network_info_t entry; wifi_network_info_t entry;
struct string_list* list = NULL; struct string_list* list = NULL;
size_t len = strlen(line); size_t _len = strlen(line);
if (len > 0 && line[len-1] == '\n') if (_len > 0 && line[_len-1] == '\n')
line[--len] = '\0'; line[--_len] = '\0';
/* Parse lines directly and store net info directly */ /* Parse lines directly and store net info directly */
memset(&entry, 0, sizeof(entry)); 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) void logger_send_v(const char *__format, va_list args)
{ {
static char sendbuf[4096]; static char sendbuf[4096];
int len; int _len = vsnprintf(sendbuf,4000,__format, args);
vsnprintf(sendbuf,4000,__format, args);
len = strlen(sendbuf);
sendto(g_sid, sendto(g_sid,
sendbuf, sendbuf,
len, _len,
MSG_DONTWAIT, MSG_DONTWAIT,
(struct sockaddr*)&target, (struct sockaddr*)&target,
sizeof(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); mktime(time_info);
} }
static bool runtime_last_played_human(runtime_log_t *runtime_log, static size_t runtime_last_played_human(runtime_log_t *runtime_log,
char *str, size_t len) char *s, size_t len)
{ {
size_t _len; size_t _len;
struct tm time_info; 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}; float periods[6] = {60.0f, 60.0f, 24.0f, 7.0f, 4.35f, 12.0f};
if (!runtime_log) if (!runtime_log)
return false; return 0;
/* Get time */ /* Get time */
runtime_log_get_last_played_time(runtime_log, &time_info); 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); current = time(NULL);
if ((delta = current - last_played) <= 0) if ((delta = current - last_played) <= 0)
return false; return 0;
for (i = 0; delta >= periods[i] && i < sizeof(periods) - 1; i++) for (i = 0; delta >= periods[i] && i < sizeof(periods) - 1; i++)
delta /= periods[i]; delta /= periods[i];
/* Generate string */ /* Generate string */
_len = snprintf(str, len, "%u ", (int)delta); _len = snprintf(s, len, "%u ", (int)delta);
_len += strlcpy(str + _len, _len += strlcpy(s + _len,
msg_hash_to_str((enum msg_hash_enums)units[i][(delta == 1) ? 0 : 1]), msg_hash_to_str((enum msg_hash_enums)units[i][(delta == 1) ? 0 : 1]),
len - _len); len - _len);
str[ _len] = ' '; s[ _len] = ' ';
str[++_len] = '\0'; s[++_len] = '\0';
strlcpy(str + _len, _len += strlcpy(s + _len,
msg_hash_to_str(MENU_ENUM_LABEL_VALUE_TIME_UNIT_AGO), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_TIME_UNIT_AGO),
len - _len); len - _len);
return true; return _len;
} }
/* Gets last played entry value as a pre-formatted string */ /* Gets last played entry value as a pre-formatted string */
void runtime_log_get_last_played_str(runtime_log_t *runtime_log, 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_style_type timedate_style,
enum playlist_sublabel_last_played_date_separator_type date_separator) enum playlist_sublabel_last_played_date_separator_type date_separator)
{ {
const char *format_str = ""; 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); MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_LAST_PLAYED), len);
if (runtime_log) if (runtime_log)
@ -752,7 +752,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
/* Get time */ /* Get time */
struct tm time_info; struct tm time_info;
runtime_log_get_last_played_time(runtime_log, &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; return;
} }
@ -772,7 +772,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
format_str = " %04u-%02u-%02u %02u:%02u"; format_str = " %04u-%02u-%02u %02u:%02u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.year, runtime_log->last_played.year,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.day, 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"; format_str = " %04u-%02u-%02u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.year, runtime_log->last_played.year,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.day); 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"; format_str = " %04u-%02u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.year, runtime_log->last_played.year,
runtime_log->last_played.month); runtime_log->last_played.month);
return; 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"; format_str = " %02u-%02u-%04u %02u:%02u:%02u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.day, runtime_log->last_played.day,
runtime_log->last_played.year, 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"; format_str = " %02u-%02u-%04u %02u:%02u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.day, runtime_log->last_played.day,
runtime_log->last_played.year, 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"; format_str = " %02u-%02u %02u:%02u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.day, runtime_log->last_played.day,
runtime_log->last_played.hour, 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"; format_str = " %02u-%02u-%04u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.day, runtime_log->last_played.day,
runtime_log->last_played.year); 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"; format_str = " %02u-%02u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.day); runtime_log->last_played.day);
return; 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"; format_str = " %02u-%02u-%04u %02u:%02u:%02u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.day, runtime_log->last_played.day,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.year, 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"; format_str = " %02u-%02u-%04u %02u:%02u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.day, runtime_log->last_played.day,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.year, 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"; format_str = " %02u-%02u %02u:%02u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.day, runtime_log->last_played.day,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.hour, 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"; format_str = " %02u-%02u-%04u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.day, runtime_log->last_played.day,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.year); 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"; format_str = " %02u-%02u";
break; 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.day, runtime_log->last_played.month);
return; return;
case PLAYLIST_LAST_PLAYED_STYLE_AGO: case PLAYLIST_LAST_PLAYED_STYLE_AGO:
str[ _len] = ' '; s[ _len] = ' ';
str[++_len] = '\0'; s[++_len] = '\0';
if (!(runtime_last_played_human(runtime_log, str + _len, len - _len - 2))) if ((runtime_last_played_human(runtime_log, s + _len, len - _len - 2)) > 0)
strlcat(str + _len, strlcat(s + _len,
msg_hash_to_str( msg_hash_to_str(
MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER), MENU_ENUM_LABEL_VALUE_PLAYLIST_INLINE_CORE_DISPLAY_NEVER),
len - _len - 2); 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"; format_str = " %04u-%02u-%02u %02u:%02u:%02u";
break; break;
} }
snprintf(str + _len, len - _len, format_str, snprintf(s + _len, len - _len, format_str,
runtime_log->last_played.year, runtime_log->last_played.year,
runtime_log->last_played.month, runtime_log->last_played.month,
runtime_log->last_played.day, runtime_log->last_played.day,
@ -1037,7 +1037,7 @@ void runtime_log_get_last_played_str(runtime_log_t *runtime_log,
} }
} }
else 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)); " %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))) if ((archive_delim = path_get_archive_delim(path)))
{ {
char archive_path[PATH_MAX_LENGTH]; char archive_path[PATH_MAX_LENGTH];
size_t len = 0; size_t _len = 0;
/* Extract path of parent archive */ /* Extract path of parent archive */
if ((len = (size_t)(1 + archive_delim - path)) if ((_len = (size_t)(1 + archive_delim - path))
>= PATH_MAX_LENGTH) >= 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)) if (!string_is_empty(archive_path))
file_info->archive_path = strdup(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; 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; unsigned i = 0;
runloop_state_t *runloop_st = runloop_state_get_ptr(); 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)) if (string_is_equal(subsystem_name, subsystem->ident))
{ {
strlcpy(subsystem_friendly_name, subsystem->desc, len); strlcpy(s, subsystem->desc, len);
break; break;
} }
} }
return;
} }
/* Add a rom to the subsystem ROM buffer */ /* Add a rom to the subsystem ROM buffer */

View File

@ -166,12 +166,12 @@ task_finished:
if (http->handle) if (http->handle)
{ {
size_t len = 0; size_t _len = 0;
char *tmp = (char*)net_http_data(http->handle, &len, false); char *tmp = (char*)net_http_data(http->handle, &_len, false);
struct string_list *headers = net_http_headers(http->handle); struct string_list *headers = net_http_headers(http->handle);
if (!tmp) 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) if ((flg & RETRO_TASK_FLG_CANCELLED) > 0)
{ {
@ -188,7 +188,7 @@ task_finished:
data = (http_transfer_data_t*)malloc(sizeof(*data)); data = (http_transfer_data_t*)malloc(sizeof(*data));
data->data = tmp; data->data = tmp;
data->headers = headers; data->headers = headers;
data->len = len; data->len = _len;
data->status = net_http_status(http->handle); data->status = net_http_status(http->handle);
task_set_data(task, data); task_set_data(task, data);
@ -199,9 +199,9 @@ task_finished:
task_set_error(task, strldup("Download failed.", task_set_error(task, strldup("Download failed.",
sizeof("Download failed."))); sizeof("Download failed.")));
} }
net_http_delete(http->handle); net_http_delete(http->handle);
} else if (http->error) }
else if (http->error)
task_set_error(task, strldup("Internal error.", task_set_error(task, strldup("Internal error.",
sizeof("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, const char *dest, bool mute, const char *headers,
retro_task_callback_t cb, void *userdata) retro_task_callback_t cb, void *userdata)
{ {
size_t _len;
struct http_connection_t *conn; struct http_connection_t *conn;
char dest_header[PATH_MAX_LENGTH + 512]; char dest_header[PATH_MAX_LENGTH + 512];
size_t len;
if (string_is_empty(url)) if (string_is_empty(url))
return NULL; return NULL;
@ -418,12 +418,12 @@ void *task_push_webdav_move(const char *url,
if (!(conn = net_http_connection_new(url, "MOVE", NULL))) if (!(conn = net_http_connection_new(url, "MOVE", NULL)))
return NULL; return NULL;
len = strlcpy(dest_header, "Destination: ", sizeof(dest_header)); _len = strlcpy(dest_header, "Destination: ", sizeof(dest_header));
len += strlcpy(dest_header + len, dest, sizeof(dest_header) - len); _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 + _len, "\r\n", sizeof(dest_header) - _len);
if (headers) 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); 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: case IMAGE_STATUS_TRANSFER_PARSE:
if (image->handle && image->cb) if (image->handle && image->cb)
{ {
size_t len = 0; size_t _len = 0;
if (image->cb(nbio, len) == -1) if (image->cb(nbio, _len) == -1)
return false; return false;
} }
if (image->flags & IMAGE_FLAG_IS_BLOCKING_ON_PROCESSING) 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: case IMAGE_STATUS_PROCESS_TRANSFER_PARSE:
if (image->handle && image->cb) if (image->handle && image->cb)
{ {
size_t len = 0; size_t _len = 0;
if (image->cb(nbio, len) == -1) if (image->cb(nbio, _len) == -1)
return false; return false;
} }
if (!(image->flags & IMAGE_FLAG_IS_FINISHED)) 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) bool content_serialize_state_rewind(void* buffer, size_t buffer_size)
{ {
rastate_size_info_t size; rastate_size_info_t size;
size_t len = content_get_rastate_size(&size, true); size_t _len = content_get_rastate_size(&size, true);
if (len == 0) if (_len == 0)
return false; return false;
if (len > buffer_size) if (_len > buffer_size)
{ {
#ifdef DEBUG #ifdef DEBUG
static size_t last_reported_len = 0; static size_t last_reported_len = 0;
if (len != last_reported_len) if (_len != last_reported_len)
{ {
last_reported_len = len; last_reported_len = _len;
RARCH_WARN("Rewind state size exceeds frame size (%zu > %zu).\n", len, buffer_size); RARCH_WARN("Rewind state size exceeds frame size (%zu > %zu).\n", _len, buffer_size);
} }
#endif #endif
return false; 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); 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; void* data;
rastate_size_info_t size; 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; return NULL;
/* Ensure buffer is initialised to zero /* 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 * sizes when core requests a larger buffer
* than it needs (and leaves the excess * than it needs (and leaves the excess
* as uninitialised garbage) */ * as uninitialised garbage) */
if (!(data = calloc(len, 1))) if (!(data = calloc(_len, 1)))
return NULL; return NULL;
if (!content_write_serialized_state(data, &size, false)) if (!content_write_serialized_state(data, &size, false))

View File

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

View File

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

View File

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