Commit 713793133f65569561c6ca518f61acdddd1d3b65

Russell Belfer 2013-09-23T13:40:23

Fix warnings on Windows 64-bit build

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 =