summaryrefslogtreecommitdiff
path: root/instance.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2020-05-22 13:06:26 +0200
committerUwe Hermann <uwe@hermann-uwe.de>2020-05-22 13:06:26 +0200
commit3d9e87aadacf3f8f8a93ad09432c67a257b51633 (patch)
treebc19a0afa54f137a6e88808e8589dd8140cc4666 /instance.c
parent9e3ed17732bfee95dd17fbd74ad82195a992eb2f (diff)
downloadlibsigrokdecode-3d9e87aadacf3f8f8a93ad09432c67a257b51633.tar.gz
libsigrokdecode-3d9e87aadacf3f8f8a93ad09432c67a257b51633.zip
Use PyLong_FromUnsignedLongLong() where needed.
There were a few places where PyLong_FromLong() was used for uint64_t numbers. Properly use PyLong_FromUnsignedLongLong() there, and also fix a few additional size/signedness issues while we're here. Reported (and partial patch provided) by "The Count" on Bugzilla, thanks! This fixes bug #1499.
Diffstat (limited to 'instance.c')
-rw-r--r--instance.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/instance.c b/instance.c
index 5264bd0..3608874 100644
--- a/instance.c
+++ b/instance.c
@@ -167,7 +167,7 @@ SRD_API int srd_inst_option_set(struct srd_decoder_inst *di,
}
} else if (g_variant_is_of_type(value, G_VARIANT_TYPE_INT64)) {
val_int = g_variant_get_int64(value);
- if (!(py_optval = PyLong_FromLong(val_int))) {
+ if (!(py_optval = PyLong_FromLongLong(val_int))) {
/* ValueError Exception */
PyErr_Clear();
srd_err("Option '%s' has invalid integer value.", sdo->id);
@@ -699,7 +699,7 @@ SRD_PRIV int srd_inst_start(struct srd_decoder_inst *di)
Py_DECREF(py_res);
/* Set self.samplenum to 0. */
- py_samplenum = PyLong_FromLong(0);
+ py_samplenum = PyLong_FromUnsignedLongLong(0);
PyObject_SetAttrString(di->py_inst, "samplenum", py_samplenum);
Py_DECREF(py_samplenum);