Commit 090d5e1f by nulltoken

Fix MSVC compilation warnings

parent 4a0ac175
......@@ -273,7 +273,7 @@ static int crc_object(uint32_t *crc_out, git_mwindow_file *mwf, git_off_t start,
if (ptr == NULL)
return -1;
len = min(left, (size_t)size);
len = min(left, (unsigned int)size);
crc = crc32(crc, ptr, len);
size -= len;
start += len;
......
......@@ -621,7 +621,7 @@ ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t
return GIT_EBUFS;
obj->zstream.next_out = buffer;
obj->zstream.avail_out = len;
obj->zstream.avail_out = (unsigned int)len;
obj->zstream.next_in = in;
st = inflate(&obj->zstream, Z_SYNC_FLUSH);
......
......@@ -298,7 +298,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
return -1;
if (!WinHttpWriteData(request,
git_buf_cstr(&buf), git_buf_len(&buf),
git_buf_cstr(&buf), (DWORD)git_buf_len(&buf),
&bytes_written)) {
git_buf_free(&buf);
giterr_set(GITERR_OS, "Failed to write chunk header");
......@@ -309,7 +309,7 @@ static int write_chunk(HINTERNET request, const char *buffer, size_t len)
/* Chunk body */
if (!WinHttpWriteData(request,
buffer, len,
buffer, (DWORD)len,
&bytes_written)) {
giterr_set(GITERR_OS, "Failed to write chunk");
return -1;
......@@ -494,7 +494,7 @@ replay:
if (!WinHttpReadData(s->request,
(LPVOID)buffer,
buf_size,
(DWORD)buf_size,
&dw_bytes_read))
{
giterr_set(GITERR_OS, "Failed to read data");
......@@ -580,7 +580,7 @@ static int put_uuid_string(LPWSTR buffer, DWORD buffer_len_cch)
static int get_temp_file(LPWSTR buffer, DWORD buffer_len_cch)
{
int len;
size_t len;
if (!GetTempPathW(buffer_len_cch, buffer)) {
giterr_set(GITERR_OS, "Failed to get temp path");
......@@ -639,7 +639,7 @@ static int winhttp_stream_write_buffered(
}
}
if (!WriteFile(s->post_body, buffer, len, &bytes_written, NULL)) {
if (!WriteFile(s->post_body, buffer, (DWORD)len, &bytes_written, NULL)) {
giterr_set(GITERR_OS, "Failed to write to temporary file");
return -1;
}
......@@ -697,7 +697,7 @@ static int winhttp_stream_write_chunked(
}
else {
/* Append as much to the buffer as we can */
int count = min(CACHED_POST_BODY_BUF_SIZE - s->chunk_buffer_len, len);
int count = min(CACHED_POST_BODY_BUF_SIZE - s->chunk_buffer_len, (int)len);
if (!s->chunk_buffer)
s->chunk_buffer = git__malloc(CACHED_POST_BODY_BUF_SIZE);
......@@ -717,7 +717,7 @@ static int winhttp_stream_write_chunked(
/* Is there any remaining data from the source? */
if (len > 0) {
memcpy(s->chunk_buffer, buffer, len);
s->chunk_buffer_len = len;
s->chunk_buffer_len = (unsigned int)len;
}
}
}
......
......@@ -143,7 +143,7 @@ void test_clone_nonetwork__custom_autotag(void)
cl_git_pass(git_clone(&g_repo, cl_git_fixture_url("testrepo.git"), "./foo", &g_options));
cl_git_pass(git_tag_list(&tags, g_repo));
cl_assert_equal_i(0, tags.count);
cl_assert_equal_sz(0, tags.count);
git_strarray_free(&tags);
}
......
......@@ -33,12 +33,12 @@ void test_revwalk_mergebase__single1(void)
cl_assert(git_oid_cmp(&result, &expected) == 0);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
cl_assert_equal_i(ahead, 2);
cl_assert_equal_i(behind, 1);
cl_assert_equal_sz(ahead, 2);
cl_assert_equal_sz(behind, 1);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &two, &one));
cl_assert_equal_i(ahead, 1);
cl_assert_equal_i(behind, 2);
cl_assert_equal_sz(ahead, 1);
cl_assert_equal_sz(behind, 2);
}
void test_revwalk_mergebase__single2(void)
......@@ -54,12 +54,12 @@ void test_revwalk_mergebase__single2(void)
cl_assert(git_oid_cmp(&result, &expected) == 0);
cl_git_pass(git_graph_ahead_behind( &ahead, &behind, _repo, &one, &two));
cl_assert_equal_i(ahead, 4);
cl_assert_equal_i(behind, 1);
cl_assert_equal_sz(ahead, 4);
cl_assert_equal_sz(behind, 1);
cl_git_pass(git_graph_ahead_behind( &ahead, &behind, _repo, &two, &one));
cl_assert_equal_i(ahead, 1);
cl_assert_equal_i(behind, 4);
cl_assert_equal_sz(ahead, 1);
cl_assert_equal_sz(behind, 4);
}
void test_revwalk_mergebase__merged_branch(void)
......@@ -78,12 +78,12 @@ void test_revwalk_mergebase__merged_branch(void)
cl_assert(git_oid_cmp(&result, &expected) == 0);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
cl_assert_equal_i(ahead, 0);
cl_assert_equal_i(behind, 3);
cl_assert_equal_sz(ahead, 0);
cl_assert_equal_sz(behind, 3);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &two, &one));
cl_assert_equal_i(ahead, 3);
cl_assert_equal_i(behind, 0);
cl_assert_equal_sz(ahead, 3);
cl_assert_equal_sz(behind, 0);
}
void test_revwalk_mergebase__two_way_merge(void)
......@@ -95,13 +95,13 @@ void test_revwalk_mergebase__two_way_merge(void)
cl_git_pass(git_oid_fromstr(&two, "a953a018c5b10b20c86e69fef55ebc8ad4c5a417"));
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo2, &one, &two));
cl_assert_equal_i(ahead, 2);
cl_assert_equal_i(behind, 8);
cl_assert_equal_sz(ahead, 2);
cl_assert_equal_sz(behind, 8);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo2, &two, &one));
cl_assert_equal_i(ahead, 8);
cl_assert_equal_i(behind, 2);
cl_assert_equal_sz(ahead, 8);
cl_assert_equal_sz(behind, 2);
}
void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
......@@ -119,8 +119,8 @@ void test_revwalk_mergebase__no_common_ancestor_returns_ENOTFOUND(void)
cl_assert_equal_i(GIT_ENOTFOUND, error);
cl_git_pass(git_graph_ahead_behind(&ahead, &behind, _repo, &one, &two));
cl_assert_equal_i(2, ahead);
cl_assert_equal_i(4, behind);
cl_assert_equal_sz(2, ahead);
cl_assert_equal_sz(4, behind);
}
void test_revwalk_mergebase__no_off_by_one_missing(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment