Merge pull request #1878 from libgit2/ntk/fix/warnings Fix x86/x64 size_t related 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
diff --git a/src/indexer.c b/src/indexer.c
index ceb11f0..3b160df 100644
--- a/src/indexer.c
+++ b/src/indexer.c
@@ -426,7 +426,7 @@ int git_indexer_stream_add(git_indexer_stream *idx, const void *data, size_t siz
if (git_filebuf_write(&idx->pack_file, data, size) < 0)
return -1;
- hash_partially(idx, data, size);
+ hash_partially(idx, data, (int)size);
/* Make sure we set the new size of the pack */
if (idx->opened_pack) {
diff --git a/tests-clar/clar_libgit2.c b/tests-clar/clar_libgit2.c
index 555af38..6063bf9 100644
--- a/tests-clar/clar_libgit2.c
+++ b/tests-clar/clar_libgit2.c
@@ -440,7 +440,7 @@ void clar__assert_equal_file(
int ignore_cr,
const char *path,
const char *file,
- size_t line)
+ int line)
{
char buf[4000];
ssize_t bytes, total_bytes = 0;
diff --git a/tests-clar/clar_libgit2.h b/tests-clar/clar_libgit2.h
index 9d4d63e..b9ef562 100644
--- a/tests-clar/clar_libgit2.h
+++ b/tests-clar/clar_libgit2.h
@@ -44,7 +44,7 @@ GIT_INLINE(void) clar__assert_in_range(
}
#define cl_assert_equal_sz(sz1,sz2) do { \
- size_t __sz1 = (sz1), __sz2 = (sz2); \
+ size_t __sz1 = (size_t)(sz1), __sz2 = (size_t)(sz2); \
clar__assert_equal(__FILE__,__LINE__,#sz1 " != " #sz2, 1, "%"PRIuZ, __sz1, __sz2); \
} while (0)
@@ -52,10 +52,10 @@ GIT_INLINE(void) clar__assert_in_range(
clar__assert_in_range((L),(V),(H),__FILE__,__LINE__,"Range check: " #V " in [" #L "," #H "]", 1)
#define cl_assert_equal_file(DATA,SIZE,PATH) \
- clar__assert_equal_file(DATA,SIZE,0,PATH,__FILE__,__LINE__)
+ clar__assert_equal_file(DATA,SIZE,0,PATH,__FILE__,(int)__LINE__)
#define cl_assert_equal_file_ignore_cr(DATA,SIZE,PATH) \
- clar__assert_equal_file(DATA,SIZE,1,PATH,__FILE__,__LINE__)
+ clar__assert_equal_file(DATA,SIZE,1,PATH,__FILE__,(int)__LINE__)
void clar__assert_equal_file(
const char *expected_data,
@@ -63,7 +63,7 @@ void clar__assert_equal_file(
int ignore_cr,
const char *path,
const char *file,
- size_t line);
+ int line);
/*
* Some utility macros for building long strings