[Python-checkins] cpython: Issue #9566: cast unsigned int to Py_ssize_t in md5 and sha1 modules

victor.stinner python-checkins at python.org
Fri Jul 8 01:10:39 CEST 2011


http://hg.python.org/cpython/rev/43fd627cc060
changeset:   71246:43fd627cc060
user:        Victor Stinner <victor.stinner at haypocalc.com>
date:        Fri Jul 08 01:10:28 2011 +0200
summary:
  Issue #9566: cast unsigned int to Py_ssize_t in md5 and sha1 modules

Fix a compiler warning on Windows 64 bits.

files:
  Modules/md5module.c  |  2 +-
  Modules/sha1module.c |  2 +-
  2 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/Modules/md5module.c b/Modules/md5module.c
--- a/Modules/md5module.c
+++ b/Modules/md5module.c
@@ -243,7 +243,7 @@
            in             += MD5_BLOCKSIZE;
            inlen          -= MD5_BLOCKSIZE;
         } else {
-           n = MIN(inlen, (MD5_BLOCKSIZE - md5->curlen));
+           n = MIN(inlen, (Py_ssize_t)(MD5_BLOCKSIZE - md5->curlen));
            memcpy(md5->buf + md5->curlen, in, (size_t)n);
            md5->curlen    += n;
            in             += n;
diff --git a/Modules/sha1module.c b/Modules/sha1module.c
--- a/Modules/sha1module.c
+++ b/Modules/sha1module.c
@@ -218,7 +218,7 @@
            in             += SHA1_BLOCKSIZE;
            inlen          -= SHA1_BLOCKSIZE;
         } else {
-           n = MIN(inlen, (SHA1_BLOCKSIZE - sha1->curlen));
+           n = MIN(inlen, (Py_ssize_t)(SHA1_BLOCKSIZE - sha1->curlen));
            memcpy(sha1->buf + sha1->curlen, in, (size_t)n);
            sha1->curlen   += n;
            in             += n;

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list