Commit 7bfdd1c2 by Carlos Martín Nieto

Merge pull request #3270 from ethomson/warnings2

Remove some warnings
parents 4a0313bc 64c415c2
...@@ -37,8 +37,8 @@ static void parse_opts(struct opts *o, int argc, char *argv[]); ...@@ -37,8 +37,8 @@ static void parse_opts(struct opts *o, int argc, char *argv[]);
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int i, line, break_on_null_hunk; int line, break_on_null_hunk;
size_t rawsize; size_t i, rawsize;
char spec[1024] = {0}; char spec[1024] = {0};
struct opts o = {0}; struct opts o = {0};
const char *rawdata; const char *rawdata;
......
...@@ -48,6 +48,8 @@ static void print_progress(const progress_data *pd) ...@@ -48,6 +48,8 @@ static void print_progress(const progress_data *pd)
static int sideband_progress(const char *str, int len, void *payload) static int sideband_progress(const char *str, int len, void *payload)
{ {
(void)payload; // unused
printf("remote: %*s", len, str); printf("remote: %*s", len, str);
fflush(stdout); fflush(stdout);
return 0; return 0;
......
...@@ -1852,7 +1852,6 @@ int git_iterator_walk( ...@@ -1852,7 +1852,6 @@ int git_iterator_walk(
const git_index_entry **iterator_item; /* next in each iterator */ 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 **cur_items; /* current path in each iter */
const git_index_entry *first_match; const git_index_entry *first_match;
int cur_item_modified;
size_t i, j; size_t i, j;
int error = 0; int error = 0;
...@@ -1875,7 +1874,6 @@ int git_iterator_walk( ...@@ -1875,7 +1874,6 @@ int git_iterator_walk(
cur_items[i] = NULL; cur_items[i] = NULL;
first_match = NULL; first_match = NULL;
cur_item_modified = 0;
/* Find the next path(s) to consume from each iterator */ /* Find the next path(s) to consume from each iterator */
for (i = 0; i < cnt; i++) { for (i = 0; i < cnt; i++) {
...@@ -1898,9 +1896,6 @@ int git_iterator_walk( ...@@ -1898,9 +1896,6 @@ int git_iterator_walk(
first_match = iterator_item[i]; first_match = iterator_item[i];
cur_items[i] = 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) { } else if (path_diff == 0) {
cur_items[i] = iterator_item[i]; cur_items[i] = iterator_item[i];
} }
......
...@@ -53,7 +53,7 @@ static int load_alternates(git_odb *odb, const char *objects_dir, int alternate_ ...@@ -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) 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); 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); assert(len > 0 && len <= (int)n);
return len+1; return len+1;
} }
......
...@@ -413,6 +413,7 @@ void openssl_free(git_stream *stream) ...@@ -413,6 +413,7 @@ void openssl_free(git_stream *stream)
{ {
openssl_stream *st = (openssl_stream *) stream; openssl_stream *st = (openssl_stream *) stream;
git__free(st->host);
git__free(st->cert_info.data); git__free(st->cert_info.data);
git_stream_free(st->io); git_stream_free(st->io);
git__free(st); git__free(st);
......
...@@ -793,7 +793,6 @@ static int stage_new_file(const git_index_entry **entries, void *data) ...@@ -793,7 +793,6 @@ static int stage_new_file(const git_index_entry **entries, void *data)
static int stage_new_files( static int stage_new_files(
git_index **out, git_index **out,
git_repository *repo,
git_tree *parent_tree, git_tree *parent_tree,
git_tree *tree) git_tree *tree)
{ {
...@@ -886,7 +885,7 @@ int git_stash_apply( ...@@ -886,7 +885,7 @@ int git_stash_apply(
*/ */
} else if ((opts.flags & GIT_STASH_APPLY_REINSTATE_INDEX) == 0) { } else if ((opts.flags & GIT_STASH_APPLY_REINSTATE_INDEX) == 0) {
if ((error = stage_new_files( 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( (error = merge_indexes(
&unstashed_index, repo, stash_parent_tree, repo_index, stash_adds)) < 0) &unstashed_index, repo, stash_parent_tree, repo_index, stash_adds)) < 0)
goto cleanup; goto cleanup;
......
...@@ -749,7 +749,7 @@ const char *git_submodule_update_to_str(git_submodule_update_t update) ...@@ -749,7 +749,7 @@ const char *git_submodule_update_to_str(git_submodule_update_t update)
{ {
int i; int i;
for (i = 0; i < (int)ARRAY_SIZE(_sm_update_map); ++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 _sm_update_map[i].str_match;
return NULL; return NULL;
} }
......
...@@ -145,7 +145,7 @@ void test_checkout_index__honor_coresymlinks_default(void) ...@@ -145,7 +145,7 @@ void test_checkout_index__honor_coresymlinks_default(void)
const char *url = git_repository_path(g_repo); 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, p_mkdir("readonly", 0555)); // Read-only directory
cl_assert_equal_i(0, chdir("readonly")); cl_assert_equal_i(0, chdir("readonly"));
cl_git_pass(git_repository_init(&repo, "../symlink.git", true)); cl_git_pass(git_repository_init(&repo, "../symlink.git", true));
......
...@@ -65,7 +65,7 @@ static void clar_unsandbox(void) ...@@ -65,7 +65,7 @@ static void clar_unsandbox(void)
if (_clar_path[0] == '\0') if (_clar_path[0] == '\0')
return; return;
chdir(".."); cl_must_pass(chdir(".."));
fs_rm(_clar_path); fs_rm(_clar_path);
} }
......
...@@ -91,9 +91,9 @@ void test_filter_file__apply_stream(void) ...@@ -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_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); cl_assert_equal_s("crlf\ncrlf\ncrlf\ncrlf\n", write_target.buf.ptr);
git_filter_list_free(fl); git_filter_list_free(fl);
write_target.base.free((struct git_writestream *)&write_target); write_target.base.free(&write_target.base);
} }
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "buffer.h" #include "buffer.h"
#include "index.h" #include "index.h"
#include "repository.h"
static git_repository *g_repo; static git_repository *g_repo;
......
...@@ -96,7 +96,7 @@ void test_stash_apply__with_existing_file(void) ...@@ -96,7 +96,7 @@ void test_stash_apply__with_existing_file(void)
void test_stash_apply__merges_new_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_mkfile("stash/where", "committed before stash\n");
cl_git_pass(git_index_add_bypath(repo_index, "where")); cl_git_pass(git_index_add_bypath(repo_index, "where"));
......
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