From acb159e19159f63651eb2ccc8e4a4a31771c08c5 Mon Sep 17 00:00:00 2001 From: nulltoken Date: Wed, 4 Jan 2012 17:59:48 +0100 Subject: [PATCH 1/2] Fix MSVC compilation warnings --- src/attr.c | 2 +- tests-clay/attr/file.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/attr.c b/src/attr.c index f984458d4..679380bba 100644 --- a/src/attr.c +++ b/src/attr.c @@ -73,7 +73,7 @@ int git_attr_get_many( attr_get_many_info *info = NULL; size_t num_found = 0; - memset(values, 0, sizeof(const char *) * num_attr); + memset((void *)values, 0, sizeof(const char *) * num_attr); if ((error = git_attr_path__init(&path, pathname)) < GIT_SUCCESS || (error = collect_attr_files(repo, pathname, &files)) < GIT_SUCCESS) diff --git a/tests-clay/attr/file.c b/tests-clay/attr/file.c index d9e2d5701..acca0c653 100644 --- a/tests-clay/attr/file.c +++ b/tests-clay/attr/file.c @@ -7,19 +7,21 @@ void test_attr_file__simple_read(void) { git_attr_file *file = NULL; + git_attr_assignment *assign; + git_attr_rule *rule; cl_git_pass(git_attr_file__from_file(NULL, cl_fixture("attr/attr0"), &file)); cl_assert_strequal(cl_fixture("attr/attr0"), file->path); cl_assert(file->rules.length == 1); - git_attr_rule *rule = get_rule(0); + rule = get_rule(0); cl_assert(rule != NULL); cl_assert_strequal("*", rule->match.pattern); cl_assert(rule->match.length == 1); cl_assert(rule->match.flags == 0); cl_assert(rule->assigns.length == 1); - git_attr_assignment *assign = get_assign(rule, 0); + assign = get_assign(rule, 0); cl_assert(assign != NULL); cl_assert_strequal("binary", assign->name); cl_assert(assign->value == GIT_ATTR_TRUE); From f46e622636c5196829329f7bcf2226b36e61f7ed Mon Sep 17 00:00:00 2001 From: nulltoken Date: Wed, 4 Jan 2012 21:15:12 +0100 Subject: [PATCH 2/2] Fix Windows specific off-by-one error The value returned by MultiByteToWideChar includes the NULL termination character. --- src/fileops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fileops.c b/src/fileops.c index 5eb7bf6ec..48bd3514d 100644 --- a/src/fileops.c +++ b/src/fileops.c @@ -486,7 +486,7 @@ static int win32_find_system_file(git_buf *path, const char *filename) filename++; if (gitwin_append_utf16(file_utf16 + root->len - 1, filename, len + 1) != - (int)len) { + (int)len + 1) { error = git__throw(GIT_EOSERR, "Failed to build file path"); goto cleanup; }