PROTON-868: Avoid "strict aliasing" warnings caused on some compilers
Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/0edb24df Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/0edb24df Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/0edb24df Branch: refs/heads/cjansen-cpp-client Commit: 0edb24df7d30ec835acf5cf36a23c28f32100e75 Parents: 0e155e2 Author: Andrew Stitcher <[email protected]> Authored: Tue May 12 14:12:35 2015 -0400 Committer: Andrew Stitcher <[email protected]> Committed: Tue May 12 14:12:35 2015 -0400 ---------------------------------------------------------------------- proton-c/src/sasl/cyrus_sasl.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/0edb24df/proton-c/src/sasl/cyrus_sasl.c ---------------------------------------------------------------------- diff --git a/proton-c/src/sasl/cyrus_sasl.c b/proton-c/src/sasl/cyrus_sasl.c index c6010e2..7ab7379 100644 --- a/proton-c/src/sasl/cyrus_sasl.c +++ b/proton-c/src/sasl/cyrus_sasl.c @@ -113,12 +113,14 @@ bool pni_init_client(pn_transport_t* transport) { if (result!=SASL_OK) return false; const sasl_callback_t *callbacks = sasl->username ? sasl->password ? pni_user_password_callbacks : pni_user_callbacks : NULL; + sasl_conn_t *cyrus_conn; result = sasl_client_new(amqp_service, sasl->remote_fqdn, NULL, NULL, callbacks, 0, - (sasl_conn_t**)&sasl->impl_context); + &cyrus_conn); if (result!=SASL_OK) return false; + sasl->impl_context = cyrus_conn; return true; } @@ -227,14 +229,15 @@ static int pni_wrap_server_new(pn_transport_t *transport) result = sasl_server_init(NULL, sasl->config_name); if (result!=SASL_OK) return result; - result = sasl_server_new(amqp_service, NULL, NULL, NULL, NULL, NULL, 0, (sasl_conn_t**)&sasl->impl_context); + sasl_conn_t *cyrus_conn; + result = sasl_server_new(amqp_service, NULL, NULL, NULL, NULL, NULL, 0, &cyrus_conn); if (result!=SASL_OK) return result; + sasl->impl_context = cyrus_conn; sasl_security_properties_t secprops = {0}; secprops.security_flags = SASL_SEC_NOPLAINTEXT | ( transport->auth_required ? SASL_SEC_NOANONYMOUS : 0 ) ; - sasl_conn_t *cyrus_conn = (sasl_conn_t*)sasl->impl_context; result = sasl_setprop(cyrus_conn, SASL_SEC_PROPS, &secprops); if (result!=SASL_OK) return result; @@ -356,7 +359,9 @@ void pni_process_response(pn_transport_t *transport, const pn_bytes_t *recv) void pni_sasl_impl_free(pn_transport_t *transport) { - sasl_dispose((sasl_conn_t**)&transport->sasl->impl_context); + sasl_conn_t *cyrus_conn = (sasl_conn_t*)transport->sasl->impl_context; + sasl_dispose(&cyrus_conn); + transport->sasl->impl_context = cyrus_conn; if (transport->sasl->client) { sasl_client_done(); } else { --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
