DORMANTno replies

[PATCH] resolve-undo.c: silence compiler complaints by casting void * to char *

From: Brandon Casey <hidden>
Date: 2016-06-15 22:48:09
Subsystem: the rest · Maintainer: Linus Torvalds

From: Brandon Casey <redacted>

Some compilers produce errors when arithmetic is attempted on pointers to
void.  We want computations done on byte addresses, so cast them to char *
to work them around.

Signed-off-by: Brandon Casey <redacted>
---
 resolve-undo.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/resolve-undo.c b/resolve-undo.c
index 37d73cd..c259fe6 100644
--- a/resolve-undo.c
+++ b/resolve-undo.c
@@ -75,7 +75,7 @@ struct string_list *resolve_undo_read(void *data, unsigned long size)
 			lost->util = xcalloc(1, sizeof(*ui));
 		ui = lost->util;
 		size -= len;
-		data += len;
+		data = (char*) data + len;
 
 		for (i = 0; i < 3; i++) {
 			ui->mode[i] = strtoul(data, &endptr, 8);
@@ -85,7 +85,7 @@ struct string_list *resolve_undo_read(void *data, unsigned long size)
 			if (size <= len)
 				goto error;
 			size -= len;
-			data += len;
+			data = (char*) data + len;
 		}
 
 		for (i = 0; i < 3; i++) {
@@ -95,7 +95,7 @@ struct string_list *resolve_undo_read(void *data, unsigned long size)
 				goto error;
 			hashcpy(ui->sha1[i], data);
 			size -= 20;
-			data += 20;
+			data = (char*) data + 20;
 		}
 	}
 	return resolve_undo;
-- 
1.6.6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help