mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-09 16:24:57 +01:00
fix parsing "-inf" in config variables
The default for export-silence-threshold is -INFINITY, written as "-inf" (by cfgtool) into system_config. Yet parsing the config using a std::stringstream results in "0" (due to bugs in various libc++).
This commit is contained in:
parent
6ce9efb11d
commit
7b1f97bffa
2 changed files with 11 additions and 0 deletions
|
|
@ -107,3 +107,10 @@ ConfigVariableBase::miss ()
|
||||||
// is set but to the same value as it already has
|
// is set but to the same value as it already has
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Specialisation of ConfigVariable to deal with float (-inf etc)
|
||||||
|
* http://stackoverflow.com/questions/23374095/should-a-stringstream-parse-infinity-as-an-infinite-value
|
||||||
|
*/
|
||||||
|
template<> void
|
||||||
|
ConfigVariable<float>::set_from_string (std::string const & s) {
|
||||||
|
value = std::strtof (s.c_str(), NULL);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,6 +89,10 @@ class /*LIBPBD_API*/ ConfigVariable : public ConfigVariableBase
|
||||||
T value;
|
T value;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Specialisation of ConfigVariable to deal with float (-inf etc) */
|
||||||
|
template<> void
|
||||||
|
ConfigVariable<float>::set_from_string (std::string const & s);
|
||||||
|
|
||||||
/** Specialisation of ConfigVariable for std::string to cope with whitespace properly */
|
/** Specialisation of ConfigVariable for std::string to cope with whitespace properly */
|
||||||
template<>
|
template<>
|
||||||
class /*LIBPBD_API*/ ConfigVariable<std::string> : public ConfigVariableBase
|
class /*LIBPBD_API*/ ConfigVariable<std::string> : public ConfigVariableBase
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue