From 2491eec0fd218f3aa95698461956a9a74f067721 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 22 Dec 2006 16:39:04 +0000 Subject: catch old style flags and use strtol to decode from string git-svn-id: svn://localhost/ardour2/trunk@1247 d708f5d6-7413-0410-9779-e7cbd77b26cf --- libs/pbd/enumwriter.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'libs') 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 + #include #include #include @@ -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::iterator i; vector::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); -- cgit v1.2.3