{"thread":{"id":"35939","subject":"[PATCH] diffcore.h: be explicit about the signedness of is_binary","startedAt":"2014-02-24T00:54:47Z","lastAt":"2014-02-24T17:55:48Z","messageCount":3,"participants":["Richard Lowe","Jeff King","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"235213","messageId":"m2ob1xba94.fsf@richlowe.net","threadId":"35939","inReplyTo":null,"subject":"[PATCH] diffcore.h: be explicit about the signedness of is_binary","fromName":"Richard Lowe","fromEmail":"richlowe@richlowe.net","sentAt":"2014-02-24T00:54:47Z","receivedAt":"2014-02-24T00:54:47Z","isPatch":true,"sender":{"key":"richlowe@richlowe.net","avatar":null},"body":"Bitfields need to specify their signedness explicitly or the compiler is\nfree to default as it sees fit.  With compilers that default 'unsigned'\n(SUNWspro 12 seems to do this) the tri-state nature of is_binary\nvanishes and all files are treated as binary.\n\nSigned-off-by: Richard Lowe <richlowe@richlowe.net>\n---\n diffcore.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/diffcore.h b/diffcore.h\nindex 79de8cf..7c6f391 100644\n--- a/diffcore.h\n+++ b/diffcore.h\n@@ -46,7 +46,7 @@ struct diff_filespec {\n \tunsigned is_stdin : 1;\n \tunsigned has_more_entries : 1; /* only appear in combined diff */\n \t/* data should be considered \"binary\"; -1 means \"don't know yet\" */\n-\tint is_binary : 2;\n+\tsigned int is_binary : 2;\n \tstruct userdiff_driver *driver;\n };\n \n-- \n1.8.5.5\n"},{"id":"235215","messageId":"20140224020940.GB7959@sigill.intra.peff.net","threadId":"35939","inReplyTo":"m2ob1xba94.fsf@richlowe.net","subject":"Re: [PATCH] diffcore.h: be explicit about the signedness of is_binary","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2014-02-24T02:09:40Z","receivedAt":"2014-02-24T02:09:40Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sun, Feb 23, 2014 at 07:54:47PM -0500, Richard Lowe wrote:\n\n> Bitfields need to specify their signedness explicitly or the compiler is\n> free to default as it sees fit.  With compilers that default 'unsigned'\n> (SUNWspro 12 seems to do this) the tri-state nature of is_binary\n> vanishes and all files are treated as binary.\n> \n> Signed-off-by: Richard Lowe <richlowe@richlowe.net>\n\nThanks, I wasn't aware of this corner of the standard when I wrote it.\nYour fix is obviously correct.\n\n-Peff\n"},{"id":"235275","messageId":"xmqqmwhg9yzf.fsf@gitster.dls.corp.google.com","threadId":"35939","inReplyTo":"m2ob1xba94.fsf@richlowe.net","subject":"Re: [PATCH] diffcore.h: be explicit about the signedness of is_binary","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-02-24T17:55:48Z","receivedAt":"2014-02-24T17:55:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Richard Lowe <richlowe@richlowe.net> writes:\n\n> Bitfields need to specify their signedness explicitly or the compiler is\n> free to default as it sees fit.  With compilers that default 'unsigned'\n> (SUNWspro 12 seems to do this) the tri-state nature of is_binary\n> vanishes and all files are treated as binary.\n>\n> Signed-off-by: Richard Lowe <richlowe@richlowe.net>\n> ---\n\nLooks good; thanks.\n\n>  diffcore.h | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/diffcore.h b/diffcore.h\n> index 79de8cf..7c6f391 100644\n> --- a/diffcore.h\n> +++ b/diffcore.h\n> @@ -46,7 +46,7 @@ struct diff_filespec {\n>  \tunsigned is_stdin : 1;\n>  \tunsigned has_more_entries : 1; /* only appear in combined diff */\n>  \t/* data should be considered \"binary\"; -1 means \"don't know yet\" */\n> -\tint is_binary : 2;\n> +\tsigned int is_binary : 2;\n>  \tstruct userdiff_driver *driver;\n>  };\n"}]}