{"thread":{"id":"21395","subject":"[PATCH] imap-send.c: fix pointer to be const","startedAt":"2009-10-28T05:09:51Z","lastAt":"2009-10-29T00:13:12Z","messageCount":6,"participants":["Vietor Liu","Junio C Hamano","Michael J Gruber"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"126083","messageId":"1256706591-2763-1-git-send-email-vietor@vxwo.org","threadId":"21395","inReplyTo":null,"subject":"[PATCH] imap-send.c: fix pointer to be const","fromName":"Vietor Liu","fromEmail":"vietor@vxwo.org","sentAt":"2009-10-28T05:09:51Z","receivedAt":"2009-10-28T05:09:51Z","isPatch":true,"sender":{"key":"vietor@vxwo.org","avatar":"https://gravatar.com/avatar/5aec20a4fda090db11446ebfef48ef01e702e5cef0710640a676ccbfce1f4fe3?d=mp&s=160"},"body":"Fixes some compiler warnings:\nimap-send.c: In function ‘ssl_socket_connect’:\nwarning: assignment discards qualifiers from pointer target type\n\nSigned-off-by: Vietor Liu <vietor@vxwo.org>\n---\n imap-send.c |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 3847fd1..10dd025 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -273,7 +273,7 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve\n \tfprintf(stderr, \"SSL requested but SSL support not compiled in\\n\");\n \treturn -1;\n #else\n-\tSSL_METHOD *meth;\n+\tconst SSL_METHOD *meth;\n \tSSL_CTX *ctx;\n \tint ret;\n \n-- \n1.6.5.2\n"},{"id":"126088","messageId":"7vk4ygxce6.fsf@alter.siamese.dyndns.org","threadId":"21395","inReplyTo":"1256706591-2763-1-git-send-email-vietor@vxwo.org","subject":"Re: [PATCH] imap-send.c: fix pointer to be const","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-28T06:26:09Z","receivedAt":"2009-10-28T06:26:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Vietor Liu <vietor@vxwo.org> writes:\n\n> Fixes some compiler warnings:\n> imap-send.c: In function ‘ssl_socket_connect’:\n> warning: assignment discards qualifiers from pointer target type\n>\n> Signed-off-by: Vietor Liu <vietor@vxwo.org>\n\nI do not quite understand.  This variable gets assigned the return values\nfrom TLSv1_method() or SSLv23_method(), but the copy of ssl.h I have\ndeclares them as:\n\n    SSL_METHOD *SSLv23_method(void);\t/* SSLv3 but can rollback to v2 */\n    SSL_METHOD *TLSv1_method(void);\t\t/* TLSv1.0 */\n\nWe would need to explain this change a bit better.\n\n>  imap-send.c |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n>\n> diff --git a/imap-send.c b/imap-send.c\n> index 3847fd1..10dd025 100644\n> --- a/imap-send.c\n> +++ b/imap-send.c\n> @@ -273,7 +273,7 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve\n>  \tfprintf(stderr, \"SSL requested but SSL support not compiled in\\n\");\n>  \treturn -1;\n>  #else\n> -\tSSL_METHOD *meth;\n> +\tconst SSL_METHOD *meth;\n>  \tSSL_CTX *ctx;\n>  \tint ret;\n>  \n> -- \n> 1.6.5.2\n"},{"id":"126090","messageId":"1256713526.3333.0.camel@localhost.localdomain","threadId":"21395","inReplyTo":"7vk4ygxce6.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] imap-send.c: fix pointer to be const","fromName":"Vietor Liu","fromEmail":"vietor@vxwo.org","sentAt":"2009-10-28T07:05:26Z","receivedAt":"2009-10-28T07:05:26Z","isPatch":true,"sender":{"key":"vietor@vxwo.org","avatar":"https://gravatar.com/avatar/5aec20a4fda090db11446ebfef48ef01e702e5cef0710640a676ccbfce1f4fe3?d=mp&s=160"},"body":"On Tue, 2009-10-27 at 23:26 -0700, Junio C Hamano wrote:\n> Vietor Liu <vietor@vxwo.org> writes:\n> \n> > Fixes some compiler warnings:\n> > imap-send.c: In function ‘ssl_socket_connect’:\n> > warning: assignment discards qualifiers from pointer target type\n> >\n> > Signed-off-by: Vietor Liu <vietor@vxwo.org>\n> \n> I do not quite understand.  This variable gets assigned the return values\n> from TLSv1_method() or SSLv23_method(), but the copy of ssl.h I have\n> declares them as:\n> \n>     SSL_METHOD *SSLv23_method(void);\t/* SSLv3 but can rollback to v2 */\n>     SSL_METHOD *TLSv1_method(void);\t\t/* TLSv1.0 */\n\n1. openssl-devel-1.0.0-0.10\n\nconst SSL_METHOD *SSLv23_method(void);\t/* SSLv3 but can rollback to v2\n*/\nconst SSL_METHOD *TLSv1_method(void);\t\t/* TLSv1.0 */\n\n\n2. http://www.openssl.org/docs/ssl/ssl.html\n\nconst SSL_METHOD *SSLv2_method(void);\n        \n        Constructor for the SSLv2 SSL_METHOD structure for combined\n        client and server.\nconst SSL_METHOD *TLSv1_method(void);\n        \n        Constructor for the TLSv1 SSL_METHOD structure for combined\n        client and server.\n\n3. it maybe fixes warnings for other version.\n"},{"id":"126142","messageId":"4AE8482F.7020807@drmicha.warpmail.net","threadId":"21395","inReplyTo":"1256713526.3333.0.camel@localhost.localdomain","subject":"Re: [PATCH] imap-send.c: fix pointer to be const","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2009-10-28T13:33:35Z","receivedAt":"2009-10-28T13:33:35Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Vietor Liu venit, vidit, dixit 28.10.2009 08:05:\n> On Tue, 2009-10-27 at 23:26 -0700, Junio C Hamano wrote:\n>> Vietor Liu <vietor@vxwo.org> writes:\n>>\n>>> Fixes some compiler warnings:\n>>> imap-send.c: In function ‘ssl_socket_connect’:\n>>> warning: assignment discards qualifiers from pointer target type\n>>>\n>>> Signed-off-by: Vietor Liu <vietor@vxwo.org>\n>>\n>> I do not quite understand.  This variable gets assigned the return values\n>> from TLSv1_method() or SSLv23_method(), but the copy of ssl.h I have\n>> declares them as:\n>>\n>>     SSL_METHOD *SSLv23_method(void);\t/* SSLv3 but can rollback to v2 */\n>>     SSL_METHOD *TLSv1_method(void);\t\t/* TLSv1.0 */\n> \n> 1. openssl-devel-1.0.0-0.10\n> \n> const SSL_METHOD *SSLv23_method(void);\t/* SSLv3 but can rollback to v2\n> */\n> const SSL_METHOD *TLSv1_method(void);\t\t/* TLSv1.0 */\n> \n> \n> 2. http://www.openssl.org/docs/ssl/ssl.html\n> \n> const SSL_METHOD *SSLv2_method(void);\n>         \n>         Constructor for the SSLv2 SSL_METHOD structure for combined\n>         client and server.\n> const SSL_METHOD *TLSv1_method(void);\n>         \n>         Constructor for the TLSv1 SSL_METHOD structure for combined\n>         client and server.\n> \n> 3. it maybe fixes warnings for other version.\n\nNo const here with openssl 0.9.8k. I think major distros will switch to\n1.0.0 with their next major release (e.g. Fedora 12 will have it by the\nend of this year).\n\nSince this is only about warnings, maybe git 1.7.0 is the right time\nframe to adjust this to the upcoming standard?\n\nMichael\n"},{"id":"126163","messageId":"7vhbtjo10s.fsf@alter.siamese.dyndns.org","threadId":"21395","inReplyTo":"4AE8482F.7020807@drmicha.warpmail.net","subject":"Re: [PATCH] imap-send.c: fix pointer to be const","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-28T17:56:35Z","receivedAt":"2009-10-28T17:56:35Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> Since this is only about warnings, maybe git 1.7.0 is the right time\n> frame to adjust this to the upcoming standard?\n\nThis does not look like \"one group wants this way, but the others want\ndifferently.  We have to pick one and sacrifice the other because it is\nimpossible to have it both ways\"; there is no excuse to bring up 1.7.0 for\nsomething like this.\n\nDoesn't inclusing \"ssl.h\" give us some indication whether \"const\" is\nneeded to allow us to use #if/#else/#endif in order to compile with\nheaders from either versions?  I.e. something like...\n\ndiff --git a/imap-send.c b/imap-send.c\nindex 3847fd1..a199db8 100644\n--- a/imap-send.c\n+++ b/imap-send.c\n@@ -273,7 +273,11 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve\n \tfprintf(stderr, \"SSL requested but SSL support not compiled in\\n\");\n \treturn -1;\n #else\n+#if (OPENSSL_VERSION_NUMBER >= 0x1000000fL)\n+\tconst SSL_METHOD *meth;\n+#else\n \tSSL_METHOD *meth;\n+#endif\n \tSSL_CTX *ctx;\n \tint ret;\n \n"},{"id":"126220","messageId":"1256775193.2040.6.camel@localhost.localdomain","threadId":"21395","inReplyTo":"7vhbtjo10s.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] imap-send.c: fix pointer to be const","fromName":"Vietor Liu","fromEmail":"vietor@vxwo.org","sentAt":"2009-10-29T00:13:12Z","receivedAt":"2009-10-29T00:13:12Z","isPatch":true,"sender":{"key":"vietor@vxwo.org","avatar":"https://gravatar.com/avatar/5aec20a4fda090db11446ebfef48ef01e702e5cef0710640a676ccbfce1f4fe3?d=mp&s=160"},"body":"On Wed, 2009-10-28 at 10:56 -0700, Junio C Hamano wrote:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n> > Since this is only about warnings, maybe git 1.7.0 is the right time\n> > frame to adjust this to the upcoming standard?\n> \n> This does not look like \"one group wants this way, but the others want\n> differently.  We have to pick one and sacrifice the other because it is\n> impossible to have it both ways\"; there is no excuse to bring up 1.7.0 for\n> something like this.\n> \n> Doesn't inclusing \"ssl.h\" give us some indication whether \"const\" is\n> needed to allow us to use #if/#else/#endif in order to compile with\n> headers from either versions?  I.e. something like...\n> \n> diff --git a/imap-send.c b/imap-send.c\n> index 3847fd1..a199db8 100644\n> --- a/imap-send.c\n> +++ b/imap-send.c\n> @@ -273,7 +273,11 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve\n>  \tfprintf(stderr, \"SSL requested but SSL support not compiled in\\n\");\n>  \treturn -1;\n>  #else\n> +#if (OPENSSL_VERSION_NUMBER >= 0x1000000fL)\n> +\tconst SSL_METHOD *meth;\n> +#else\n>  \tSSL_METHOD *meth;\n> +#endif\n>  \tSSL_CTX *ctx;\n>  \tint ret;\n>  \n\nIt's better than my patch, thanks.\n"}]}