Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
86290e95
Commit
86290e95
authored
Jun 25, 2013
by
Victor Stinner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If MS_WIN64 is defined, MS_WINDOWS is also defined: #ifdef can be simplified.
parent
601fced3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
20 additions
and
20 deletions
+20
-20
Include/pyport.h
Include/pyport.h
+1
-1
Modules/_io/_iomodule.h
Modules/_io/_iomodule.h
+1
-1
Modules/_io/fileio.c
Modules/_io/fileio.c
+7
-7
Modules/posixmodule.c
Modules/posixmodule.c
+4
-4
Modules/socketmodule.c
Modules/socketmodule.c
+4
-4
Objects/fileobject.c
Objects/fileobject.c
+1
-1
Python/fileutils.c
Python/fileutils.c
+2
-2
No files found.
Include/pyport.h
View file @
86290e95
...
@@ -263,7 +263,7 @@ typedef size_t Py_uhash_t;
...
@@ -263,7 +263,7 @@ typedef size_t Py_uhash_t;
*/
*/
#ifdef HAVE_LONG_LONG
#ifdef HAVE_LONG_LONG
# ifndef PY_FORMAT_LONG_LONG
# ifndef PY_FORMAT_LONG_LONG
# if
defined(MS_WIN64) || defined(MS_WINDOWS)
# if
def MS_WINDOWS
# define PY_FORMAT_LONG_LONG "I64"
# define PY_FORMAT_LONG_LONG "I64"
# else
# else
# error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG"
# error "This platform's pyconfig.h needs to define PY_FORMAT_LONG_LONG"
...
...
Modules/_io/_iomodule.h
View file @
86290e95
...
@@ -77,7 +77,7 @@ extern int _PyIO_trap_eintr(void);
...
@@ -77,7 +77,7 @@ extern int _PyIO_trap_eintr(void);
long with "%lld" even when both long and long long have the same
long with "%lld" even when both long and long long have the same
precision. */
precision. */
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
/* Windows uses long long for offsets */
/* Windows uses long long for offsets */
typedef
PY_LONG_LONG
Py_off_t
;
typedef
PY_LONG_LONG
Py_off_t
;
...
...
Modules/_io/fileio.c
View file @
86290e95
...
@@ -533,7 +533,7 @@ fileio_readinto(fileio *self, PyObject *args)
...
@@ -533,7 +533,7 @@ fileio_readinto(fileio *self, PyObject *args)
len
=
pbuf
.
len
;
len
=
pbuf
.
len
;
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
errno
=
0
;
errno
=
0
;
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
if
(
len
>
INT_MAX
)
if
(
len
>
INT_MAX
)
len
=
INT_MAX
;
len
=
INT_MAX
;
n
=
read
(
self
->
fd
,
pbuf
.
buf
,
(
int
)
len
);
n
=
read
(
self
->
fd
,
pbuf
.
buf
,
(
int
)
len
);
...
@@ -602,7 +602,7 @@ fileio_readall(fileio *self)
...
@@ -602,7 +602,7 @@ fileio_readall(fileio *self)
if
(
!
_PyVerify_fd
(
self
->
fd
))
if
(
!
_PyVerify_fd
(
self
->
fd
))
return
PyErr_SetFromErrno
(
PyExc_IOError
);
return
PyErr_SetFromErrno
(
PyExc_IOError
);
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
pos
=
_lseeki64
(
self
->
fd
,
0L
,
SEEK_CUR
);
pos
=
_lseeki64
(
self
->
fd
,
0L
,
SEEK_CUR
);
#else
#else
pos
=
lseek
(
self
->
fd
,
0L
,
SEEK_CUR
);
pos
=
lseek
(
self
->
fd
,
0L
,
SEEK_CUR
);
...
@@ -645,7 +645,7 @@ fileio_readall(fileio *self)
...
@@ -645,7 +645,7 @@ fileio_readall(fileio *self)
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
errno
=
0
;
errno
=
0
;
n
=
bufsize
-
bytes_read
;
n
=
bufsize
-
bytes_read
;
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
if
(
n
>
INT_MAX
)
if
(
n
>
INT_MAX
)
n
=
INT_MAX
;
n
=
INT_MAX
;
n
=
read
(
self
->
fd
,
PyBytes_AS_STRING
(
result
)
+
bytes_read
,
(
int
)
n
);
n
=
read
(
self
->
fd
,
PyBytes_AS_STRING
(
result
)
+
bytes_read
,
(
int
)
n
);
...
@@ -706,7 +706,7 @@ fileio_read(fileio *self, PyObject *args)
...
@@ -706,7 +706,7 @@ fileio_read(fileio *self, PyObject *args)
return
fileio_readall
(
self
);
return
fileio_readall
(
self
);
}
}
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
if
(
size
>
INT_MAX
)
if
(
size
>
INT_MAX
)
size
=
INT_MAX
;
size
=
INT_MAX
;
#endif
#endif
...
@@ -718,7 +718,7 @@ fileio_read(fileio *self, PyObject *args)
...
@@ -718,7 +718,7 @@ fileio_read(fileio *self, PyObject *args)
if
(
_PyVerify_fd
(
self
->
fd
))
{
if
(
_PyVerify_fd
(
self
->
fd
))
{
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
errno
=
0
;
errno
=
0
;
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
n
=
read
(
self
->
fd
,
ptr
,
(
int
)
size
);
n
=
read
(
self
->
fd
,
ptr
,
(
int
)
size
);
#else
#else
n
=
read
(
self
->
fd
,
ptr
,
size
);
n
=
read
(
self
->
fd
,
ptr
,
size
);
...
@@ -766,7 +766,7 @@ fileio_write(fileio *self, PyObject *args)
...
@@ -766,7 +766,7 @@ fileio_write(fileio *self, PyObject *args)
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
errno
=
0
;
errno
=
0
;
len
=
pbuf
.
len
;
len
=
pbuf
.
len
;
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
if
(
len
>
32767
&&
isatty
(
self
->
fd
))
{
if
(
len
>
32767
&&
isatty
(
self
->
fd
))
{
/* Issue #11395: the Windows console returns an error (12: not
/* Issue #11395: the Windows console returns an error (12: not
enough space error) on writing into stdout if stdout mode is
enough space error) on writing into stdout if stdout mode is
...
@@ -839,7 +839,7 @@ portable_lseek(int fd, PyObject *posobj, int whence)
...
@@ -839,7 +839,7 @@ portable_lseek(int fd, PyObject *posobj, int whence)
if
(
_PyVerify_fd
(
fd
))
{
if
(
_PyVerify_fd
(
fd
))
{
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
res
=
_lseeki64
(
fd
,
pos
,
whence
);
res
=
_lseeki64
(
fd
,
pos
,
whence
);
#else
#else
res
=
lseek
(
fd
,
pos
,
whence
);
res
=
lseek
(
fd
,
pos
,
whence
);
...
...
Modules/posixmodule.c
View file @
86290e95
...
@@ -361,7 +361,7 @@ static int win32_can_symlink = 0;
...
@@ -361,7 +361,7 @@ static int win32_can_symlink = 0;
#undef STAT
#undef STAT
#undef FSTAT
#undef FSTAT
#undef STRUCT_STAT
#undef STRUCT_STAT
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
# define STAT win32_stat
# define STAT win32_stat
# define LSTAT win32_lstat
# define LSTAT win32_lstat
# define FSTAT win32_fstat
# define FSTAT win32_fstat
...
@@ -7425,7 +7425,7 @@ static PyObject *
...
@@ -7425,7 +7425,7 @@ static PyObject *
posix_lseek
(
PyObject
*
self
,
PyObject
*
args
)
posix_lseek
(
PyObject
*
self
,
PyObject
*
args
)
{
{
int
fd
,
how
;
int
fd
,
how
;
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
PY_LONG_LONG
pos
,
res
;
PY_LONG_LONG
pos
,
res
;
#else
#else
off_t
pos
,
res
;
off_t
pos
,
res
;
...
@@ -7453,7 +7453,7 @@ posix_lseek(PyObject *self, PyObject *args)
...
@@ -7453,7 +7453,7 @@ posix_lseek(PyObject *self, PyObject *args)
if
(
!
_PyVerify_fd
(
fd
))
if
(
!
_PyVerify_fd
(
fd
))
return
posix_error
();
return
posix_error
();
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
res
=
_lseeki64
(
fd
,
pos
,
how
);
res
=
_lseeki64
(
fd
,
pos
,
how
);
#else
#else
res
=
lseek
(
fd
,
pos
,
how
);
res
=
lseek
(
fd
,
pos
,
how
);
...
@@ -7659,7 +7659,7 @@ posix_write(PyObject *self, PyObject *args)
...
@@ -7659,7 +7659,7 @@ posix_write(PyObject *self, PyObject *args)
}
}
len
=
pbuf
.
len
;
len
=
pbuf
.
len
;
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
if
(
len
>
INT_MAX
)
if
(
len
>
INT_MAX
)
len
=
INT_MAX
;
len
=
INT_MAX
;
size
=
write
(
fd
,
pbuf
.
buf
,
(
int
)
len
);
size
=
write
(
fd
,
pbuf
.
buf
,
(
int
)
len
);
...
...
Modules/socketmodule.c
View file @
86290e95
...
@@ -2553,7 +2553,7 @@ sock_recv_guts(PySocketSockObject *s, char* cbuf, Py_ssize_t len, int flags)
...
@@ -2553,7 +2553,7 @@ sock_recv_guts(PySocketSockObject *s, char* cbuf, Py_ssize_t len, int flags)
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
timeout
=
internal_select_ex
(
s
,
0
,
interval
);
timeout
=
internal_select_ex
(
s
,
0
,
interval
);
if
(
!
timeout
)
{
if
(
!
timeout
)
{
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
if
(
len
>
INT_MAX
)
if
(
len
>
INT_MAX
)
len
=
INT_MAX
;
len
=
INT_MAX
;
outlen
=
recv
(
s
->
sock_fd
,
cbuf
,
(
int
)
len
,
flags
);
outlen
=
recv
(
s
->
sock_fd
,
cbuf
,
(
int
)
len
,
flags
);
...
@@ -3251,7 +3251,7 @@ sock_send(PySocketSockObject *s, PyObject *args)
...
@@ -3251,7 +3251,7 @@ sock_send(PySocketSockObject *s, PyObject *args)
if
(
!
timeout
)
{
if
(
!
timeout
)
{
#ifdef __VMS
#ifdef __VMS
n
=
sendsegmented
(
s
->
sock_fd
,
buf
,
len
,
flags
);
n
=
sendsegmented
(
s
->
sock_fd
,
buf
,
len
,
flags
);
#elif defined(MS_WIN
64) || defined(MS_WIN
DOWS)
#elif defined(MS_WINDOWS)
if
(
len
>
INT_MAX
)
if
(
len
>
INT_MAX
)
len
=
INT_MAX
;
len
=
INT_MAX
;
n
=
send
(
s
->
sock_fd
,
buf
,
(
int
)
len
,
flags
);
n
=
send
(
s
->
sock_fd
,
buf
,
(
int
)
len
,
flags
);
...
@@ -3308,7 +3308,7 @@ sock_sendall(PySocketSockObject *s, PyObject *args)
...
@@ -3308,7 +3308,7 @@ sock_sendall(PySocketSockObject *s, PyObject *args)
if
(
!
timeout
)
{
if
(
!
timeout
)
{
#ifdef __VMS
#ifdef __VMS
n
=
sendsegmented
(
s
->
sock_fd
,
buf
,
len
,
flags
);
n
=
sendsegmented
(
s
->
sock_fd
,
buf
,
len
,
flags
);
#elif defined(MS_WIN
64) || defined(MS_WIN
DOWS)
#elif defined(MS_WINDOWS)
if
(
len
>
INT_MAX
)
if
(
len
>
INT_MAX
)
len
=
INT_MAX
;
len
=
INT_MAX
;
n
=
send
(
s
->
sock_fd
,
buf
,
(
int
)
len
,
flags
);
n
=
send
(
s
->
sock_fd
,
buf
,
(
int
)
len
,
flags
);
...
@@ -3407,7 +3407,7 @@ sock_sendto(PySocketSockObject *s, PyObject *args)
...
@@ -3407,7 +3407,7 @@ sock_sendto(PySocketSockObject *s, PyObject *args)
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
timeout
=
internal_select_ex
(
s
,
1
,
interval
);
timeout
=
internal_select_ex
(
s
,
1
,
interval
);
if
(
!
timeout
)
{
if
(
!
timeout
)
{
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
if
(
len
>
INT_MAX
)
if
(
len
>
INT_MAX
)
len
=
INT_MAX
;
len
=
INT_MAX
;
n
=
sendto
(
s
->
sock_fd
,
buf
,
(
int
)
len
,
flags
,
n
=
sendto
(
s
->
sock_fd
,
buf
,
(
int
)
len
,
flags
,
...
...
Objects/fileobject.c
View file @
86290e95
...
@@ -390,7 +390,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
...
@@ -390,7 +390,7 @@ stdprinter_write(PyStdPrinter_Object *self, PyObject *args)
Py_BEGIN_ALLOW_THREADS
Py_BEGIN_ALLOW_THREADS
errno
=
0
;
errno
=
0
;
#if
defined(MS_WIN64) || defined(MS_WINDOWS)
#if
def MS_WINDOWS
if
(
n
>
INT_MAX
)
if
(
n
>
INT_MAX
)
n
=
INT_MAX
;
n
=
INT_MAX
;
n
=
write
(
self
->
fd
,
c
,
(
int
)
n
);
n
=
write
(
self
->
fd
,
c
,
(
int
)
n
);
...
...
Python/fileutils.c
View file @
86290e95
...
@@ -16,13 +16,13 @@ extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size);
...
@@ -16,13 +16,13 @@ extern wchar_t* _Py_DecodeUTF8_surrogateescape(const char *s, Py_ssize_t size);
PyObject
*
PyObject
*
_Py_device_encoding
(
int
fd
)
_Py_device_encoding
(
int
fd
)
{
{
#if defined(MS_WINDOWS)
|| defined(MS_WIN64)
#if defined(MS_WINDOWS)
UINT
cp
;
UINT
cp
;
#endif
#endif
if
(
!
_PyVerify_fd
(
fd
)
||
!
isatty
(
fd
))
{
if
(
!
_PyVerify_fd
(
fd
)
||
!
isatty
(
fd
))
{
Py_RETURN_NONE
;
Py_RETURN_NONE
;
}
}
#if defined(MS_WINDOWS)
|| defined(MS_WIN64)
#if defined(MS_WINDOWS)
if
(
fd
==
0
)
if
(
fd
==
0
)
cp
=
GetConsoleCP
();
cp
=
GetConsoleCP
();
else
if
(
fd
==
1
||
fd
==
2
)
else
if
(
fd
==
1
||
fd
==
2
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment