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

Neal Norwitz nnorwitz at gmail.com
Thu Mar 2 05:50:21 CET 2006


This change causes failures on my amd64:

http://www.python.org/dev/buildbot/all/amd64%20gentoo%20trunk/builds/199/step-test/0

n
--

On 3/1/06, thomas.wouters <python-checkins at python.org> wrote:
> Author: thomas.wouters
> Date: Wed Mar  1 22:50:07 2006
> New Revision: 42743
>
> Modified:
>    python/trunk/Modules/_hashopenssl.c
> Log:
>
> Make Py_ssize_t-clean.
>
>
>
> Modified: python/trunk/Modules/_hashopenssl.c
> ==============================================================================
> --- python/trunk/Modules/_hashopenssl.c (original)
> +++ python/trunk/Modules/_hashopenssl.c Wed Mar  1 22:50:07 2006
> @@ -11,6 +11,8 @@
>   *
>   */
>
> +#define PY_SSIZE_T_CLEAN
> +
>  #include "Python.h"
>  #include "structmember.h"
>
> @@ -166,12 +168,13 @@
>  EVP_update(EVPobject *self, PyObject *args)
>  {
>      unsigned char *cp;
> -    int len;
> +    Py_ssize_t len;
>
>      if (!PyArg_ParseTuple(args, "s#:update", &cp, &len))
>          return NULL;
>
> -    EVP_DigestUpdate(&self->ctx, cp, len);
> +    EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
> +                                                      unsigned int));
>
>      Py_INCREF(Py_None);
>      return Py_None;
> @@ -238,7 +241,7 @@
>      PyObject *name_obj = NULL;
>      char *nameStr;
>      unsigned char *cp = NULL;
> -    unsigned int len;
> +    Py_ssize_t len;
>      const EVP_MD *digest;
>
>      if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|s#:HASH", kwlist,
> @@ -262,7 +265,8 @@
>      Py_INCREF(self->name);
>
>      if (cp && len)
> -        EVP_DigestUpdate(&self->ctx, cp, len);
> +        EVP_DigestUpdate(&self->ctx, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
> +                                                          unsigned int));
>
>      return 0;
>  }
> @@ -375,7 +379,7 @@
>      char *name;
>      const EVP_MD *digest;
>      unsigned char *cp = NULL;
> -    unsigned int len;
> +    Py_ssize_t len;
>
>      if (!PyArg_ParseTupleAndKeywords(args, kwdict, "O|s#:new", kwlist,
>                                       &name_obj, &cp, &len)) {
> @@ -389,7 +393,8 @@
>
>      digest = EVP_get_digestbyname(name);
>
> -    return EVPnew(name_obj, digest, NULL, cp, len);
> +    return EVPnew(name_obj, digest, NULL, cp, Py_SAFE_DOWNCAST(len, Py_ssize_t,
> +                                                               unsigned int));
>  }
>
>  /*
> @@ -404,7 +409,7 @@
>      EVP_new_ ## NAME (PyObject *self, PyObject *args) \
>      { \
>          unsigned char *cp = NULL; \
> -        unsigned int len; \
> +        Py_ssize_t len; \
>       \
>          if (!PyArg_ParseTuple(args, "|s#:" #NAME , &cp, &len)) { \
>              return NULL; \
> @@ -414,7 +419,7 @@
>                  CONST_ ## NAME ## _name_obj, \
>                  NULL, \
>                  CONST_new_ ## NAME ## _ctx_p, \
> -                cp, len); \
> +                cp, Py_SAFE_DOWNCAST(len, Py_ssize_t, unsigned int)); \
>      }
>
>  /* a PyMethodDef structure for the constructor */
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> http://mail.python.org/mailman/listinfo/python-checkins
>


More information about the Python-checkins mailing list