From 5f3d61e2f0b64d0012fe001a8e5f9d49a8e82fb2 Mon Sep 17 00:00:00 2001 From: James Buren Date: Sat, 26 Feb 2022 13:55:25 -0600 Subject: [PATCH 1/2] src/borg/_hashindex.c: fix compiler warnings The value argument of hashindex_set is causing harmless pointer type mismatches. This resolves the issue by changing the type to void* which silences these types of warnings. --- src/borg/_hashindex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/borg/_hashindex.c b/src/borg/_hashindex.c index dd3b1c323..7236cfdce 100644 --- a/src/borg/_hashindex.c +++ b/src/borg/_hashindex.c @@ -118,7 +118,7 @@ static void hashindex_write(HashIndex *index, PyObject *file_py); static uint64_t hashindex_compact(HashIndex *index); static HashIndex *hashindex_init(int capacity, int key_size, int value_size); static const unsigned char *hashindex_get(HashIndex *index, const unsigned char *key); -static int hashindex_set(HashIndex *index, const unsigned char *key, const unsigned char *value); +static int hashindex_set(HashIndex *index, const unsigned char *key, const void *value); static int hashindex_delete(HashIndex *index, const unsigned char *key); static unsigned char *hashindex_next_key(HashIndex *index, const unsigned char *key); @@ -559,7 +559,7 @@ hashindex_get(HashIndex *index, const unsigned char *key) } static int -hashindex_set(HashIndex *index, const unsigned char *key, const unsigned char *value) +hashindex_set(HashIndex *index, const unsigned char *key, const void *value) { int start_idx; int idx = hashindex_lookup(index, key, &start_idx); From 5c94c932bb02a1746c2b146f72c8f3416c2f4ae7 Mon Sep 17 00:00:00 2001 From: James Buren Date: Sat, 26 Feb 2022 13:57:49 -0600 Subject: [PATCH 2/2] src/borg/cache_sync/unpack.h: fix compiler warnings The key argument being sent to hashindex_get and hashindex_set by multiple functions is a different signedness from what the functions expect. This resolves the issue by changing the key type in the unpack_user struct to unsigned char. --- src/borg/cache_sync/unpack.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/borg/cache_sync/unpack.h b/src/borg/cache_sync/unpack.h index a185fe784..f6dd9ca8e 100644 --- a/src/borg/cache_sync/unpack.h +++ b/src/borg/cache_sync/unpack.h @@ -102,7 +102,7 @@ typedef struct unpack_user { /* collect values here for current chunklist entry */ struct { - char key[32]; + unsigned char key[32]; uint32_t csize; uint32_t size; } current;