summaryrefslogtreecommitdiffstats
path: root/Modules/_io
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2013-06-24 22:37:25 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2013-06-24 22:37:25 (GMT)
commit14b9b110982fd7f00392b898230c4015bd2bdaaa (patch)
tree77ed33b8f8db6c8b91fd253978ea5bc8c859bca6 /Modules/_io
parentb28a375f2f4724c129e8683f548c8f1477e00a68 (diff)
downloadcpython-14b9b110982fd7f00392b898230c4015bd2bdaaa.zip
cpython-14b9b110982fd7f00392b898230c4015bd2bdaaa.tar.gz
cpython-14b9b110982fd7f00392b898230c4015bd2bdaaa.tar.bz2
If MS_WIN64 is defined, MS_WINDOWS is also defined: #ifdef can be simplified.
Diffstat (limited to 'Modules/_io')
-rw-r--r--Modules/_io/_iomodule.h2
-rw-r--r--Modules/_io/fileio.c14
2 files changed, 8 insertions, 8 deletions
diff --git a/Modules/_io/_iomodule.h b/Modules/_io/_iomodule.h
index 0fe90a3..ad1faa8 100644
--- a/Modules/_io/_iomodule.h
+++ b/Modules/_io/_iomodule.h
@@ -77,7 +77,7 @@ extern int _PyIO_trap_eintr(void);
long with "%lld" even when both long and long long have the same
precision. */
-#if defined(MS_WIN64) || defined(MS_WINDOWS)
+#ifdef MS_WINDOWS
/* Windows uses long long for offsets */
typedef PY_LONG_LONG Py_off_t;
diff --git a/Modules/_io/fileio.c b/Modules/_io/fileio.c
index 34a5801..efcc594 100644
--- a/Modules/_io/fileio.c
+++ b/Modules/_io/fileio.c
@@ -533,7 +533,7 @@ fileio_readinto(fileio *self, PyObject *args)
len = pbuf.len;
Py_BEGIN_ALLOW_THREADS
errno = 0;
-#if defined(MS_WIN64) || defined(MS_WINDOWS)
+#ifdef MS_WINDOWS
if (len > INT_MAX)
len = INT_MAX;
n = read(self->fd, pbuf.buf, (int)len);
@@ -602,7 +602,7 @@ fileio_readall(fileio *self)
if (!_PyVerify_fd(self->fd))
return PyErr_SetFromErrno(PyExc_IOError);
-#if defined(MS_WIN64) || defined(MS_WINDOWS)
+#ifdef MS_WINDOWS
pos = _lseeki64(self->fd, 0L, SEEK_CUR);
#else
pos = lseek(self->fd, 0L, SEEK_CUR);
@@ -645,7 +645,7 @@ fileio_readall(fileio *self)
Py_BEGIN_ALLOW_THREADS
errno = 0;
n = bufsize - bytes_read;
-#if defined(MS_WIN64) || defined(MS_WINDOWS)
+#ifdef MS_WINDOWS
if (n > INT_MAX)
n = INT_MAX;
n = read(self->fd, PyBytes_AS_STRING(result) + bytes_read, (int)n);
@@ -706,7 +706,7 @@ fileio_read(fileio *self, PyObject *args)
return fileio_readall(self);
}
-#if defined(MS_WIN64) || defined(MS_WINDOWS)
+#ifdef MS_WINDOWS
if (size > INT_MAX)
size = INT_MAX;
#endif
@@ -718,7 +718,7 @@ fileio_read(fileio *self, PyObject *args)
if (_PyVerify_fd(self->fd)) {
Py_BEGIN_ALLOW_THREADS
errno = 0;
-#if defined(MS_WIN64) || defined(MS_WINDOWS)
+#ifdef MS_WINDOWS
n = read(self->fd, ptr, (int)size);
#else
n = read(self->fd, ptr, size);
@@ -766,7 +766,7 @@ fileio_write(fileio *self, PyObject *args)
Py_BEGIN_ALLOW_THREADS
errno = 0;
len = pbuf.len;
-#if defined(MS_WIN64) || defined(MS_WINDOWS)
+#ifdef MS_WINDOWS
if (len > 32767 && isatty(self->fd)) {
/* Issue #11395: the Windows console returns an error (12: not
enough space error) on writing into stdout if stdout mode is
@@ -839,7 +839,7 @@ portable_lseek(int fd, PyObject *posobj, int whence)
if (_PyVerify_fd(fd)) {
Py_BEGIN_ALLOW_THREADS
-#if defined(MS_WIN64) || defined(MS_WINDOWS)
+#ifdef MS_WINDOWS
res = _lseeki64(fd, pos, whence);
#else
res = lseek(fd, pos, whence);