diff options
Diffstat (limited to 'libs/pbd/enumwriter.cc')
-rw-r--r-- | libs/pbd/enumwriter.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libs/pbd/enumwriter.cc b/libs/pbd/enumwriter.cc index c42cc3a5c2..d6c882e00a 100644 --- a/libs/pbd/enumwriter.cc +++ b/libs/pbd/enumwriter.cc @@ -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); |