mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-neutrino.git
synced 2025-08-31 17:31:11 +02:00
Merge branch 'dvbsi++' of coolstreamtech.de:cst-public-gui-neutrino into dvbsi++
Origin commit data
------------------
Branch: ni/coolstream
Commit: af5ead9f3f
Author: [CST] Focus <focus.cst@gmail.com>
Date: 2013-02-26 (Tue, 26 Feb 2013)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -91,20 +91,22 @@ bool CConfigFile::loadConfig(const std::string & filename)
|
||||
|
||||
bool CConfigFile::saveConfig(const char * const filename)
|
||||
{
|
||||
std::ofstream configFile(filename);
|
||||
std::fstream configFile(filename);
|
||||
|
||||
if (configFile != NULL)
|
||||
{
|
||||
std::cout << "[ConfigFile] saving " << filename << std::endl;
|
||||
for (ConfigDataMap::const_iterator it = configData.begin(); it != configData.end(); ++it)
|
||||
{
|
||||
configFile << it->first << "=" << it->second << std::endl;
|
||||
}
|
||||
|
||||
configFile.sync();
|
||||
configFile.close();
|
||||
sync();
|
||||
|
||||
chmod(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
|
||||
|
||||
modifiedFlag = false;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
@@ -387,6 +389,9 @@ void CConfigFile::setString(const std::string & key, const std::string & val)
|
||||
|
||||
void CConfigFile::setInt32Vector(const std::string & key, const std::vector<int32_t> vec)
|
||||
{
|
||||
bool tmpUnknownKeyQueryedFlag = unknownKeyQueryedFlag;
|
||||
unknownKeyQueryedFlag = false;
|
||||
std::string oldVal = getString(key);
|
||||
std::stringstream s;
|
||||
|
||||
for (std::vector<int32_t>::const_iterator it = vec.begin(); ; )
|
||||
@@ -399,21 +404,35 @@ void CConfigFile::setInt32Vector(const std::string & key, const std::vector<int3
|
||||
break;
|
||||
s << delimiter;
|
||||
}
|
||||
s >> configData[key];
|
||||
if (oldVal != s.str() || unknownKeyQueryedFlag)
|
||||
{
|
||||
modifiedFlag = true;
|
||||
configData[key] = s.str();
|
||||
}
|
||||
unknownKeyQueryedFlag = tmpUnknownKeyQueryedFlag;
|
||||
}
|
||||
|
||||
void CConfigFile::setStringVector(const std::string & key, const std::vector<std::string> vec)
|
||||
{
|
||||
configData[key] = "";
|
||||
bool tmpUnknownKeyQueryedFlag = unknownKeyQueryedFlag;
|
||||
unknownKeyQueryedFlag = false;
|
||||
std::string oldVal = getString(key);
|
||||
std::string newVal = "";
|
||||
|
||||
for (std::vector<std::string>::const_iterator it = vec.begin(); ; )
|
||||
{
|
||||
if (it == vec.end())
|
||||
break;
|
||||
configData[key] += *it;
|
||||
newVal += *it;
|
||||
++it;
|
||||
if (it == vec.end())
|
||||
break;
|
||||
configData[key] += delimiter;
|
||||
newVal += delimiter;
|
||||
}
|
||||
if (oldVal != newVal || unknownKeyQueryedFlag)
|
||||
{
|
||||
modifiedFlag = true;
|
||||
configData[key] = newVal;
|
||||
}
|
||||
unknownKeyQueryedFlag = tmpUnknownKeyQueryedFlag;
|
||||
}
|
||||
|
Reference in New Issue
Block a user