diff --git a/src/include/switch_event.h b/src/include/switch_event.h index be344ffaa4..bbb648df13 100644 --- a/src/include/switch_event.h +++ b/src/include/switch_event.h @@ -124,7 +124,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_shutdown(void); SWITCH_DECLARE(switch_status_t) switch_event_create_subclass_detailed(const char *file, const char *func, int line, switch_event_t **event, switch_event_types_t event_id, const char *subclass_name); -#define switch_event_create_subclass(_e, _eid, _sn) switch_event_create_subclass_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, _e, _eid, _sn) +#define switch_event_create_subclass(_e, _eid, _sn) switch_event_create_subclass_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, _e, _eid, _sn) /*! \brief Set the priority of an event @@ -202,7 +202,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_dup(switch_event_t **event, switch_ SWITCH_DECLARE(switch_status_t) switch_event_fire_detailed(const char *file, const char *func, int line, switch_event_t **event, void *user_data); SWITCH_DECLARE(void) switch_event_prep_for_delivery_detailed(const char *file, const char *func, int line, switch_event_t *event); -#define switch_event_prep_for_delivery(_event) switch_event_prep_for_delivery_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, _event) +#define switch_event_prep_for_delivery(_event) switch_event_prep_for_delivery_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, _event) /*! @@ -310,7 +310,7 @@ SWITCH_DECLARE(switch_status_t) switch_event_create_pres_in_detailed(_In_z_ char _In_z_ const char *alt_event_type, _In_ int event_count, _In_z_ const char *unique_id, _In_z_ const char *channel_state, _In_z_ const char *answer_state, _In_z_ const char *call_direction); -#define switch_event_create_pres_in(event) switch_event_create_pres_in_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, \ +#define switch_event_create_pres_in(event) switch_event_create_pres_in_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, \ proto, login, from, from_domain, status, event_type, alt_event_type, event_count, \ unique_id, channel_state, answer_state, call_direction) @@ -345,7 +345,7 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event); \return SWITCH_STATUS_SUCCESS if the operation was successful \note the body supplied by this function will supersede an existing body the event may have */ -#define switch_event_fire(event) switch_event_fire_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, event, NULL) +#define switch_event_fire(event) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, NULL) /*! \brief Fire an event filling in most of the arguements with obvious values and allowing user_data to be sent @@ -354,7 +354,7 @@ SWITCH_DECLARE(void) switch_event_deliver(switch_event_t **event); \return SWITCH_STATUS_SUCCESS if the operation was successful \note the body supplied by this function will supersede an existing body the event may have */ -#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (char * )__SWITCH_FUNC__, __LINE__, event, data) +#define switch_event_fire_data(event, data) switch_event_fire_detailed(__FILE__, (const char * )__SWITCH_FUNC__, __LINE__, event, data) SWITCH_DECLARE(char *) switch_event_build_param_string(switch_event_t *event, const char *prefix, switch_hash_t *vars_map); diff --git a/src/switch_apr.c b/src/switch_apr.c index d841060fdf..ae4ca68c30 100644 --- a/src/switch_apr.c +++ b/src/switch_apr.c @@ -786,7 +786,7 @@ SWITCH_DECLARE(switch_status_t) switch_pollset_create(switch_pollset_t **pollset SWITCH_DECLARE(switch_status_t) switch_pollset_add(switch_pollset_t *pollset, const switch_pollfd_t *descriptor) { - return apr_pollset_add((apr_pollset_t *)pollset, (apr_pollfd_t *)descriptor); + return apr_pollset_add((apr_pollset_t *)pollset, (const apr_pollfd_t *)descriptor); } SWITCH_DECLARE(switch_status_t) switch_poll(switch_pollfd_t *aprset, int32_t numsock, int32_t *nsds, switch_interval_time_t timeout) diff --git a/src/switch_channel.c b/src/switch_channel.c index d993382b91..79daf4ee35 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -489,7 +489,7 @@ SWITCH_DECLARE(const char *) switch_channel_get_variable(switch_channel_t *chann switch_assert(channel != NULL); switch_mutex_lock(channel->profile_mutex); - if (!channel->variables || !(v = switch_event_get_header(channel->variables, (char *) varname))) { + if (!channel->variables || !(v = switch_event_get_header(channel->variables, varname))) { switch_caller_profile_t *cp = channel->caller_profile; if (cp) { @@ -969,7 +969,7 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state( switch_channel_clear_flag(channel, CF_TAGGED); if (channel->state >= CS_ROUTING && channel->state <= CS_HANGUP) { - switch_channel_presence(channel, "unknown", (char *) state_names[state], NULL); + switch_channel_presence(channel, "unknown", (const char *) state_names[state], NULL); } if (state < CS_HANGUP) { @@ -978,10 +978,8 @@ SWITCH_DECLARE(switch_channel_state_t) switch_channel_perform_set_running_state( if (state == CS_ROUTING) { switch_channel_event_set_data(channel, event); } else { - char state_num[25]; - switch_snprintf(state_num, sizeof(state_num), "%d", state); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State", (char *) switch_channel_state_name(state)); - switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", (char *) state_num); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-State", switch_channel_state_name(state)); + switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-State-Number", "%d", state); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Channel-Name", channel->name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Unique-ID", switch_core_session_get_uuid(channel->session)); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Call-Direction",