Commit 1ec1de6d43e2f4dcf18ad730efbbfc20d0e4adb0

Russell Belfer 2012-02-23T11:15:45

Fix warnings about type conversion on win32

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");