This commit is contained in:
twinaphex 2019-09-18 02:16:47 +02:00
parent 7dd3939a26
commit 8fa6230426
11 changed files with 53 additions and 45 deletions

View File

@ -1303,8 +1303,7 @@ void fill_pathname_application_path(char *s, size_t len)
if (realpath(s, resolved_bundle_dir_buf))
{
size_t copied = strlcpy(s,resolved_bundle_dir_buf, len);
s[copied] = '/';
s[copied+1] = '\0';
string_add_backslash_fast(s, copied);
}
}
#endif

View File

@ -59,9 +59,33 @@ static INLINE bool string_is_equal(const char *a, const char *b)
#define string_add_glob_open(s, size) strlcat((s), "glob('*", (size))
#define string_add_glob_close(s, size) strlcat((s), "*')", (size))
#define string_add_backslash_fast(s, size) \
(s)[(size)] = '/'; \
(s)[(size)+1] = '\0'
#define string_add_colon_fast(s, size) \
(s)[(size)] = ':'; \
(s)[(size)+1] = '\0'
#define string_add_star_fast(s, size) \
(s)[(size)] = '*'; \
(s)[(size)+1] = '\0'
#define string_add_space_fast(s, size) \
(s)[(size)] = ' '; \
(s)[(size)+1] = '\0'
#define string_add_vertical_bar_fast(s, size) \
(s)[(size)] = '|'; \
(s)[(size)+1] = '\0'
#define string_add_pair_open_fast(s, size) \
(s)[(size)] = '('; \
(s)[(size)+1] = '\0'
#define string_add_pair_close_fast(s, size) \
(s)[size] = ')'; \
(s)[size+1] = '\0'
(s)[(size)] = ')'; \
(s)[(size)+1] = '\0'
#define string_is_not_equal_fast(a, b, size) (memcmp(a, b, size) != 0)
#define string_is_equal_fast(a, b, size) (memcmp(a, b, size) == 0)

View File

