From: Brian Warner Date: Thu, 16 Aug 2007 00:48:52 +0000 (-0700) Subject: crypto: fix compiler warnings in the .c files X-Git-Tag: allmydata-tahoe-0.5.0~4 X-Git-Url: https://git.rkrishnan.org/simplejson/encoder.py.html?a=commitdiff_plain;h=664a0e6af4bf9a9255c1f9f7ea28d3a42dc8bc5e;p=tahoe-lafs%2Ftahoe-lafs.git crypto: fix compiler warnings in the .c files --- diff --git a/src/allmydata/Crypto/SHA256.c b/src/allmydata/Crypto/SHA256.c index 6bd9df2b..2e61f350 100644 --- a/src/allmydata/Crypto/SHA256.c +++ b/src/allmydata/Crypto/SHA256.c @@ -194,7 +194,7 @@ hash_digest (const hash_state *self) hash_copy((hash_state*)self,&temp); sha_done(&temp,digest); - return PyString_FromStringAndSize(digest, 32); + return PyString_FromStringAndSize((char *)digest, 32); } #include "hash_template.c" diff --git a/src/allmydata/Crypto/block_template.c b/src/allmydata/Crypto/block_template.c index 3c9f4e9f..50a656d8 100644 --- a/src/allmydata/Crypto/block_template.c +++ b/src/allmydata/Crypto/block_template.c @@ -410,7 +410,7 @@ ALG_Encrypt(ALGobject *self, PyObject *args) free(buffer); return NULL; } - result=PyString_FromStringAndSize(buffer, len); + result=PyString_FromStringAndSize((char *)buffer, len); free(buffer); return(result); } @@ -572,7 +572,7 @@ ALG_Decrypt(ALGobject *self, PyObject *args) free(buffer); return NULL; } - result=PyString_FromStringAndSize(buffer, len); + result=PyString_FromStringAndSize((char *)buffer, len); free(buffer); return(result); } @@ -674,7 +674,7 @@ ALGgetattr(PyObject *s, char *name) ALGobject *self = (ALGobject*)s; if (strcmp(name, "IV") == 0) { - return(PyString_FromStringAndSize(self->IV, BLOCK_SIZE)); + return(PyString_FromStringAndSize((char *)(self->IV), BLOCK_SIZE)); } if (strcmp(name, "mode") == 0) { diff --git a/src/allmydata/Crypto/hash_template.c b/src/allmydata/Crypto/hash_template.c index 2325b0fb..c3433988 100644 --- a/src/allmydata/Crypto/hash_template.c +++ b/src/allmydata/Crypto/hash_template.c @@ -105,11 +105,11 @@ ALG_hexdigest(ALGobject *self, PyObject *args) /* Get the raw (binary) digest value */ value = (PyObject *)hash_digest(&(self->st)); size = PyString_Size(value); - raw_digest = PyString_AsString(value); + raw_digest = (unsigned char *)PyString_AsString(value); /* Create a new string */ retval = PyString_FromStringAndSize(NULL, size * 2 ); - hex_digest = PyString_AsString(retval); + hex_digest = (unsigned char *)PyString_AsString(retval); /* Make hex version of the digest */ for(i=j=0; i