Merge pull request #961 from arrbee/win64-cleanups Win64 cleanups
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 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
diff --git a/src/diff_output.c b/src/diff_output.c
index 05bca46..8a099a4 100644
--- a/src/diff_output.c
+++ b/src/diff_output.c
@@ -1366,7 +1366,7 @@ int git_diff_patch_num_lines_in_hunk(
if (hunk_idx >= patch->hunks_size)
return GIT_ENOTFOUND;
else
- return patch->hunks[hunk_idx].line_count;
+ return (int)patch->hunks[hunk_idx].line_count;
}
int git_diff_patch_get_line_in_hunk(
diff --git a/src/refs.c b/src/refs.c
index 903accc..bd6fbee 100644
--- a/src/refs.c
+++ b/src/refs.c
@@ -1610,12 +1610,12 @@ static int ensure_segment_validity(const char *name)
prev = *current;
}
- return current - name;
+ return (int)(current - name);
}
-static bool is_all_caps_and_underscore(const char *name, int len)
+static bool is_all_caps_and_underscore(const char *name, size_t len)
{
- int i;
+ size_t i;
char c;
assert(name && len > 0);
@@ -1667,10 +1667,10 @@ int git_reference__normalize_name(
if (segment_len > 0) {
if (normalize) {
- int cur_len = git_buf_len(buf);
+ size_t cur_len = git_buf_len(buf);
git_buf_joinpath(buf, git_buf_cstr(buf), current);
- git_buf_truncate(buf,
+ git_buf_truncate(buf,
cur_len + segment_len + (segments_count ? 1 : 0));
if (git_buf_oom(buf))
@@ -1706,7 +1706,7 @@ int git_reference__normalize_name(
goto cleanup;
if ((segments_count == 1 ) &&
- !(is_all_caps_and_underscore(name, segment_len) ||
+ !(is_all_caps_and_underscore(name, (size_t)segment_len) ||
((flags & GIT_REF_FORMAT_REFSPEC_PATTERN) && !strcmp("*", name))))
goto cleanup;
diff --git a/src/submodule.c b/src/submodule.c
index e55e128..a216249 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -1474,7 +1474,7 @@ static int submodule_wd_status(unsigned int *status, git_submodule *sm)
error = git_diff_workdir_to_index(sm_repo, &opt, &diff);
if (!error) {
- int untracked =
+ size_t untracked =
git_diff_num_deltas_of_type(diff, GIT_DELTA_UNTRACKED);
if (untracked > 0)
diff --git a/tests-clar/diff/diffiter.c b/tests-clar/diff/diffiter.c
index 78f97fc..f6d9bfc 100644
--- a/tests-clar/diff/diffiter.c
+++ b/tests-clar/diff/diffiter.c
@@ -37,7 +37,7 @@ void test_diff_diffiter__iterate_files(void)
cl_git_pass(git_diff_workdir_to_index(repo, NULL, &diff));
num_d = git_diff_num_deltas(diff);
- cl_assert_equal_i(6, num_d);
+ cl_assert_equal_i(6, (int)num_d);
for (d = 0; d < num_d; ++d) {
const git_diff_delta *delta;
@@ -60,7 +60,7 @@ void test_diff_diffiter__iterate_files_2(void)
cl_git_pass(git_diff_workdir_to_index(repo, NULL, &diff));
num_d = git_diff_num_deltas(diff);
- cl_assert_equal_i(8, num_d);
+ cl_assert_equal_i(8, (int)num_d);
for (d = 0; d < num_d; ++d) {
const git_diff_delta *delta;
@@ -150,7 +150,7 @@ void test_diff_diffiter__max_size_threshold(void)
cl_assert(patch);
file_count++;
- hunk_count += git_diff_patch_num_hunks(patch);
+ hunk_count += (int)git_diff_patch_num_hunks(patch);
assert(delta->binary == 0 || delta->binary == 1);
binary_count += delta->binary;
@@ -183,7 +183,7 @@ void test_diff_diffiter__max_size_threshold(void)
cl_git_pass(git_diff_get_patch(&patch, &delta, diff, d));
file_count++;
- hunk_count += git_diff_patch_num_hunks(patch);
+ hunk_count += (int)git_diff_patch_num_hunks(patch);
assert(delta->binary == 0 || delta->binary == 1);
binary_count += delta->binary;
@@ -266,13 +266,13 @@ static void iterate_over_patch(git_diff_patch *patch, diff_expects *exp)
size_t h, num_h = git_diff_patch_num_hunks(patch), num_l;
exp->files++;
- exp->hunks += num_h;
+ exp->hunks += (int)num_h;
/* let's iterate in reverse, just because we can! */
for (h = 1, num_l = 0; h <= num_h; ++h)
num_l += git_diff_patch_num_lines_in_hunk(patch, num_h - h);
- exp->lines += num_l;
+ exp->lines += (int)num_l;
}
#define PATCH_CACHE 5
diff --git a/tests-clar/diff/tree.c b/tests-clar/diff/tree.c
index e62fa26..d8af3ac 100644
--- a/tests-clar/diff/tree.c
+++ b/tests-clar/diff/tree.c
@@ -309,7 +309,7 @@ void test_diff_tree__larger_hunks(void)
cl_git_fail(git_diff_get_patch(&patch, &delta, diff, num_d));
- cl_assert_equal_i(2, num_d);
+ cl_assert_equal_i(2, (int)num_d);
git_diff_list_free(diff);
diff = NULL;