diff --git a/libretro-common/formats/logiqx_dat/logiqx_dat.c b/libretro-common/formats/logiqx_dat/logiqx_dat.c index a81708925b..7ec79df8f8 100644 --- a/libretro-common/formats/logiqx_dat/logiqx_dat.c +++ b/libretro-common/formats/logiqx_dat/logiqx_dat.c @@ -229,7 +229,8 @@ static void logiqx_dat_sanitise_element_data( /* Element data includes leading/trailing * newline characters - trim them away */ - string_trim_whitespace(sanitised_data); + string_trim_whitespace_right(sanitised_data); + string_trim_whitespace_left(sanitised_data); if (string_is_empty(sanitised_data)) return; diff --git a/libretro-common/formats/m3u/m3u_file.c b/libretro-common/formats/m3u/m3u_file.c index 9497f39c2c..70fc45ae05 100644 --- a/libretro-common/formats/m3u/m3u_file.c +++ b/libretro-common/formats/m3u/m3u_file.c @@ -145,7 +145,8 @@ static bool m3u_file_load(m3u_file_t *m3u_file) strlcpy( entry_label, line + STRLEN_CONST(M3U_FILE_NONSTD_LABEL), sizeof(entry_label)); - string_trim_whitespace(entry_label); + string_trim_whitespace_right(entry_label); + string_trim_whitespace_left(entry_label); } } /* > '#EXTINF:' */ @@ -164,7 +165,8 @@ static bool m3u_file_load(m3u_file_t *m3u_file) if (!string_is_empty(label_ptr)) { strlcpy(entry_label, label_ptr, sizeof(entry_label)); - string_trim_whitespace(entry_label); + string_trim_whitespace_right(entry_label); + string_trim_whitespace_left(entry_label); } } } @@ -190,7 +192,8 @@ static bool m3u_file_load(m3u_file_t *m3u_file) entry_path, line, ((len < PATH_MAX_LENGTH ? len : PATH_MAX_LENGTH) * sizeof(char))); - string_trim_whitespace(entry_path); + string_trim_whitespace_right(entry_path); + string_trim_whitespace_left(entry_path); } /* Get entry_label segment */ @@ -198,14 +201,16 @@ static bool m3u_file_load(m3u_file_t *m3u_file) if (*token_ptr != '\0') { strlcpy(entry_label, token_ptr, sizeof(entry_label)); - string_trim_whitespace(entry_label); + string_trim_whitespace_right(entry_label); + string_trim_whitespace_left(entry_label); } } else { /* Just a normal file name/path */ strlcpy(entry_path, line, sizeof(entry_path)); - string_trim_whitespace(entry_path); + string_trim_whitespace_right(entry_path); + string_trim_whitespace_left(entry_path); } /* Add entry to file diff --git a/manual_content_scan.c b/manual_content_scan.c index b3fd57de90..712c4fd8e7 100644 --- a/manual_content_scan.c +++ b/manual_content_scan.c @@ -191,7 +191,8 @@ static void manual_content_scan_scrub_file_exts(char *file_exts) string_remove_all_chars(file_exts, '.'); string_to_lower(file_exts); - string_trim_whitespace(file_exts); + string_trim_whitespace_right(file_exts); + string_trim_whitespace_left(file_exts); } /* Removes invalid characters from diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 90fca78c23..ab6644f9fc 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -7176,12 +7176,13 @@ static void rgui_update_menu_sublabel(rgui_t *rgui, size_t selection) while (tok) { - const char *line = string_trim_whitespace(tok); - if (!string_is_empty(line)) + string_trim_whitespace_right(tok); + string_trim_whitespace_left(tok); + if (!string_is_empty(tok)) { if (!prev_line_empty) strlcat(rgui->menu_sublabel, sublabel_spacer, sizeof(rgui->menu_sublabel)); - strlcat(rgui->menu_sublabel, line, sizeof(rgui->menu_sublabel)); + strlcat(rgui->menu_sublabel, tok, sizeof(rgui->menu_sublabel)); prev_line_empty = false; } tok = strtok_r(NULL, "\n", &save); diff --git a/network/drivers_wifi/nmcli.c b/network/drivers_wifi/nmcli.c index a093bdbf62..e864f91fe9 100644 --- a/network/drivers_wifi/nmcli.c +++ b/network/drivers_wifi/nmcli.c @@ -110,15 +110,17 @@ static void nmcli_scan(void *data) wifi_network_info_t entry; memset(&entry, 0, sizeof(entry)); - string_trim_whitespace(line); + string_trim_whitespace_right(line); + string_trim_whitespace_left(line); if (!line || line[0] == '\0') continue; if (line[0] == '*') { entry.connected = true; - line[0] = ' '; - string_trim_whitespace(line); + line[0] = ' '; + string_trim_whitespace_right(line); + string_trim_whitespace_left(line); } strlcpy(entry.ssid, line, sizeof(entry.ssid)); diff --git a/network/natt.c b/network/natt.c index ff0a030a90..9f35b0e45a 100644 --- a/network/natt.c +++ b/network/natt.c @@ -184,7 +184,8 @@ bool natt_device_next(struct natt_discovery *discovery, *lnbreak++ = '\0'; /* This also gets rid of any trailing carriage return. */ - string_trim_whitespace(data); + string_trim_whitespace_right(data); + string_trim_whitespace_left(data); if (string_starts_with_case_insensitive(data, "Location:")) { diff --git a/tasks/task_database_cue.c b/tasks/task_database_cue.c index a9792e4d9d..a6f7b90855 100644 --- a/tasks/task_database_cue.c +++ b/tasks/task_database_cue.c @@ -697,7 +697,8 @@ int detect_scd_game(intfstream_t *fd, char *s, size_t len, const char *filename) } else { - string_trim_whitespace(raw_game_id); + string_trim_whitespace_right(raw_game_id); + string_trim_whitespace_left(raw_game_id); strlcpy(s, raw_game_id, len); return true; } @@ -742,7 +743,8 @@ int detect_sat_game(intfstream_t *fd, char *s, size_t len, const char *filename) return false; } - string_trim_whitespace(raw_game_id); + string_trim_whitespace_right(raw_game_id); + string_trim_whitespace_left(raw_game_id); /** Dissect this raw serial into parts **/ length = strlen(raw_game_id); @@ -832,7 +834,8 @@ int detect_dc_game(intfstream_t *fd, char *s, size_t len, const char *filename) return false; } - string_trim_whitespace(raw_game_id); + string_trim_whitespace_right(raw_game_id); + string_trim_whitespace_left(raw_game_id); string_replace_multi_space_with_single_space(raw_game_id); string_replace_whitespace_with_single_character(raw_game_id, '-'); length = strlen(raw_game_id);