diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/indexer.c | 38 | ||||
-rw-r--r-- | src/mwindow.c | 18 | ||||
-rw-r--r-- | src/mwindow.h | 8 | ||||
-rw-r--r-- | src/pack-objects.h | 2 | ||||
-rw-r--r-- | src/pack.c | 54 | ||||
-rw-r--r-- | src/pack.h | 22 | ||||
-rw-r--r-- | src/unix/map.c | 2 | ||||
-rw-r--r-- | src/win32/posix.h | 2 | ||||
-rw-r--r-- | src/win32/posix_w32.c | 2 | ||||
-rw-r--r-- | src/win32/w32_util.h | 2 |
10 files changed, 75 insertions, 75 deletions
diff --git a/src/indexer.c b/src/indexer.c index 84b950d13..717549fa2 100644 --- a/src/indexer.c +++ b/src/indexer.c @@ -47,8 +47,8 @@ struct git_indexer { struct git_pack_header hdr; struct git_pack_file *pack; unsigned int mode; - git_off_t off; - git_off_t entry_start; + off64_t off; + off64_t entry_start; git_object_t entry_type; git_buf entry_data; git_packfile_stream stream; @@ -75,7 +75,7 @@ struct git_indexer { }; struct delta_info { - git_off_t delta_off; + off64_t delta_off; }; const git_oid *git_indexer_hash(const git_indexer *idx) @@ -220,7 +220,7 @@ static int store_delta(git_indexer *idx) return 0; } -static int hash_header(git_hash_ctx *ctx, git_off_t len, git_object_t type) +static int hash_header(git_hash_ctx *ctx, off64_t len, git_object_t type) { char buffer[64]; size_t hdrlen; @@ -265,7 +265,7 @@ static int advance_delta_offset(git_indexer *idx, git_object_t type) if (type == GIT_OBJECT_REF_DELTA) { idx->off += GIT_OID_RAWSZ; } else { - git_off_t base_off = get_delta_base(idx->pack, &w, &idx->off, type, idx->entry_start); + off64_t base_off = get_delta_base(idx->pack, &w, &idx->off, type, idx->entry_start); git_mwindow_close(&w); if (base_off < 0) return (int)base_off; @@ -291,7 +291,7 @@ static int read_object_stream(git_indexer *idx, git_packfile_stream *stream) return 0; } -static int crc_object(uint32_t *crc_out, git_mwindow_file *mwf, git_off_t start, git_off_t size) +static int crc_object(uint32_t *crc_out, git_mwindow_file *mwf, off64_t start, off64_t size) { void *ptr; uint32_t crc; @@ -414,9 +414,9 @@ static int store_object(git_indexer *idx) int i, error; git_oid oid; struct entry *entry; - git_off_t entry_size; + off64_t entry_size; struct git_pack_entry *pentry; - git_off_t entry_start = idx->entry_start; + off64_t entry_start = idx->entry_start; entry = git__calloc(1, sizeof(*entry)); GIT_ERROR_CHECK_ALLOC(entry); @@ -485,7 +485,7 @@ GIT_INLINE(bool) has_entry(git_indexer *idx, git_oid *id) return git_oidmap_exists(idx->pack->idx_cache, id); } -static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_entry *pentry, git_off_t entry_start) +static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_entry *pentry, off64_t entry_start) { int i; @@ -515,7 +515,7 @@ static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_ent return 0; } -static int hash_and_save(git_indexer *idx, git_rawobj *obj, git_off_t entry_start) +static int hash_and_save(git_indexer *idx, git_rawobj *obj, off64_t entry_start) { git_oid oid; size_t entry_size; @@ -596,12 +596,12 @@ static void hash_partially(git_indexer *idx, const uint8_t *data, size_t size) idx->inbuf_len += size - to_expell; } -static int write_at(git_indexer *idx, const void *data, git_off_t offset, size_t size) +static int write_at(git_indexer *idx, const void *data, off64_t offset, size_t size) { git_file fd = idx->pack->mwf.fd; size_t mmap_alignment; size_t page_offset; - git_off_t page_start; + off64_t page_start; unsigned char *map_data; git_map map; int error; @@ -627,11 +627,11 @@ static int write_at(git_indexer *idx, const void *data, git_off_t offset, size_t static int append_to_pack(git_indexer *idx, const void *data, size_t size) { - git_off_t new_size; + off64_t new_size; size_t mmap_alignment; size_t page_offset; - git_off_t page_start; - git_off_t current_size = idx->pack->mwf.size; + off64_t page_start; + off64_t current_size = idx->pack->mwf.size; int fd = idx->pack->mwf.fd; int error; @@ -661,7 +661,7 @@ static int append_to_pack(git_indexer *idx, const void *data, size_t size) static int read_stream_object(git_indexer *idx, git_indexer_progress *stats) { git_packfile_stream *stream = &idx->stream; - git_off_t entry_start = idx->off; + off64_t entry_start = idx->off; size_t entry_size; git_object_t type; git_mwindow *w = NULL; @@ -865,7 +865,7 @@ static int inject_object(git_indexer *idx, git_oid *id) git_oid foo = {{0}}; unsigned char hdr[64]; git_buf buf = GIT_BUF_INIT; - git_off_t entry_start; + off64_t entry_start; const void *data; size_t len, hdr_len; int error; @@ -939,7 +939,7 @@ static int fix_thin_pack(git_indexer *idx, git_indexer_progress *stats) size_t size; git_object_t type; git_mwindow *w = NULL; - git_off_t curpos = 0; + off64_t curpos = 0; unsigned char *base_info; unsigned int left = 0; git_oid base; @@ -1054,7 +1054,7 @@ static int update_header_and_rehash(git_indexer *idx, git_indexer_progress *stat { void *ptr; size_t chunk = 1024*1024; - git_off_t hashed = 0; + off64_t hashed = 0; git_mwindow *w = NULL; git_mwindow_file *mwf; unsigned int left; diff --git a/src/mwindow.c b/src/mwindow.c index e834f7621..262786a5f 100644 --- a/src/mwindow.c +++ b/src/mwindow.c @@ -167,11 +167,11 @@ void git_mwindow_free_all_locked(git_mwindow_file *mwf) /* * Check if a window 'win' contains the address 'offset' */ -int git_mwindow_contains(git_mwindow *win, git_off_t offset) +int git_mwindow_contains(git_mwindow *win, off64_t offset) { - git_off_t win_off = win->offset; + off64_t win_off = win->offset; return win_off <= offset - && offset <= (git_off_t)(win_off + win->window_map.len); + && offset <= (off64_t)(win_off + win->window_map.len); } /* @@ -246,12 +246,12 @@ static int git_mwindow_close_lru(git_mwindow_file *mwf) static git_mwindow *new_window( git_mwindow_file *mwf, git_file fd, - git_off_t size, - git_off_t offset) + off64_t size, + off64_t offset) { git_mwindow_ctl *ctl = &mem_ctl; size_t walign = git_mwindow__window_size / 2; - git_off_t len; + off64_t len; git_mwindow *w; w = git__malloc(sizeof(*w)); @@ -263,8 +263,8 @@ static git_mwindow *new_window( w->offset = (offset / walign) * walign; len = size - w->offset; - if (len > (git_off_t)git_mwindow__window_size) - len = (git_off_t)git_mwindow__window_size; + if (len > (off64_t)git_mwindow__window_size) + len = (off64_t)git_mwindow__window_size; ctl->mapped += (size_t)len; @@ -311,7 +311,7 @@ static git_mwindow *new_window( unsigned char *git_mwindow_open( git_mwindow_file *mwf, git_mwindow **cursor, - git_off_t offset, + off64_t offset, size_t extra, unsigned int *left) { diff --git a/src/mwindow.h b/src/mwindow.h index ea962d1b6..1a391b055 100644 --- a/src/mwindow.h +++ b/src/mwindow.h @@ -16,7 +16,7 @@ typedef struct git_mwindow { struct git_mwindow *next; git_map window_map; - git_off_t offset; + off64_t offset; size_t last_used; size_t inuse_cnt; } git_mwindow; @@ -24,7 +24,7 @@ typedef struct git_mwindow { typedef struct git_mwindow_file { git_mwindow *windows; int fd; - git_off_t size; + off64_t size; } git_mwindow_file; typedef struct git_mwindow_ctl { @@ -37,10 +37,10 @@ typedef struct git_mwindow_ctl { git_vector windowfiles; } git_mwindow_ctl; -int git_mwindow_contains(git_mwindow *win, git_off_t offset); +int git_mwindow_contains(git_mwindow *win, off64_t offset); void git_mwindow_free_all(git_mwindow_file *mwf); /* locks */ void git_mwindow_free_all_locked(git_mwindow_file *mwf); /* run under lock */ -unsigned char *git_mwindow_open(git_mwindow_file *mwf, git_mwindow **cursor, git_off_t offset, size_t extra, unsigned int *left); +unsigned char *git_mwindow_open(git_mwindow_file *mwf, git_mwindow **cursor, off64_t offset, size_t extra, unsigned int *left); int git_mwindow_file_register(git_mwindow_file *mwf); void git_mwindow_file_deregister(git_mwindow_file *mwf); void git_mwindow_close(git_mwindow **w_cursor); diff --git a/src/pack-objects.h b/src/pack-objects.h index 53684a1ba..04514daa6 100644 --- a/src/pack-objects.h +++ b/src/pack-objects.h @@ -30,7 +30,7 @@ typedef struct git_pobject { git_oid id; git_object_t type; - git_off_t offset; + off64_t offset; size_t size; diff --git a/src/pack.c b/src/pack.c index 68eeb7b0d..4c4eb9b8e 100644 --- a/src/pack.c +++ b/src/pack.c @@ -20,12 +20,12 @@ bool git_disable_pack_keep_file_checks = false; static int packfile_open(struct git_pack_file *p); -static git_off_t nth_packed_object_offset(const struct git_pack_file *p, uint32_t n); +static off64_t nth_packed_object_offset(const struct git_pack_file *p, uint32_t n); static int packfile_unpack_compressed( git_rawobj *obj, struct git_pack_file *p, git_mwindow **w_curs, - git_off_t *curpos, + off64_t *curpos, size_t size, git_object_t type); @@ -37,7 +37,7 @@ static int packfile_unpack_compressed( * GIT_OID_MINPREFIXLEN and GIT_OID_HEXSZ. */ static int pack_entry_find_offset( - git_off_t *offset_out, + off64_t *offset_out, git_oid *found_oid, struct git_pack_file *p, const git_oid *short_oid, @@ -109,7 +109,7 @@ static int cache_init(git_pack_cache *cache) return 0; } -static git_pack_cache_entry *cache_get(git_pack_cache *cache, git_off_t offset) +static git_pack_cache_entry *cache_get(git_pack_cache *cache, off64_t offset) { git_pack_cache_entry *entry; @@ -128,7 +128,7 @@ static git_pack_cache_entry *cache_get(git_pack_cache *cache, git_off_t offset) /* Run with the cache lock held */ static void free_lowest_entry(git_pack_cache *cache) { - git_off_t offset; + off64_t offset; git_pack_cache_entry *entry; git_offmap_foreach(cache->entries, offset, entry, { @@ -144,7 +144,7 @@ static int cache_add( git_pack_cache_entry **cached_out, git_pack_cache *cache, git_rawobj *base, - git_off_t offset) + off64_t offset) { git_pack_cache_entry *entry; int exists; @@ -345,7 +345,7 @@ static int pack_index_open(struct git_pack_file *p) static unsigned char *pack_window_open( struct git_pack_file *p, git_mwindow **w_cursor, - git_off_t offset, + off64_t offset, unsigned int *left) { if (p->mwf.fd == -1 && packfile_open(p) < 0) @@ -441,7 +441,7 @@ int git_packfile_unpack_header( git_object_t *type_p, git_mwindow_file *mwf, git_mwindow **w_curs, - git_off_t *curpos) + off64_t *curpos) { unsigned char *base; unsigned int left; @@ -474,13 +474,13 @@ int git_packfile_resolve_header( size_t *size_p, git_object_t *type_p, struct git_pack_file *p, - git_off_t offset) + off64_t offset) { git_mwindow *w_curs = NULL; - git_off_t curpos = offset; + off64_t curpos = offset; size_t size; git_object_t type; - git_off_t base_offset; + off64_t base_offset; int error; error = git_packfile_unpack_header(&size, &type, &p->mwf, &w_curs, &curpos); @@ -528,13 +528,13 @@ int git_packfile_resolve_header( * cache, we stop calculating there. */ static int pack_dependency_chain(git_dependency_chain *chain_out, - git_pack_cache_entry **cached_out, git_off_t *cached_off, + git_pack_cache_entry **cached_out, off64_t *cached_off, struct pack_chain_elem *small_stack, size_t *stack_sz, - struct git_pack_file *p, git_off_t obj_offset) + struct git_pack_file *p, off64_t obj_offset) { git_dependency_chain chain = GIT_ARRAY_INIT; git_mwindow *w_curs = NULL; - git_off_t curpos = obj_offset, base_offset; + off64_t curpos = obj_offset, base_offset; int error = 0, use_heap = 0; size_t size, elem_pos; git_object_t type; @@ -619,10 +619,10 @@ on_error: int git_packfile_unpack( git_rawobj *obj, struct git_pack_file *p, - git_off_t *obj_offset) + off64_t *obj_offset) { git_mwindow *w_curs = NULL; - git_off_t curpos = *obj_offset; + off64_t curpos = *obj_offset; int error, free_base = 0; git_dependency_chain chain = GIT_ARRAY_INIT; struct pack_chain_elem *elem = NULL, *stack; @@ -777,7 +777,7 @@ static void use_git_free(void *opaq, void *ptr) git__free(ptr); } -int git_packfile_stream_open(git_packfile_stream *obj, struct git_pack_file *p, git_off_t curpos) +int git_packfile_stream_open(git_packfile_stream *obj, struct git_pack_file *p, off64_t curpos) { int st; @@ -846,7 +846,7 @@ static int packfile_unpack_compressed( git_rawobj *obj, struct git_pack_file *p, git_mwindow **w_curs, - git_off_t *curpos, + off64_t *curpos, size_t size, git_object_t type) { @@ -909,16 +909,16 @@ static int packfile_unpack_compressed( * curpos is where the data starts, delta_obj_offset is the where the * header starts */ -git_off_t get_delta_base( +off64_t get_delta_base( struct git_pack_file *p, git_mwindow **w_curs, - git_off_t *curpos, + off64_t *curpos, git_object_t type, - git_off_t delta_obj_offset) + off64_t delta_obj_offset) { unsigned int left = 0; unsigned char *base_info; - git_off_t base_offset; + off64_t base_offset; git_oid unused; base_info = pack_window_open(p, w_curs, *curpos, &left); @@ -1045,7 +1045,7 @@ static int packfile_open(struct git_pack_file *p) if (!p->mwf.size) { if (!S_ISREG(st.st_mode)) goto cleanup; - p->mwf.size = (git_off_t)st.st_size; + p->mwf.size = (off64_t)st.st_size; } else if (p->mwf.size != st.st_size) goto cleanup; @@ -1182,7 +1182,7 @@ int git_packfile_alloc(struct git_pack_file **pack_out, const char *path) * ***********************************************************/ -static git_off_t nth_packed_object_offset(const struct git_pack_file *p, uint32_t n) +static off64_t nth_packed_object_offset(const struct git_pack_file *p, uint32_t n) { const unsigned char *index = p->index_map.data; const unsigned char *end = index + p->index_map.len; @@ -1270,7 +1270,7 @@ int git_pack_foreach_entry( } static int pack_entry_find_offset( - git_off_t *offset_out, + off64_t *offset_out, git_oid *found_oid, struct git_pack_file *p, const git_oid *short_oid, @@ -1280,7 +1280,7 @@ static int pack_entry_find_offset( const unsigned char *index; unsigned hi, lo, stride; int pos, found = 0; - git_off_t offset; + off64_t offset; const unsigned char *current = 0; *offset_out = 0; @@ -1375,7 +1375,7 @@ int git_pack_entry_find( const git_oid *short_oid, size_t len) { - git_off_t offset; + off64_t offset; git_oid found_oid; int error; diff --git a/src/pack.h b/src/pack.h index 483c4e8d7..a294ecd17 100644 --- a/src/pack.h +++ b/src/pack.h @@ -64,8 +64,8 @@ typedef struct git_pack_cache_entry { } git_pack_cache_entry; struct pack_chain_elem { - git_off_t base_key; - git_off_t offset; + off64_t base_key; + off64_t offset; size_t size; git_object_t type; }; @@ -108,13 +108,13 @@ struct git_pack_file { }; struct git_pack_entry { - git_off_t offset; + off64_t offset; git_oid sha1; struct git_pack_file *p; }; typedef struct git_packfile_stream { - git_off_t curpos; + off64_t curpos; int done; z_stream zstream; struct git_pack_file *p; @@ -130,23 +130,23 @@ int git_packfile_unpack_header( git_object_t *type_p, git_mwindow_file *mwf, git_mwindow **w_curs, - git_off_t *curpos); + off64_t *curpos); int git_packfile_resolve_header( size_t *size_p, git_object_t *type_p, struct git_pack_file *p, - git_off_t offset); + off64_t offset); -int git_packfile_unpack(git_rawobj *obj, struct git_pack_file *p, git_off_t *obj_offset); +int git_packfile_unpack(git_rawobj *obj, struct git_pack_file *p, off64_t *obj_offset); -int git_packfile_stream_open(git_packfile_stream *obj, struct git_pack_file *p, git_off_t curpos); +int git_packfile_stream_open(git_packfile_stream *obj, struct git_pack_file *p, off64_t curpos); ssize_t git_packfile_stream_read(git_packfile_stream *obj, void *buffer, size_t len); void git_packfile_stream_dispose(git_packfile_stream *obj); -git_off_t get_delta_base(struct git_pack_file *p, git_mwindow **w_curs, - git_off_t *curpos, git_object_t type, - git_off_t delta_obj_offset); +off64_t get_delta_base(struct git_pack_file *p, git_mwindow **w_curs, + off64_t *curpos, git_object_t type, + off64_t delta_obj_offset); void git_packfile_close(struct git_pack_file *p, bool unlink_packfile); void git_packfile_free(struct git_pack_file *p); diff --git a/src/unix/map.c b/src/unix/map.c index 1ebbced5c..7f9076e19 100644 --- a/src/unix/map.c +++ b/src/unix/map.c @@ -32,7 +32,7 @@ int git__mmap_alignment(size_t *alignment) return git__page_size(alignment); } -int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, git_off_t offset) +int p_mmap(git_map *out, size_t len, int prot, int flags, int fd, off64_t offset) { int mprot = PROT_READ; int mflag = 0; diff --git a/src/win32/posix.h b/src/win32/posix.h index e427d64c3..f115088b4 100644 --- a/src/win32/posix.h +++ b/src/win32/posix.h @@ -47,7 +47,7 @@ extern int p_chdir(const char* path); extern int p_chmod(const char* path, mode_t mode); extern int p_rmdir(const char* path); extern int p_access(const char* path, mode_t mode); -extern int p_ftruncate(int fd, git_off_t size); +extern int p_ftruncate(int fd, off64_t size); /* p_lstat is almost but not quite POSIX correct. Specifically, the use of * ENOTDIR is wrong, in that it does not mean precisely that a non-directory diff --git a/src/win32/posix_w32.c b/src/win32/posix_w32.c index 078b50952..2bc93a3c7 100644 --- a/src/win32/posix_w32.c +++ b/src/win32/posix_w32.c @@ -210,7 +210,7 @@ on_error: * We now take a "git_off_t" rather than "long" because * files may be longer than 2Gb. */ -int p_ftruncate(int fd, git_off_t size) +int p_ftruncate(int fd, off64_t size) { if (size < 0) { errno = EINVAL; diff --git a/src/win32/w32_util.h b/src/win32/w32_util.h index ac191157c..d7f9d3da6 100644 --- a/src/win32/w32_util.h +++ b/src/win32/w32_util.h @@ -120,7 +120,7 @@ GIT_INLINE(void) git_win32__stat_init( st->st_uid = 0; st->st_nlink = 1; st->st_mode = mode; - st->st_size = ((git_off_t)nFileSizeHigh << 32) + nFileSizeLow; + st->st_size = ((int64_t)nFileSizeHigh << 32) + nFileSizeLow; st->st_dev = _getdrive() - 1; st->st_rdev = st->st_dev; git_win32__filetime_to_timespec(&ftLastAccessTime, &(st->st_atim)); |