Fix warnings about type conversion on win32
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
diff --git a/src/blob.c b/src/blob.c
index f65fa73..4065ffa 100644
--- a/src/blob.c
+++ b/src/blob.c
@@ -102,13 +102,13 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat
char *link_data;
ssize_t read_len;
- link_data = git__malloc(size);
+ link_data = git__malloc((size_t)size);
if (!link_data) {
error = GIT_ENOMEM;
goto cleanup;
}
- read_len = p_readlink(full_path.ptr, link_data, size);
+ read_len = p_readlink(full_path.ptr, link_data, (size_t)size);
if (read_len != (ssize_t)size) {
error = git__throw(GIT_EOSERR, "Failed to create blob. Can't read symlink");
@@ -116,7 +116,7 @@ int git_blob_create_fromfile(git_oid *oid, git_repository *repo, const char *pat
goto cleanup;
}
- stream->write(stream, link_data, size);
+ stream->write(stream, link_data, (size_t)size);
free(link_data);
} else {
diff --git a/src/odb.c b/src/odb.c
index 77287aa..4eaf289 100644
--- a/src/odb.c
+++ b/src/odb.c
@@ -164,11 +164,11 @@ int git_odb__hashlink(git_oid *out, const char *path)
char *link_data;
ssize_t read_len;
- link_data = git__malloc(size);
+ link_data = git__malloc((size_t)size);
if (link_data == NULL)
return GIT_ENOMEM;
- read_len = p_readlink(path, link_data, size + 1);
+ read_len = p_readlink(path, link_data, (size_t)(size + 1));
if (read_len != (ssize_t)size)
return git__throw(GIT_EOSERR, "Failed to read symlink data");