]> sigrok.org Git - libsigrokdecode.git/commitdiff
Fix enumeration of option values.
authorBert Vermeulen <redacted>
Tue, 11 Mar 2014 22:27:31 +0000 (23:27 +0100)
committerBert Vermeulen <redacted>
Tue, 11 Mar 2014 22:27:31 +0000 (23:27 +0100)
decoder.c

index fd76a1cbec0ac897c77f017ddf74cda5cae094c5..1e22d0dd5c297ffd622c1651cc3c99bb2dd28434 100644 (file)
--- a/decoder.c
+++ b/decoder.c
@@ -254,7 +254,7 @@ static int get_options(struct srd_decoder *d)
                                        o->values = g_slist_append(o->values, gvar);
                                } else if (PyLong_Check(py_item)) {
                                        /* Long */
-                                       lval = PyLong_AsLongAndOverflow(py_default, &overflow);
+                                       lval = PyLong_AsLongAndOverflow(py_item, &overflow);
                                        if (overflow) {
                                                /* Value is < LONG_MIN or > LONG_MAX */
                                                PyErr_Clear();
@@ -265,9 +265,9 @@ static int get_options(struct srd_decoder *d)
                                        gvar = g_variant_new_int64(lval);
                                        g_variant_ref_sink(gvar);
                                        o->values = g_slist_append(o->values, gvar);
-                               } else if (PyFloat_Check(py_default)) {
+                               } else if (PyFloat_Check(py_item)) {
                                        /* Float */
-                                       if ((dval = PyFloat_AsDouble(py_default)) == -1.0) {
+                                       if ((dval = PyFloat_AsDouble(py_item)) == -1.0) {
                                                PyErr_Clear();
                                                srd_err("Protocol decoder %s option 'default' has "
                                                                "invalid default value.", d->name);