@matheusbsbs / matheus-bagliano / commits / 6698060c15
Fork 0

git-tar-tree: no more void pointer arithmetic

Noticed by Florian Forster: Use a char pointer when adding offsets, because void pointer arithmetic is a GNU extension. Const'ify the function arguments while we're at it. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <junkio@cox.net>

Rene Scharfe committed Jun 18, 2006 at 12:58 UTC 6698060c15e837babb3b80f980bbed290934a692
1 file changed +5 -2
builtin-tar-tree.c
+5 -2
@@ -22,8 +22,10 @@ static unsigned long offset;
22 static time_t archive_time;
23
24 /* tries hard to write, either succeeds or dies in the attempt */
25 -static void reliable_write(void *buf, unsigned long size)
25 +static void reliable_write(const void *data, unsigned long size)
26 {
27 + const char *buf = data;
28 +
29 while (size > 0) {
30 long ret = xwrite(1, buf, size);
31 if (ret < 0) {
@@ -51,8 +53,9 @@ static void write_if_needed(void)
53 * queues up writes, so that all our write(2) calls write exactly one
54 * full block; pads writes to RECORDSIZE
55 */
54 -static void write_blocked(void *buf, unsigned long size)
56 +static void write_blocked(const void *data, unsigned long size)
57 {
58 + const char *buf = data;
59 unsigned long tail;
60
61 if (offset) {