summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2006-12-22 16:39:04 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2006-12-22 16:39:04 +0000
commit2491eec0fd218f3aa95698461956a9a74f067721 (patch)
tree01ab043fffae79bb623414a841a5a9fa1cf42da7
parent6d4e6dc580c18ee940a30345656c70c054a6fa2d (diff)
catch old style flags and use strtol to decode from string
git-svn-id: svn://localhost/ardour2/trunk@1247 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--libs/pbd/enumwriter.cc14
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);