mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-27 00:58:30 -05:00
Merge branch 'topic/size-t' into size-t-followups
This commit is contained in:
4
.github/workflows/main.yml
vendored
4
.github/workflows/main.yml
vendored
@@ -420,7 +420,9 @@ jobs:
|
||||
CI_JOB_IMAGE: ${{matrix.vector.image}}
|
||||
CUSTOM_PATH: /custom
|
||||
runs-on: ubuntu-latest
|
||||
container: ${{matrix.vector.image}}
|
||||
container:
|
||||
image: ${{ matrix.vector.image }}
|
||||
options: ${{ github.repository_visibility == 'private' && '--pids-limit 16384 --ulimit nproc=16384:16384 --ulimit nofile=32768:32768' || '' }}
|
||||
steps:
|
||||
- name: prepare libc6 for actions
|
||||
if: matrix.vector.jobname == 'linux32'
|
||||
|
||||
@@ -206,7 +206,7 @@ static void *zlib_deflate_raw(void *data, unsigned long size,
|
||||
unsigned long *compressed_size)
|
||||
{
|
||||
git_zstream stream;
|
||||
unsigned long maxsize;
|
||||
size_t maxsize;
|
||||
void *buffer;
|
||||
int result;
|
||||
|
||||
|
||||
2
attr.c
2
attr.c
@@ -793,7 +793,7 @@ static struct attr_stack *read_attr_from_index(struct index_state *istate,
|
||||
{
|
||||
struct attr_stack *stack = NULL;
|
||||
char *buf;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
int sparse_dir_pos = -1;
|
||||
|
||||
if (!istate)
|
||||
|
||||
23
blame.c
23
blame.c
@@ -238,7 +238,7 @@ static struct commit *fake_working_tree_commit(struct repository *r,
|
||||
struct stat st;
|
||||
const char *read_from;
|
||||
char *buf_ptr;
|
||||
unsigned long buf_len;
|
||||
size_t buf_len;
|
||||
|
||||
if (contents_from) {
|
||||
if (stat(contents_from, &st) < 0)
|
||||
@@ -335,7 +335,7 @@ static const char *get_next_line(const char *start, const char *end)
|
||||
}
|
||||
|
||||
static int find_line_starts(int **line_starts, const char *buf,
|
||||
unsigned long len)
|
||||
size_t len)
|
||||
{
|
||||
const char *end = buf + len;
|
||||
const char *p;
|
||||
@@ -1034,20 +1034,17 @@ static void fill_origin_blob(struct diff_options *opt,
|
||||
{
|
||||
if (!o->file.ptr) {
|
||||
enum object_type type;
|
||||
unsigned long file_size;
|
||||
size_t file_size;
|
||||
|
||||
(*num_read_blob)++;
|
||||
if (opt->flags.allow_textconv &&
|
||||
textconv_object(opt->repo, o->path, o->mode,
|
||||
&o->blob_oid, 1, &file->ptr, &file_size))
|
||||
;
|
||||
else {
|
||||
size_t file_size_st = 0;
|
||||
else
|
||||
file->ptr = odb_read_object(the_repository->objects,
|
||||
&o->blob_oid, &type,
|
||||
&file_size_st);
|
||||
file_size = cast_size_t_to_ulong(file_size_st);
|
||||
}
|
||||
&file_size);
|
||||
file->size = file_size;
|
||||
|
||||
if (!file->ptr)
|
||||
@@ -2864,22 +2861,20 @@ void setup_scoreboard(struct blame_scoreboard *sb,
|
||||
sb->final_buf_size = o->file.size;
|
||||
}
|
||||
else {
|
||||
size_t final_buf_size_st = 0;
|
||||
o = get_origin(sb->final, sb->path);
|
||||
if (fill_blob_sha1_and_mode(sb->repo, o))
|
||||
die(_("no such path %s in %s"), sb->path, final_commit_name);
|
||||
|
||||
if (sb->revs->diffopt.flags.allow_textconv &&
|
||||
textconv_object(sb->repo, sb->path, o->mode, &o->blob_oid, 1, (char **) &sb->final_buf,
|
||||
&sb->final_buf_size))
|
||||
&final_buf_size_st))
|
||||
;
|
||||
else {
|
||||
size_t final_buf_size_st = 0;
|
||||
else
|
||||
sb->final_buf = odb_read_object(the_repository->objects,
|
||||
&o->blob_oid, &type,
|
||||
&final_buf_size_st);
|
||||
sb->final_buf_size =
|
||||
cast_size_t_to_ulong(final_buf_size_st);
|
||||
}
|
||||
sb->final_buf_size = cast_size_t_to_ulong(final_buf_size_st);
|
||||
|
||||
if (!sb->final_buf)
|
||||
die(_("cannot read blob %s for path %s"),
|
||||
|
||||
@@ -186,11 +186,9 @@ static int cat_one_file(int opt, const char *exp_type, const char *obj_name)
|
||||
|
||||
case 'c':
|
||||
{
|
||||
unsigned long size_ul = 0;
|
||||
int textconv_ret = textconv_object(the_repository, path,
|
||||
obj_context.mode, &oid, 1,
|
||||
&buf, &size_ul);
|
||||
size = size_ul;
|
||||
&buf, &size);
|
||||
if (textconv_ret)
|
||||
break;
|
||||
}
|
||||
@@ -413,12 +411,9 @@ static void print_object_or_die(struct batch_options *opt, struct expand_data *d
|
||||
oid_to_hex(oid), data->rest);
|
||||
} else if (opt->transform_mode == 'c') {
|
||||
enum object_type type;
|
||||
unsigned long size_ul = 0;
|
||||
if (textconv_object(the_repository,
|
||||
data->rest, 0100644, oid,
|
||||
1, &contents, &size_ul))
|
||||
size = size_ul;
|
||||
else
|
||||
if (!textconv_object(the_repository,
|
||||
data->rest, 0100644, oid,
|
||||
1, &contents, &size))
|
||||
contents = odb_read_object(the_repository->objects,
|
||||
oid, &type, &size);
|
||||
if (!contents)
|
||||
|
||||
@@ -285,7 +285,7 @@ static void show_progress(void)
|
||||
* There's no need to cache this result with anonymize_mem, since
|
||||
* we already handle blob content caching with marks.
|
||||
*/
|
||||
static char *anonymize_blob(unsigned long *size)
|
||||
static char *anonymize_blob(size_t *size)
|
||||
{
|
||||
static int counter;
|
||||
struct strbuf out = STRBUF_INIT;
|
||||
@@ -296,7 +296,7 @@ static char *anonymize_blob(unsigned long *size)
|
||||
|
||||
static void export_blob(const struct object_id *oid)
|
||||
{
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
enum object_type type;
|
||||
char *buf;
|
||||
struct object *object;
|
||||
@@ -317,10 +317,8 @@ static void export_blob(const struct object_id *oid)
|
||||
object = (struct object *)lookup_blob(the_repository, oid);
|
||||
eaten = 0;
|
||||
} else {
|
||||
size_t size_st = 0;
|
||||
buf = odb_read_object(the_repository->objects, oid, &type,
|
||||
&size_st);
|
||||
size = cast_size_t_to_ulong(size_st);
|
||||
&size);
|
||||
if (!buf)
|
||||
die(_("could not read blob %s"), oid_to_hex(oid));
|
||||
if (check_object_signature(the_repository, oid, buf, size,
|
||||
|
||||
@@ -998,11 +998,13 @@ static int store_object(
|
||||
|
||||
if (last && last->data.len && last->data.buf && last->depth < max_depth
|
||||
&& dat->len > the_hash_algo->rawsz) {
|
||||
size_t deltalen_st = 0;
|
||||
|
||||
delta_count_attempts_by_type[type]++;
|
||||
delta = diff_delta(last->data.buf, last->data.len,
|
||||
dat->buf, dat->len,
|
||||
&deltalen, dat->len - the_hash_algo->rawsz);
|
||||
&deltalen_st, dat->len - the_hash_algo->rawsz);
|
||||
deltalen = cast_size_t_to_ulong(deltalen_st);
|
||||
} else
|
||||
delta = NULL;
|
||||
|
||||
|
||||
@@ -584,7 +584,7 @@ static int show_blob_object(const struct object_id *oid, struct rev_info *rev, c
|
||||
struct object_id oidc;
|
||||
struct object_context obj_context = {0};
|
||||
char *buf;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
|
||||
fflush(rev->diffopt.file);
|
||||
if (!rev->diffopt.flags.textconv_set_via_cmdline ||
|
||||
|
||||
@@ -260,8 +260,8 @@ static int exclude_promisor_objects_best_effort;
|
||||
|
||||
static int use_delta_islands;
|
||||
|
||||
static unsigned long delta_cache_size = 0;
|
||||
static unsigned long max_delta_cache_size = DEFAULT_DELTA_CACHE_SIZE;
|
||||
static size_t delta_cache_size = 0;
|
||||
static size_t max_delta_cache_size = DEFAULT_DELTA_CACHE_SIZE;
|
||||
static unsigned long cache_max_small_delta_size = 1000;
|
||||
|
||||
static unsigned long window_memory_limit = 0;
|
||||
@@ -353,7 +353,8 @@ static void index_commit_for_bitmap(struct commit *commit)
|
||||
|
||||
static void *get_delta(struct object_entry *entry)
|
||||
{
|
||||
unsigned long size, base_size, delta_size;
|
||||
unsigned long size, base_size;
|
||||
size_t delta_size;
|
||||
void *buf, *base_buf, *delta_buf;
|
||||
enum object_type type;
|
||||
size_t size_st = 0, base_size_st = 0;
|
||||
@@ -487,7 +488,7 @@ static void copy_pack_data(struct hashfile *f,
|
||||
off_t len)
|
||||
{
|
||||
unsigned char *in;
|
||||
unsigned long avail;
|
||||
size_t avail;
|
||||
|
||||
while (len) {
|
||||
in = use_pack(p, w_curs, offset, &avail);
|
||||
@@ -1916,7 +1917,7 @@ struct pbase_tree_cache {
|
||||
int ref;
|
||||
int temporary;
|
||||
void *tree_data;
|
||||
unsigned long tree_size;
|
||||
size_t tree_size;
|
||||
};
|
||||
|
||||
static struct pbase_tree_cache *(pbase_tree_cache[256]);
|
||||
@@ -1943,8 +1944,7 @@ static struct pbase_tree_cache *pbase_tree_get(const struct object_id *oid)
|
||||
{
|
||||
struct pbase_tree_cache *ent, *nent;
|
||||
void *data;
|
||||
unsigned long size;
|
||||
size_t size_st = 0;
|
||||
size_t size;
|
||||
enum object_type type;
|
||||
int neigh;
|
||||
int my_ix = pbase_tree_cache_ix(oid);
|
||||
@@ -1972,8 +1972,7 @@ static struct pbase_tree_cache *pbase_tree_get(const struct object_id *oid)
|
||||
/* Did not find one. Either we got a bogus request or
|
||||
* we need to read and perhaps cache.
|
||||
*/
|
||||
data = odb_read_object(the_repository->objects, oid, &type, &size_st);
|
||||
size = cast_size_t_to_ulong(size_st);
|
||||
data = odb_read_object(the_repository->objects, oid, &type, &size);
|
||||
if (!data)
|
||||
return NULL;
|
||||
if (type != OBJ_TREE) {
|
||||
@@ -2127,16 +2126,14 @@ static void add_preferred_base(struct object_id *oid)
|
||||
{
|
||||
struct pbase_tree *it;
|
||||
void *data;
|
||||
unsigned long size;
|
||||
size_t size_st = 0;
|
||||
size_t size;
|
||||
struct object_id tree_oid;
|
||||
|
||||
if (window <= num_preferred_base++)
|
||||
return;
|
||||
|
||||
data = odb_read_object_peeled(the_repository->objects, oid,
|
||||
OBJ_TREE, &size_st, &tree_oid);
|
||||
size = cast_size_t_to_ulong(size_st);
|
||||
OBJ_TREE, &size, &tree_oid);
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
@@ -2259,7 +2256,7 @@ static void check_object(struct object_entry *entry, uint32_t object_index)
|
||||
struct object_id base_ref;
|
||||
struct object_entry *base_entry;
|
||||
unsigned long used, used_0;
|
||||
unsigned long avail;
|
||||
size_t avail;
|
||||
off_t ofs;
|
||||
unsigned char *buf, c;
|
||||
enum object_type type;
|
||||
@@ -2687,8 +2684,8 @@ struct unpacked {
|
||||
unsigned depth;
|
||||
};
|
||||
|
||||
static int delta_cacheable(unsigned long src_size, unsigned long trg_size,
|
||||
unsigned long delta_size)
|
||||
static int delta_cacheable(size_t src_size, size_t trg_size,
|
||||
size_t delta_size)
|
||||
{
|
||||
if (max_delta_cache_size && delta_cache_size + delta_size > max_delta_cache_size)
|
||||
return 0;
|
||||
@@ -2755,8 +2752,8 @@ size_t oe_get_size_slow(struct packing_data *pack,
|
||||
struct pack_window *w_curs;
|
||||
unsigned char *buf;
|
||||
enum object_type type;
|
||||
unsigned long used, avail;
|
||||
size_t size;
|
||||
unsigned long used;
|
||||
size_t avail, size;
|
||||
|
||||
if (e->type_ != OBJ_OFS_DELTA && e->type_ != OBJ_REF_DELTA) {
|
||||
size_t sz;
|
||||
@@ -2787,11 +2784,12 @@ size_t oe_get_size_slow(struct packing_data *pack,
|
||||
}
|
||||
|
||||
static int try_delta(struct unpacked *trg, struct unpacked *src,
|
||||
unsigned max_depth, unsigned long *mem_usage)
|
||||
unsigned max_depth, size_t *mem_usage)
|
||||
{
|
||||
struct object_entry *trg_entry = trg->entry;
|
||||
struct object_entry *src_entry = src->entry;
|
||||
unsigned long trg_size, src_size, delta_size, sizediff, max_size, sz;
|
||||
unsigned long trg_size, src_size, sizediff, max_size, sz;
|
||||
size_t delta_size;
|
||||
unsigned ref_depth;
|
||||
enum object_type type;
|
||||
void *delta_buf;
|
||||
@@ -2955,9 +2953,9 @@ static unsigned int check_delta_limit(struct object_entry *me, unsigned int n)
|
||||
return m;
|
||||
}
|
||||
|
||||
static unsigned long free_unpacked(struct unpacked *n)
|
||||
static size_t free_unpacked(struct unpacked *n)
|
||||
{
|
||||
unsigned long freed_mem = sizeof_delta_index(n->index);
|
||||
size_t freed_mem = sizeof_delta_index(n->index);
|
||||
free_delta_index(n->index);
|
||||
n->index = NULL;
|
||||
if (n->data) {
|
||||
@@ -2974,7 +2972,7 @@ static void find_deltas(struct object_entry **list, unsigned *list_size,
|
||||
{
|
||||
uint32_t i, idx = 0, count = 0;
|
||||
struct unpacked *array;
|
||||
unsigned long mem_usage = 0;
|
||||
size_t mem_usage = 0;
|
||||
|
||||
CALLOC_ARRAY(array, window);
|
||||
|
||||
|
||||
@@ -459,7 +459,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)
|
||||
struct commit *commit;
|
||||
struct strbuf buf = STRBUF_INIT;
|
||||
const char *buffer;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
|
||||
if (repo_get_oid(the_repository, old_ref, &old_oid) < 0)
|
||||
return error(_("not a valid object name: '%s'"), old_ref);
|
||||
|
||||
@@ -783,15 +783,14 @@ static int count_objects(const char *path UNUSED, struct oid_array *oids,
|
||||
|
||||
for (size_t i = 0; i < oids->nr; i++) {
|
||||
struct object_info oi = OBJECT_INFO_INIT;
|
||||
unsigned long inflated;
|
||||
size_t inflated_st = 0;
|
||||
size_t inflated;
|
||||
struct commit *commit;
|
||||
struct object *obj;
|
||||
void *content;
|
||||
off_t disk;
|
||||
int eaten;
|
||||
|
||||
oi.sizep = &inflated_st;
|
||||
oi.sizep = &inflated;
|
||||
oi.disk_sizep = &disk;
|
||||
oi.contentp = &content;
|
||||
|
||||
@@ -799,7 +798,6 @@ static int count_objects(const char *path UNUSED, struct oid_array *oids,
|
||||
OBJECT_INFO_SKIP_FETCH_OBJECT |
|
||||
OBJECT_INFO_QUICK) < 0)
|
||||
continue;
|
||||
inflated = cast_size_t_to_ulong(inflated_st);
|
||||
|
||||
obj = parse_object_buffer(the_repository, &oids->oid[i], type,
|
||||
inflated, content, &eaten);
|
||||
|
||||
@@ -2083,7 +2083,7 @@ static int write_commit_with_parents(struct repository *r,
|
||||
const char *orig_author, *orig_committer;
|
||||
char *author = NULL, *committer = NULL;
|
||||
const char *buffer;
|
||||
unsigned long bufsize;
|
||||
size_t bufsize;
|
||||
const char *p;
|
||||
struct strbuf msg = STRBUF_INIT;
|
||||
int ret = 0;
|
||||
@@ -2135,7 +2135,7 @@ static int do_import_stash(struct repository *r, const char *rev)
|
||||
struct object_id chain;
|
||||
int res = 0;
|
||||
const char *buffer = NULL;
|
||||
unsigned long bufsize;
|
||||
size_t bufsize;
|
||||
struct commit *this = NULL;
|
||||
struct commit_list *items = NULL, *cur;
|
||||
char *msg = NULL;
|
||||
|
||||
@@ -40,7 +40,7 @@ static struct progress *progress;
|
||||
*/
|
||||
struct obj_buffer {
|
||||
char *buffer;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
static struct decoration obj_decorate;
|
||||
@@ -50,7 +50,7 @@ static struct obj_buffer *lookup_object_buffer(struct object *base)
|
||||
return lookup_decoration(&obj_decorate, base);
|
||||
}
|
||||
|
||||
static void add_object_buffer(struct object *object, char *buffer, unsigned long size)
|
||||
static void add_object_buffer(struct object *object, char *buffer, size_t size)
|
||||
{
|
||||
struct obj_buffer *obj;
|
||||
CALLOC_ARRAY(obj, 1);
|
||||
@@ -114,10 +114,10 @@ static void use(int bytes)
|
||||
* allocated buffer which is reused to hold temporary zstream output
|
||||
* and return NULL instead of returning garbage data.
|
||||
*/
|
||||
static void *get_data(unsigned long size)
|
||||
static void *get_data(size_t size)
|
||||
{
|
||||
git_zstream stream;
|
||||
unsigned long bufsize = dry_run && size > 8192 ? 8192 : size;
|
||||
size_t bufsize = dry_run && size > 8192 ? 8192 : size;
|
||||
void *buf = xmallocz(bufsize);
|
||||
|
||||
memset(&stream, 0, sizeof(stream));
|
||||
@@ -161,7 +161,7 @@ struct delta_info {
|
||||
struct object_id base_oid;
|
||||
unsigned nr;
|
||||
off_t base_offset;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
void *delta;
|
||||
struct delta_info *next;
|
||||
};
|
||||
@@ -170,7 +170,7 @@ static struct delta_info *delta_list;
|
||||
|
||||
static void add_delta_to_list(unsigned nr, const struct object_id *base_oid,
|
||||
off_t base_offset,
|
||||
void *delta, unsigned long size)
|
||||
void *delta, size_t size)
|
||||
{
|
||||
struct delta_info *info = xmalloc(sizeof(*info));
|
||||
|
||||
@@ -261,7 +261,7 @@ static void write_rest(void)
|
||||
}
|
||||
|
||||
static void added_object(unsigned nr, enum object_type type,
|
||||
void *data, unsigned long size);
|
||||
void *data, size_t size);
|
||||
|
||||
/*
|
||||
* Write out nr-th object from the list, now we know the contents
|
||||
@@ -269,7 +269,7 @@ static void added_object(unsigned nr, enum object_type type,
|
||||
* to be checked at the end.
|
||||
*/
|
||||
static void write_object(unsigned nr, enum object_type type,
|
||||
void *buf, unsigned long size)
|
||||
void *buf, size_t size)
|
||||
{
|
||||
if (!strict) {
|
||||
if (odb_write_object(the_repository->objects, buf, size, type,
|
||||
@@ -310,8 +310,8 @@ static void write_object(unsigned nr, enum object_type type,
|
||||
}
|
||||
|
||||
static void resolve_delta(unsigned nr, enum object_type type,
|
||||
void *base, unsigned long base_size,
|
||||
void *delta, unsigned long delta_size)
|
||||
void *base, size_t base_size,
|
||||
void *delta, size_t delta_size)
|
||||
{
|
||||
void *result;
|
||||
size_t result_size;
|
||||
@@ -330,7 +330,7 @@ static void resolve_delta(unsigned nr, enum object_type type,
|
||||
* resolve all the deltified objects that are based on it.
|
||||
*/
|
||||
static void added_object(unsigned nr, enum object_type type,
|
||||
void *data, unsigned long size)
|
||||
void *data, size_t size)
|
||||
{
|
||||
struct delta_info **p = &delta_list;
|
||||
struct delta_info *info;
|
||||
@@ -349,7 +349,7 @@ static void added_object(unsigned nr, enum object_type type,
|
||||
}
|
||||
}
|
||||
|
||||
static void unpack_non_delta_entry(enum object_type type, unsigned long size,
|
||||
static void unpack_non_delta_entry(enum object_type type, size_t size,
|
||||
unsigned nr)
|
||||
{
|
||||
void *buf = get_data(size);
|
||||
@@ -385,7 +385,7 @@ static ssize_t feed_input_zstream(struct odb_write_stream *in_stream,
|
||||
return buf_len - zstream->avail_out;
|
||||
}
|
||||
|
||||
static void stream_blob(unsigned long size, unsigned nr)
|
||||
static void stream_blob(size_t size, unsigned nr)
|
||||
{
|
||||
git_zstream zstream = { 0 };
|
||||
struct input_zstream_data data = { 0 };
|
||||
@@ -416,7 +416,7 @@ static void stream_blob(unsigned long size, unsigned nr)
|
||||
}
|
||||
|
||||
static int resolve_against_held(unsigned nr, const struct object_id *base,
|
||||
void *delta_data, unsigned long delta_size)
|
||||
void *delta_data, size_t delta_size)
|
||||
{
|
||||
struct object *obj;
|
||||
struct obj_buffer *obj_buffer;
|
||||
@@ -431,12 +431,11 @@ static int resolve_against_held(unsigned nr, const struct object_id *base,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
|
||||
static void unpack_delta_entry(enum object_type type, size_t delta_size,
|
||||
unsigned nr)
|
||||
{
|
||||
void *delta_data, *base;
|
||||
unsigned long base_size;
|
||||
size_t base_size_st = 0;
|
||||
size_t base_size;
|
||||
struct object_id base_oid;
|
||||
|
||||
if (type == OBJ_REF_DELTA) {
|
||||
@@ -513,8 +512,7 @@ static void unpack_delta_entry(enum object_type type, unsigned long delta_size,
|
||||
return;
|
||||
|
||||
base = odb_read_object(the_repository->objects, &base_oid,
|
||||
&type, &base_size_st);
|
||||
base_size = cast_size_t_to_ulong(base_size_st);
|
||||
&type, &base_size);
|
||||
if (!base) {
|
||||
error("failed to read delta-pack base object %s",
|
||||
oid_to_hex(&base_oid));
|
||||
|
||||
@@ -304,7 +304,7 @@ static struct lline *coalesce_lines(struct lline *base, int *lenbase,
|
||||
|
||||
static char *grab_blob(struct repository *r,
|
||||
const struct object_id *oid, unsigned int mode,
|
||||
unsigned long *size, struct userdiff_driver *textconv,
|
||||
size_t *size, struct userdiff_driver *textconv,
|
||||
const char *path)
|
||||
{
|
||||
char *blob;
|
||||
@@ -325,9 +325,7 @@ static char *grab_blob(struct repository *r,
|
||||
*size = fill_textconv(r, textconv, df, &blob);
|
||||
free_filespec(df);
|
||||
} else {
|
||||
size_t size_st = 0;
|
||||
blob = odb_read_object(r->objects, oid, &type, &size_st);
|
||||
*size = cast_size_t_to_ulong(size_st);
|
||||
blob = odb_read_object(r->objects, oid, &type, size);
|
||||
if (!blob)
|
||||
die(_("unable to read %s"), oid_to_hex(oid));
|
||||
if (type != OBJ_BLOB)
|
||||
@@ -431,7 +429,7 @@ static void combine_diff(struct repository *r,
|
||||
xdemitconf_t xecfg;
|
||||
mmfile_t parent_file;
|
||||
struct combine_diff_state state;
|
||||
unsigned long sz;
|
||||
size_t sz;
|
||||
|
||||
if (result_deleted)
|
||||
return; /* result deleted */
|
||||
@@ -1015,7 +1013,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
||||
struct rev_info *rev)
|
||||
{
|
||||
struct diff_options *opt = &rev->diffopt;
|
||||
unsigned long result_size, cnt, lno;
|
||||
size_t result_size, cnt, lno;
|
||||
int result_deleted = 0;
|
||||
char *result, *cp;
|
||||
struct sline *sline; /* survived lines */
|
||||
@@ -1134,7 +1132,7 @@ static void show_patch_diff(struct combine_diff_path *elem, int num_parent,
|
||||
is_binary = buffer_is_binary(result, result_size);
|
||||
for (i = 0; !is_binary && i < num_parent; i++) {
|
||||
char *buf;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
buf = grab_blob(opt->repo,
|
||||
&elem->parent[i].oid,
|
||||
elem->parent[i].mode,
|
||||
|
||||
19
commit.c
19
commit.c
@@ -349,7 +349,7 @@ int for_each_commit_graft(each_commit_graft_fn fn, void *cb_data)
|
||||
|
||||
struct commit_buffer {
|
||||
void *buffer;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
};
|
||||
define_commit_slab(buffer_slab, struct commit_buffer);
|
||||
|
||||
@@ -366,7 +366,8 @@ void free_commit_buffer_slab(struct buffer_slab *bs)
|
||||
free(bs);
|
||||
}
|
||||
|
||||
void set_commit_buffer(struct repository *r, struct commit *commit, void *buffer, unsigned long size)
|
||||
void set_commit_buffer(struct repository *r, struct commit *commit,
|
||||
void *buffer, size_t size)
|
||||
{
|
||||
struct commit_buffer *v = buffer_slab_at(
|
||||
r->parsed_objects->buffer_slab, commit);
|
||||
@@ -374,7 +375,9 @@ void set_commit_buffer(struct repository *r, struct commit *commit, void *buffer
|
||||
v->size = size;
|
||||
}
|
||||
|
||||
const void *get_cached_commit_buffer(struct repository *r, const struct commit *commit, unsigned long *sizep)
|
||||
const void *get_cached_commit_buffer(struct repository *r,
|
||||
const struct commit *commit,
|
||||
size_t *sizep)
|
||||
{
|
||||
struct commit_buffer *v = buffer_slab_peek(
|
||||
r->parsed_objects->buffer_slab, commit);
|
||||
@@ -390,7 +393,7 @@ const void *get_cached_commit_buffer(struct repository *r, const struct commit *
|
||||
|
||||
const void *repo_get_commit_buffer(struct repository *r,
|
||||
const struct commit *commit,
|
||||
unsigned long *sizep)
|
||||
size_t *sizep)
|
||||
{
|
||||
const void *ret = get_cached_commit_buffer(r, commit, sizep);
|
||||
if (!ret) {
|
||||
@@ -404,7 +407,7 @@ const void *repo_get_commit_buffer(struct repository *r,
|
||||
die("expected commit for %s, got %s",
|
||||
oid_to_hex(&commit->object.oid), type_name(type));
|
||||
if (sizep)
|
||||
*sizep = cast_size_t_to_ulong(size);
|
||||
*sizep = size;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
@@ -1192,7 +1195,7 @@ int parse_signed_commit(const struct commit *commit,
|
||||
struct strbuf *payload, struct strbuf *signature,
|
||||
const struct git_hash_algo *algop)
|
||||
{
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
const char *buffer = repo_get_commit_buffer(the_repository, commit,
|
||||
&size);
|
||||
int ret = parse_buffer_signed_by_header(buffer, size, payload, signature, algop);
|
||||
@@ -1365,7 +1368,7 @@ int verify_commit_buffer(const char *buffer, size_t size,
|
||||
|
||||
int check_commit_signature(const struct commit *commit, struct signature_check *sigc)
|
||||
{
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
const char *buffer = repo_get_commit_buffer(the_repository, commit, &size);
|
||||
int ret = verify_commit_buffer(buffer, size, sigc);
|
||||
|
||||
@@ -1462,7 +1465,7 @@ struct commit_extra_header *read_commit_extra_headers(struct commit *commit,
|
||||
const char **exclude)
|
||||
{
|
||||
struct commit_extra_header *extra = NULL;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
const char *buffer = repo_get_commit_buffer(the_repository, commit,
|
||||
&size);
|
||||
extra = read_commit_extra_header_lines(buffer, size, exclude);
|
||||
|
||||
8
commit.h
8
commit.h
@@ -131,13 +131,15 @@ void free_commit_buffer_slab(struct buffer_slab *bs);
|
||||
* Associate an object buffer with the commit. The ownership of the
|
||||
* memory is handed over to the commit, and must be free()-able.
|
||||
*/
|
||||
void set_commit_buffer(struct repository *r, struct commit *, void *buffer, unsigned long size);
|
||||
void set_commit_buffer(struct repository *r, struct commit *,
|
||||
void *buffer, size_t size);
|
||||
|
||||
/*
|
||||
* Get any cached object buffer associated with the commit. Returns NULL
|
||||
* if none. The resulting memory should not be freed.
|
||||
*/
|
||||
const void *get_cached_commit_buffer(struct repository *, const struct commit *, unsigned long *size);
|
||||
const void *get_cached_commit_buffer(struct repository *,
|
||||
const struct commit *, size_t *size);
|
||||
|
||||
/*
|
||||
* Get the commit's object contents, either from cache or by reading the object
|
||||
@@ -146,7 +148,7 @@ const void *get_cached_commit_buffer(struct repository *, const struct commit *,
|
||||
*/
|
||||
const void *repo_get_commit_buffer(struct repository *r,
|
||||
const struct commit *,
|
||||
unsigned long *size);
|
||||
size_t *size);
|
||||
|
||||
/*
|
||||
* Tell the commit subsystem that we are done with a particular commit buffer.
|
||||
|
||||
@@ -352,6 +352,29 @@ process_phantom_symlink(const wchar_t *wtarget, const wchar_t *wlink)
|
||||
wchar_t relative[MAX_PATH];
|
||||
const wchar_t *rel;
|
||||
|
||||
/*
|
||||
* Do not follow symlinks to network shares, to avoid NTLM credential
|
||||
* leak from crafted repositories (e.g. \\attacker-server\share).
|
||||
* Since paths come in all kind of enterprising shapes and forms (in
|
||||
* addition to the canonical `\\host\share` form, there's also
|
||||
* `\??\UNC\host\share`, `\GLOBAL??\UNC\host\share` and also
|
||||
* `\Device\Mup\host\share`, just to name a few), we simply avoid
|
||||
* following every symlink target that starts with a slash.
|
||||
*
|
||||
* This also catches drive-less absolute paths, of course. These are
|
||||
* uncommon in practice (and also fragile because they are relative to
|
||||
* the current working directory's drive). The only "harm" this does
|
||||
* is that it now requires users to specify via the Git attributes if
|
||||
* they have such an uncommon symbolic link and need it to be a
|
||||
* directory type link.
|
||||
*/
|
||||
if (is_wdir_sep(wtarget[0])) {
|
||||
warning("created file symlink '%ls' pointing to '%ls';\n"
|
||||
"set the `symlink` gitattribute to `dir` if a "
|
||||
"directory symlink is required", wlink, wtarget);
|
||||
return PHANTOM_SYMLINK_DONE;
|
||||
}
|
||||
|
||||
/* check that wlink is still a file symlink */
|
||||
if ((GetFileAttributesW(wlink)
|
||||
& (FILE_ATTRIBUTE_REPARSE_POINT | FILE_ATTRIBUTE_DIRECTORY))
|
||||
|
||||
@@ -102,7 +102,7 @@ static int convert_is_binary(const struct text_stat *stats)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int gather_convert_stats(const char *data, unsigned long size)
|
||||
static unsigned int gather_convert_stats(const char *data, size_t size)
|
||||
{
|
||||
struct text_stat stats;
|
||||
int ret = 0;
|
||||
@@ -119,7 +119,7 @@ static unsigned int gather_convert_stats(const char *data, unsigned long size)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const char *gather_convert_stats_ascii(const char *data, unsigned long size)
|
||||
static const char *gather_convert_stats_ascii(const char *data, size_t size)
|
||||
{
|
||||
unsigned int convert_stats = gather_convert_stats(data, size);
|
||||
|
||||
@@ -141,7 +141,7 @@ const char *get_cached_convert_stats_ascii(struct index_state *istate,
|
||||
const char *path)
|
||||
{
|
||||
const char *ret;
|
||||
unsigned long sz;
|
||||
size_t sz;
|
||||
void *data = read_blob_data_from_index(istate, path, &sz);
|
||||
ret = gather_convert_stats_ascii(data, sz);
|
||||
free(data);
|
||||
@@ -223,7 +223,7 @@ static void check_global_conv_flags_eol(const char *path,
|
||||
|
||||
static int has_crlf_in_index(struct index_state *istate, const char *path)
|
||||
{
|
||||
unsigned long sz;
|
||||
size_t sz;
|
||||
void *data;
|
||||
const char *crp;
|
||||
int has_crlf = 0;
|
||||
|
||||
14
delta.h
14
delta.h
@@ -14,7 +14,7 @@ struct delta_index;
|
||||
* using free_delta_index().
|
||||
*/
|
||||
struct delta_index *
|
||||
create_delta_index(const void *buf, unsigned long bufsize);
|
||||
create_delta_index(const void *buf, size_t bufsize);
|
||||
|
||||
/*
|
||||
* free_delta_index: free the index created by create_delta_index()
|
||||
@@ -28,7 +28,7 @@ void free_delta_index(struct delta_index *index);
|
||||
*
|
||||
* Given pointer must be what create_delta_index() returned, or NULL.
|
||||
*/
|
||||
unsigned long sizeof_delta_index(struct delta_index *index);
|
||||
size_t sizeof_delta_index(struct delta_index *index);
|
||||
|
||||
/*
|
||||
* create_delta: create a delta from given index for the given buffer
|
||||
@@ -42,8 +42,8 @@ unsigned long sizeof_delta_index(struct delta_index *index);
|
||||
*/
|
||||
void *
|
||||
create_delta(const struct delta_index *index,
|
||||
const void *buf, unsigned long bufsize,
|
||||
unsigned long *delta_size, unsigned long max_delta_size);
|
||||
const void *buf, size_t bufsize,
|
||||
size_t *delta_size, size_t max_delta_size);
|
||||
|
||||
/*
|
||||
* diff_delta: create a delta from source buffer to target buffer
|
||||
@@ -54,9 +54,9 @@ create_delta(const struct delta_index *index,
|
||||
* updated with its size. The returned buffer must be freed by the caller.
|
||||
*/
|
||||
static inline void *
|
||||
diff_delta(const void *src_buf, unsigned long src_bufsize,
|
||||
const void *trg_buf, unsigned long trg_bufsize,
|
||||
unsigned long *delta_size, unsigned long max_delta_size)
|
||||
diff_delta(const void *src_buf, size_t src_bufsize,
|
||||
const void *trg_buf, size_t trg_bufsize,
|
||||
size_t *delta_size, size_t max_delta_size)
|
||||
{
|
||||
struct delta_index *index = create_delta_index(src_buf, src_bufsize);
|
||||
if (index) {
|
||||
|
||||
14
diff-delta.c
14
diff-delta.c
@@ -125,14 +125,14 @@ struct unpacked_index_entry {
|
||||
};
|
||||
|
||||
struct delta_index {
|
||||
unsigned long memsize;
|
||||
size_t memsize;
|
||||
const void *src_buf;
|
||||
unsigned long src_size;
|
||||
size_t src_size;
|
||||
unsigned int hash_mask;
|
||||
struct index_entry *hash[FLEX_ARRAY];
|
||||
};
|
||||
|
||||
struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
|
||||
struct delta_index * create_delta_index(const void *buf, size_t bufsize)
|
||||
{
|
||||
unsigned int i, hsize, hmask, entries, prev_val, *hash_count;
|
||||
const unsigned char *data, *buffer = buf;
|
||||
@@ -140,7 +140,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
|
||||
struct unpacked_index_entry *entry, **hash;
|
||||
struct index_entry *packed_entry, **packed_hash;
|
||||
void *mem;
|
||||
unsigned long memsize;
|
||||
size_t memsize;
|
||||
|
||||
if (!buf || !bufsize)
|
||||
return NULL;
|
||||
@@ -302,7 +302,7 @@ void free_delta_index(struct delta_index *index)
|
||||
free(index);
|
||||
}
|
||||
|
||||
unsigned long sizeof_delta_index(struct delta_index *index)
|
||||
size_t sizeof_delta_index(struct delta_index *index)
|
||||
{
|
||||
if (index)
|
||||
return index->memsize;
|
||||
@@ -318,8 +318,8 @@ unsigned long sizeof_delta_index(struct delta_index *index)
|
||||
|
||||
void *
|
||||
create_delta(const struct delta_index *index,
|
||||
const void *trg_buf, unsigned long trg_size,
|
||||
unsigned long *delta_size, unsigned long max_size)
|
||||
const void *trg_buf, size_t trg_size,
|
||||
size_t *delta_size, size_t max_size)
|
||||
{
|
||||
unsigned int i, val;
|
||||
off_t outpos, moff;
|
||||
|
||||
21
diff.c
21
diff.c
@@ -3606,10 +3606,10 @@ static int checkdiff_consume(void *priv, char *line, unsigned long len)
|
||||
}
|
||||
|
||||
static unsigned char *deflate_it(char *data,
|
||||
unsigned long size,
|
||||
unsigned long *result_size)
|
||||
size_t size,
|
||||
size_t *result_size)
|
||||
{
|
||||
int bound;
|
||||
size_t bound;
|
||||
unsigned char *deflated;
|
||||
git_zstream stream;
|
||||
struct repo_config_values *cfg = repo_config_values(the_repository);
|
||||
@@ -3636,10 +3636,10 @@ static void emit_binary_diff_body(struct diff_options *o,
|
||||
void *delta;
|
||||
void *deflated;
|
||||
void *data;
|
||||
unsigned long orig_size;
|
||||
unsigned long delta_size;
|
||||
unsigned long deflate_size;
|
||||
unsigned long data_size;
|
||||
size_t orig_size;
|
||||
size_t delta_size;
|
||||
size_t deflate_size;
|
||||
size_t data_size;
|
||||
|
||||
/* We could do deflated delta, or we could do just deflated two,
|
||||
* whichever is smaller.
|
||||
@@ -4595,9 +4595,8 @@ int diff_populate_filespec(struct repository *r,
|
||||
}
|
||||
}
|
||||
else {
|
||||
size_t size_st = 0;
|
||||
struct object_info info = {
|
||||
.sizep = &size_st
|
||||
.sizep = &s->size
|
||||
};
|
||||
|
||||
if (!(size_only || check_binary))
|
||||
@@ -4619,7 +4618,6 @@ int diff_populate_filespec(struct repository *r,
|
||||
die("unable to read %s", oid_to_hex(&s->oid));
|
||||
|
||||
object_read:
|
||||
s->size = cast_size_t_to_ulong(size_st);
|
||||
if (size_only || check_binary) {
|
||||
if (size_only)
|
||||
return 0;
|
||||
@@ -4634,7 +4632,6 @@ object_read:
|
||||
if (odb_read_object_info_extended(r->objects, &s->oid, &info,
|
||||
OBJECT_INFO_LOOKUP_REPLACE))
|
||||
die("unable to read %s", oid_to_hex(&s->oid));
|
||||
s->size = cast_size_t_to_ulong(size_st);
|
||||
}
|
||||
s->should_free = 1;
|
||||
}
|
||||
@@ -7845,7 +7842,7 @@ int textconv_object(struct repository *r,
|
||||
const struct object_id *oid,
|
||||
int oid_valid,
|
||||
char **buf,
|
||||
unsigned long *buf_size)
|
||||
size_t *buf_size)
|
||||
{
|
||||
struct diff_filespec *df;
|
||||
struct userdiff_driver *textconv;
|
||||
|
||||
2
diff.h
2
diff.h
@@ -757,7 +757,7 @@ int textconv_object(struct repository *repo,
|
||||
const char *path,
|
||||
unsigned mode,
|
||||
const struct object_id *oid, int oid_valid,
|
||||
char **buf, unsigned long *buf_size);
|
||||
char **buf, size_t *buf_size);
|
||||
|
||||
int parse_rename_score(const char **cp_p);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ struct diff_filespec {
|
||||
char *path;
|
||||
void *data;
|
||||
void *cnt_data;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
int count; /* Reference count */
|
||||
int rename_used; /* Count of rename users */
|
||||
unsigned short mode; /* file mode */
|
||||
|
||||
16
git-zlib.c
16
git-zlib.c
@@ -167,9 +167,21 @@ int git_inflate(git_zstream *strm, int flush)
|
||||
return status;
|
||||
}
|
||||
|
||||
unsigned long git_deflate_bound(git_zstream *strm, unsigned long size)
|
||||
size_t git_deflate_bound(git_zstream *strm, size_t size)
|
||||
{
|
||||
return deflateBound(&strm->z, size);
|
||||
#if SIZE_MAX > ULONG_MAX
|
||||
if (size > maximum_unsigned_value_of_type(uLong))
|
||||
/*
|
||||
* deflateBound() takes uLong, which is 32-bit on
|
||||
* Windows. For inputs above that range, return zlib's
|
||||
* stored-block formula (the conservative path it would
|
||||
* itself use for an unknown stream state) plus the
|
||||
* worst-case wrapper overhead.
|
||||
*/
|
||||
return size + (size >> 5) + (size >> 7) + (size >> 11)
|
||||
+ 7 + 18;
|
||||
#endif
|
||||
return deflateBound(&strm->z, (uLong)size);
|
||||
}
|
||||
|
||||
void git_deflate_init(git_zstream *strm, int level)
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
|
||||
typedef struct git_zstream {
|
||||
struct z_stream_s z;
|
||||
unsigned long avail_in;
|
||||
unsigned long avail_out;
|
||||
size_t avail_in;
|
||||
size_t avail_out;
|
||||
size_t total_in;
|
||||
size_t total_out;
|
||||
unsigned char *next_in;
|
||||
@@ -25,6 +25,6 @@ void git_deflate_end(git_zstream *);
|
||||
int git_deflate_abort(git_zstream *);
|
||||
int git_deflate_end_gently(git_zstream *);
|
||||
int git_deflate(git_zstream *, int flush);
|
||||
unsigned long git_deflate_bound(git_zstream *, unsigned long);
|
||||
size_t git_deflate_bound(git_zstream *, size_t);
|
||||
|
||||
#endif /* GIT_ZLIB_H */
|
||||
|
||||
20
grep.c
20
grep.c
@@ -864,9 +864,9 @@ void free_grep_patterns(struct grep_opt *opt)
|
||||
free_pattern_expr(opt->pattern_expression);
|
||||
}
|
||||
|
||||
static const char *end_of_line(const char *cp, unsigned long *left)
|
||||
static const char *end_of_line(const char *cp, size_t *left)
|
||||
{
|
||||
unsigned long l = *left;
|
||||
size_t l = *left;
|
||||
while (l && *cp != '\n') {
|
||||
l--;
|
||||
cp++;
|
||||
@@ -1454,7 +1454,7 @@ static int should_lookahead(struct grep_opt *opt)
|
||||
}
|
||||
|
||||
static int look_ahead(struct grep_opt *opt,
|
||||
unsigned long *left_p,
|
||||
size_t *left_p,
|
||||
unsigned *lno_p,
|
||||
const char **bol_p)
|
||||
{
|
||||
@@ -1567,7 +1567,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
|
||||
{
|
||||
const char *bol;
|
||||
const char *peek_bol = NULL;
|
||||
unsigned long left;
|
||||
size_t left;
|
||||
unsigned lno = 1;
|
||||
unsigned last_hit = 0;
|
||||
int binary_match_only = 0;
|
||||
@@ -1647,6 +1647,8 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
|
||||
|
||||
bol = gs->buf;
|
||||
left = gs->size;
|
||||
if (left && gs->buf[left-1] == '\n')
|
||||
left--;
|
||||
while (left) {
|
||||
const char *eol;
|
||||
int hit;
|
||||
@@ -1735,7 +1737,7 @@ static int grep_source_1(struct grep_opt *opt, struct grep_source *gs, int colle
|
||||
goto next_line;
|
||||
}
|
||||
if (show_function && (!peek_bol || peek_bol < bol)) {
|
||||
unsigned long peek_left = left;
|
||||
size_t peek_left = left;
|
||||
const char *peek_eol = eol;
|
||||
|
||||
/*
|
||||
@@ -1854,7 +1856,7 @@ int grep_source(struct grep_opt *opt, struct grep_source *gs)
|
||||
|
||||
static void grep_source_init_buf(struct grep_source *gs,
|
||||
const char *buf,
|
||||
unsigned long size)
|
||||
size_t size)
|
||||
{
|
||||
gs->type = GREP_SOURCE_BUF;
|
||||
gs->name = NULL;
|
||||
@@ -1865,7 +1867,7 @@ static void grep_source_init_buf(struct grep_source *gs,
|
||||
gs->identifier = NULL;
|
||||
}
|
||||
|
||||
int grep_buffer(struct grep_opt *opt, const char *buf, unsigned long size)
|
||||
int grep_buffer(struct grep_opt *opt, const char *buf, size_t size)
|
||||
{
|
||||
struct grep_source gs;
|
||||
int r;
|
||||
@@ -1931,11 +1933,9 @@ void grep_source_clear_data(struct grep_source *gs)
|
||||
static int grep_source_load_oid(struct grep_source *gs)
|
||||
{
|
||||
enum object_type type;
|
||||
size_t size_st = 0;
|
||||
|
||||
gs->buf = odb_read_object(gs->repo->objects, gs->identifier,
|
||||
&type, &size_st);
|
||||
gs->size = cast_size_t_to_ulong(size_st);
|
||||
&type, &gs->size);
|
||||
if (!gs->buf)
|
||||
return error(_("'%s': unable to read %s"),
|
||||
gs->name,
|
||||
|
||||
4
grep.h
4
grep.h
@@ -212,7 +212,7 @@ void append_grep_pattern(struct grep_opt *opt, const char *pat, const char *orig
|
||||
void append_header_grep_pattern(struct grep_opt *, enum grep_header_field, const char *);
|
||||
void compile_grep_patterns(struct grep_opt *opt);
|
||||
void free_grep_patterns(struct grep_opt *opt);
|
||||
int grep_buffer(struct grep_opt *opt, const char *buf, unsigned long size);
|
||||
int grep_buffer(struct grep_opt *opt, const char *buf, size_t size);
|
||||
|
||||
/* The field parameter is only used to filter header patterns
|
||||
* (where appropriate). If filtering isn't desirable
|
||||
@@ -235,7 +235,7 @@ struct grep_source {
|
||||
struct repository *repo; /* if GREP_SOURCE_OID */
|
||||
|
||||
const char *buf;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
|
||||
char *path; /* for attribute lookups */
|
||||
struct userdiff_driver *driver;
|
||||
|
||||
@@ -367,7 +367,7 @@ static void start_put(struct transfer_request *request)
|
||||
void *unpacked;
|
||||
size_t len;
|
||||
int hdrlen;
|
||||
ssize_t size;
|
||||
size_t size;
|
||||
git_zstream stream;
|
||||
struct repo_config_values *cfg = repo_config_values(the_repository);
|
||||
|
||||
|
||||
@@ -1853,8 +1853,8 @@ static void filter_bitmap_blob_none(struct bitmap_index *bitmap_git,
|
||||
OBJ_BLOB);
|
||||
}
|
||||
|
||||
static unsigned long get_size_by_pos(struct bitmap_index *bitmap_git,
|
||||
uint32_t pos)
|
||||
static size_t get_size_by_pos(struct bitmap_index *bitmap_git,
|
||||
uint32_t pos)
|
||||
{
|
||||
size_t size;
|
||||
struct object_info oi = OBJECT_INFO_INIT;
|
||||
@@ -1891,7 +1891,7 @@ static unsigned long get_size_by_pos(struct bitmap_index *bitmap_git,
|
||||
die(_("unable to get size of %s"), oid_to_hex(&obj->oid));
|
||||
}
|
||||
|
||||
return cast_size_t_to_ulong(size);
|
||||
return size;
|
||||
}
|
||||
|
||||
static void filter_bitmap_blob_limit(struct bitmap_index *bitmap_git,
|
||||
|
||||
@@ -34,7 +34,7 @@ int check_pack_crc(struct packed_git *p, struct pack_window **w_curs,
|
||||
uint32_t data_crc = crc32(0, NULL, 0);
|
||||
|
||||
do {
|
||||
unsigned long avail;
|
||||
size_t avail;
|
||||
void *data = use_pack(p, w_curs, offset, &avail);
|
||||
if (avail > len)
|
||||
avail = len;
|
||||
@@ -71,7 +71,7 @@ static int verify_packfile(struct repository *r,
|
||||
|
||||
r->hash_algo->init_fn(&ctx);
|
||||
do {
|
||||
unsigned long remaining;
|
||||
size_t remaining;
|
||||
unsigned char *in = use_pack(p, w_curs, offset, &remaining);
|
||||
offset += remaining;
|
||||
if (!pack_sig_ofs)
|
||||
|
||||
@@ -704,7 +704,7 @@ static int in_window(struct repository *r, struct pack_window *win,
|
||||
unsigned char *use_pack(struct packed_git *p,
|
||||
struct pack_window **w_cursor,
|
||||
off_t offset,
|
||||
unsigned long *left)
|
||||
size_t *left)
|
||||
{
|
||||
struct pack_window *win = *w_cursor;
|
||||
|
||||
@@ -1228,7 +1228,7 @@ int unpack_object_header(struct packed_git *p,
|
||||
size_t *sizep)
|
||||
{
|
||||
unsigned char *base;
|
||||
unsigned long left;
|
||||
size_t left;
|
||||
unsigned long used;
|
||||
enum object_type type;
|
||||
|
||||
|
||||
@@ -402,7 +402,8 @@ uint32_t get_pack_fanout(struct packed_git *p, uint32_t value);
|
||||
|
||||
struct object_database;
|
||||
|
||||
unsigned char *use_pack(struct packed_git *, struct pack_window **, off_t, unsigned long *);
|
||||
unsigned char *use_pack(struct packed_git *, struct pack_window **, off_t,
|
||||
size_t *);
|
||||
void close_pack_windows(struct packed_git *);
|
||||
void close_pack(struct packed_git *);
|
||||
void unuse_pack(struct pack_window **);
|
||||
|
||||
@@ -411,7 +411,7 @@ int chmod_index_entry(struct index_state *, struct cache_entry *ce, char flip);
|
||||
int ce_same_name(const struct cache_entry *a, const struct cache_entry *b);
|
||||
void set_object_name_for_intent_to_add_entry(struct cache_entry *ce);
|
||||
int index_name_is_other(struct index_state *, const char *, int);
|
||||
void *read_blob_data_from_index(struct index_state *, const char *, unsigned long *);
|
||||
void *read_blob_data_from_index(struct index_state *, const char *, size_t *);
|
||||
|
||||
/* do stat comparison even if CE_VALID is true */
|
||||
#define CE_MATCH_IGNORE_VALID 01
|
||||
|
||||
@@ -3459,7 +3459,7 @@ int index_name_is_other(struct index_state *istate, const char *name,
|
||||
}
|
||||
|
||||
void *read_blob_data_from_index(struct index_state *istate,
|
||||
const char *path, unsigned long *size)
|
||||
const char *path, size_t *size)
|
||||
{
|
||||
int pos, len;
|
||||
size_t sz;
|
||||
@@ -3490,7 +3490,7 @@ void *read_blob_data_from_index(struct index_state *istate,
|
||||
return NULL;
|
||||
}
|
||||
if (size)
|
||||
*size = cast_size_t_to_ulong(sz);
|
||||
*size = sz;
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ int cmd__delta(int argc, const char **argv)
|
||||
die_errno("unable to read '%s'", argv[3]);
|
||||
|
||||
if (argv[1][1] == 'd') {
|
||||
unsigned long delta_size;
|
||||
size_t delta_size;
|
||||
out_buf = diff_delta(from.buf, from.len,
|
||||
data.buf, data.len,
|
||||
&delta_size, 0);
|
||||
|
||||
@@ -22,7 +22,7 @@ static unsigned long do_compress(void **pptr, unsigned long size)
|
||||
{
|
||||
git_zstream stream;
|
||||
void *in, *out;
|
||||
unsigned long maxsize;
|
||||
size_t maxsize;
|
||||
|
||||
git_deflate_init(&stream, 1);
|
||||
maxsize = git_deflate_bound(&stream, size);
|
||||
@@ -49,7 +49,7 @@ static void write_ref_delta(struct hashfile *f,
|
||||
{
|
||||
unsigned char header[MAX_PACK_OBJECT_HEADER];
|
||||
unsigned long delta_size, compressed_size, hdrlen;
|
||||
size_t size, base_size;
|
||||
size_t size, base_size, delta_size_st = 0;
|
||||
enum object_type type;
|
||||
void *base_buf, *delta_buf;
|
||||
void *buf = odb_read_object(the_repository->objects,
|
||||
@@ -65,7 +65,8 @@ static void write_ref_delta(struct hashfile *f,
|
||||
die("unable to read %s", oid_to_hex(base));
|
||||
|
||||
delta_buf = diff_delta(base_buf, base_size,
|
||||
buf, size, &delta_size, 0);
|
||||
buf, size, &delta_size_st, 0);
|
||||
delta_size = cast_size_t_to_ulong(delta_size_st);
|
||||
|
||||
compressed_size = do_compress(&delta_buf, delta_size);
|
||||
|
||||
|
||||
12
tree-walk.c
12
tree-walk.c
@@ -49,7 +49,7 @@ static int decode_tree_entry(struct tree_desc *desc, const char *buf, unsigned l
|
||||
|
||||
static int init_tree_desc_internal(struct tree_desc *desc,
|
||||
const struct object_id *oid,
|
||||
const void *buffer, unsigned long size,
|
||||
const void *buffer, size_t size,
|
||||
struct strbuf *err,
|
||||
enum tree_desc_flags flags)
|
||||
{
|
||||
@@ -63,7 +63,7 @@ static int init_tree_desc_internal(struct tree_desc *desc,
|
||||
}
|
||||
|
||||
void init_tree_desc(struct tree_desc *desc, const struct object_id *tree_oid,
|
||||
const void *buffer, unsigned long size)
|
||||
const void *buffer, size_t size)
|
||||
{
|
||||
struct strbuf err = STRBUF_INIT;
|
||||
if (init_tree_desc_internal(desc, tree_oid, buffer, size, &err, 0))
|
||||
@@ -72,7 +72,7 @@ void init_tree_desc(struct tree_desc *desc, const struct object_id *tree_oid,
|
||||
}
|
||||
|
||||
int init_tree_desc_gently(struct tree_desc *desc, const struct object_id *oid,
|
||||
const void *buffer, unsigned long size,
|
||||
const void *buffer, size_t size,
|
||||
enum tree_desc_flags flags)
|
||||
{
|
||||
struct strbuf err = STRBUF_INIT;
|
||||
@@ -777,8 +777,7 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct repository *r,
|
||||
goto done;
|
||||
} else if (S_ISLNK(*mode)) {
|
||||
/* Follow a symlink */
|
||||
unsigned long link_len;
|
||||
size_t link_len_st = 0;
|
||||
size_t link_len;
|
||||
size_t len;
|
||||
char *contents, *contents_start;
|
||||
struct dir_state *parent;
|
||||
@@ -798,8 +797,7 @@ enum get_oid_result get_tree_entry_follow_symlinks(struct repository *r,
|
||||
|
||||
contents = odb_read_object(r->objects,
|
||||
¤t_tree_oid, &type,
|
||||
&link_len_st);
|
||||
link_len = cast_size_t_to_ulong(link_len_st);
|
||||
&link_len);
|
||||
|
||||
if (!contents)
|
||||
goto done;
|
||||
|
||||
@@ -85,10 +85,10 @@ int update_tree_entry_gently(struct tree_desc *);
|
||||
* members of `struct tree`.
|
||||
*/
|
||||
void init_tree_desc(struct tree_desc *desc, const struct object_id *tree_oid,
|
||||
const void *buf, unsigned long size);
|
||||
const void *buf, size_t size);
|
||||
|
||||
int init_tree_desc_gently(struct tree_desc *desc, const struct object_id *oid,
|
||||
const void *buf, unsigned long size,
|
||||
const void *buf, size_t size,
|
||||
enum tree_desc_flags flags);
|
||||
|
||||
/*
|
||||
|
||||
2
tree.c
2
tree.c
@@ -172,7 +172,7 @@ struct tree *lookup_tree(struct repository *r, const struct object_id *oid)
|
||||
return object_as_type(obj, OBJ_TREE, 0);
|
||||
}
|
||||
|
||||
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size)
|
||||
int parse_tree_buffer(struct tree *item, void *buffer, size_t size)
|
||||
{
|
||||
if (item->object.parsed)
|
||||
return 0;
|
||||
|
||||
4
tree.h
4
tree.h
@@ -10,14 +10,14 @@ struct strbuf;
|
||||
struct tree {
|
||||
struct object object;
|
||||
void *buffer;
|
||||
unsigned long size;
|
||||
size_t size;
|
||||
};
|
||||
|
||||
extern const char *tree_type;
|
||||
|
||||
struct tree *lookup_tree(struct repository *r, const struct object_id *oid);
|
||||
|
||||
int parse_tree_buffer(struct tree *item, void *buffer, unsigned long size);
|
||||
int parse_tree_buffer(struct tree *item, void *buffer, size_t size);
|
||||
|
||||
#define parse_tree_gently(t, q) repo_parse_tree_gently(the_repository, t, q)
|
||||
int repo_parse_tree_gently(struct repository *r, struct tree *item,
|
||||
|
||||
@@ -84,7 +84,7 @@ int unix_stream_connect(const char *path, int disallow_chdir)
|
||||
struct unix_sockaddr_context ctx;
|
||||
|
||||
if (unix_sockaddr_init(&sa, path, &ctx, disallow_chdir) < 0)
|
||||
return -1;
|
||||
goto fail;
|
||||
fd = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
if (fd < 0)
|
||||
goto fail;
|
||||
|
||||
@@ -195,7 +195,7 @@ void read_mmblob(mmfile_t *ptr, struct object_database *odb,
|
||||
}
|
||||
|
||||
#define FIRST_FEW_BYTES 8000
|
||||
int buffer_is_binary(const char *ptr, unsigned long size)
|
||||
int buffer_is_binary(const char *ptr, size_t size)
|
||||
{
|
||||
if (FIRST_FEW_BYTES < size)
|
||||
size = FIRST_FEW_BYTES;
|
||||
|
||||
@@ -49,7 +49,7 @@ int xdi_diff_outf(mmfile_t *mf1, mmfile_t *mf2,
|
||||
int read_mmfile(mmfile_t *ptr, const char *filename);
|
||||
void read_mmblob(mmfile_t *ptr, struct object_database *odb,
|
||||
const struct object_id *oid);
|
||||
int buffer_is_binary(const char *ptr, unsigned long size);
|
||||
int buffer_is_binary(const char *ptr, size_t size);
|
||||
|
||||
void xdiff_set_find_func(xdemitconf_t *xecfg, const char *line, int cflags);
|
||||
void xdiff_clear_find_func(xdemitconf_t *xecfg);
|
||||
|
||||
Reference in New Issue
Block a user