From e6be9b59a911626d6597fe148c32f0342bd2bd24 Mon Sep 17 00:00:00 2001 From: Andy Lester Date: Tue, 11 Feb 2020 20:28:35 -0600 Subject: closes bpo-39605: Fix some casts to not cast away const. (GH-18453) gcc -Wcast-qual turns up a number of instances of casting away constness of pointers. Some of these can be safely modified, by either: Adding the const to the type cast, as in: - return _PyUnicode_FromUCS1((unsigned char*)s, size); + return _PyUnicode_FromUCS1((const unsigned char*)s, size); or, Removing the cast entirely, because it's not necessary (but probably was at one time), as in: - PyDTrace_FUNCTION_ENTRY((char *)filename, (char *)funcname, lineno); + PyDTrace_FUNCTION_ENTRY(filename, funcname, lineno); These changes will not change code, but they will make it much easier to check for errors in consts --- Python/pyhash.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Python/pyhash.c') diff --git a/Python/pyhash.c b/Python/pyhash.c index d381dc0230..faac730d79 100644 --- a/Python/pyhash.c +++ b/Python/pyhash.c @@ -366,7 +366,7 @@ static PyHash_FuncDef PyHash_Func = {fnv, "fnv", 8 * SIZEOF_PY_HASH_T, static uint64_t siphash24(uint64_t k0, uint64_t k1, const void *src, Py_ssize_t src_sz) { uint64_t b = (uint64_t)src_sz << 56; - const uint8_t *in = (uint8_t*)src; + const uint8_t *in = (const uint8_t*)src; uint64_t v0 = k0 ^ 0x736f6d6570736575ULL; uint64_t v1 = k1 ^ 0x646f72616e646f6dULL; -- cgit v1.2.1