diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 14:33:01 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-21 14:44:07 +0200 |
| commit | 510a7471348788fccba6b7c4b9f7b7cc9aee6ba9 (patch) | |
| tree | 58df7791242d9a4f52e80da93ad3af20ed5e3528 /python | |
| parent | 1d9b8acfeece68c4f55d2499d8aed127f98a383c (diff) | |
| download | nissy-core-510a7471348788fccba6b7c4b9f7b7cc9aee6ba9.tar.gz nissy-core-510a7471348788fccba6b7c4b9f7b7cc9aee6ba9.zip | |
Always use unsigned char * for data buffers
Before this commit I was inconsistently using one of void *, char *
and uint8_t *.
Diffstat (limited to '')
| -rw-r--r-- | python/nissy_module.c | 13 |
1 files changed, 8 insertions, 5 deletions
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) | |||
| 263 | { | 263 | { |
| 264 | long long size, err; | 264 | long long size, err; |
| 265 | const char *solver; | 265 | const char *solver; |
| 266 | char *buf, dataid[NISSY_SIZE_DATAID]; | 266 | char dataid[NISSY_SIZE_DATAID]; |
| 267 | unsigned char *buf; | ||
| 267 | 268 | ||
| 268 | if (!PyArg_ParseTuple(args, "s", &solver)) | 269 | if (!PyArg_ParseTuple(args, "s", &solver)) |
| 269 | return NULL; | 270 | return NULL; |
| @@ -279,7 +280,7 @@ gendata(PyObject *self, PyObject *args) | |||
| 279 | Py_END_ALLOW_THREADS | 280 | Py_END_ALLOW_THREADS |
| 280 | 281 | ||
| 281 | if (check_error(err)) | 282 | if (check_error(err)) |
| 282 | return PyByteArray_FromStringAndSize(buf, size); | 283 | return PyByteArray_FromStringAndSize((char *)buf, size); |
| 283 | else | 284 | else |
| 284 | return NULL; | 285 | return NULL; |
| 285 | } | 286 | } |
| @@ -303,7 +304,8 @@ checkdata(PyObject *self, PyObject *args) | |||
| 303 | if (!PyArg_ParseTuple(args, "Y", &data)) | 304 | if (!PyArg_ParseTuple(args, "Y", &data)) |
| 304 | return NULL; | 305 | return NULL; |
| 305 | 306 | ||
| 306 | result = nissy_checkdata(data->ob_alloc, data->ob_bytes); | 307 | result = nissy_checkdata( |
| 308 | data->ob_alloc, (unsigned char *)data->ob_bytes); | ||
| 307 | 309 | ||
| 308 | if (check_error(result)) | 310 | if (check_error(result)) |
| 309 | return Py_True; | 311 | return Py_True; |
| @@ -348,8 +350,9 @@ solve(PyObject *self, PyObject *args) | |||
| 348 | 350 | ||
| 349 | Py_BEGIN_ALLOW_THREADS | 351 | Py_BEGIN_ALLOW_THREADS |
| 350 | result = nissy_solve(cube, solver, nissflag, minmoves, maxmoves, | 352 | result = nissy_solve(cube, solver, nissflag, minmoves, maxmoves, |
| 351 | maxsolutions, optimal, threads, data->ob_alloc, data->ob_bytes, | 353 | maxsolutions, optimal, threads, data->ob_alloc, |
| 352 | MAX_SOLUTIONS_SIZE, solutions, stats); | 354 | (unsigned char *)data->ob_bytes, MAX_SOLUTIONS_SIZE, solutions, |
| 355 | stats); | ||
| 353 | Py_END_ALLOW_THREADS | 356 | Py_END_ALLOW_THREADS |
| 354 | 357 | ||
| 355 | if(!check_error(result)) { | 358 | if(!check_error(result)) { |
