Use a real std::string object instead of a temporary reference

This commit is contained in:
Ingo Ruhnke 2009-02-18 08:14:13 +01:00
parent 6c321a9f46
commit 442ceda634
2 changed files with 4 additions and 5 deletions

4
TODO
View file

@ -16,9 +16,7 @@ Stuff to do before 0.4.6 release:
* work in xboxdrv-hal demon to launch things
* Recalibrate: CalibrationModifier
--calibration X2=min:center:max
* boost::tokenizer is broken on 64bit
Stuff to do before 0.5 release:

View file

@ -85,7 +85,8 @@ CalibrationMapping CalibrationMapping::from_string(const std::string& str)
boost::char_separator<char> sep(":", "", boost::keep_empty_tokens);
typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
tokenizer tokens(str.substr(epos+1), sep);
std::string rhs = str.substr(epos+1);
tokenizer tokens(rhs, sep);
int j = 0;
for(tokenizer::iterator i = tokens.begin(); i != tokens.end(); ++i, ++j)
{
@ -103,7 +104,7 @@ CalibrationMapping CalibrationMapping::from_string(const std::string& str)
mapping.max = boost::lexical_cast<int>(*i);
else
throw std::runtime_error("--calibration: to many arguments given, syntax is 'AXIS=MIN:CENTER:MAX': " + str);
}
}
catch(boost::bad_lexical_cast&)
{
throw std::runtime_error("--calibration: couldn't convert '" + *i + "' to int");