git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Koegler <martin.koegler@chello.at>
To: git@vger.kernel.org, gitster@pobox.com, Johannes.Schindelin@gmx.de
Cc: Martin Koegler <martin.koegler@chello.at>
Subject: [Patch size_t V3 13/19] Convert index-pack to size_t
Date: Wed, 16 Aug 2017 22:16:25 +0200	[thread overview]
Message-ID: <1502914591-26215-14-git-send-email-martin@mail.zuhause> (raw)
In-Reply-To: <1502914591-26215-1-git-send-email-martin@mail.zuhause>

From: Martin Koegler <martin.koegler@chello.at>

Signed-off-by: Martin Koegler <martin.koegler@chello.at>
---
 builtin/index-pack.c | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 7f3ccd0..bf2d728 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -435,7 +435,7 @@ static int is_delta_type(enum object_type type)
 	return (type == OBJ_REF_DELTA || type == OBJ_OFS_DELTA);
 }
 
-static void *unpack_entry_data(off_t offset, unsigned long size,
+static void *unpack_entry_data(off_t offset, size_t size,
 			       enum object_type type, unsigned char *sha1)
 {
 	static char fixed_buf[8192];
@@ -444,10 +444,10 @@ static void *unpack_entry_data(off_t offset, unsigned long size,
 	void *buf;
 	git_SHA_CTX c;
 	char hdr[32];
-	int hdrlen;
+	size_t hdrlen;
 
 	if (!is_delta_type(type)) {
-		hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), size) + 1;
+		hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %" PRIuMAX, typename(type), (uintmax_t)size) + 1;
 		git_SHA1_Init(&c);
 		git_SHA1_Update(&c, hdr, hdrlen);
 	} else
@@ -489,7 +489,7 @@ static void *unpack_raw_entry(struct object_entry *obj,
 			      unsigned char *sha1)
 {
 	unsigned char *p;
-	unsigned long size, c;
+	size_t size, c;
 	off_t base_offset;
 	unsigned shift;
 	void *data;
@@ -551,11 +551,11 @@ static void *unpack_raw_entry(struct object_entry *obj,
 }
 
 static void *unpack_data(struct object_entry *obj,
-			 int (*consume)(const unsigned char *, unsigned long, void *),
+			 int (*consume)(const unsigned char *, size_t, void *),
 			 void *cb_data)
 {
 	off_t from = obj[0].idx.offset + obj[0].hdr_size;
-	off_t len = obj[1].idx.offset - from;
+	size_t len = obj[1].idx.offset - from;
 	unsigned char *data, *inbuf;
 	git_zstream stream;
 	int status;
@@ -728,10 +728,10 @@ struct compare_data {
 	struct object_entry *entry;
 	struct git_istream *st;
 	unsigned char *buf;
-	unsigned long buf_size;
+	size_t buf_size;
 };
 
-static int compare_objects(const unsigned char *buf, unsigned long size,
+static int compare_objects(const unsigned char *buf, size_t size,
 			   void *cb_data)
 {
 	struct compare_data *data = cb_data;
@@ -783,7 +783,7 @@ static int check_collison(struct object_entry *entry)
 }
 
 static void sha1_object(const void *data, struct object_entry *obj_entry,
-			unsigned long size, enum object_type type,
+			size_t size, enum object_type type,
 			const struct object_id *oid)
 {
 	void *new_data = NULL;
@@ -1311,11 +1311,11 @@ static int write_compressed(struct sha1file *f, void *in, unsigned int size)
 
 static struct object_entry *append_obj_to_pack(struct sha1file *f,
 			       const unsigned char *sha1, void *buf,
-			       unsigned long size, enum object_type type)
+			       size_t size, enum object_type type)
 {
 	struct object_entry *obj = &objects[nr_objects++];
 	unsigned char header[10];
-	unsigned long s = size;
+	size_t s = size;
 	int n = 0;
 	unsigned char c = (type << 4) | (s & 15);
 	s >>= 4;
@@ -1585,10 +1585,10 @@ static void show_pack_info(int stat_only)
 			chain_histogram[obj_stat[i].delta_depth - 1]++;
 		if (stat_only)
 			continue;
-		printf("%s %-6s %" PRIuMAX " %lu %" PRIuMAX,
+		printf("%s %-6s %" PRIuMAX " %" PRIuMAX " %" PRIuMAX,
 		       oid_to_hex(&obj->idx.oid),
 		       typename(obj->real_type), (uintmax_t)obj->size,
-		       (unsigned long)(obj[1].idx.offset - obj->idx.offset),
+		       (uintmax_t)(obj[1].idx.offset - obj->idx.offset),
 		       (uintmax_t)obj->idx.offset);
 		if (is_delta_type(obj->type)) {
 			struct object_entry *bobj = &objects[obj_stat[i].base_object_no];
-- 
2.1.4


  parent reply	other threads:[~2017-08-16 20:17 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-16 20:16 [Patch size_t V3 00/19] use size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 01/19] delta: fix enconding size larger than an "uint" can hold Martin Koegler
2017-08-17 20:28   ` Torsten Bögershausen
2017-08-16 20:16 ` [Patch size_t V3 02/19] Convert size datatype to size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 03/19] Convert zlib.c " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 04/19] delta: Fix offset overflows Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 05/19] Convert sha1_file.c to size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 06/19] Use size_t for sha1 Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 07/19] Convert parse_X_buffer to size_t Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 08/19] Convert fsck.c & commit.c " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 09/19] Convert cache functions " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 10/19] Add overflow check to get_delta_hdr_size Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 11/19] Use size_t for config parsing Martin Koegler
2017-08-24 20:29   ` Johannes Sixt
2017-08-16 20:16 ` [Patch size_t V3 12/19] Convert pack-objects to size_t Martin Koegler
2017-08-16 20:16 ` Martin Koegler [this message]
2017-08-16 21:42   ` [Patch size_t V3 13/19] Convert index-pack " Ramsay Jones
2017-08-16 20:16 ` [Patch size_t V3 14/19] Convert unpack-objects " Martin Koegler
2017-08-16 20:16 ` [Patch size_t V3 15/19] Convert archive functions " Martin Koegler
2017-08-21  6:42   ` Junio C Hamano
2017-08-22  1:19     ` brian m. carlson
2017-08-16 20:16 ` [Patch size_t V3 16/19] Convert various things " Martin Koegler
2017-08-21  6:34   ` Junio C Hamano
2017-08-16 20:16 ` [Patch size_t V3 17/19] Convert ref-filter " Martin Koegler
2017-08-17 18:03   ` Junio C Hamano
2017-08-17 18:04     ` Junio C Hamano
2017-08-16 20:16 ` [Patch size_t V3 18/19] Convert tree-walk " Martin Koegler
2017-08-17 17:53   ` Junio C Hamano
2017-08-16 20:16 ` [Patch size_t V3 19/19] Convert xdiff-interface " Martin Koegler
2017-08-17 17:49   ` Junio C Hamano
2017-08-16 21:33 ` [Patch size_t V3 00/19] use size_t Junio C Hamano
2017-08-17 20:35 ` Torsten Bögershausen
2017-08-18  7:08   ` Martin Koegler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502914591-26215-14-git-send-email-martin@mail.zuhause \
    --to=martin.koegler@chello.at \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).