diff options
| author | Edward Thomson <ethomson@edwardthomson.com> | 2019-06-23 15:16:47 +0100 |
|---|---|---|
| committer | Edward Thomson <ethomson@edwardthomson.com> | 2019-11-22 15:09:17 +1100 |
| commit | bed9fc6b59eafc9ad197a7ff7215ed6be97663ae (patch) | |
| tree | 8f0ab10bc03df5ef108faf7751a2589663e9b876 | |
| parent | 9b04d0be29caca53a48c683660d1c1ca77de7b02 (diff) | |
| download | libgit2-bed9fc6b59eafc9ad197a7ff7215ed6be97663ae.tar.gz | |
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.
| -rw-r--r-- | include/git2/odb.h | 2 | ||||
| -rw-r--r-- | include/git2/odb_backend.h | 4 | ||||
| -rw-r--r-- | src/odb.c | 10 | ||||
| -rw-r--r-- | src/odb.h | 2 |
4 files changed, 9 insertions, 9 deletions
diff --git a/include/git2/odb.h b/include/git2/odb.h index e8824b727..c4bfa5290 100644 --- a/include/git2/odb.h +++ b/include/git2/odb.h @@ -294,7 +294,7 @@ GIT_EXTERN(int) git_odb_write(git_oid *out, git_odb *odb, const void *data, size * @param type type of the object that will be written * @return 0 if the stream was created; error code otherwise */ -GIT_EXTERN(int) git_odb_open_wstream(git_odb_stream **out, git_odb *db, git_off_t size, git_object_t type); +GIT_EXTERN(int) git_odb_open_wstream(git_odb_stream **out, git_odb *db, git_object_size_t size, git_object_t type); /** * Write to an odb stream diff --git a/include/git2/odb_backend.h b/include/git2/odb_backend.h index 47e0dd4b2..c593bac26 100644 --- a/include/git2/odb_backend.h +++ b/include/git2/odb_backend.h @@ -87,8 +87,8 @@ struct git_odb_stream { unsigned int mode; void *hash_ctx; - git_off_t declared_size; - git_off_t received_bytes; + git_object_size_t declared_size; + git_object_size_t received_bytes; /** * Write at most `len` bytes into `buffer` and advance the stream. @@ -89,7 +89,7 @@ int git_odb__format_object_header( size_t *written, char *hdr, size_t hdr_size, - git_off_t obj_len, + git_object_size_t obj_len, git_object_t obj_type) { const char *type_str = git_object_type2string(obj_type); @@ -320,7 +320,7 @@ int git_odb__hashlink(git_oid *out, const char *path) int git_odb_hashfile(git_oid *out, const char *path, git_object_t type) { - git_off_t size; + git_object_size_t size; int result, fd = git_futils_open_ro(path); if (fd < 0) return fd; @@ -385,7 +385,7 @@ static void fake_wstream__free(git_odb_stream *_stream) git__free(stream); } -static int init_fake_wstream(git_odb_stream **stream_p, git_odb_backend *backend, git_off_t size, git_object_t type) +static int init_fake_wstream(git_odb_stream **stream_p, git_odb_backend *backend, git_object_size_t size, git_object_t type) { fake_wstream *stream; size_t blobsize; @@ -1319,7 +1319,7 @@ int git_odb_write( return error; } -static int hash_header(git_hash_ctx *ctx, git_off_t size, git_object_t type) +static int hash_header(git_hash_ctx *ctx, git_object_size_t size, git_object_t type) { char header[64]; size_t hdrlen; @@ -1333,7 +1333,7 @@ static int hash_header(git_hash_ctx *ctx, git_off_t size, git_object_t type) } int git_odb_open_wstream( - git_odb_stream **stream, git_odb *db, git_off_t size, git_object_t type) + git_odb_stream **stream, git_odb *db, git_object_size_t size, git_object_t type) { size_t i, writes = 0; int error = GIT_ERROR; @@ -70,7 +70,7 @@ int git_odb__hashobj(git_oid *id, git_rawobj *obj); /* * Format the object header such as it would appear in the on-disk object */ -int git_odb__format_object_header(size_t *out_len, char *hdr, size_t hdr_size, git_off_t obj_len, git_object_t obj_type); +int git_odb__format_object_header(size_t *out_len, char *hdr, size_t hdr_size, git_object_size_t obj_len, git_object_t obj_type); /* * Hash an open file descriptor. |
