X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=util.c;h=b7fd4fb4900728c6df3bc186f22aa141dac0578d;hb=2aa30631c0e0d54f3e71c88107ae153b8a1c5426;hp=7c09f6d70d6b298c9af013bbbc2f5ea9adda9d6f;hpb=5d1d5597d953b5a4a44938ee295aa3386d84e799;p=libsigrokdecode.git diff --git a/util.c b/util.c index 7c09f6d..b7fd4fb 100644 --- a/util.c +++ b/util.c @@ -303,7 +303,7 @@ err: * * @private */ -SRD_PRIV int py_pydictitem_as_long(PyObject *py_obj, PyObject *py_key, uint64_t *out) +SRD_PRIV int py_pydictitem_as_long(PyObject *py_obj, PyObject *py_key, int64_t *out) { PyObject *py_value; PyGILState_STATE gstate; @@ -328,7 +328,7 @@ SRD_PRIV int py_pydictitem_as_long(PyObject *py_obj, PyObject *py_key, uint64_t goto err; } - *out = PyLong_AsUnsignedLongLong(py_value); + *out = PyLong_AsLongLong(py_value); PyGILState_Release(gstate); @@ -490,7 +490,6 @@ SRD_PRIV GVariant *py_obj_to_variant(PyObject *py_obj) } if (!var) srd_exception_catch("Failed to extract string value"); - } else if (PyLong_Check(py_obj)) { /* integer */ int64_t val; @@ -499,7 +498,6 @@ SRD_PRIV GVariant *py_obj_to_variant(PyObject *py_obj) var = g_variant_new_int64(val); else srd_exception_catch("Failed to extract integer value"); - } else if (PyFloat_Check(py_obj)) { /* float */ double val; @@ -508,7 +506,6 @@ SRD_PRIV GVariant *py_obj_to_variant(PyObject *py_obj) var = g_variant_new_double(val); else srd_exception_catch("Failed to extract float value"); - } else { srd_err("Failed to extract value of unsupported type."); }