Merge pull request #1647 from arrbee/fix-win32-warnings-part-112 Fix Windows warnings and missing prototypes
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 150
diff --git a/src/config.c b/src/config.c
index 9491d26..4066cf7 100644
--- a/src/config.c
+++ b/src/config.c
@@ -154,7 +154,7 @@ static int find_internal_file_by_level(
} else {
git_vector_foreach(&cfg->files, i, internal) {
if (internal->level == level)
- pos = i;
+ pos = (int)i;
}
}
@@ -189,7 +189,7 @@ static void try_remove_existing_file_internal(
git_vector_foreach(&cfg->files, i, internal) {
if (internal->level == level)
- pos = i;
+ pos = (int)i;
}
if (pos == -1)
diff --git a/src/diff_driver.c b/src/diff_driver.c
index ae2b7c3..469be0d 100644
--- a/src/diff_driver.c
+++ b/src/diff_driver.c
@@ -331,7 +331,7 @@ int git_diff_driver_content_is_binary(
}
static int diff_context_line__simple(
- git_diff_driver *driver, const char *line, long line_len)
+ git_diff_driver *driver, const char *line, size_t line_len)
{
GIT_UNUSED(driver);
GIT_UNUSED(line_len);
@@ -339,7 +339,7 @@ static int diff_context_line__simple(
}
static int diff_context_line__pattern_match(
- git_diff_driver *driver, const char *line, long line_len)
+ git_diff_driver *driver, const char *line, size_t line_len)
{
size_t i;
diff --git a/src/diff_driver.h b/src/diff_driver.h
index 3db7df0..9d3f186 100644
--- a/src/diff_driver.h
+++ b/src/diff_driver.h
@@ -31,7 +31,7 @@ typedef long (*git_diff_find_context_fn)(
const char *, long, char *, long, void *);
typedef int (*git_diff_find_context_line)(
- git_diff_driver *, const char *, long);
+ git_diff_driver *, const char *, size_t);
typedef struct {
git_diff_driver *driver;
diff --git a/src/diff_tform.c b/src/diff_tform.c
index 53a7e63..94fa035 100644
--- a/src/diff_tform.c
+++ b/src/diff_tform.c
@@ -711,7 +711,7 @@ int git_diff_find_similar(
git_vector_foreach(&diff->deltas, i, to) {
size_t tried_sources = 0;
- match_targets[i].idx = i;
+ match_targets[i].idx = (uint32_t)i;
match_targets[i].similarity = 0;
/* skip things that are not rename targets */
@@ -744,8 +744,8 @@ int git_diff_find_similar(
match_sources[j].similarity < (uint32_t)similarity) {
match_targets[i].similarity = (uint32_t)similarity;
match_sources[j].similarity = (uint32_t)similarity;
- match_targets[i].idx = j;
- match_sources[j].idx = i;
+ match_targets[i].idx = (uint32_t)j;
+ match_sources[j].idx = (uint32_t)i;
}
}
}
diff --git a/src/revparse.c b/src/revparse.c
index 3e3edb6..bcfb084 100644
--- a/src/revparse.c
+++ b/src/revparse.c
@@ -674,7 +674,7 @@ static int ensure_left_hand_identifier_is_not_known_yet(git_object *object, git_
int revparse__ext(
git_object **object_out,
git_reference **reference_out,
- int *identifier_len_out,
+ size_t *identifier_len_out,
git_repository *repo,
const char *spec)
{
@@ -832,7 +832,8 @@ int git_revparse_ext(
git_repository *repo,
const char *spec)
{
- int error, identifier_len;
+ int error;
+ size_t identifier_len;
git_object *obj = NULL;
git_reference *ref = NULL;
@@ -841,6 +842,7 @@ int git_revparse_ext(
*object_out = obj;
*reference_out = ref;
+ GIT_UNUSED(identifier_len);
return 0;
diff --git a/src/transports/winhttp.c b/src/transports/winhttp.c
index d803c81..95e422d 100644
--- a/src/transports/winhttp.c
+++ b/src/transports/winhttp.c
@@ -19,6 +19,8 @@
#include <winhttp.h>
#pragma comment(lib, "winhttp")
+#include <strsafe.h>
+
/* For UuidCreate */
#pragma comment(lib, "rpcrt4")
diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c
index f9967e0..f049744 100644
--- a/src/win32/posix_w32.c
+++ b/src/win32/posix_w32.c
@@ -5,6 +5,7 @@
* a Linking Exception. For full terms see the included COPYING file.
*/
#include "../posix.h"
+#include "../fileops.h"
#include "path.h"
#include "utf-conv.h"
#include "repository.h"
diff --git a/tests-clar/refs/iterator.c b/tests-clar/refs/iterator.c
index 7a96689..266410f 100644
--- a/tests-clar/refs/iterator.c
+++ b/tests-clar/refs/iterator.c
@@ -66,7 +66,7 @@ void test_refs_iterator__list(void)
} while (!error);
git_reference_iterator_free(iter);
- cl_assert_equal_i(output.length, ARRAY_SIZE(refnames));
+ cl_assert_equal_sz(output.length, ARRAY_SIZE(refnames));
git_vector_sort(&output);