Commit fefefd1d39420095631987e503402f8ee6956163

Edward Thomson 2019-06-23T16:42:14

odb: use `git_object_size_t` for object size Instead of using a signed type (`off_t`) use a new `git_object_size_t` for the sizes of objects.

diff --git a/include/git2/sys/odb_backend.h b/include/git2/sys/odb_backend.h
index 6614dcf..4dba460 100644
--- a/include/git2/sys/odb_backend.h
+++ b/include/git2/sys/odb_backend.h
@@ -53,7 +53,7 @@ struct git_odb_backend {
 		git_odb_backend *, const git_oid *, const void *, size_t, git_object_t);
 
 	int GIT_CALLBACK(writestream)(
-		git_odb_stream **, git_odb_backend *, git_off_t, git_object_t);
+		git_odb_stream **, git_odb_backend *, git_object_size_t, git_object_t);
 
 	int GIT_CALLBACK(readstream)(
 		git_odb_stream **, size_t *, git_object_t *,
diff --git a/src/odb_loose.c b/src/odb_loose.c
index 04b8165..4a54b3f 100644
--- a/src/odb_loose.c
+++ b/src/odb_loose.c
@@ -824,7 +824,7 @@ static int filebuf_flags(loose_backend *backend)
 	return flags;
 }
 
-static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backend *_backend, git_off_t length, git_object_t type)
+static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backend *_backend, git_object_size_t length, git_object_t type)
 {
 	loose_backend *backend;
 	loose_writestream *stream = NULL;
@@ -833,7 +833,7 @@ static int loose_backend__writestream(git_odb_stream **stream_out, git_odb_backe
 	size_t hdrlen;
 	int error;
 
-	assert(_backend && length >= 0);
+	assert(_backend);
 
 	backend = (loose_backend *)_backend;
 	*stream_out = NULL;
diff --git a/src/patch_parse.c b/src/patch_parse.c
index e4031f1..35fd65a 100644
--- a/src/patch_parse.c
+++ b/src/patch_parse.c
@@ -491,7 +491,7 @@ done:
 
 static int parse_int(int *out, git_patch_parse_ctx *ctx)
 {
-	git_off_t num;
+	int64_t num;
 
 	if (git_parse_advance_digit(&num, &ctx->parse_ctx, 10) < 0 || !git__is_int(num))
 		return -1;
@@ -765,7 +765,7 @@ static int parse_patch_binary_side(
 {
 	git_diff_binary_t type = GIT_DIFF_BINARY_NONE;
 	git_buf base85 = GIT_BUF_INIT, decoded = GIT_BUF_INIT;
-	git_off_t len;
+	int64_t len;
 	int error = 0;
 
 	if (git_parse_ctx_contains_s(&ctx->parse_ctx, "literal ")) {