Re: [PATCH] Fix git-pack-objects for 64-bit platforms

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Dennis Stosberg <dennis@...>
Cc: <git@...>, Linus Torvalds <torvalds@...>
Date: Thursday, May 11, 2006 - 2:52 pm

Linus Torvalds <torvalds@osdl.org> writes:


That sounds sensible.

Since I saw a patch that touches only one place, I thought I'd
better point this out...

There are a few more places that knows about this
((char*)base_pointer + (entry_count * 24)) magic in our code.

$ git grep -n -e '24  *\*' -e '\*  *24' master -- '*.c'

master:pack-objects.c:159:		long hl = *((long *)(index + 24 * i));

	This is yours.

master:sha1_file.c:447:	if (idx_size != 4*256 + nr * 24 + 20 + 20)
master:sha1_file.c:1148:	memcpy(sha1, (index + 24 * n + 4), 20);
master:sha1_file.c:1162:		int cmp = memcmp(index + 24 * mi + 4, sha1, 20);

	These three should be OK, I think.

master:sha1_file.c:1164:			e->offset = ntohl(*((int*)(index + 24 * mi)));

	This you might want to look at; I suspect it is what
	Linus suggests.

Also we _might_ have uglier magic that assumes the base_pointer to
be a pointer to a 4-byte integer and uses offset of multiple of
6 instead of 24, although I do not think it is likely.

I have to leave the keyboard in a few minutes so I cannot verify
nor fix them myself for the next 8 hours or so.  Sorry.


Is uint32_t guaranteed to be exactly 32-bit, or merely enough to
hold 32-bit?

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH] Fix git-pack-objects for 64-bit platforms, Dennis Stosberg, (Thu May 11, 1:36 pm)
Re: [PATCH] Fix git-pack-objects for 64-bit platforms, Linus Torvalds, (Thu May 11, 1:58 pm)
Re: [PATCH] Fix git-pack-objects for 64-bit platforms, Junio C Hamano, (Thu May 11, 2:52 pm)
Re: [PATCH] Fix git-pack-objects for 64-bit platforms, Linus Torvalds, (Thu May 11, 3:27 pm)
Re: [PATCH] Fix git-pack-objects for 64-bit platforms, Junio C Hamano, (Sat May 13, 1:58 am)
Re: [PATCH] Fix git-pack-objects for 64-bit platforms, Ben Clifford, (Sun May 14, 4:56 pm)
Re: [PATCH] Fix git-pack-objects for 64-bit platforms, Linus Torvalds, (Thu May 11, 3:10 pm)