bpo-9566: Fixed some _ssl warnings

This commit is contained in:
Segev Finer 2017-06-29 22:22:46 +03:00
parent 181a36f617
commit a639001c94

View file

@ -1555,7 +1555,7 @@ cipher_to_dict(const SSL_CIPHER *cipher)
cipher_protocol = SSL_CIPHER_get_version(cipher); cipher_protocol = SSL_CIPHER_get_version(cipher);
cipher_id = SSL_CIPHER_get_id(cipher); cipher_id = SSL_CIPHER_get_id(cipher);
SSL_CIPHER_description(cipher, buf, sizeof(buf) - 1); SSL_CIPHER_description(cipher, buf, sizeof(buf) - 1);
len = strlen(buf); len = (int)strlen(buf);
if (len > 1 && buf[len-1] == '\n') if (len > 1 && buf[len-1] == '\n')
buf[len-1] = '\0'; buf[len-1] = '\0';
strength_bits = SSL_CIPHER_get_bits(cipher, &alg_bits); strength_bits = SSL_CIPHER_get_bits(cipher, &alg_bits);
@ -4073,7 +4073,7 @@ memory_bio_dealloc(PySSLMemoryBIO *self)
static PyObject * static PyObject *
memory_bio_get_pending(PySSLMemoryBIO *self, void *c) memory_bio_get_pending(PySSLMemoryBIO *self, void *c)
{ {
return PyLong_FromLong(BIO_ctrl_pending(self->bio)); return PyLong_FromSize_t(BIO_ctrl_pending(self->bio));
} }
PyDoc_STRVAR(PySSL_memory_bio_pending_doc, PyDoc_STRVAR(PySSL_memory_bio_pending_doc,
@ -4109,7 +4109,7 @@ _ssl_MemoryBIO_read_impl(PySSLMemoryBIO *self, int len)
int avail, nbytes; int avail, nbytes;
PyObject *result; PyObject *result;
avail = BIO_ctrl_pending(self->bio); avail = (int)BIO_ctrl_pending(self->bio);
if ((len < 0) || (len > avail)) if ((len < 0) || (len > avail))
len = avail; len = avail;