Commit 6b1eab3976b5b7cf4e65b9d12e5e25a98411c4da

Vicent Marti 2010-11-23T14:36:31

Fix MSVC warnings and errors Signed-off-by: Vicent Marti <tanoku@gmail.com>

diff --git a/src/repository.c b/src/repository.c
index 5dd1fdf..dbf3407 100644
--- a/src/repository.c
+++ b/src/repository.c
@@ -212,7 +212,7 @@ static int source_resize(git_odb_source *src)
 	size_t write_offset, new_size;
 	void *new_data;
 
-	write_offset = src->write_ptr - src->raw.data;
+	write_offset = (size_t)((char *)src->write_ptr - (char *)src->raw.data);
 
 	new_size = src->raw.len * 2;
 	if ((new_data = git__malloc(new_size)) == NULL)
@@ -223,7 +223,7 @@ static int source_resize(git_odb_source *src)
 
 	src->raw.data = new_data;
 	src->raw.len = new_size;
-	src->write_ptr = new_data + write_offset;
+	src->write_ptr = (char *)new_data + write_offset;
 
 	return GIT_SUCCESS;
 }
@@ -249,7 +249,7 @@ int git__source_printf(git_odb_source *source, const char *format, ...)
 	if (did_resize)
 		vsnprintf(source->write_ptr, source->raw.len - source->written_bytes, format, arglist);
 
-	source->write_ptr += len;
+	source->write_ptr = (char *)source->write_ptr + len;
 	source->written_bytes += len;
 
 	return GIT_SUCCESS;
@@ -267,7 +267,7 @@ int git__source_write(git_odb_source *source, const void *bytes, size_t len)
 	}
 
 	memcpy(source->write_ptr, bytes, len);
-	source->write_ptr += len;
+	source->write_ptr = (char *)source->write_ptr + len;
 	source->written_bytes += len;
 
 	return GIT_SUCCESS;
diff --git a/src/tag.c b/src/tag.c
index fe71f7b..f612cf3 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -229,6 +229,6 @@ int git_tag__writeback(git_tag *tag, git_odb_source *src)
 int git_tag__parse(git_tag *tag)
 {
 	assert(tag && tag->object.source.open);
-	return parse_tag_buffer(tag, tag->object.source.raw.data, tag->object.source.raw.data + tag->object.source.raw.len);
+	return parse_tag_buffer(tag, tag->object.source.raw.data, (char *)tag->object.source.raw.data + tag->object.source.raw.len);
 }
 
diff --git a/tests/t0501-walk.c b/tests/t0501-walk.c
index 8dd7990..4b90e07 100644
--- a/tests/t0501-walk.c
+++ b/tests/t0501-walk.c
@@ -45,7 +45,7 @@ static const int commit_sorting_time_reverse[][6] = {
 	{4, 5, 2, 1, 3, 0}
 };
 
-static const int commit_count = 6;
+#define commit_count 6
 static const int result_bytes = 24;