diff --git a/php_python_internal.h b/php_python_internal.h index f099a4c..8b6a001 100644 --- a/php_python_internal.h +++ b/php_python_internal.h @@ -110,6 +110,6 @@ int pip_pyobject_to_zval(PyObject *o, zval *zv TSRMLS_DC); PyObject * pip_args_to_tuple(int argc, int start TSRMLS_DC); /* Object Representations */ -int python_str(PyObject *o, char **buffer, int *length TSRMLS_DC); +int python_str(PyObject *o, char **buffer, Py_ssize_t *length TSRMLS_DC); #endif /* PHP_PYTHON_INTERNAL_H */ diff --git a/python_convert.c b/python_convert.c index e44d14d..b3393cb 100644 --- a/python_convert.c +++ b/python_convert.c @@ -86,7 +86,7 @@ pip_hash_to_dict(zval *hash TSRMLS_DC) PyObject *dict, *integer; zval **entry; char *string_key; - long num_key; + unsigned long num_key; PHP_PYTHON_THREAD_ASSERT(); @@ -136,7 +136,7 @@ pip_zobject_to_pyobject(zval *obj TSRMLS_DC) PyObject *dict, *str; zval **entry; char *string_key; - long num_key; + unsigned long num_key; PHP_PYTHON_THREAD_ASSERT(); @@ -164,7 +164,7 @@ pip_zobject_to_pyobject(zval *obj TSRMLS_DC) PyDict_SetItemString(dict, string_key, item); break; case HASH_KEY_IS_LONG: - str = PyString_FromFormat("%d", num_key); + str = PyString_FromFormat("%lu", num_key); PyObject_SetItem(dict, str, item); Py_DECREF(str); break; @@ -309,7 +309,8 @@ pip_mapping_to_hash(PyObject *o, HashTable *ht TSRMLS_DC) PyObject *keys, *key, *str, *item; zval *v; char *name; - int i, size, name_len; + int i, size; + Py_ssize_t name_len; int status = FAILURE; PHP_PYTHON_THREAD_ASSERT(); @@ -582,7 +583,7 @@ pip_args_to_tuple(int argc, int start TSRMLS_DC) /* {{{ python_str(PyObject *o, char **buffer, int *length) Returns the NUL-terminated string representation of a Python object. */ int -python_str(PyObject *o, char **buffer, int *length TSRMLS_DC) +python_str(PyObject *o, char **buffer, Py_ssize_t *length TSRMLS_DC) { PyObject *str; int ret = -1; diff --git a/python_streams.c b/python_streams.c index a3e7904..dc6e3e5 100644 --- a/python_streams.c +++ b/python_streams.c @@ -85,7 +85,7 @@ OutputStream_writelines(OutputStream *self, PyObject *args) PyObject *iterator; PyObject *item; char *str; - int len; + Py_ssize_t len; if (!PyArg_ParseTuple(args, "O:writelines", &sequence)) return NULL;