[Python-checkins] cpython: Issue #9566: Explicit downcast to fix compiler warnings on Win64
victor.stinner
python-checkins at python.org
Wed Oct 31 01:07:09 CET 2012
http://hg.python.org/cpython/rev/96fc87997ce9
changeset: 80066:96fc87997ce9
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Oct 31 00:33:57 2012 +0100
summary:
Issue #9566: Explicit downcast to fix compiler warnings on Win64
files:
Modules/faulthandler.c | 6 ++++--
Modules/md5module.c | 2 +-
Modules/sha1module.c | 2 +-
Modules/zlibmodule.c | 4 ++--
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/Modules/faulthandler.c b/Modules/faulthandler.c
--- a/Modules/faulthandler.c
+++ b/Modules/faulthandler.c
@@ -22,7 +22,9 @@
# define FAULTHANDLER_USER
#endif
-#define PUTS(fd, str) write(fd, str, strlen(str))
+/* cast size_t to int because write() takes an int on Windows
+ (anyway, the length is smaller than 30 characters) */
+#define PUTS(fd, str) write(fd, str, (int)strlen(str))
#ifdef HAVE_SIGACTION
typedef struct sigaction _Py_sighandler_t;
@@ -445,7 +447,7 @@
/* get the thread holding the GIL, NULL if no thread hold the GIL */
current = _Py_atomic_load_relaxed(&_PyThreadState_Current);
- write(thread.fd, thread.header, thread.header_len);
+ write(thread.fd, thread.header, (int)thread.header_len);
errmsg = _Py_DumpTracebackThreads(thread.fd, thread.interp, current);
ok = (errmsg == NULL);
diff --git a/Modules/md5module.c b/Modules/md5module.c
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -246,7 +246,7 @@
} else {
n = MIN(inlen, (Py_ssize_t)(MD5_BLOCKSIZE - md5->curlen));
memcpy(md5->buf + md5->curlen, in, (size_t)n);
- md5->curlen += n;
+ md5->curlen += (MD5_INT32)n;
in += n;
inlen -= n;
if (md5->curlen == MD5_BLOCKSIZE) {
diff --git a/Modules/sha1module.c b/Modules/sha1module.c
--- a/Modules/sha1module.c
+++ b/Modules/sha1module.c
@@ -222,7 +222,7 @@
} else {
n = MIN(inlen, (Py_ssize_t)(SHA1_BLOCKSIZE - sha1->curlen));
memcpy(sha1->buf + sha1->curlen, in, (size_t)n);
- sha1->curlen += n;
+ sha1->curlen += (SHA1_INT32)n;
in += n;
inlen -= n;
if (sha1->curlen == SHA1_BLOCKSIZE) {
diff --git a/Modules/zlibmodule.c b/Modules/zlibmodule.c
--- a/Modules/zlibmodule.c
+++ b/Modules/zlibmodule.c
@@ -161,7 +161,7 @@
goto error;
}
input = pinput.buf;
- length = pinput.len;
+ length = (unsigned int)pinput.len;
zst.avail_out = length + length/1000 + 12 + 1;
@@ -251,7 +251,7 @@
goto error;
}
input = pinput.buf;
- length = pinput.len;
+ length = (unsigned int)pinput.len;
if (r_strlen <= 0)
r_strlen = 1;
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list