Commit 3ad05221 by nulltoken

Fix MSVC compilation warnings

Fix #1308
parent d96aa8a9
......@@ -348,7 +348,7 @@ int git_branch_tracking_name(
if (tracking_branch_name_out)
git_buf_copy_cstr(tracking_branch_name_out, buffer_size, &buf);
error = buf.size + 1;
error = (int)buf.size + 1;
cleanup:
git_buf_free(&buf);
......
......@@ -1603,8 +1603,8 @@ int git_diff_patch_get_line_in_hunk(
if (line_origin) *line_origin = line->origin;
if (content) *content = line->ptr;
if (content_len) *content_len = line->len;
if (old_lineno) *old_lineno = line->oldno;
if (new_lineno) *new_lineno = line->newno;
if (old_lineno) *old_lineno = (int)line->oldno;
if (new_lineno) *new_lineno = (int)line->newno;
return 0;
......
......@@ -42,7 +42,7 @@ typedef struct diff_patch_line diff_patch_line;
struct diff_patch_line {
const char *ptr;
size_t len;
int lines, oldno, newno;
size_t lines, oldno, newno;
char origin;
};
......
......@@ -355,7 +355,7 @@ size_t git_tree_entrycount(const git_tree *tree)
unsigned int git_treebuilder_entrycount(git_treebuilder *bld)
{
assert(bld);
return bld->entries.length;
return (int)bld->entries.length;
}
static int tree_error(const char *str, const char *path)
......
......@@ -46,7 +46,7 @@ void test_clone_empty__can_clone_an_empty_local_repo_barely(void)
cl_assert_equal_i(GIT_ENOTFOUND, git_reference_lookup(&ref, g_repo_cloned, local_name));
/* ...one can still retrieve the name of the remote tracking reference */
cl_assert_equal_i(strlen("refs/remotes/origin/master") + 1,
cl_assert_equal_i((int)strlen("refs/remotes/origin/master") + 1U,
git_branch_tracking_name(tracking_name, 1024, g_repo_cloned, local_name));
}
......
......@@ -251,13 +251,13 @@ static void check_single_patch_stats(
cl_git_pass(git_diff_get_patch(&patch, &delta, diff, 0));
cl_assert_equal_i(GIT_DELTA_MODIFIED, (int)delta->status);
cl_assert_equal_i(hunks, (int)git_diff_patch_num_hunks(patch));
cl_assert_equal_sz(hunks, git_diff_patch_num_hunks(patch));
cl_git_pass(
git_diff_patch_line_stats(NULL, &actual_adds, &actual_dels, patch));
cl_assert_equal_i(adds, actual_adds);
cl_assert_equal_i(dels, actual_dels);
cl_assert_equal_sz(adds, actual_adds);
cl_assert_equal_sz(dels, actual_dels);
git_diff_patch_free(patch);
git_diff_list_free(diff);
......
......@@ -37,6 +37,6 @@ void test_refs_branches_trackingname__can_retrieve_the_local_tracking_reference_
void test_refs_branches_trackingname__can_return_the_size_of_thelocal_tracking_reference_name_of_a_local_branch(void)
{
cl_assert_equal_i(strlen("refs/heads/master") + 1,
cl_assert_equal_i((int)strlen("refs/heads/master") + 1,
git_branch_tracking_name(NULL, 0, repo, "refs/heads/track-local"));
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment