Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7bfdd1c

Browse files
committed
Merge pull request libgit2#3270 from ethomson/warnings2
Remove some warnings
2 parents 4a0313b + 64c415c commit 7bfdd1c

File tree

12 files changed

+14
-16
lines changed

12 files changed

+14
-16
lines changed

examples/blame.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ static void parse_opts(struct opts *o, int argc, char *argv[]);
3737

3838
int main(int argc, char *argv[])
3939
{
40-
int i, line, break_on_null_hunk;
41-
size_t rawsize;
40+
int line, break_on_null_hunk;
41+
size_t i, rawsize;
4242
char spec[1024] = {0};
4343
struct opts o = {0};
4444
const char *rawdata;

examples/network/clone.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ static void print_progress(const progress_data *pd)
4848

4949
static int sideband_progress(const char *str, int len, void *payload)
5050
{
51+
(void)payload; // unused
52+
5153
printf("remote: %*s", len, str);
5254
fflush(stdout);
5355
return 0;

src/iterator.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1852,7 +1852,6 @@ int git_iterator_walk(
18521852
const git_index_entry **iterator_item; /* next in each iterator */
18531853
const git_index_entry **cur_items; /* current path in each iter */
18541854
const git_index_entry *first_match;
1855-
int cur_item_modified;
18561855
size_t i, j;
18571856
int error = 0;
18581857

@@ -1875,7 +1874,6 @@ int git_iterator_walk(
18751874
cur_items[i] = NULL;
18761875

18771876
first_match = NULL;
1878-
cur_item_modified = 0;
18791877

18801878
/* Find the next path(s) to consume from each iterator */
18811879
for (i = 0; i < cnt; i++) {
@@ -1898,9 +1896,6 @@ int git_iterator_walk(
18981896

18991897
first_match = iterator_item[i];
19001898
cur_items[i] = iterator_item[i];
1901-
} else if (path_diff > 0) {
1902-
/* No entry for the current item, this is modified */
1903-
cur_item_modified = 1;
19041899
} else if (path_diff == 0) {
19051900
cur_items[i] = iterator_item[i];
19061901
}

src/odb.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static int load_alternates(git_odb *odb, const char *objects_dir, int alternate_
5353
int git_odb__format_object_header(char *hdr, size_t n, git_off_t obj_len, git_otype obj_type)
5454
{
5555
const char *type_str = git_object_type2string(obj_type);
56-
int len = p_snprintf(hdr, n, "%s %lld", type_str, obj_len);
56+
int len = p_snprintf(hdr, n, "%s %lld", type_str, (long long)obj_len);
5757
assert(len > 0 && len <= (int)n);
5858
return len+1;
5959
}

src/openssl_stream.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ void openssl_free(git_stream *stream)
413413
{
414414
openssl_stream *st = (openssl_stream *) stream;
415415

416+
git__free(st->host);
416417
git__free(st->cert_info.data);
417418
git_stream_free(st->io);
418419
git__free(st);

src/stash.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,6 @@ static int stage_new_file(const git_index_entry **entries, void *data)
793793

794794
static int stage_new_files(
795795
git_index **out,
796-
git_repository *repo,
797796
git_tree *parent_tree,
798797
git_tree *tree)
799798
{
@@ -886,7 +885,7 @@ int git_stash_apply(
886885
*/
887886
} else if ((opts.flags & GIT_STASH_APPLY_REINSTATE_INDEX) == 0) {
888887
if ((error = stage_new_files(
889-
&stash_adds, repo, stash_parent_tree, stash_tree)) < 0 ||
888+
&stash_adds, stash_parent_tree, stash_tree)) < 0 ||
890889
(error = merge_indexes(
891890
&unstashed_index, repo, stash_parent_tree, repo_index, stash_adds)) < 0)
892891
goto cleanup;

src/submodule.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -749,7 +749,7 @@ const char *git_submodule_update_to_str(git_submodule_update_t update)
749749
{
750750
int i;
751751
for (i = 0; i < (int)ARRAY_SIZE(_sm_update_map); ++i)
752-
if (_sm_update_map[i].map_value == update)
752+
if (_sm_update_map[i].map_value == (int)update)
753753
return _sm_update_map[i].str_match;
754754
return NULL;
755755
}

tests/checkout/index.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ void test_checkout_index__honor_coresymlinks_default(void)
145145

146146
const char *url = git_repository_path(g_repo);
147147

148-
getcwd(cwd, sizeof(cwd));
148+
cl_assert(getcwd(cwd, sizeof(cwd)) != NULL);
149149
cl_assert_equal_i(0, p_mkdir("readonly", 0555)); // Read-only directory
150150
cl_assert_equal_i(0, chdir("readonly"));
151151
cl_git_pass(git_repository_init(&repo, "../symlink.git", true));

tests/clar/sandbox.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static void clar_unsandbox(void)
6565
if (_clar_path[0] == '\0')
6666
return;
6767

68-
chdir("..");
68+
cl_must_pass(chdir(".."));
6969

7070
fs_rm(_clar_path);
7171
}

tests/filter/file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ void test_filter_file__apply_stream(void)
9191

9292
cl_git_pass(git_filter_list_push(fl, crlf, NULL));
9393

94-
cl_git_pass(git_filter_list_stream_file(fl, g_repo, "all-crlf", (git_writestream *)&write_target));
94+
cl_git_pass(git_filter_list_stream_file(fl, g_repo, "all-crlf", &write_target.base));
9595
cl_assert_equal_s("crlf\ncrlf\ncrlf\ncrlf\n", write_target.buf.ptr);
9696

9797
git_filter_list_free(fl);
98-
write_target.base.free((struct git_writestream *)&write_target);
98+
write_target.base.free(&write_target.base);
9999
}

tests/index/racy.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
#include "buffer.h"
55
#include "index.h"
6+
#include "repository.h"
67

78
static git_repository *g_repo;
89

tests/stash/apply.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ void test_stash_apply__with_existing_file(void)
9696

9797
void test_stash_apply__merges_new_file(void)
9898
{
99-
git_index_entry *ancestor, *our, *their;
99+
const git_index_entry *ancestor, *our, *their;
100100

101101
cl_git_mkfile("stash/where", "committed before stash\n");
102102
cl_git_pass(git_index_add_bypath(repo_index, "where"));

0 commit comments

Comments
 (0)