##// END OF EJS Templates
cext: modernize charencode.c to use Py_ssize_t
Yuya Nishihara -
r33754:a22339d3 default
parent child Browse files
Show More
@@ -7,6 +7,7 b''
7 the GNU General Public License, incorporated herein by reference.
7 the GNU General Public License, incorporated herein by reference.
8 */
8 */
9
9
10 #define PY_SSIZE_T_CLEAN
10 #include <Python.h>
11 #include <Python.h>
11
12
12 #include "charencode.h"
13 #include "charencode.h"
@@ -57,11 +58,11 b' static const char uppertable[128] = {'
57 /*
58 /*
58 * Turn a hex-encoded string into binary.
59 * Turn a hex-encoded string into binary.
59 */
60 */
60 PyObject *unhexlify(const char *str, int len)
61 PyObject *unhexlify(const char *str, Py_ssize_t len)
61 {
62 {
62 PyObject *ret;
63 PyObject *ret;
63 char *d;
64 char *d;
64 int i;
65 Py_ssize_t i;
65
66
66 ret = PyBytes_FromStringAndSize(NULL, len / 2);
67 ret = PyBytes_FromStringAndSize(NULL, len / 2);
67
68
@@ -18,7 +18,7 b' enum normcase_spec {'
18 NORMCASE_OTHER = 0
18 NORMCASE_OTHER = 0
19 };
19 };
20
20
21 PyObject *unhexlify(const char *str, int len);
21 PyObject *unhexlify(const char *str, Py_ssize_t len);
22 PyObject *asciilower(PyObject *self, PyObject *args);
22 PyObject *asciilower(PyObject *self, PyObject *args);
23 PyObject *asciiupper(PyObject *self, PyObject *args);
23 PyObject *asciiupper(PyObject *self, PyObject *args);
24 PyObject *make_file_foldmap(PyObject *self, PyObject *args);
24 PyObject *make_file_foldmap(PyObject *self, PyObject *args);
@@ -85,7 +85,7 b' static PyObject *parse_manifest(PyObject'
85
85
86 nlen = newline - zero - 1;
86 nlen = newline - zero - 1;
87
87
88 node = unhexlify(zero + 1, nlen > 40 ? 40 : (int)nlen);
88 node = unhexlify(zero + 1, nlen > 40 ? 40 : (Py_ssize_t)nlen);
89 if (!node)
89 if (!node)
90 goto bail;
90 goto bail;
91
91
General Comments 0
You need to be logged in to leave comments. Login now