[Freeswitch-svn] [commit] r12640 - in freeswitch/trunk/src: . include

FreeSWITCH SVN mrene at freeswitch.org
Tue Mar 17 06:25:02 PDT 2009


Author: mrene
Date: Tue Mar 17 08:25:02 2009
New Revision: 12640

Log:
Fix a bunch of const (-Wcast-qual checking start)

Modified:
   freeswitch/trunk/src/include/switch_event.h
   freeswitch/trunk/src/switch_apr.c
   freeswitch/trunk/src/switch_channel.c

Modified: freeswitch/trunk/src/include/switch_event.h
==============================================================================
--- freeswitch/trunk/src/include/switch_event.h	(original)
+++ freeswitch/trunk/src/include/switch_event.h	Tue Mar 17 08:25:02 2009
@@ -124,7 +124,7 @@
 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_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 @@
 																	 _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 @@
   \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 @@
   \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);
 

Modified: freeswitch/trunk/src/switch_apr.c
==============================================================================
--- freeswitch/trunk/src/switch_apr.c	(original)
+++ freeswitch/trunk/src/switch_apr.c	Tue Mar 17 08:25:02 2009
@@ -786,7 +786,7 @@
 
 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)

Modified: freeswitch/trunk/src/switch_channel.c
==============================================================================
--- freeswitch/trunk/src/switch_channel.c	(original)
+++ freeswitch/trunk/src/switch_channel.c	Tue Mar 17 08:25:02 2009
@@ -489,7 +489,7 @@
 	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_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 @@
 			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",



More information about the Freeswitch-svn mailing list