{"thread":{"id":"21396","subject":"[PATCH] imap-send.c: fix pointer to be const","startedAt":"2009-10-28T07:24:37Z","lastAt":"2009-10-28T07:48:08Z","messageCount":3,"participants":["Vietor Liu","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"126108","messageId":"1256714677-3659-1-git-send-email-vietor@vxwo.org","threadId":"21396","inReplyTo":null,"subject":"[PATCH] imap-send.c: fix pointer to be const","fromName":"Vietor Liu","fromEmail":"vietor@vxwo.org","sentAt":"2009-10-28T07:24:37Z","receivedAt":"2009-10-28T07:24:37Z","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\n====================================================\nOpenSSL Changes between 0.9.8k and 1.0:\n\n*) Let the TLSv1_method() etc. functions return a 'const' SSL_METHOD\n     pointer and make the SSL_METHOD parameter in SSL_CTX_new,\n     SSL_CTX_set_ssl_version and SSL_set_ssl_method 'const'.\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":"126110","messageId":"7vljiwq8tc.fsf@alter.siamese.dyndns.org","threadId":"21396","inReplyTo":"1256714677-3659-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-28T07:25:19Z","receivedAt":"2009-10-28T07:25:19Z","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> ====================================================\n> OpenSSL Changes between 0.9.8k and 1.0:\n>\n> *) Let the TLSv1_method() etc. functions return a 'const' SSL_METHOD\n>      pointer and make the SSL_METHOD parameter in SSL_CTX_new,\n>      SSL_CTX_set_ssl_version and SSL_set_ssl_method 'const'.\n>\n> Signed-off-by: Vietor Liu <vietor@vxwo.org>\n\nThis is much easier to understand.\n\nThanks.\n\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":"126112","messageId":"7v8wewq7rb.fsf@alter.siamese.dyndns.org","threadId":"21396","inReplyTo":"7vljiwq8tc.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] imap-send.c: fix pointer to be const","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-28T07:48:08Z","receivedAt":"2009-10-28T07:48:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\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>> ====================================================\n>> OpenSSL Changes between 0.9.8k and 1.0:\n>>\n>> *) Let the TLSv1_method() etc. functions return a 'const' SSL_METHOD\n>>      pointer and make the SSL_METHOD parameter in SSL_CTX_new,\n>>      SSL_CTX_set_ssl_version and SSL_set_ssl_method 'const'.\n>>\n>> Signed-off-by: Vietor Liu <vietor@vxwo.org>\n>\n> This is much easier to understand.\n\nThis indeed _is_ easier to understand, but what this means is that making\n\"meth\" const will break the compilation for people with 0.9.8k.\n\nTheir SSL_CTX_new() does not promise the callers that it won't modify the\nobject its parameter points at, so SSL_CTX_new(meth) will now see exactly\nthe same issue.  You will be discarding \"const\" qualifier by passing it.\n"}]}