diff options
author | cgohlke <cgohlke@uci.edu> | 2012-07-12 20:58:35 -0700 |
---|---|---|
committer | cgohlke <cgohlke@uci.edu> | 2012-07-12 20:58:35 -0700 |
commit | 4e74a93e31371baed2fb027123d3cd16c8832ecc (patch) | |
tree | 3e76b993ea73cae3efff3dc998592956de93b56b /numpy | |
parent | 2ee97d6014b4c1c2b33a02bdcf99cd1e15808360 (diff) | |
download | numpy-4e74a93e31371baed2fb027123d3cd16c8832ecc.tar.gz |
Use npy_ftell and npy_fseek
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/multiarray/ctors.c | 28 |
1 files changed, 4 insertions, 24 deletions
diff --git a/numpy/core/src/multiarray/ctors.c b/numpy/core/src/multiarray/ctors.c index c9cdffb23..3da4c5294 100644 --- a/numpy/core/src/multiarray/ctors.c +++ b/numpy/core/src/multiarray/ctors.c @@ -3000,41 +3000,21 @@ array_fromfile_binary(FILE *fp, PyArray_Descr *dtype, npy_intp num, size_t *nrea if (num < 0) { int fail = 0; - -#if defined(_MSC_VER) && defined(_WIN64) && (_MSC_VER > 1400) - /* Workaround Win64 fwrite() bug. Ticket #1660 */ - start = (npy_intp )_ftelli64(fp); - if (start < 0) { - fail = 1; - } - if (_fseeki64(fp, 0, SEEK_END) < 0) { - fail = 1; - } - numbytes = (npy_intp) _ftelli64(fp); - if (numbytes < 0) { - fail = 1; - } - numbytes -= start; - if (_fseeki64(fp, start, SEEK_SET) < 0) { - fail = 1; - } -#else - start = (npy_intp)ftell(fp); + start = (npy_intp) npy_ftell(fp); if (start < 0) { fail = 1; } - if (fseek(fp, 0, SEEK_END) < 0) { + if (npy_fseek(fp, 0, SEEK_END) < 0) { fail = 1; } - numbytes = (npy_intp) ftell(fp); + numbytes = (npy_intp) npy_ftell(fp); if (numbytes < 0) { fail = 1; } numbytes -= start; - if (fseek(fp, start, SEEK_SET) < 0) { + if (npy_fseek(fp, start, SEEK_SET) < 0) { fail = 1; } -#endif if (fail) { PyErr_SetString(PyExc_IOError, "could not seek in file"); |