From ded4ccab01e465018da7f9020d20d140ae270ba8 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Jun 2015 15:16:22 -0500 Subject: [PATCH 01/11] iterator_walk: drop unused variable --- src/iterator.c | 5 ----- 1 file changed, 5 deletions(-) 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]; } From 149d5d8a504aaa44d90a9630fc5f70cd4a37bb91 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Jun 2015 15:17:58 -0500 Subject: [PATCH 02/11] stash: drop unused variable --- src/stash.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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; From 2cf33fee89f3a7a3b1097e30d0468239048689ab Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Jun 2015 15:20:34 -0500 Subject: [PATCH 03/11] index test: include repository.h for decl --- tests/index/racy.c | 1 + 1 file changed, 1 insertion(+) 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; From 0175971e91641cd07246f59003930d81019ce40b Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Jun 2015 15:21:22 -0500 Subject: [PATCH 04/11] stash: const up conflict params --- tests/stash/apply.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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")); From 3ca84ac0ed2675387d5e65f28a7e256ddeab87bf Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Jun 2015 20:29:29 +0000 Subject: [PATCH 05/11] openssl: free hostname --- src/openssl_stream.c | 1 + 1 file changed, 1 insertion(+) 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); From 60655056672d28d88b246ecc97ba4b5a6e1dcdf4 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Jun 2015 21:37:07 +0000 Subject: [PATCH 06/11] submodule: cast enum to int for compare --- src/submodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/submodule.c b/src/submodule.c index 796364bb8..2a12a97e8 100644 --- a/src/submodule.c +++ b/src/submodule.c @@ -741,7 +741,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; } From e5f9df7b0f754c90c35c8cad72e814adbb2657ac Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Jun 2015 21:45:04 +0000 Subject: [PATCH 07/11] odb: cast to long long for printf --- src/odb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; } From d202bb7d3bcca536c3b236b36621707a99854572 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Jun 2015 21:48:35 +0000 Subject: [PATCH 08/11] examples: clean up some warnings --- examples/blame.c | 4 ++-- examples/network/clone.c | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) 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; From d88abb89495654b68d10e40e17e4d57fe21b6f9b Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Jun 2015 21:54:06 +0000 Subject: [PATCH 09/11] filter test: pass base type --- tests/filter/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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); } From eadf37151ba8154b44a918862ddbb3a7d3d8ba14 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Jun 2015 22:10:45 +0000 Subject: [PATCH 10/11] clar: test chdir --- tests/clar/sandbox.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); } From 64c415c2aea1f4e3d3a4dfdeb3c1588ef04ba819 Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Mon, 29 Jun 2015 22:12:20 +0000 Subject: [PATCH 11/11] checkout test: check getcwd return value --- tests/checkout/index.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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));