Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 3b5001b

Browse files
committed
Merge pull request libgit2#1647 from arrbee/fix-win32-warnings-part-112
Fix Windows warnings and missing prototypes
2 parents 88c401b + 37f66e8 commit 3b5001b

File tree

8 files changed

+16
-11
lines changed

8 files changed

+16
-11
lines changed

src/config.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static int find_internal_file_by_level(
154154
} else {
155155
git_vector_foreach(&cfg->files, i, internal) {
156156
if (internal->level == level)
157-
pos = i;
157+
pos = (int)i;
158158
}
159159
}
160160

@@ -189,7 +189,7 @@ static void try_remove_existing_file_internal(
189189

190190
git_vector_foreach(&cfg->files, i, internal) {
191191
if (internal->level == level)
192-
pos = i;
192+
pos = (int)i;
193193
}
194194

195195
if (pos == -1)

src/diff_driver.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,15 +331,15 @@ int git_diff_driver_content_is_binary(
331331
}
332332

333333
static int diff_context_line__simple(
334-
git_diff_driver *driver, const char *line, long line_len)
334+
git_diff_driver *driver, const char *line, size_t line_len)
335335
{
336336
GIT_UNUSED(driver);
337337
GIT_UNUSED(line_len);
338338
return (git__isalpha(*line) || *line == '_' || *line == '$');
339339
}
340340

341341
static int diff_context_line__pattern_match(
342-
git_diff_driver *driver, const char *line, long line_len)
342+
git_diff_driver *driver, const char *line, size_t line_len)
343343
{
344344
size_t i;
345345

src/diff_driver.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ typedef long (*git_diff_find_context_fn)(
3131
const char *, long, char *, long, void *);
3232

3333
typedef int (*git_diff_find_context_line)(
34-
git_diff_driver *, const char *, long);
34+
git_diff_driver *, const char *, size_t);
3535

3636
typedef struct {
3737
git_diff_driver *driver;

src/diff_tform.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,7 +711,7 @@ int git_diff_find_similar(
711711
git_vector_foreach(&diff->deltas, i, to) {
712712
size_t tried_sources = 0;
713713

714-
match_targets[i].idx = i;
714+
match_targets[i].idx = (uint32_t)i;
715715
match_targets[i].similarity = 0;
716716

717717
/* skip things that are not rename targets */
@@ -744,8 +744,8 @@ int git_diff_find_similar(
744744
match_sources[j].similarity < (uint32_t)similarity) {
745745
match_targets[i].similarity = (uint32_t)similarity;
746746
match_sources[j].similarity = (uint32_t)similarity;
747-
match_targets[i].idx = j;
748-
match_sources[j].idx = i;
747+
match_targets[i].idx = (uint32_t)j;
748+
match_sources[j].idx = (uint32_t)i;
749749
}
750750
}
751751
}

src/revparse.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ static int ensure_left_hand_identifier_is_not_known_yet(git_object *object, git_
674674
int revparse__ext(
675675
git_object **object_out,
676676
git_reference **reference_out,
677-
int *identifier_len_out,
677+
size_t *identifier_len_out,
678678
git_repository *repo,
679679
const char *spec)
680680
{
@@ -832,7 +832,8 @@ int git_revparse_ext(
832832
git_repository *repo,
833833
const char *spec)
834834
{
835-
int error, identifier_len;
835+
int error;
836+
size_t identifier_len;
836837
git_object *obj = NULL;
837838
git_reference *ref = NULL;
838839

@@ -841,6 +842,7 @@ int git_revparse_ext(
841842

842843
*object_out = obj;
843844
*reference_out = ref;
845+
GIT_UNUSED(identifier_len);
844846

845847
return 0;
846848

src/transports/winhttp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
#include <winhttp.h>
2020
#pragma comment(lib, "winhttp")
2121

22+
#include <strsafe.h>
23+
2224
/* For UuidCreate */
2325
#pragma comment(lib, "rpcrt4")
2426

src/win32/posix_w32.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
* a Linking Exception. For full terms see the included COPYING file.
66
*/
77
#include "../posix.h"
8+
#include "../fileops.h"
89
#include "path.h"
910
#include "utf-conv.h"
1011
#include "repository.h"

tests-clar/refs/iterator.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ void test_refs_iterator__list(void)
6666
} while (!error);
6767

6868
git_reference_iterator_free(iter);
69-
cl_assert_equal_i(output.length, ARRAY_SIZE(refnames));
69+
cl_assert_equal_sz(output.length, ARRAY_SIZE(refnames));
7070

7171
git_vector_sort(&output);
7272

0 commit comments

Comments
 (0)