summaryrefslogtreecommitdiff
path: root/src/fileops.c
diff options
context:
space:
mode:
authorRamsay Jones <ramsay@ramsay1.demon.co.uk>2009-02-18 18:50:36 +0000
committerShawn O. Pearce <spearce@spearce.org>2009-03-17 18:58:30 -0700
commitfc3c3a2083e9f6f89e6bd53e9420e70d1e357c9b (patch)
treeb290b470aa40a42fc5b24a408ab9250443aed5da /src/fileops.c
parent1906f2369d2906cfd4affeab0852b67c4a91ddca (diff)
downloadlibgit2-fc3c3a2083e9f6f89e6bd53e9420e70d1e357c9b.tar.gz
Avoid using a gcc compiler language extension
In particular, using pointer arithmetic on void pointers, despite being quite useful, is not legal in standard C. Avoiding non-standard C constructs will help in porting the library to other compilers/platforms. Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'src/fileops.c')
-rw-r--r--src/fileops.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/fileops.c b/src/fileops.c
index f494e4772..8cc293419 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -125,7 +125,7 @@ void gitfo_free_map(gitfo_map *out)
struct gitfo_cache {
git_file fd;
unsigned int cache_size, pos;
- void *cache;
+ unsigned char *cache;
};
gitfo_cache *gitfo_enable_caching(git_file fd, size_t cache_size)
@@ -165,8 +165,10 @@ int gitfo_flush_cached(gitfo_cache *ioc)
return result;
}
-int gitfo_write_cached(gitfo_cache *ioc, void *buf, size_t len)
+int gitfo_write_cached(gitfo_cache *ioc, void *buff, size_t len)
{
+ unsigned char *buf = buff;
+
for (;;) {
size_t space_left = ioc->cache_size - ioc->pos;
/* cache if it's small */