# HG changeset patch # User Mike Becker # Date 1667742419 -3600 # Node ID c49104015a6b561d3cb797304e458d92d2f6f4f0 # Parent 3b071ea0e9cfb83e1f3b4539df2de5d2a7c29aea fix missing const in cx_hash_key signature diff -r 3b071ea0e9cf -r c49104015a6b src/cx/hash_key.h --- a/src/cx/hash_key.h Sun Nov 06 14:17:33 2022 +0100 +++ b/src/cx/hash_key.h Sun Nov 06 14:46:59 2022 +0100 @@ -50,9 +50,10 @@ union { unsigned char *bytes; unsigned char const *cbytes; + char *str; char const *cstr; - char *str; void *obj; + void const *cobj; } data; /** * The key data length. @@ -114,7 +115,7 @@ */ __attribute__((__warn_unused_result__)) CxHashKey cx_hash_key( - void *obj, + void const *obj, size_t len ); diff -r 3b071ea0e9cf -r c49104015a6b src/hash_key.c --- a/src/hash_key.c Sun Nov 06 14:17:33 2022 +0100 +++ b/src/hash_key.c Sun Nov 06 14:46:59 2022 +0100 @@ -96,11 +96,11 @@ } CxHashKey cx_hash_key( - void *obj, + void const *obj, size_t len ) { CxHashKey key; - key.data.obj = obj; + key.data.cobj = obj; key.len = len; cx_hash_murmur(&key); return key; diff -r 3b071ea0e9cf -r c49104015a6b test/test_hash_key.cpp --- a/test/test_hash_key.cpp Sun Nov 06 14:17:33 2022 +0100 +++ b/test/test_hash_key.cpp Sun Nov 06 14:46:59 2022 +0100 @@ -37,7 +37,8 @@ auto str_key = cx_hash_key_str(str); auto bytes_key = cx_hash_key_bytes( reinterpret_cast(str), len); - auto obj_key = cx_hash_key((void *) str, len); + auto obj_key = cx_hash_key( + reinterpret_cast(str), len); EXPECT_EQ(str_key.hash, bytes_key.hash); EXPECT_EQ(obj_key.hash, bytes_key.hash);