diff options
author | Anthony Baxter <anthonybaxter@gmail.com> | 2006-04-11 06:54:30 (GMT) |
---|---|---|
committer | Anthony Baxter <anthonybaxter@gmail.com> | 2006-04-11 06:54:30 (GMT) |
commit | 377be11ee1fab015f4cc77975374f86cf436536e (patch) | |
tree | 3181b8a7ebd32101aa56048eaa2f96a98b8bf013 /Objects/fileobject.c | |
parent | bbfe4fad361e7190675f28702332ddc377bd8cfd (diff) | |
download | cpython-377be11ee1fab015f4cc77975374f86cf436536e.zip cpython-377be11ee1fab015f4cc77975374f86cf436536e.tar.gz cpython-377be11ee1fab015f4cc77975374f86cf436536e.tar.bz2 |
More C++-compliance. Note especially listobject.c - to get C++ to accept the
PyTypeObject structures, I had to make prototypes for the functions, and
move the structure definition ahead of the functions. I'd dearly like a better
way to do this - to change this would make for a massive set of changes to
the codebase.
There's still some warnings - this is purely to get rid of errors first.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r-- | Objects/fileobject.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 5a50d1e..20e71a3 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -313,7 +313,8 @@ PyFile_SetBufSize(PyObject *f, int bufsize) PyMem_Free(file->f_setbuf); file->f_setbuf = NULL; } else { - file->f_setbuf = PyMem_Realloc(file->f_setbuf, bufsize); + file->f_setbuf = (char *)PyMem_Realloc(file->f_setbuf, + bufsize); } #ifdef HAVE_SETVBUF setvbuf(file->f_fp, file->f_setbuf, type, bufsize); @@ -1391,7 +1392,7 @@ file_readlines(PyFileObject *f, PyObject *args) goto cleanup; } totalread += nread; - p = memchr(buffer+nfilled, '\n', nread); + p = (char *)memchr(buffer+nfilled, '\n', nread); if (p == NULL) { /* Need a larger buffer to fit this line */ nfilled += nread; @@ -1431,7 +1432,7 @@ file_readlines(PyFileObject *f, PyObject *args) if (err != 0) goto error; q = p; - p = memchr(q, '\n', end-q); + p = (char *)memchr(q, '\n', end-q); } while (p != NULL); /* Move the remaining incomplete line to the start */ nfilled = end-q; @@ -1809,7 +1810,7 @@ readahead(PyFileObject *f, int bufsize) else drop_readahead(f); } - if ((f->f_buf = PyMem_Malloc(bufsize)) == NULL) { + if ((f->f_buf = (char *)PyMem_Malloc(bufsize)) == NULL) { PyErr_NoMemory(); return -1; } @@ -1852,7 +1853,7 @@ readahead_get_line_skip(PyFileObject *f, int skip, int bufsize) if (len == 0) return (PyStringObject *) PyString_FromStringAndSize(NULL, skip); - bufptr = memchr(f->f_bufptr, '\n', len); + bufptr = (char *)memchr(f->f_bufptr, '\n', len); if (bufptr != NULL) { bufptr++; /* Count the '\n' */ len = bufptr - f->f_bufptr; |