mirror of
https://github.com/Hopiu/linkchecker.git
synced 2026-05-14 09:33:09 +00:00
prepare for Py_ssize_t conversion
git-svn-id: https://linkchecker.svn.sourceforge.net/svnroot/linkchecker/trunk/linkchecker@3530 e7d03fd6-7b0d-0410-9947-9c21f3af8025
This commit is contained in:
parent
7397929e9e
commit
b274787c5b
3 changed files with 12 additions and 4 deletions
|
|
@ -57,7 +57,8 @@
|
|||
CHECK_NULL(pencoding = PyObject_GetAttrString(yyextra->parser, "encoding")); \
|
||||
encoding = PyString_AsString(pencoding); \
|
||||
if (encoding==NULL) { Py_DECREF(pencoding); return T_ERROR; } \
|
||||
(a) = PyUnicode_Decode(yyextra->tmp_buf, strlen(yyextra->tmp_buf), \
|
||||
(a) = PyUnicode_Decode(yyextra->tmp_buf, \
|
||||
(Py_ssize_t)strlen(yyextra->tmp_buf), \
|
||||
encoding, "ignore"); \
|
||||
Py_DECREF(pencoding); \
|
||||
CHECK_NULL(a); \
|
||||
|
|
@ -65,7 +66,7 @@
|
|||
|
||||
#define PYSTRING_TMP_ASCII(a) \
|
||||
CHECK_NULL((a) = PyUnicode_Decode(yyextra->tmp_buf, \
|
||||
strlen(yyextra->tmp_buf), "ascii", "ignore"))
|
||||
(Py_ssize_t)strlen(yyextra->tmp_buf), "ascii", "ignore"))
|
||||
|
||||
/* set return value from tmp_buf */
|
||||
#define SETLVAL_UNICODE { \
|
||||
|
|
|
|||
|
|
@ -630,8 +630,8 @@ static PyObject* parser_flush (parser_object* self, PyObject* args) {
|
|||
int error = 0;
|
||||
const char* enc = PyString_AsString(self->encoding);
|
||||
PyObject* s = PyUnicode_Decode(self->userData->buf,
|
||||
strlen(self->userData->buf),
|
||||
enc, "ignore");
|
||||
(Py_ssize_t)strlen(self->userData->buf),
|
||||
enc, "ignore");
|
||||
PyObject* callback = NULL;
|
||||
PyObject* result = NULL;
|
||||
/* reset buffer */
|
||||
|
|
|
|||
|
|
@ -31,6 +31,13 @@
|
|||
#error please install Python >= 2.4
|
||||
#endif
|
||||
|
||||
/* See http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
|
||||
#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
|
||||
typedef int Py_ssize_t;
|
||||
#define PY_SSIZE_T_MAX INT_MAX
|
||||
#define PY_SSIZE_T_MIN INT_MIN
|
||||
#endif
|
||||
|
||||
/* user_data type for SAX calls */
|
||||
typedef struct {
|
||||
/* the Python SAX object to issue callbacks */
|
||||
|
|
|
|||
Loading…
Reference in a new issue