diff --git a/examples/blame.c b/examples/blame.c index b126c0d33..9288352e2 100644 --- a/examples/blame.c +++ b/examples/blame.c @@ -37,8 +37,8 @@ static void parse_opts(struct opts *o, int argc, char *argv[]); int main(int argc, char *argv[]) { - int i, line, break_on_null_hunk; - size_t rawsize; + int line, break_on_null_hunk; + size_t i, rawsize; char spec[1024] = {0}; struct opts o = {0}; const char *rawdata; diff --git a/examples/network/clone.c b/examples/network/clone.c index b2d80ed01..caf41cca8 100644 --- a/examples/network/clone.c +++ b/examples/network/clone.c @@ -48,6 +48,8 @@ static void print_progress(const progress_data *pd) static int sideband_progress(const char *str, int len, void *payload) { + (void)payload; // unused + printf("remote: %*s", len, str); fflush(stdout); return 0; diff --git a/src/iterator.c b/src/iterator.c index 949949388..2c3a87af0 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -1852,7 +1852,6 @@ int git_iterator_walk( const git_index_entry **iterator_item; /* next in each iterator */ const git_index_entry **cur_items; /* current path in each iter */ const git_index_entry *first_match; - int cur_item_modified; size_t i, j; int error = 0; @@ -1875,7 +1874,6 @@ int git_iterator_walk( cur_items[i] = NULL; first_match = NULL; - cur_item_modified = 0; /* Find the next path(s) to consume from each iterator */ for (i = 0; i < cnt; i++) { @@ -1898,9 +1896,6 @@ int git_iterator_walk( first_match = iterator_item[i]; cur_items[i] = iterator_item[i]; - } else if (path_diff > 0) { - /* No entry for the current item, this is modified */ - cur_item_modified = 1; } else if (path_diff == 0) { cur_items[i] = iterator_item[i]; } diff --git a/src/odb.c b/src/odb.c index 7a718f5d6..b2d635109 100644 --- a/src/odb.c +++ b/src/odb.c @@ -53,7 +53,7 @@ static int load_alternates(git_odb *odb, const char *objects_dir, int alternate_ int git_odb__format_object_header(char *hdr, size_t n, git_off_t obj_len, git_otype obj_type) { const char *type_str = git_object_type2string(obj_type); - int len = p_snprintf(hdr, n, "%s %lld", type_str, obj_len); + int len = p_snprintf(hdr, n, "%s %lld", type_str, (long long)obj_len); assert(len > 0 && len <= (int)n); return len+1; } diff --git a/src/openssl_stream.c b/src/openssl_stream.c index 90af4ae6e..958252e9f 100644 --- a/src/openssl_stream.c +++ b/src/openssl_stream.c @@ -413,6 +413,7 @@ void openssl_free(git_stream *stream) { openssl_stream *st = (openssl_stream *) stream; + git__free(st->host); git__free(st->cert_info.data); git_stream_free(st->io); git__free(st); diff --git a/src/stash.c b/src/stash.c index 59ecd3b07..acf89442a 100644 --- a/src/stash.c +++ b/src/stash.c @@ -793,7 +793,6 @@ static int stage_new_file(const git_index_entry **entries, void *data) static int stage_new_files( git_index **out, - git_repository *repo, git_tree *parent_tree, git_tree *tree) { @@ -886,7 +885,7 @@ int git_stash_apply( */ } else if ((opts.flags & GIT_STASH_APPLY_REINSTATE_INDEX) == 0) { if ((error = stage_new_files( - &stash_adds, repo, stash_parent_tree, stash_tree)) < 0 || + &stash_adds, stash_parent_tree, stash_tree)) < 0 || (error = merge_indexes( &unstashed_index, repo, stash_parent_tree, repo_index, stash_adds)) < 0) goto cleanup; diff --git a/src/submodule.c b/src/submodule.c index 0cd6bb913..17e1a3561 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -749,7 +749,7 @@ const char *git_submodule_update_to_str(git_submodule_update_t update) { int i; for (i = 0; i < (int)ARRAY_SIZE(_sm_update_map); ++i) - if (_sm_update_map[i].map_value == update) + if (_sm_update_map[i].map_value == (int)update) return _sm_update_map[i].str_match; return NULL; } diff --git a/tests/checkout/index.c b/tests/checkout/index.c index 89b014586..0d220e141 100644 --- a/tests/checkout/index.c +++ b/tests/checkout/index.c @@ -145,7 +145,7 @@ void test_checkout_index__honor_coresymlinks_default(void) const char *url = git_repository_path(g_repo); - getcwd(cwd, sizeof(cwd)); + cl_assert(getcwd(cwd, sizeof(cwd)) != NULL); cl_assert_equal_i(0, p_mkdir("readonly", 0555)); // Read-only directory cl_assert_equal_i(0, chdir("readonly")); cl_git_pass(git_repository_init(&repo, "../symlink.git", true)); diff --git a/tests/clar/sandbox.h b/tests/clar/sandbox.h index ea9e35ca9..4b83bf31d 100644 --- a/tests/clar/sandbox.h +++ b/tests/clar/sandbox.h @@ -65,7 +65,7 @@ static void clar_unsandbox(void) if (_clar_path[0] == '\0') return; - chdir(".."); + cl_must_pass(chdir("..")); fs_rm(_clar_path); } diff --git a/tests/filter/file.c b/tests/filter/file.c index 8243a026a..599f4e54b 100644 --- a/tests/filter/file.c +++ b/tests/filter/file.c @@ -91,9 +91,9 @@ void test_filter_file__apply_stream(void) cl_git_pass(git_filter_list_push(fl, crlf, NULL)); - cl_git_pass(git_filter_list_stream_file(fl, g_repo, "all-crlf", (git_writestream *)&write_target)); + cl_git_pass(git_filter_list_stream_file(fl, g_repo, "all-crlf", &write_target.base)); cl_assert_equal_s("crlf\ncrlf\ncrlf\ncrlf\n", write_target.buf.ptr); git_filter_list_free(fl); - write_target.base.free((struct git_writestream *)&write_target); + write_target.base.free(&write_target.base); } diff --git a/tests/index/racy.c b/tests/index/racy.c index fda1ed239..3b26aabf4 100644 --- a/tests/index/racy.c +++ b/tests/index/racy.c @@ -3,6 +3,7 @@ #include "buffer.h" #include "index.h" +#include "repository.h" static git_repository *g_repo; diff --git a/tests/stash/apply.c b/tests/stash/apply.c index 1056ce7eb..f26b73b19 100644 --- a/tests/stash/apply.c +++ b/tests/stash/apply.c @@ -96,7 +96,7 @@ void test_stash_apply__with_existing_file(void) void test_stash_apply__merges_new_file(void) { - git_index_entry *ancestor, *our, *their; + const git_index_entry *ancestor, *our, *their; cl_git_mkfile("stash/where", "committed before stash\n"); cl_git_pass(git_index_add_bypath(repo_index, "where"));