Fix warnings on Windows 64-bit build
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
diff --git a/src/filter.c b/src/filter.c
index 503f185..9f866fe 100644
--- a/src/filter.c
+++ b/src/filter.c
@@ -657,9 +657,17 @@ int git_filter_list_apply_to_blob(
git_filter_list *filters,
git_blob *blob)
{
- git_buf in = {
- (char *)git_blob_rawcontent(blob), 0, git_blob_rawsize(blob)
- };
+ git_buf in = GIT_BUF_INIT;
+ git_off_t rawsize = git_blob_rawsize(blob);
+
+ if (!git__is_sizet(rawsize)) {
+ giterr_set(GITERR_OS, "Blob is too large to filter");
+ return -1;
+ }
+
+ in.ptr = (char *)git_blob_rawcontent(blob);
+ in.asize = 0;
+ in.size = (size_t)rawsize;
if (filters)
git_oid_cpy(&filters->source.oid, git_blob_id(blob));
diff --git a/tests-clar/repo/init.c b/tests-clar/repo/init.c
index caa211e..392be20 100644
--- a/tests-clar/repo/init.c
+++ b/tests-clar/repo/init.c
@@ -382,7 +382,7 @@ static void assert_hooks_match(
cl_git_pass(git_buf_joinpath(&actual, repo_dir, hook_path));
cl_git_pass(git_path_lstat(actual.ptr, &st));
- cl_assert_equal_sz(expected_st.st_size, st.st_size);
+ cl_assert(expected_st.st_size == st.st_size);
if (GIT_MODE_TYPE(expected_st.st_mode) != GIT_FILEMODE_LINK) {
mode_t expected_mode =