[Python-checkins] r42774 - python/trunk/Modules/_hashopenssl.c

thomas.wouters python-checkins at python.org
Thu Mar 2 05:48:28 CET 2006


Author: thomas.wouters
Date: Thu Mar  2 05:48:27 2006
New Revision: 42774

Modified:
   python/trunk/Modules/_hashopenssl.c
Log:

Py_SAFE_DOWNCAST isn't quite doing the right thing for going from Py_ssize_t
to an unsigned int (and back again) on 64-bit machines, even though the
actual value of the Py_ssize_t variable is way below 31 bits. I suspect
compiler-error.



Modified: python/trunk/Modules/_hashopenssl.c
==============================================================================
--- python/trunk/Modules/_hashopenssl.c	(original)
+++ python/trunk/Modules/_hashopenssl.c	Thu Mar  2 05:48:27 2006
@@ -173,8 +173,7 @@
     if (!PyArg_ParseTuple(args, "s#:update", &cp, &len))
         return NULL;
 
-    EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
-                                                      unsigned int));
+    EVP_DigestUpdate(&self->ctx, cp, (unsigned int)len);
 
     Py_INCREF(Py_None);
     return Py_None;
@@ -265,8 +264,7 @@
     Py_INCREF(self->name);
 
     if (cp && len)
-        EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
-                                                          unsigned int));
+        EVP_DigestUpdate(&self->ctx, cp, (unsigned int)len);
 
     return 0;
 }
@@ -393,8 +391,7 @@
 
     digest = EVP_get_digestbyname(name);
 
-    return EVPnew(name_obj, digest, NULL, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
-                                                               unsigned int));
+    return EVPnew(name_obj, digest, NULL, cp, (unsigned int)len);
 }
 
 /*
@@ -419,7 +416,7 @@
                 CONST_ ## NAME ## _name_obj, \
                 NULL, \
                 CONST_new_ ## NAME ## _ctx_p, \
-                cp, Py_SAFE_DOWNCAST(len, Py_ssize_t, unsigned int)); \
+                cp, (unsigned int)len); \
     }
 
 /* a PyMethodDef structure for the constructor */


More information about the Python-checkins mailing list