catch old style flags and use strtol to decode from string
git-svn-id: svn://localhost/ardour2/trunk@1247 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
6d4e6dc580
commit
2491eec0fd
@ -18,6 +18,8 @@
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <pbd/enumwriter.h>
|
||||
#include <pbd/error.h>
|
||||
#include <pbd/compose.h>
|
||||
@ -149,6 +151,12 @@ EnumWriter::read_bits (EnumRegistration& er, string str)
|
||||
bool found = false;
|
||||
string::size_type comma;
|
||||
|
||||
/* catch old-style hex numerics */
|
||||
|
||||
if (str.length() > 2 && str[0] == '0' && str[1] == 'x') {
|
||||
return strtol (str.c_str(), (char **) 0, 16);
|
||||
}
|
||||
|
||||
do {
|
||||
|
||||
comma = str.find_first_of (',');
|
||||
@ -182,6 +190,12 @@ EnumWriter::read_distinct (EnumRegistration& er, string str)
|
||||
vector<int>::iterator i;
|
||||
vector<string>::iterator s;
|
||||
|
||||
/* catch old-style hex numerics */
|
||||
|
||||
if (str.length() > 2 && str[0] == '0' && str[1] == 'x') {
|
||||
return strtol (str.c_str(), (char **) 0, 16);
|
||||
}
|
||||
|
||||
for (i = er.values.begin(), s = er.names.begin(); i != er.values.end(); ++i, ++s) {
|
||||
if (str == (*s)) {
|
||||
return (*i);
|
||||
|
Loading…
Reference in New Issue
Block a user