git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Warning in apply.c

From
PRPavel Roskin <proski@gnu.org>
Date
Jul 4, 2005, 02:50 UTC
Message-ID
<1120445400.1265.23.camel@dv>
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>
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
Message 1 of 1 in “Warning in apply.c”
  1. Warning in apply.cPavel Roskin, Jul 4, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.