Merge pull request #3175 from git-up/build_warnings Fixed build warnings on Xcode 6.1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149
diff --git a/src/odb.c b/src/odb.c
index deb9d5c..7a718f5 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 %"PRIuZ, type_str, obj_len);
+ int len = p_snprintf(hdr, n, "%s %lld", type_str, obj_len);
assert(len > 0 && len <= (int)n);
return len+1;
}
diff --git a/src/transports/cred.c b/src/transports/cred.c
index 006cd2c..044b2a2 100644
--- a/src/transports/cred.c
+++ b/src/transports/cred.c
@@ -209,6 +209,12 @@ int git_cred_ssh_key_memory_new(
passphrase,
GIT_CREDTYPE_SSH_MEMORY);
#else
+ GIT_UNUSED(cred);
+ GIT_UNUSED(username);
+ GIT_UNUSED(publickey);
+ GIT_UNUSED(privatekey);
+ GIT_UNUSED(passphrase);
+
giterr_set(GITERR_INVALID,
"This version of libgit2 was not built with ssh memory credentials.");
return -1;
diff --git a/tests/core/path.c b/tests/core/path.c
index 7d3e493..c3e622f 100644
--- a/tests/core/path.c
+++ b/tests/core/path.c
@@ -492,7 +492,7 @@ void test_core_path__13_cannot_prettify_a_non_existing_file(void)
{
git_buf p = GIT_BUF_INIT;
- cl_must_pass(git_path_exists(NON_EXISTING_FILEPATH) == false);
+ cl_assert_equal_b(git_path_exists(NON_EXISTING_FILEPATH), false);
cl_assert_equal_i(GIT_ENOTFOUND, git_path_prettify(&p, NON_EXISTING_FILEPATH, NULL));
cl_assert_equal_i(GIT_ENOTFOUND, git_path_prettify(&p, NON_EXISTING_FILEPATH "/so-do-i", NULL));
diff --git a/tests/diff/index.c b/tests/diff/index.c
index a544b83..cf883f1 100644
--- a/tests/diff/index.c
+++ b/tests/diff/index.c
@@ -168,7 +168,7 @@ static void do_conflicted_diff(diff_expects *exp, unsigned long flags)
const char *a_commit = "26a125ee1bf"; /* the current HEAD */
git_tree *a = resolve_commit_oid_to_tree(g_repo, a_commit);
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
- git_index_entry ancestor = {0}, ours = {0}, theirs = {0};
+ git_index_entry ancestor = {{0}}, ours = {{0}}, theirs = {{0}};
git_diff *diff = NULL;
git_index *index;
diff --git a/tests/diff/workdir.c b/tests/diff/workdir.c
index 460f1b5..65005f9 100644
--- a/tests/diff/workdir.c
+++ b/tests/diff/workdir.c
@@ -73,7 +73,7 @@ void test_diff_workdir__to_index_with_conflicts(void)
git_diff_options opts = GIT_DIFF_OPTIONS_INIT;
git_diff *diff = NULL;
git_index *index;
- git_index_entry our_entry = {0}, their_entry = {0};
+ git_index_entry our_entry = {{0}}, their_entry = {{0}};
diff_expects exp = {0};
g_repo = cl_git_sandbox_init("status");
diff --git a/tests/index/addall.c b/tests/index/addall.c
index 211e762..f344cc6 100644
--- a/tests/index/addall.c
+++ b/tests/index/addall.c
@@ -288,7 +288,6 @@ void test_index_addall__repo_lifecycle(void)
void test_index_addall__files_in_folders(void)
{
git_index *index;
- git_strarray paths = { NULL, 0 };
addall_create_test_repo(true);
@@ -408,7 +407,7 @@ void test_index_addall__adds_conflicts(void)
cl_git_pass(git_reference_lookup(&ref, g_repo, "refs/heads/branch"));
cl_git_pass(git_annotated_commit_from_ref(&annotated, g_repo, ref));
- cl_git_pass(git_merge(g_repo, &annotated, 1, NULL, NULL));
+ cl_git_pass(git_merge(g_repo, (const git_annotated_commit**)&annotated, 1, NULL, NULL));
check_status(g_repo, 0, 1, 2, 0, 0, 0, 0, 1);
cl_git_pass(git_index_add_all(index, NULL, 0, NULL, NULL));
@@ -433,7 +432,7 @@ void test_index_addall__removes_deleted_conflicted_files(void)
cl_git_pass(git_reference_lookup(&ref, g_repo, "refs/heads/branch"));
cl_git_pass(git_annotated_commit_from_ref(&annotated, g_repo, ref));
- cl_git_pass(git_merge(g_repo, &annotated, 1, NULL, NULL));
+ cl_git_pass(git_merge(g_repo, (const git_annotated_commit**)&annotated, 1, NULL, NULL));
check_status(g_repo, 0, 1, 2, 0, 0, 0, 0, 1);
cl_git_rmfile("merge-resolve/conflicting.txt");
diff --git a/tests/stash/apply.c b/tests/stash/apply.c
index e9b56f8..c242536 100644
--- a/tests/stash/apply.c
+++ b/tests/stash/apply.c
@@ -254,6 +254,11 @@ int checkout_notify(
{
struct seen_paths *seen_paths = (struct seen_paths *)payload;
+ GIT_UNUSED(why);
+ GIT_UNUSED(baseline);
+ GIT_UNUSED(target);
+ GIT_UNUSED(workdir);
+
if (strcmp(path, "what") == 0)
seen_paths->what = 1;
else if (strcmp(path, "how") == 0)
@@ -318,6 +323,8 @@ int aborting_progress_cb(
git_stash_apply_progress_t progress,
void *payload)
{
+ GIT_UNUSED(payload);
+
if (progress == GIT_STASH_APPLY_PROGRESS_ANALYZE_MODIFIED)
return -44;
@@ -327,7 +334,6 @@ int aborting_progress_cb(
void test_stash_apply__progress_cb_can_abort(void)
{
git_stash_apply_options opts = GIT_STASH_APPLY_OPTIONS_INIT;
- git_stash_apply_progress_t progress = GIT_STASH_APPLY_PROGRESS_NONE;
opts.progress_cb = aborting_progress_cb;
diff --git a/tests/status/worktree.c b/tests/status/worktree.c
index e272c0a..3b18ae6 100644
--- a/tests/status/worktree.c
+++ b/tests/status/worktree.c
@@ -649,10 +649,10 @@ void test_status_worktree__conflict_has_no_oid(void)
{
git_repository *repo = cl_git_sandbox_init("status");
git_index *index;
- git_index_entry entry = {0};
+ git_index_entry entry = {{0}};
git_status_list *statuslist;
const git_status_entry *status;
- git_oid zero_id = {0};
+ git_oid zero_id = {{0}};
entry.mode = 0100644;
entry.path = "modified_file";