{"thread":{"id":"5083","subject":"[PATCH 8/10] Fix some minor warnings to allow -Werror.","startedAt":"2006-08-02T01:03:42Z","lastAt":"2006-08-02T18:47:49Z","messageCount":4,"participants":["Ramsay Jones","Junio C Hamano","Rocco Rutte"],"isPatch":true,"patchVersion":1,"patchTotal":10},"messages":[{"id":"24540","messageId":"00be01c6b5cf$7f7e9e20$c47eedc1@ramsay1.demon.co.uk","threadId":"5083","inReplyTo":null,"subject":"[PATCH 8/10] Fix some minor warnings to allow -Werror.","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2006-08-02T01:03:42Z","receivedAt":"2006-08-02T01:03:42Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Signed-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>\n---\n builtin-mailinfo.c |    3 ++-\n diff.c             |    1 +\n 2 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\nindex 3e40747..bb5e7b7 100644\n--- a/builtin-mailinfo.c\n+++ b/builtin-mailinfo.c\n@@ -531,7 +531,8 @@ static int decode_b_segment(char *in, ch\n static void convert_to_utf8(char *line, char *charset)\n {\n #ifndef NO_ICONV\n-\tchar *in, *out;\n+\tconst char *in;\n+\tchar *out;\n \tsize_t insize, outsize, nrc;\n \tchar outbuf[4096]; /* cheat */\n \tstatic char latin_one[] = \"latin1\";\ndiff --git a/diff.c b/diff.c\nindex 5a71489..81630c0 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -614,6 +614,7 @@ static void emit_binary_diff(mmfile_t *o\n \t * whichever is smaller.\n \t */\n \tdelta = NULL;\n+\torig_size = 0;\n \tdeflated = deflate_it(two->ptr, two->size, &deflate_size);\n \tif (one->size && two->size) {\n \t\tdelta = diff_delta(one->ptr, one->size,\n-- \n1.4.1\n\n\nFrom 262b57917ff01f74c95670ae59f1cd59a9024135 Mon Sep 17 00:00:00 2001\nFrom: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>\nDate: Sun, 30 Jul 2006 17:06:25 +0100\nSubject: [PATCH 8/10] Fix some minor warnings to allow -Werror.\n\nSigned-off-by: Ramsay Allan Jones <ramsay@ramsay1.demon.co.uk>\n---\n builtin-mailinfo.c |    3 ++-\n diff.c             |    1 +\n 2 files changed, 3 insertions(+), 1 deletions(-)\n\ndiff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\nindex 3e40747..bb5e7b7 100644\n--- a/builtin-mailinfo.c\n+++ b/builtin-mailinfo.c\n@@ -531,7 +531,8 @@ static int decode_b_segment(char *in, ch\n static void convert_to_utf8(char *line, char *charset)\n {\n #ifndef NO_ICONV\n-\tchar *in, *out;\n+\tconst char *in;\n+\tchar *out;\n \tsize_t insize, outsize, nrc;\n \tchar outbuf[4096]; /* cheat */\n \tstatic char latin_one[] = \"latin1\";\ndiff --git a/diff.c b/diff.c\nindex 5a71489..81630c0 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -614,6 +614,7 @@ static void emit_binary_diff(mmfile_t *o\n \t * whichever is smaller.\n \t */\n \tdelta = NULL;\n+\torig_size = 0;\n \tdeflated = deflate_it(two->ptr, two->size, &deflate_size);\n \tif (one->size && two->size) {\n \t\tdelta = diff_delta(one->ptr, one->size,\n-- \n1.4.1\n\n"},{"id":"24549","messageId":"7vvepbvauo.fsf@assigned-by-dhcp.cox.net","threadId":"5083","inReplyTo":"00be01c6b5cf$7f7e9e20$c47eedc1@ramsay1.demon.co.uk","subject":"Re: [PATCH 8/10] Fix some minor warnings to allow -Werror.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-08-02T07:46:23Z","receivedAt":"2006-08-02T07:46:23Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Ramsay Jones\" <ramsay@ramsay1.demon.co.uk> writes:\n\n> diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\n> index 3e40747..bb5e7b7 100644\n> --- a/builtin-mailinfo.c\n> +++ b/builtin-mailinfo.c\n> @@ -531,7 +531,8 @@ static int decode_b_segment(char *in, ch\n>  static void convert_to_utf8(char *line, char *charset)\n>  {\n>  #ifndef NO_ICONV\n> -\tchar *in, *out;\n> +\tconst char *in;\n> +\tchar *out;\n>  \tsize_t insize, outsize, nrc;\n>  \tchar outbuf[4096]; /* cheat */\n>  \tstatic char latin_one[] = \"latin1\";\n\nThis kills the compilation with:\n\ngcc -o builtin-mailinfo.o -c -O2 -Werror -ansi -pedantic -std=c99 -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wall -Wdeclaration-after-statement -g -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRLCPY builtin-mailinfo.c\ncc1: warnings being treated as errors\nbuiltin-mailinfo.c: In function 'convert_to_utf8':\nbuiltin-mailinfo.c:561: warning: passing argument 2 of 'iconv' from incompatible pointer type\n\nwhere the line 561 reads:\n\n\tnrc = iconv(conv, &in, &insize, &out, &outsize);\n\n> diff --git a/diff.c b/diff.c\n> index 5a71489..81630c0 100644\n> --- a/diff.c\n> +++ b/diff.c\n> @@ -614,6 +614,7 @@ static void emit_binary_diff(mmfile_t *o\n>  \t * whichever is smaller.\n>  \t */\n>  \tdelta = NULL;\n> +\torig_size = 0;\n>  \tdeflated = deflate_it(two->ptr, two->size, &deflate_size);\n>  \tif (one->size && two->size) {\n>  \t\tdelta = diff_delta(one->ptr, one->size,\n\nThis is not wrong per se, but is working around a stupid compiler that\ndo not understand the dataflow.  orig_size is only used when\ndelta is non NULL, and when delta is non NULL, the variable is\nalways set.  Not very happy but is acceptable.\n"},{"id":"24553","messageId":"20060802085330.GA6595@peter.daprodeges.fqdn.th-h.de","threadId":"5083","inReplyTo":"7vvepbvauo.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH 8/10] Fix some minor warnings to allow -Werror.","fromName":"Rocco Rutte","fromEmail":"pdmef@gmx.net","sentAt":"2006-08-02T08:53:30Z","receivedAt":"2006-08-02T08:53:30Z","isPatch":true,"sender":{"key":"pdmef@gmx.net","avatar":null},"body":"Hi,\n\n* Junio C Hamano [06-08-02 00:46:23 -0700] wrote:\n\n[...]\n\n>This kills the compilation with:\n>\n>gcc -o builtin-mailinfo.o -c -O2 -Werror -ansi -pedantic -std=c99 -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wall -Wdeclaration-after-statement -g -DSHA1_HEADER='<openssl/sha.h>' -DNO_STRLCPY builtin-mailinfo.c\n>cc1: warnings being treated as errors\n>builtin-mailinfo.c: In function 'convert_to_utf8':\n>builtin-mailinfo.c:561: warning: passing argument 2 of 'iconv' from incompatible pointer type\n>\n>where the line 561 reads:\n>\n>\tnrc = iconv(conv, &in, &insize, &out, &outsize);\n\nIt depends on the iconv() implementation as what the input pointer is \ndefined: some use just 'char*' while others use 'const char*' (GNU \nlibiconv IIRC).\n\n   bye, Rocco\n-- \n:wq!\n"},{"id":"24578","messageId":"001c01c6b664$27536740$c47eedc1@ramsay1.demon.co.uk","threadId":"5083","inReplyTo":"7vvepbvauo.fsf@assigned-by-dhcp.cox.net","subject":"RE: [PATCH 8/10] Fix some minor warnings to allow -Werror.","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2006-08-02T18:47:49Z","receivedAt":"2006-08-02T18:47:49Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nOn Wed, 2006-08-02 at 8:46, Junio C Hamano wrote:\n> \n> \"Ramsay Jones\" <ramsay@ramsay1.demon.co.uk> writes:\n> \n> > diff --git a/builtin-mailinfo.c b/builtin-mailinfo.c\n> > index 3e40747..bb5e7b7 100644\n> > --- a/builtin-mailinfo.c\n> > +++ b/builtin-mailinfo.c\n> > @@ -531,7 +531,8 @@ static int decode_b_segment(char *in, ch\n> >  static void convert_to_utf8(char *line, char *charset)\n> >  {\n> >  #ifndef NO_ICONV\n> > -\tchar *in, *out;\n> > +\tconst char *in;\n> > +\tchar *out;\n> >  \tsize_t insize, outsize, nrc;\n> >  \tchar outbuf[4096]; /* cheat */\n> >  \tstatic char latin_one[] = \"latin1\";\n> \n> This kills the compilation with:\n> \n> gcc -o builtin-mailinfo.o -c -O2 -Werror -ansi -pedantic -std=c99 \n> -D_XOPEN_SOURCE=500 -D_BSD_SOURCE -Wall \n> -Wdeclaration-after-statement -g -DSHA1_HEADER='<openssl/sha.h>' \n> -DNO_STRLCPY builtin-mailinfo.c\n> cc1: warnings being treated as errors\n> builtin-mailinfo.c: In function 'convert_to_utf8':\n> builtin-mailinfo.c:561: warning: passing argument 2 of 'iconv' \n> from incompatible pointer type\n> \n> where the line 561 reads:\n> \n> \tnrc = iconv(conv, &in, &insize, &out, &outsize);\n> \n\nOK, so I get exactly the same if I don't make the indicated change!\nThe second param of iconv() must have changed from const char* to char*\nat some point in the last six years.\nJust ignore this.\n\n> > diff --git a/diff.c b/diff.c\n> > index 5a71489..81630c0 100644\n> > --- a/diff.c\n> > +++ b/diff.c\n> > @@ -614,6 +614,7 @@ static void emit_binary_diff(mmfile_t *o\n> >  \t * whichever is smaller.\n> >  \t */\n> >  \tdelta = NULL;\n> > +\torig_size = 0;\n> >  \tdeflated = deflate_it(two->ptr, two->size, &deflate_size);\n> >  \tif (one->size && two->size) {\n> >  \t\tdelta = diff_delta(one->ptr, one->size,\n> \n> This is not wrong per se, but is working around a stupid compiler that\n> do not understand the dataflow.  orig_size is only used when\n> delta is non NULL, and when delta is non NULL, the variable is\n> always set.  Not very happy but is acceptable.\n> \n\nYes, you are absolutely correct. I agree it would be nice if gcc was\n\"fixed\" so that it could detect this situation, but I'm not going to\nhold my breath. It just seemed to be the lesser evil.\n\nRamsay\n"}]}