From 096b31618386bfe2354c70ce849c8b88b80cc2ad Mon Sep 17 00:00:00 2001
From: markwkidd <mark@stardart.net>
Date: Tue, 15 Nov 2016 14:01:28 -0500
Subject: [PATCH] additional fixes per the PR discussion

---
 menu/drivers/xmb.c | 43 +++++++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 10 deletions(-)

diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c
index b8c2cc5b33..1043d4cdfe 100644
--- a/menu/drivers/xmb.c
+++ b/menu/drivers/xmb.c
@@ -862,16 +862,39 @@ static void xmb_update_thumbnail_path(void *data, unsigned i)
          xmb_thumbnails_ident(), sizeof(xmb->thumbnail_file_path));
 
    /* Scrub characters that are not cross-platform safe from 'display name' in playlist and replace with underscore */
-   tmp = string_replace_substring(entry.path, "&", "_");
-   tmp = string_replace_substring(entry.path, "\\", "_");
-   tmp = string_replace_substring(entry.path, "/", "_");
-   tmp = string_replace_substring(entry.path, "\?", "_");
-   tmp = string_replace_substring(entry.path, ":", "_");  
-   tmp = string_replace_substring(entry.path, ";", "_");
-   tmp = string_replace_substring(entry.path, "<", "_");
-   tmp = string_replace_substring(entry.path, ">", "_");
-   tmp = string_replace_substring(entry.path, "*", "_");
-   tmp = string_replace_substring(entry.path, "|", "_");
+   char *scrub_char_pointer = 0;
+   *tmp = *entry.path;
+   
+   while ((scrub_char_pointer = strchr (tmp, '&')) != NULL) {
+      *scrub_char_pointer = '_';
+   }
+   while ((scrub_char_pointer = strchr (tmp, '\\')) != NULL) {
+      *scrub_char_pointer = '_';
+   }
+   while ((scrub_char_pointer = strchr (tmp, '/')) != NULL) {
+      *scrub_char_pointer = '_';
+   }
+   while ((scrub_char_pointer = strchr (tmp, '?')) != NULL) {
+      *scrub_char_pointer = '_';
+   }
+   while ((scrub_char_pointer = strchr (tmp, ':')) != NULL) {
+      *scrub_char_pointer = '_';
+   }
+   while ((scrub_char_pointer = strchr (tmp, '`')) != NULL) {
+      *scrub_char_pointer = '_';
+   }
+   while ((scrub_char_pointer = strchr (tmp, '<')) != NULL) {
+      *scrub_char_pointer = '_';
+   }
+   while ((scrub_char_pointer = strchr (tmp, '>')) != NULL) {
+      *scrub_char_pointer = '_';
+   }
+   while ((scrub_char_pointer = strchr (tmp, '*')) != NULL) {
+      *scrub_char_pointer = '_';
+   }
+   while ((scrub_char_pointer = strchr (tmp, '_')) != NULL) {
+      *scrub_char_pointer = '_';
+   }
 
    /* Look for thumbnail file with the scrubbed filename */