Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

CFavourites: replace Paramify() implementation with StringUtils::Para…

…mify()
  • Loading branch information...
commit a02630c1f2f75cd1350019d922e36b529b289ce8 1 parent 1146ff9
Sascha Montellese Montellese authored

Showing 2 changed files with 5 additions and 26 deletions. Show diff stats Hide diff stats

  1. +5 21 xbmc/Favourites.cpp
  2. +0 5 xbmc/Favourites.h
26 xbmc/Favourites.cpp
@@ -25,6 +25,7 @@
25 25 #include "FileItem.h"
26 26 #include "utils/XBMCTinyXML.h"
27 27 #include "utils/log.h"
  28 +#include "utils/StringUtils.h"
28 29 #include "utils/URIUtils.h"
29 30 #include "settings/AdvancedSettings.h"
30 31 #include "video/VideoInfoTag.h"
@@ -148,37 +149,20 @@ bool CFavourites::IsFavourite(CFileItem *item, int contextWindow)
148 149 return items.Contains(GetExecutePath(item, contextWindow));
149 150 }
150 151
151   -static CStdString Paramify(const CStdString& param)
152   -{
153   - CStdString result(param);
154   - result.Replace("\\", "\\\\");
155   - result.Replace("\"", "\\\"");
156   - return "\"" + result + "\"";
157   -}
158   -
159   -#ifdef UNIT_TESTING
160   -bool CFavourites::TestParamify()
161   -{
162   - return (Paramify("test") == "\"test\"" &&
163   - Paramify("test\"foo\"test") == "\"test\\\"foo\\\"test\"" &&
164   - Paramify("C:\\foo\\bar\\") == "\"C:\\\\foo\\\\bar\\\\\"");
165   -}
166   -#endif
167   -
168 152 CStdString CFavourites::GetExecutePath(const CFileItem *item, int contextWindow)
169 153 {
170 154 CStdString execute;
171 155 if (item->m_bIsFolder && (g_advancedSettings.m_playlistAsFolders ||
172 156 !(item->IsSmartPlayList() || item->IsPlayList())))
173   - execute.Format("ActivateWindow(%i,%s)", contextWindow, Paramify(item->GetPath()));
  157 + execute.Format("ActivateWindow(%i,%s)", contextWindow, StringUtils::Paramify(item->GetPath()).c_str());
174 158 else if (item->IsScript())
175   - execute.Format("RunScript(%s)", Paramify(item->GetPath().Mid(9)));
  159 + execute.Format("RunScript(%s)", StringUtils::Paramify(item->GetPath().Mid(9)).c_str());
176 160 else // assume a media file
177 161 {
178 162 if (item->IsVideoDb() && item->HasVideoInfoTag())
179   - execute.Format("PlayMedia(%s)", Paramify(item->GetVideoInfoTag()->m_strFileNameAndPath));
  163 + execute.Format("PlayMedia(%s)", StringUtils::Paramify(item->GetVideoInfoTag()->m_strFileNameAndPath).c_str());
180 164 else
181   - execute.Format("PlayMedia(%s)", Paramify(item->GetPath()));
  165 + execute.Format("PlayMedia(%s)", StringUtils::Paramify(item->GetPath()).c_str());
182 166 }
183 167 return execute;
184 168 }
5 xbmc/Favourites.h
@@ -33,11 +33,6 @@ class CFavourites
33 33 static bool AddOrRemove(CFileItem *item, int contextWindow);
34 34 static bool Save(const CFileItemList& items);
35 35 static bool IsFavourite(CFileItem *item, int contextWindow);
36   -
37   -#ifdef UNIT_TESTING
38   - static bool TestParamify();
39   -#endif
40   -
41 36 private:
42 37 static CStdString GetExecutePath(const CFileItem *item, int contextWindow);
43 38 };

0 comments on commit a02630c

Please sign in to comment.
Something went wrong with that request. Please try again.