Merge pull request #2134 from libgit2/ben/icc Fix Intel compiler warnings
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
diff --git a/src/diff_tform.c b/src/diff_tform.c
index dfb59a3..97fbc28 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -218,7 +218,7 @@ int git_diff_merge(git_diff *onto, const git_diff *from)
int git_diff_find_similar__hashsig_for_file(
void **out, const git_diff_file *f, const char *path, void *p)
{
- git_hashsig_option_t opt = (git_hashsig_option_t)p;
+ git_hashsig_option_t opt = (git_hashsig_option_t)(intptr_t)p;
int error = 0;
GIT_UNUSED(f);
@@ -235,7 +235,7 @@ int git_diff_find_similar__hashsig_for_file(
int git_diff_find_similar__hashsig_for_buf(
void **out, const git_diff_file *f, const char *buf, size_t len, void *p)
{
- git_hashsig_option_t opt = (git_hashsig_option_t)p;
+ git_hashsig_option_t opt = (git_hashsig_option_t)(intptr_t)p;
int error = 0;
GIT_UNUSED(f);
diff --git a/src/index.c b/src/index.c
index e0c0022..2de3dfe 100644
--- a/src/index.c
+++ b/src/index.c
@@ -2046,13 +2046,15 @@ static int write_index(git_index *index, git_filebuf *file)
git_oid hash_final;
struct index_header header;
bool is_extended;
+ uint32_t index_version_number;
assert(index && file);
is_extended = is_index_extended(index);
+ index_version_number = is_extended ? INDEX_VERSION_NUMBER_EXT : INDEX_VERSION_NUMBER;
header.signature = htonl(INDEX_HEADER_SIG);
- header.version = htonl(is_extended ? INDEX_VERSION_NUMBER_EXT : INDEX_VERSION_NUMBER);
+ header.version = htonl(index_version_number);
header.entry_count = htonl((uint32_t)index->entries.length);
if (git_filebuf_write(file, &header, sizeof(struct index_header)) < 0)
diff --git a/tests/blame/buffer.c b/tests/blame/buffer.c
index 912ee98..340b1dc 100644
--- a/tests/blame/buffer.c
+++ b/tests/blame/buffer.c
@@ -1,7 +1,7 @@
#include "blame_helpers.h"
-git_repository *g_repo;
-git_blame *g_fileblame, *g_bufferblame;
+static git_repository *g_repo;
+static git_blame *g_fileblame, *g_bufferblame;
void test_blame_buffer__initialize(void)
{
diff --git a/tests/index/addall.c b/tests/index/addall.c
index 4527337..a7e2583 100644
--- a/tests/index/addall.c
+++ b/tests/index/addall.c
@@ -3,7 +3,7 @@
#include "posix.h"
#include "fileops.h"
-git_repository *g_repo = NULL;
+static git_repository *g_repo = NULL;
#define TEST_DIR "addall"
void test_index_addall__initialize(void)