CThemes: make saveFile and readFile accept const char* param

this removes the need for ugly (char *) casts
This commit is contained in:
Stefan Seyfried
2015-02-10 14:28:10 +01:00
committed by Jacek Jendrzej
parent 63d8c8e90b
commit 3fa68cae90
2 changed files with 7 additions and 7 deletions

View File

@@ -82,10 +82,10 @@ int CThemes::exec(CMenuTarget* parent, const std::string & actionKey)
if ( strstr(themeFile.c_str(), "{U}") != 0 ) if ( strstr(themeFile.c_str(), "{U}") != 0 )
{ {
themeFile.erase(0, 3); themeFile.erase(0, 3);
readFile((char*)((std::string)THEMEDIR_VAR + themeFile + FILE_PREFIX).c_str()); readFile(((std::string)THEMEDIR_VAR + themeFile + FILE_PREFIX).c_str());
} }
else else
readFile((char*)((std::string)THEMEDIR + themeFile + FILE_PREFIX).c_str()); readFile(((std::string)THEMEDIR + themeFile + FILE_PREFIX).c_str());
} }
return res; return res;
} }
@@ -177,7 +177,7 @@ int CThemes::Show()
int res = themes.exec(NULL, ""); int res = themes.exec(NULL, "");
if (!file_name.empty()) { if (!file_name.empty()) {
saveFile((char*)((std::string)THEMEDIR_VAR + file_name + FILE_PREFIX).c_str()); saveFile(((std::string)THEMEDIR_VAR + file_name + FILE_PREFIX).c_str());
} }
if (hasThemeChanged) { if (hasThemeChanged) {
@@ -203,7 +203,7 @@ void CThemes::rememberOldTheme(bool remember)
} }
} }
void CThemes::readFile(char* themename) void CThemes::readFile(const char *themename)
{ {
if(themefile.loadConfig(themename)) if(themefile.loadConfig(themename))
{ {
@@ -218,7 +218,7 @@ void CThemes::readFile(char* themename)
printf("[neutrino theme] %s not found\n", themename); printf("[neutrino theme] %s not found\n", themename);
} }
void CThemes::saveFile(char * themename) void CThemes::saveFile(const char *themename)
{ {
setTheme(themefile); setTheme(themefile);

View File

@@ -40,8 +40,8 @@ class CThemes : public CMenuTarget, CChangeObserver
bool hasThemeChanged; bool hasThemeChanged;
int Show(); int Show();
void readFile(char* themename); void readFile(const char *themename);
void saveFile(char* themename); void saveFile(const char *themename);
void readThemes(CMenuWidget &); void readThemes(CMenuWidget &);
void rememberOldTheme(bool remember); void rememberOldTheme(bool remember);
void move_userDir(); void move_userDir();