8000 internal: use off64_t instead of git_off_t · libgit2/libgit2@a2aac53 · GitHub
[go: up one dir, main page]

Skip to content

Commit a2aac53

Browse files
committed
internal: use off64_t instead of git_off_t
Remove git_off_t from our internal usage so that we can deprecate it. Use the off64_t type instead.
1 parent f357102 commit a2aac53

File tree

13 files changed

+78
-78
lines changed

13 files changed

+78
-78
lines changed

src/indexer.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ struct git_indexer {
4747
struct git_pack_header hdr;
4848
struct git_pack_file *pack;
4949
unsigned int mode;
50-
git_off_t off;
51-
git_off_t entry_start;
50+
off64_t off;
51+
off64_t entry_start;
5252
git_object_t entry_type;
5353
git_buf entry_data;
5454
git_packfile_stream stream;
@@ -75,7 +75,7 @@ struct git_indexer {
7575
};
7676

7777
struct delta_info {
78-
git_off_t delta_off;
78+
off64_t delta_off;
7979
};
8080

8181
const git_oid *git_indexer_hash(const git_indexer *idx)
@@ -220,7 +220,7 @@ static int store_delta(git_indexer *idx)
220220
return 0;
221221
}
222222

223-
static int hash_header(git_hash_ctx *ctx, git_off_t len, git_object_t type)
223+
static int hash_header(git_hash_ctx *ctx, off64_t len, git_object_t type)
224224
{
225225
char buffer[64];
226226
size_t hdrlen D7AE ;
@@ -265,7 +265,7 @@ static int advance_delta_offset(git_indexer *idx, git_object_t type)
265265
if (type == GIT_OBJECT_REF_DELTA) {
266266
idx->off += GIT_OID_RAWSZ;
267267
} else {
268-
git_off_t base_off = get_delta_base(idx->pack, &w, &idx->off, type, idx->entry_start);
268+
off64_t base_off = get_delta_base(idx->pack, &w, &idx->off, type, idx->entry_start);
269269
git_mwindow_close(&w);
270270
if (base_off < 0)
271271
return (int)base_off;
@@ -291,7 +291,7 @@ static int read_object_stream(git_indexer *idx, git_packfile_stream *stream)
291291
return 0;
292292
}
293293

294-
static int crc_object(uint32_t *crc_out, git_mwindow_file *mwf, git_off_t start, git_off_t size)
294+
static int crc_object(uint32_t *crc_out, git_mwindow_file *mwf, off64_t start, off64_t size)
295295
{
296296
void *ptr;
297297
uint32_t crc;
@@ -413,9 +413,9 @@ static int store_object(git_indexer *idx)
413413
int i, error;
414414
git_oid oid;
415415
struct entry *entry;
416-
git_off_t entry_size;
416+
off64_t entry_size;
417417
struct git_pack_entry *pentry;
418-
git_off_t entry_start = idx->entry_start;
418+
off64_t entry_start = idx->entry_start;
419419

420420
entry = git__calloc(1, sizeof(*entry));
421421
GIT_ERROR_CHECK_ALLOC(entry);
@@ -484,7 +484,7 @@ GIT_INLINE(bool) has_entry(git_indexer *idx, git_oid *id)
484484
return git_oidmap_exists(idx->pack->idx_cache, id);
485485
}
486486

487-
static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_entry *pentry, git_off_t entry_start)
487+
static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_entry *pentry, off64_t entry_start)
488488
{
489489
int i;
490490

@@ -514,7 +514,7 @@ static int save_entry(git_indexer *idx, struct entry *entry, struct git_pack_ent
514514
return 0;
515515
}
516516

517-
static int hash_and_save(git_indexer *idx, git_rawobj *obj, git_off_t entry_start)
517+
static int hash_and_save(git_indexer *idx, git_rawobj *obj, off64_t entry_start)
518518
{
519519
git_oid oid;
520520
size_t entry_size;
@@ -595,12 +595,12 @@ static void hash_partially(git_indexer *idx, const uint8_t *data, size_t size)
595595
idx->inbuf_len += size - to_expell;
596596
}
597597

598-
static int write_at(git_indexer *idx, const void *data, git_off_t offset, size_t size)
598+
static int write_at(git_indexer *idx, const void *data, off64_t offset, size_t size)
599599
{
600600
git_file fd = idx->pack->mwf.fd;
601601
size_t mmap_alignment;
602602
size_t page_offset;
603-
git_off_t page_start;
603+
off64_t page_start;
604604
unsigned char *map_data;
605605
git_map map;
606606
int error;
@@ -626,11 +626,11 @@ static int write_at(git_indexer *idx, const void *data, git_off_t offset, size_t
626626

627627
static int append_to_pack(git_indexer *idx, const void *data, size_t size)
628628
{
629-
git_off_t new_size;
629+
off64_t new_size;
630630
size_t mmap_alignment;
631631
size_t page_offset;
632-
git_off_t page_start;
633-
git_off_t current_size = idx->pack->mwf.size;
632+
off64_t page_start;
633+
off64_t current_size = idx->pack->mwf.size;
634634
int fd = idx->pack->mwf.fd;
635635
int error;
636636

@@ -660,7 +660,7 @@ static int append_to_pack(git_indexer *idx, const void *data, size_t size)
660660
static int read_stream_object(git_indexer *idx, git_indexer_progress *stats)
661661
{
662662
git_packfile_stream *stream = &idx->stream;
663-
git_off_t entry_start = idx->off;
663+
off64_t entry_start = idx->off;
664664
size_t entry_size;
665665
git_object_t type;
666666
git_mwindow *w = NULL;
@@ -864,7 +864,7 @@ static int inject_object(git_indexer *idx, git_oid *id)
864864
git_oid foo = {{0}};
865865
unsigned char hdr[64];
866866
git_buf buf = GIT_BUF_INIT;
867-
git_off_t entry_start;
867+
off64_t entry_start;
868868
const void *data;
869869
size_t len, hdr_len;
870870
int error;
@@ -938,7 +938,7 @@ static int fix_thin_pack(git_indexer *idx, git_indexer_progress *stats)
938938
size_t size;
939939
git_object_t type;
940940
git_mwindow *w = NULL;
941-
git_off_t curpos = 0;
941+
off64_t curpos = 0;
942942
unsigned char *base_info;
943943
unsigned int left = 0;
944944
git_oid base;
@@ -1053,7 +1053,7 @@ static int update_header_and_rehash(git_indexer *idx, git_indexer_progress *stat
10531053
{
10541054
void *ptr;
10551055
size_t chunk = 1024*1024;
1056-
git_off_t hashed = 0;
1056+
off64_t hashed = 0;
10571057
git_mwindow *w = NULL;
10581058
git_mwindow_file *mwf;
10591059
unsigned int left;

src/mwindow.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ void git_mwindow_free_all_locked(git_mwindow_file *mwf)
167167
/*
168168
* Check if a window 'win' contains the address 'offset'
169169
*/
170-
int git_mwindow_contains(git_mwindow *win, git_off_t offset)
170+
int git_mwindow_contains(git_mwindow *win, off64_t offset)
171171
{
172-
git_off_t win_off = win->offset;
172+
off64_t win_off = win->offset;
173173
return win_off <= offset
174-
&& offset <= (git_off_t)(win_off + win->window_map.len);
174+
&& offset <= (off64_t)(win_off + win->window_map.len);
175175
}
176176

177177
/*
@@ -246,12 +246,12 @@ static int git_mwindow_close_lru(git_mwindow_file *mwf)
246246
static git_mwindow *new_window(
247247
git_mwindow_file *mwf,
248248
git_file fd,
249-
git_off_t size,
250-
git_off_t offset)
249+
off64_t size,
250+
off64_t offset)
251251
{
252252
git_mwindow_ctl *ctl = &mem_ctl;
253253
size_t walign = git_mwindow__window_size / 2;
254-
git_off_t len;
254+
off64_t len;
255255
git_mwindow *w;
256256

257257
w = git__malloc(sizeof(*w));
@@ -263,8 +263,8 @@ static git_mwindow *new_window(
263263
w->offset = (offset / walign) * walign;
264264

265265
len = size - w->offset;
266-
if (len > (git_off_t)git_mwindow__window_size)
267-
len = (git_off_t)git_mwindow__window_size;
266+
if (len > (off64_t)git_mwindow__window_size)
267+
len = (off64_t)git_mwindow__window_size;
268268

269269
ctl->mapped += (size_t)len;
270270

@@ -311,7 +311,7 @@ static git_mwindow *new_window(
311311
unsigned char *git_mwindow_open(
312312
git_mwindow_file *mwf,
313313
git_mwindow **cursor,
314-
git_off_t offset,
314+
off64_t offset,
315315
size_t extra,
316316
unsigned int *left)
317317
{

src/mwindow.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
typedef struct git_mwindow {
1717
struct git_mwindow *next;
1818
git_map window_map;
19-
git_off_t offset;
19+
off64_t offset;
2020
size_t last_used;
2121
size_t inuse_cnt;
2222
} git_mwindow;
2323

2424
typedef struct git_mwindow_file {
2525
git_mwindow *windows;
2626
int fd;
27-
git_off_t size;
27+
off64_t size;
2828
} git_mwindow_file;
2929

3030
typedef struct git_mwindow_ctl {
@@ -37,10 +37,10 @@ typedef struct git_mwindow_ctl {
3737
git_vector windowfiles;
3838
} git_mwindow_ctl;
3939

40-
int git_mwindow_contains(git_mwindow *win, git_off_t offset);
40+
int git_mwindow_contains(git_mwindow *win, off64_t offset);
4141
void git_mwindow_free_all(git_mwindow_file *mwf); /* locks */
4242
void git_mwindow_free_all_locked(git_mwindow_file *mwf); /* run under lock */
43-
unsigned char *git_mwindow_open(git_mwindow_file *mwf, git_mwindow **cursor, git_off_t offset, size_t extra, unsigned int *left);
43+
unsigned char *git_mwindow_open(git_mwindow_file *mwf, git_mwindow **cursor, off64_t offset, size_t extra, unsigned int *left);
4444
int git_mwindow_file_register(git_mwindow_file *mwf);
4545
void git_mwindow_file_deregister(git_mwindow_file *mwf);
4646
void git_mwindow_close(git_mwindow **w_cursor);

src/pack-objects.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
typedef struct git_pobject {
3131
git_oid id;
3232
git_object_t type;
33-
git_off_t offset;
33+
off64_t offset;
3434

3535
size_t size;
3636

0 commit comments

Comments
 (0)
0