From 510a7471348788fccba6b7c4b9f7b7cc9aee6ba9 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 21 Apr 2025 14:33:01 +0200 Subject: Always use unsigned char * for data buffers Before this commit I was inconsistently using one of void *, char * and uint8_t *. --- python/nissy_module.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'python') diff --git a/python/nissy_module.c b/python/nissy_module.c index 46570dc..b389297 100644 --- a/python/nissy_module.c +++ b/python/nissy_module.c @@ -263,7 +263,8 @@ gendata(PyObject *self, PyObject *args) { long long size, err; const char *solver; - char *buf, dataid[NISSY_SIZE_DATAID]; + char dataid[NISSY_SIZE_DATAID]; + unsigned char *buf; if (!PyArg_ParseTuple(args, "s", &solver)) return NULL; @@ -279,7 +280,7 @@ gendata(PyObject *self, PyObject *args) Py_END_ALLOW_THREADS if (check_error(err)) - return PyByteArray_FromStringAndSize(buf, size); + return PyByteArray_FromStringAndSize((char *)buf, size); else return NULL; } @@ -303,7 +304,8 @@ checkdata(PyObject *self, PyObject *args) if (!PyArg_ParseTuple(args, "Y", &data)) return NULL; - result = nissy_checkdata(data->ob_alloc, data->ob_bytes); + result = nissy_checkdata( + data->ob_alloc, (unsigned char *)data->ob_bytes); if (check_error(result)) return Py_True; @@ -348,8 +350,9 @@ solve(PyObject *self, PyObject *args) Py_BEGIN_ALLOW_THREADS result = nissy_solve(cube, solver, nissflag, minmoves, maxmoves, - maxsolutions, optimal, threads, data->ob_alloc, data->ob_bytes, - MAX_SOLUTIONS_SIZE, solutions, stats); + maxsolutions, optimal, threads, data->ob_alloc, + (unsigned char *)data->ob_bytes, MAX_SOLUTIONS_SIZE, solutions, + stats); Py_END_ALLOW_THREADS if(!check_error(result)) { -- cgit v1.3