]> sigrok.org Git - libsigrokdecode.git/blobdiff - type_decoder.c
sle44xx: support memory read "to end of capacity"
[libsigrokdecode.git] / type_decoder.c
index 454e7ea90deea3b0a89ecf1ba6b90aaad62978e4..1b378f1ac6e8b53d2e037310c60bd659923ee0b1 100644 (file)
@@ -605,13 +605,13 @@ static PyObject *get_current_pinvalues(const struct srd_decoder_inst *di)
                /* A channelmap value of -1 means "unused optional channel". */
                if (di->dec_channelmap[i] == -1) {
                        /* Value of unused channel is 0xff, instead of 0 or 1. */
-                       PyTuple_SetItem(py_pinvalues, i, PyLong_FromLong(0xff));
+                       PyTuple_SetItem(py_pinvalues, i, PyLong_FromUnsignedLong(0xff));
                } else {
                        sample_pos = di->inbuf + ((di->abs_cur_samplenum - di->abs_start_samplenum) * di->data_unitsize);
                        byte_offset = di->dec_channelmap[i] / 8;
                        bit_offset = di->dec_channelmap[i] % 8;
                        sample = *(sample_pos + byte_offset) & (1 << bit_offset) ? 1 : 0;
-                       PyTuple_SetItem(py_pinvalues, i, PyLong_FromLong(sample));
+                       PyTuple_SetItem(py_pinvalues, i, PyLong_FromUnsignedLong(sample));
                }
        }
 
@@ -677,7 +677,7 @@ static int create_term_list(struct srd_decoder_inst *di,
                        term->type = SRD_TERM_SKIP;
                        term->num_samples_to_skip = num_samples_to_skip;
                        term->num_samples_already_skipped = 0;
-                       if (num_samples_to_skip < 1)
+                       if (num_samples_to_skip < 0)
                                term->type = SRD_TERM_ALWAYS_FALSE;
                } else {
                        srd_err("Term key is neither a string nor a number.");
@@ -922,7 +922,7 @@ static PyObject *Decoder_wait(PyObject *self, PyObject *args)
                /* If there's a match, set self.samplenum etc. and return. */
                if (found_match) {
                        /* Set self.samplenum to the (absolute) sample number that matched. */
-                       py_samplenum = PyLong_FromLong(di->abs_cur_samplenum);
+                       py_samplenum = PyLong_FromUnsignedLongLong(di->abs_cur_samplenum);
                        PyObject_SetAttrString(di->py_inst, "samplenum", py_samplenum);
                        Py_DECREF(py_samplenum);
 
@@ -1037,7 +1037,7 @@ err:
 static PyMethodDef Decoder_methods[] = {
        { "put", Decoder_put, METH_VARARGS,
          "Accepts a dictionary with the following keys: startsample, endsample, data" },
-       { "register", (PyCFunction)Decoder_register, METH_VARARGS|METH_KEYWORDS,
+       { "register", (PyCFunction)(void(*)(void))Decoder_register, METH_VARARGS|METH_KEYWORDS,
                        "Register a new output stream" },
        { "wait", Decoder_wait, METH_VARARGS,
                        "Wait for one or more conditions to occur" },