Commit bed9fc6b by Edward Thomson

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.
parent 9b04d0be
...@@ -294,7 +294,7 @@ GIT_EXTERN(int) git_odb_write(git_oid *out, git_odb *odb, const void *data, size ...@@ -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 * @param type type of the object that will be written
* @return 0 if the stream was created; error code otherwise * @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 * Write to an odb stream
......
...@@ -87,8 +87,8 @@ struct git_odb_stream { ...@@ -87,8 +87,8 @@ struct git_odb_stream {
unsigned int mode; unsigned int mode;
void *hash_ctx; void *hash_ctx;
git_off_t declared_size; git_object_size_t declared_size;
git_off_t received_bytes; git_object_size_t received_bytes;
/** /**
* Write at most `len` bytes into `buffer` and advance the stream. * Write at most `len` bytes into `buffer` and advance the stream.
......
...@@ -89,7 +89,7 @@ int git_odb__format_object_header( ...@@ -89,7 +89,7 @@ int git_odb__format_object_header(
size_t *written, size_t *written,
char *hdr, char *hdr,
size_t hdr_size, size_t hdr_size,
git_off_t obj_len, git_object_size_t obj_len,
git_object_t obj_type) git_object_t obj_type)
{ {
const char *type_str = git_object_type2string(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) ...@@ -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) 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); int result, fd = git_futils_open_ro(path);
if (fd < 0) if (fd < 0)
return fd; return fd;
...@@ -385,7 +385,7 @@ static void fake_wstream__free(git_odb_stream *_stream) ...@@ -385,7 +385,7 @@ static void fake_wstream__free(git_odb_stream *_stream)
git__free(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; fake_wstream *stream;
size_t blobsize; size_t blobsize;
...@@ -1319,7 +1319,7 @@ int git_odb_write( ...@@ -1319,7 +1319,7 @@ int git_odb_write(
return error; 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]; char header[64];
size_t hdrlen; size_t hdrlen;
...@@ -1333,7 +1333,7 @@ static int hash_header(git_hash_ctx *ctx, git_off_t size, git_object_t type) ...@@ -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( 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; size_t i, writes = 0;
int error = GIT_ERROR; int error = GIT_ERROR;
......
...@@ -70,7 +70,7 @@ int git_odb__hashobj(git_oid *id, git_rawobj *obj); ...@@ -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 * 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. * Hash an open file descriptor.
......
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