summaryrefslogtreecommitdiffstats
path: root/Include/fileobject.h
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2002-04-21 07:29:14 (GMT)
committerTim Peters <tim.peters@gmail.com>2002-04-21 07:29:14 (GMT)
commit058b141ef77edcd8000bc169f3b9b7cc9d362ffa (patch)
tree96a5f7b157b28e2667c8ebf708cc3e27d839e645 /Include/fileobject.h
parentea572b21f846e4b9050a7508c0d5626fc835c309 (diff)
downloadcpython-058b141ef77edcd8000bc169f3b9b7cc9d362ffa.zip
cpython-058b141ef77edcd8000bc169f3b9b7cc9d362ffa.tar.gz
cpython-058b141ef77edcd8000bc169f3b9b7cc9d362ffa.tar.bz2
Py_UniversalNewlineFread(): Many changes.
+ Continued looping until n bytes in the buffer have been filled, not just when n bytes have been read from the file. This repairs the bug that f.readlines() only sucked up the first 8192 bytes of the file on Windows when universal newlines was enabled and f was opened in U mode (see Python-Dev -- this was the ultimate cause of the test_inspect.py failure). + Changed prototye to take a char* buffer (void* doesn't make much sense). + Squashed size_t vs int mismatches (in particular, besides the unsigned vs signed distinction, size_t may be larger than int). + Gets out under all error conditions now (it's possible for fread() to suffer an error even if it returns a number larger than 0 -- any "short read" is an error or EOF condition). + Rearranged and simplified declarations.
Diffstat (limited to 'Include/fileobject.h')
-rw-r--r--Include/fileobject.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/Include/fileobject.h b/Include/fileobject.h
index d696475..6c34223 100644
--- a/Include/fileobject.h
+++ b/Include/fileobject.h
@@ -41,7 +41,7 @@ extern DL_IMPORT(int) PyFile_WriteString(const char *, PyObject *);
extern DL_IMPORT(int) PyObject_AsFileDescriptor(PyObject *);
/* The default encoding used by the platform file system APIs
- If non-NULL, this is different than the default encoding for strings
+ If non-NULL, this is different than the default encoding for strings
*/
extern DL_IMPORT(const char *) Py_FileSystemDefaultEncoding;
@@ -51,12 +51,12 @@ extern DL_IMPORT(const char *) Py_FileSystemDefaultEncoding;
*/
#define PY_STDIOTEXTMODE "b"
char *Py_UniversalNewlineFgets(char *, int, FILE*, PyObject *);
-size_t Py_UniversalNewlineFread(void *, size_t, FILE *, PyObject *);
+size_t Py_UniversalNewlineFread(char *, size_t, FILE *, PyObject *);
#else
#define PY_STDIOTEXTMODE ""
-#define Py_UniversalNewlineFgets(buf, len, fp, obj) (fgets((buf), (len), (fp)))
-#define Py_UniversalNewlineFread(buf, len, fp, obj) \
- (fread((buf), 1, (len), (fp)))
+#define Py_UniversalNewlineFgets(buf, len, fp, obj) fgets((buf), (len), (fp))
+#define Py_UniversalNewlineFread(buf, len, fp, obj)
+ fread((buf), 1, (len), (fp))
#endif /* WITH_UNIVERSAL_NEWLINES */
#ifdef __cplusplus
}