wok-current view hplip/stuff/hplip.python3.10.diff @ rev 25721
Update slitaz-i18n for gnumeric
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Tue Jun 18 11:25:19 2024 +0000 (8 months ago) |
parents | |
children |
line source
1 diff --git a/io/mudext/hpmudext.c b/io/mudext/hpmudext.c
2 index dca3e9d..dfcd22a 100644
3 --- a/io/mudext/hpmudext.c
4 +++ b/io/mudext/hpmudext.c
5 @@ -24,6 +24,8 @@ Authors: Don Welch, David Suffield, Naga Samrat Chowdary Narla
7 \*****************************************************************************/
9 +#define PY_SSIZE_T_CLEAN
10 +
11 #include <Python.h>
12 #include <stdarg.h>
13 #include "hpmud.h"
14 @@ -187,14 +189,22 @@ static PyObject *write_channel(PyObject *self, PyObject *args)
15 HPMUD_CHANNEL cd;
16 int timeout = 30;
17 char * buf;
18 - int buf_size = 0;
19 + Py_ssize_t buf_size = 0;
20 + int buf_size_asInt = 0;
21 int bytes_written = 0;
23 if (!PyArg_ParseTuple(args, "iis#|i", &dd, &cd, &buf, &buf_size, &timeout))
24 return NULL;
26 + if (buf_size < INT_MIN)
27 + buf_size_asInt = INT_MIN;
28 + else if (buf_size > INT_MAX)
29 + buf_size_asInt = INT_MAX;
30 + else
31 + buf_size_asInt = (int)buf_size;
32 +
33 Py_BEGIN_ALLOW_THREADS
34 - result = hpmud_write_channel(dd, cd, buf, buf_size, timeout, &bytes_written);
35 + result = hpmud_write_channel(dd, cd, buf, buf_size_asInt, timeout, &bytes_written);
36 Py_END_ALLOW_THREADS
38 return Py_BuildValue("(ii)", result, bytes_written);
39 @@ -231,14 +241,22 @@ static PyObject *set_pml(PyObject *self, PyObject *args)
40 char * oid;
41 int type;
42 char * data;
43 - int data_size;
44 + Py_ssize_t data_size = 0;
45 + int data_size_asInt = 0;
46 int pml_result;
48 if (!PyArg_ParseTuple(args, "iisis#", &dd, &cd, &oid, &type, &data, &data_size))
49 return NULL;
51 + if (data_size < INT_MIN)
52 + data_size_asInt = INT_MIN;
53 + else if (data_size > INT_MAX)
54 + data_size_asInt = INT_MAX;
55 + else
56 + data_size_asInt = (int)data_size;
57 +
58 Py_BEGIN_ALLOW_THREADS
59 - result = hpmud_set_pml(dd, cd, oid, type, (void *)data, data_size, &pml_result);
60 + result = hpmud_set_pml(dd, cd, oid, type, (void *)data, data_size_asInt, &pml_result);
61 Py_END_ALLOW_THREADS
63 return Py_BuildValue("(ii)", result, pml_result);
64 diff --git a/scan/scanext/scanext.c b/scan/scanext/scanext.c
65 index 1e6b514..597abd8 100755
66 --- a/scan/scanext/scanext.c
67 +++ b/scan/scanext/scanext.c
68 @@ -45,6 +45,8 @@ PERFORMANCE OF THIS SOFTWARE.
69 *******************************************************************/
72 +#define PY_SSIZE_T_CLEAN
73 +
74 /* _ScanDevice objects */
76 #include "Python.h"