@ -168,8 +168,7 @@ void net_http_urlencode_full(char *dest,
tmp = NULL;
net_http_urlencode(&tmp, url_path);
copied = strlcpy(dest, url_domain, size);
dest[copied] = '/';
dest[copied+1] = '\0';
string_add_backslash_fast(dest, copied);
copied = strlcat(dest, tmp, size);
free (tmp);
}
@ -328,8 +327,7 @@ struct http_connection_t *net_http_connection_new(const char *url,
strlcat(new_domain, uri, sizeof(new_domain));
else
{
new_domain[copied] = '/';
new_domain[copied+1] = '\0';
string_add_backslash_fast(new_domain, copied);
strlcat(new_domain, strchr(uri, (char)'/') + sizeof(char),
sizeof(new_domain));
}

View File

@ -1154,14 +1154,12 @@ libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
/* Non-NT platforms don't like extra slashes in the path */
if (name[path_len - 1] == '\\')
{
path_buf[copied] = '*';
path_buf[copied+1] = '\0';
string_add_star_fast(path_buf, copied);
}
else
{
path_buf[copied] = '\\';
path_buf[copied+1] = '*';
path_buf[copied+2] = '\0';
string_add_star_fast(path_buf, copied+1);
}
#if defined(LEGACY_WIN32)

View File

@ -1023,8 +1023,7 @@ static int action_bind_sublabel_playlist_entry(
/* Add core name */
written = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PLAYLIST_SUBLABEL_CORE), len);
s[written ] = ' ';
s[written+1] = '\0';
string_add_space_fast(s, written);
written = strlcat(s, entry->core_name, len);
/* Get runtime info *if* required runtime log is enabled

View File

@ -306,7 +306,7 @@ static int action_get_title_generic(char *s, size_t len, const char *path,
if (!string_is_empty(elem0_path))
{
s[written ] = '-';
s[written+1] = ' ';
string_add_space_fast(s, written+1);
strlcat(s, path_basename(elem0_path), len);
}
}
@ -344,8 +344,7 @@ static int action_get_title_default(const char *path, const char *label,
unsigned menu_type, char *s, size_t len)
{
size_t written = strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_SELECT_FILE), len);
s[written] = ' ';
s[written+1] = '\0';
string_add_space_fast(s, written);
strlcat(s, path, len);
return 0;
}
@ -399,10 +398,9 @@ static int action_get_title_group_settings(const char *path, const char *label,
if (!string_is_empty(elem1))
{
s[copied] = ' ';
string_add_space_fast(s, copied);
s[copied+1] = '-';
s[copied+2] = ' ';
s[copied+3] = '\0';
string_add_space_fast(s, copied+2);
strlcat(s, elem1, len);
}
}

View File

@ -3880,7 +3880,7 @@ void menu_subsystem_populate(const struct retro_subsystem_info* subsystem, menu_
{
if (verbosity_is_enabled())
{
RARCH_WARN("Menu subsytem entry: Description label truncated.\n");
RARCH_WARN("Menu subsystem entry: Description label truncated.\n");
}
}
@ -3915,8 +3915,7 @@ void menu_subsystem_populate(const struct retro_subsystem_info* subsystem, menu_
path_basename(content_get_subsystem_rom(j)), sizeof(rom_buff));
if (j != content_get_subsystem_rom_id() - 1)
{
rom_buff[copied] = '|';
rom_buff[copied+1] = '\0';
string_add_vertical_bar_fast(rom_buff, copied);
}
}
@ -3929,7 +3928,7 @@ void menu_subsystem_populate(const struct retro_subsystem_info* subsystem, menu_
{
if (verbosity_is_enabled())
{
RARCH_WARN("Menu subsytem entry: Description label truncated.\n");
RARCH_WARN("Menu subsystem entry: Description label truncated.\n");
}
}
@ -3970,7 +3969,7 @@ void menu_subsystem_populate(const struct retro_subsystem_info* subsystem, menu_
{
if (verbosity_is_enabled())
{
RARCH_WARN("Menu subsytem entry: Description label truncated.\n");
RARCH_WARN("Menu subsystem entry: Description label truncated.\n");
}
}

View File

@ -18959,11 +18959,10 @@ static void video_driver_frame(const void *data, unsigned width,
"FPS: %6.2f", last_fps);
if (video_info.framecount_show)
{
video_info.fps_text[copied] = ' ';
video_info.fps_text[copied+1] = '|';
video_info.fps_text[copied+2] = '|';
video_info.fps_text[copied+3] = ' ';
video_info.fps_text[copied+4] = '\0';
string_add_space_fast(video_info.fps_text, copied);
string_add_vertical_bar_fast(video_info.fps_text, copied+1);
string_add_vertical_bar_fast(video_info.fps_text, copied+2);
string_add_space_fast(video_info.fps_text, copied+3);
}
}
@ -18989,11 +18988,10 @@ static void video_driver_frame(const void *data, unsigned width,
if (!string_is_empty(video_info.fps_text))
{
video_driver_window_title[copied] = ' ';
video_driver_window_title[copied+1] = '|';
video_driver_window_title[copied+2] = '|';
video_driver_window_title[copied+3] = ' ';
video_driver_window_title[copied+4] = '\0';
string_add_space_fast(video_driver_window_title, copied);
string_add_vertical_bar_fast(video_driver_window_title, copied+1);
string_add_vertical_bar_fast(video_driver_window_title, copied+2);
string_add_space_fast(video_driver_window_title, copied+3);
strlcat(video_driver_window_title,
video_info.fps_text, sizeof(video_driver_window_title));
}

View File

@ -238,8 +238,7 @@ static void input_autoconfigure_joypad_add(config_file_t *conf,
size_t written = strlcpy(
msg, autoconfig_str, sizeof(msg));
msg[written ] = ' ';
msg[written+1] = '\0';
string_add_space_fast(msg, written);
strlcat(msg, "configured.", sizeof(msg));
if (!remote_is_bound)

View File

@ -303,8 +303,7 @@ static void* task_push_http_transfer_generic(
copied = strlcpy(tmp,
msg_hash_to_str(MSG_DOWNLOADING), sizeof(tmp));
tmp[copied] = ' ';
tmp[copied+1] = '\0';
string_add_space_fast(tmp, copied);
if (strstr(s, ".index"))
strlcat(tmp, msg_hash_to_str(MSG_INDEX_FILE), sizeof(tmp));

View File

@ -145,14 +145,11 @@ static bool get_thumbnail_paths(
/* Generate remote path */
copied = strlcpy(raw_url, file_path_str(FILE_PATH_CORE_THUMBNAILS_URL), sizeof(raw_url));
raw_url[copied] = '/';
raw_url[copied+1] = '\0';
string_add_backslash_fast(raw_url, copied);
copied = strlcat(raw_url, system_name, sizeof(raw_url));
raw_url[copied] = '/';
raw_url[copied+1] = '\0';
string_add_backslash_fast(raw_url, copied);
copied = strlcat(raw_url, sub_dir, sizeof(raw_url));
raw_url[copied] = '/';
raw_url[copied+1] = '\0';
string_add_backslash_fast(raw_url, copied);
strlcat(raw_url, img_name, sizeof(raw_url));
if (string_is_empty(raw_url))