/* See also ../Dos/dosmodule.c */
+#define PY_SSIZE_T_CLEAN
+
#include "Python.h"
#include "structseq.h"
#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;
/* 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
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))
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);
}