Fix MSVC warnings and errors Signed-off-by: Vicent Marti <tanoku@gmail.com>
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
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;