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

[PATCH] diffcore.h: be explicit about the signedness of is_binary

From
RLRichard Lowe <richlowe@richlowe.net>
Date
Feb 24, 2014, 00:54 UTC
Message-ID
<m2ob1xba94.fsf@richlowe.net>

Bitfields need to specify their signedness explicitly or the compiler is free to default as it sees fit. With compilers that default 'unsigned' (SUNWspro 12 seems to do this) the tri-state nature of is_binary vanishes and all files are treated as binary.

Signed-off-by: Richard Lowe <richlowe@richlowe.net>
---
 diffcore.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/diffcore.h b/diffcore.h
index 79de8cf..7c6f391 100644
--- a/diffcore.h
+++ b/diffcore.h
@@ -46,7 +46,7 @@ struct diff_filespec {
 	unsigned is_stdin : 1;
 	unsigned has_more_entries : 1; /* only appear in combined diff */
 	/* data should be considered "binary"; -1 means "don't know yet" */
-	int is_binary : 2;
+	signed int is_binary : 2;
 	struct userdiff_driver *driver;
 };
 
-- 
1.8.5.5
Next: Jeff King
Message 1 of 3 in “diffcore.h: be explicit about the signedness of is_binary”
  1. diffcore.h: be explicit about the signedness of is_binaryRichard Lowe, Feb 24, 2014
  2. Jeff KingFeb 24, 2014
  3. Junio C HamanoFeb 24, 2014

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.