fix for 9b65b39126 (funny bug)

This commit is contained in:
unK
2008-09-27 23:17:57 +02:00
parent 0318da84ca
commit d0e521de98
2 changed files with 27 additions and 26 deletions

View File

@@ -218,31 +218,6 @@ string GetLineValue(const string &line, char a, char b)
return ""; return "";
} }
namespace
{
void GetKeys(string line, int *key)
{
int i = line.find("=")+1;
line = line.substr(i, line.length()-i);
i = 0;
if (line[i] == ' ')
while (line[++i] == ' ');
line = line.substr(i, line.length()-i);
i = line.find(" ");
string one;
string two;
if (i != string::npos)
{
one = line.substr(0, i);
i++;
two = line.substr(i, line.length()-i);
}
else
one = line;
key[0] = !one.empty() && one[0] == '\'' ? one[1] : (atoi(one.c_str()) == 0 ? null_key : atoi(one.c_str()));
key[1] = !two.empty() && two[0] == '\'' ? two[1] : (atoi(two.c_str()) == 0 ? null_key : atoi(two.c_str()));
}
string IntoStr(Color color) string IntoStr(Color color)
{ {
string result; string result;
@@ -269,6 +244,31 @@ namespace
return result; return result;
} }
namespace
{
void GetKeys(string line, int *key)
{
int i = line.find("=")+1;
line = line.substr(i, line.length()-i);
i = 0;
if (line[i] == ' ')
while (line[++i] == ' ');
line = line.substr(i, line.length()-i);
i = line.find(" ");
string one;
string two;
if (i != string::npos)
{
one = line.substr(0, i);
i++;
two = line.substr(i, line.length()-i);
}
else
one = line;
key[0] = !one.empty() && one[0] == '\'' ? one[1] : (atoi(one.c_str()) == 0 ? null_key : atoi(one.c_str()));
key[1] = !two.empty() && two[0] == '\'' ? two[1] : (atoi(two.c_str()) == 0 ? null_key : atoi(two.c_str()));
}
Color IntoColor(const string &color) Color IntoColor(const string &color)
{ {
Color result = clDefault; Color result = clDefault;

View File

@@ -151,6 +151,7 @@ void DefaultConfiguration(ncmpcpp_config &);
void ReadKeys(ncmpcpp_keys &); void ReadKeys(ncmpcpp_keys &);
void ReadConfiguration(ncmpcpp_config &); void ReadConfiguration(ncmpcpp_config &);
string IntoStr(Color);
string GetLineValue(const string &, char = '"', char = '"'); string GetLineValue(const string &, char = '"', char = '"');
#endif #endif