diff options
author | Thomas Wouters <thomas@python.org> | 2006-03-01 01:05:10 (GMT) |
---|---|---|
committer | Thomas Wouters <thomas@python.org> | 2006-03-01 01:05:10 (GMT) |
commit | 68bc4f9ae574b81fc14e54c9e96ea2b4fb4eaecb (patch) | |
tree | 991b17483067237ed57087c27af01525a795d597 /Modules/posixmodule.c | |
parent | 9d63ccae909122dc5a6e4dc793ad3c3885cc5bdc (diff) | |
download | cpython-68bc4f9ae574b81fc14e54c9e96ea2b4fb4eaecb.zip cpython-68bc4f9ae574b81fc14e54c9e96ea2b4fb4eaecb.tar.gz cpython-68bc4f9ae574b81fc14e54c9e96ea2b4fb4eaecb.tar.bz2 |
Py_ssize_t-ify.
Diffstat (limited to 'Modules/posixmodule.c')
-rw-r--r-- | Modules/posixmodule.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c index 4a482fc..efe5074 100644 --- a/Modules/posixmodule.c +++ b/Modules/posixmodule.c @@ -13,6 +13,8 @@ /* See also ../Dos/dosmodule.c */ +#define PY_SSIZE_T_CLEAN + #include "Python.h" #include "structseq.h" @@ -1759,7 +1761,7 @@ posix_listdir(PyObject *self, PyObject *args) #define MAX_PATH CCHMAXPATH #endif char *name, *pt; - int len; + Py_ssize_t len; PyObject *d, *v; char namebuf[MAX_PATH+5]; HDIR hdir = 1; @@ -1899,7 +1901,7 @@ posix__getfullpathname(PyObject *self, PyObject *args) /* assume encoded strings wont more than double no of chars */ char inbuf[MAX_PATH*2]; char *inbufp = inbuf; - int insize = sizeof(inbuf)/sizeof(inbuf[0]); + Py_ssize_t insize; char outbuf[MAX_PATH*2]; char *temp; #ifdef Py_WIN_WIDE_FILENAMES @@ -1919,6 +1921,7 @@ posix__getfullpathname(PyObject *self, PyObject *args) PyErr_Clear(); } #endif + /* XXX(twouters) Why use 'et#' here at all? insize isn't used */ if (!PyArg_ParseTuple (args, "et#:_getfullpathname", Py_FileSystemDefaultEncoding, &inbufp, &insize)) @@ -5590,16 +5593,18 @@ Write a string to a file descriptor."); static PyObject * posix_write(PyObject *self, PyObject *args) { - int fd, size; + int fd; + Py_ssize_t size; char *buffer; + if (!PyArg_ParseTuple(args, "is#:write", &fd, &buffer, &size)) return NULL; Py_BEGIN_ALLOW_THREADS - size = write(fd, buffer, size); + size = write(fd, buffer, (size_t)size); Py_END_ALLOW_THREADS if (size < 0) return posix_error(); - return PyInt_FromLong((long)size); + return PyInt_FromSsize_t(size); } |