aboutsummaryrefslogtreecommitdiff
path: root/read-cache.c
diff options
context:
space:
mode:
authorFlorian Forster <octo@verplant.org>2006-06-18 17:18:09 +0200
committerJunio C Hamano <junkio@cox.net>2006-06-20 01:59:46 -0700
commit1d7f171c3a456b980d821ee0f68e01535a5f7e36 (patch)
tree040ae96db3e2d18f84a95cc46ec4d7626bcc1994 /read-cache.c
parent2bda77e080dd8d47ca0b87c78e9061fbaa37455a (diff)
downloadgit-1d7f171c3a456b980d821ee0f68e01535a5f7e36.tar.gz
git-1d7f171c3a456b980d821ee0f68e01535a5f7e36.tar.xz
Remove all void-pointer arithmetic.
ANSI C99 doesn't allow void-pointer arithmetic. This patch fixes this in various ways. Usually the strategy that required the least changes was used. Signed-off-by: Florian Forster <octo@verplant.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'read-cache.c')
-rw-r--r--read-cache.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/read-cache.c b/read-cache.c
index c499c5185..3c32aae7e 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -706,7 +706,7 @@ static int verify_hdr(struct cache_header *hdr, unsigned long size)
SHA1_Init(&c);
SHA1_Update(&c, hdr, size - 20);
SHA1_Final(sha1, &c);
- if (memcmp(sha1, (void *)hdr + size - 20, 20))
+ if (memcmp(sha1, (char *) hdr + size - 20, 20))
return error("bad index file sha1 signature");
return 0;
}
@@ -770,7 +770,7 @@ int read_cache(void)
offset = sizeof(*hdr);
for (i = 0; i < active_nr; i++) {
- struct cache_entry *ce = map + offset;
+ struct cache_entry *ce = (struct cache_entry *) ((char *) map + offset);
offset = offset + ce_size(ce);
active_cache[i] = ce;
}
@@ -783,10 +783,11 @@ int read_cache(void)
* in 4-byte network byte order.
*/
unsigned long extsize;
- memcpy(&extsize, map + offset + 4, 4);
+ memcpy(&extsize, (char *) map + offset + 4, 4);
extsize = ntohl(extsize);
- if (read_index_extension(map + offset,
- map + offset + 8, extsize) < 0)
+ if (read_index_extension(((const char *) map) + offset,
+ (char *) map + offset + 8,
+ extsize) < 0)
goto unmap;
offset += 8;
offset += extsize;
@@ -820,7 +821,7 @@ static int ce_write(SHA_CTX *context, int fd, void *data, unsigned int len)
}
write_buffer_len = buffered;
len -= partial;
- data += partial;
+ data = (char *) data + partial;
}
return 0;
}