@matheusbsbs / matheus-bagliano / commits / b8bba41925
Fork 0

build: make code "-Wpointer-arith" clean

Recently introduced resolve_undo_read() expected arithmetic to (void *) to work on byte-addresses. Correct this. Noticed by Brandon Casey. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Feb 1, 2010 at 22:04 UTC b8bba419250711a69e09e7648e5c991f4847a127
2 files changed +3 -3
resolve-undo.c
+2 -2
@@ -53,7 +53,7 @@ void resolve_undo_write(struct strbuf *sb, struct string_list *resolve_undo)
53 for_each_string_list(write_one, resolve_undo, sb);
54 }
55
56 -struct string_list *resolve_undo_read(void *data, unsigned long size)
56 +struct string_list *resolve_undo_read(const char *data, unsigned long size)
57 {
58 struct string_list *resolve_undo;
59 size_t len;
@@ -93,7 +93,7 @@ struct string_list *resolve_undo_read(void *data, unsigned long size)
93 continue;
94 if (size < 20)
95 goto error;
96 - hashcpy(ui->sha1[i], data);
96 + hashcpy(ui->sha1[i], (const unsigned char *)data);
97 size -= 20;
98 data += 20;
99 }
resolve-undo.h
+1 -1
@@ -8,7 +8,7 @@ struct resolve_undo_info {
8
9 extern void record_resolve_undo(struct index_state *, struct cache_entry *);
10 extern void resolve_undo_write(struct strbuf *, struct string_list *);
11 -extern struct string_list *resolve_undo_read(void *, unsigned long);
11 +extern struct string_list *resolve_undo_read(const char *, unsigned long);
12 extern void resolve_undo_clear_index(struct index_state *);
13 extern int unmerge_index_entry_at(struct index_state *, int);
14 extern void unmerge_index(struct index_state *, const char **);