threads / patch / 1100

patchWarning in apply.c

Subject: [PATCH] Warning in apply.c

## tl;dr

One message between Jul 4, 2005 and Jul 4, 2005. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

Pavel Roskin· Jul 4, 2005, 02:50 UTC · lore
Hello!
gcc 4.0.0 reports one warning while compiling git on x86_64:

gcc -g -O2 -Wall '-DSHA1_HEADER=<openssl/sha.h>' -o git-apply apply.c libgit.a -lz -lcrypto apply.c: In function 'show_rename_copy': apply.c:1147: warning: field precision should have type 'int', but argument 3 has type 'long int'

The fix is to cast pointer difference to int.
Signed-off-by: Pavel Roskin <proski@gnu.org>
Show changes to apply.c +1 −1
diff --git a/apply.c b/apply.c
--- a/apply.c
+++ b/apply.c
@@ -1143,7 +1143,7 @@ static void show_rename_copy(struct patc
 	 */
 	if (old != p->old_name)
 		printf(" %s %.*s{%s => %s} (%d%%)\n", renamecopy,
-		       old - p->old_name, p->old_name,
+		       (int)(old - p->old_name), p->old_name,
 		       old, new, p->score);
 	else
 		printf(" %s %s => %s (%d%%)\n", renamecopy,
-- 
Regards,
Pavel Roskin

← back to recent threads