Code

fix warning from pack-objects.c
authorLuck, Tony <tony.luck@intel.com>
Thu, 23 Feb 2006 22:42:39 +0000 (14:42 -0800)
committerJunio C Hamano <junkio@cox.net>
Sat, 25 Feb 2006 06:17:20 +0000 (22:17 -0800)
When compiling on ia64 I get this warning (from gcc 3.4.3):

gcc -o pack-objects.o -c -g -O2 -Wall -DSHA1_HEADER='<openssl/sha.h>'  pack-objects.c
pack-objects.c: In function `pack_revindex_ix':
pack-objects.c:94: warning: cast from pointer to integer of different size

A double cast (first to long, then to int) shuts gcc up, but is there
a better way?

[jc: Andreas Ericsson suggests to use ulong instead. ]

Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
pack-objects.c

index be7a2008c52f582626dd18b47372a4765c8bd39c..0287449b4ce365eaa134815d34522fdf8495dbe7 100644 (file)
@@ -99,7 +99,7 @@ static int reused_delta = 0;
 
 static int pack_revindex_ix(struct packed_git *p)
 {
-       unsigned int ui = (unsigned int) p;
+       unsigned long ui = (unsigned long)(long)p;
        int i;
 
        ui = ui ^ (ui >> 16); /* defeat structure alignment */