[Freeswitch-svn] [commit] r13280 - in freeswitch/trunk/src: include mod/applications/mod_conference mod/applications/mod_dptools mod/applications/mod_fifo mod/applications/mod_voicemail mod/endpoints/mod_loopback mod/endpoints/mod_sofia mod/event_handlers/mod_event_socket mod/formats/mod_local_stream mod/formats/mod_shout

FreeSWITCH SVN mikej at freeswitch.org
Mon May 11 15:28:02 PDT 2009


Author: mikej
Date: Mon May 11 17:28:02 2009
New Revision: 13280

Log:
cleanup msvc code analysis tagging and warnings

Modified:
   freeswitch/trunk/src/include/switch_core.h
   freeswitch/trunk/src/include/switch_xml.h
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
   freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
   freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
   freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
   freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
   freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
   freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c

Modified: freeswitch/trunk/src/include/switch_core.h
==============================================================================
--- freeswitch/trunk/src/include/switch_core.h	(original)
+++ freeswitch/trunk/src/include/switch_core.h	Mon May 11 17:28:02 2009
@@ -1505,7 +1505,7 @@
 														const char *module_name,
 														const char *voice_name,
 														_In_ unsigned int rate,
-														_In_ unsigned int interval, switch_speech_flag_t *flags, _In_ switch_memory_pool_t *pool);
+														_In_ unsigned int interval, switch_speech_flag_t *flags, _In_opt_ switch_memory_pool_t *pool);
 /*! 
   \brief Feed text to the TTS module
   \param sh the speech handle to feed

Modified: freeswitch/trunk/src/include/switch_xml.h
==============================================================================
--- freeswitch/trunk/src/include/switch_xml.h	(original)
+++ freeswitch/trunk/src/include/switch_xml.h	Mon May 11 17:28:02 2009
@@ -104,7 +104,7 @@
  * \param dup true if you want the string to be strdup()'d automatically
  * \return the switch_xml_t or NULL if an error occured
  */ 
-SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str_dynamic(_In_z_ char *s, _In_opt_ switch_bool_t dup);
+SWITCH_DECLARE(switch_xml_t) switch_xml_parse_str_dynamic(_In_z_ char *s, _In_ switch_bool_t dup);
 
 /*! 
  * \brief Parses a string into a switch_xml_t 
@@ -156,7 +156,7 @@
 ///\param attrname the attribute name
 ///\param value the value
 ///\return an xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_find_child(_In_ switch_xml_t node, _In_z_ const char *childname, _In_z_ const char *attrname, _In_z_ const char *value);
+SWITCH_DECLARE(switch_xml_t) switch_xml_find_child(_In_ switch_xml_t node, _In_z_ const char *childname, _In_opt_z_ const char *attrname, _In_opt_z_ const char *value);
 SWITCH_DECLARE(switch_xml_t) switch_xml_find_child_multi(_In_ switch_xml_t node, _In_z_ const char *childname, ...);
 
 ///\brief returns the next tag of the same name in the same section and depth or NULL
@@ -170,7 +170,7 @@
 ///\param xml the xml node
 ///\param idx the index
 ///\return an xml node or NULL
-	 switch_xml_t switch_xml_idx(_In_z_ switch_xml_t xml, _In_opt_ int idx);
+	 switch_xml_t switch_xml_idx(_In_ switch_xml_t xml, _In_ int idx);
 
 ///\brief returns the name of the given tag
 ///\param xml the xml node
@@ -186,7 +186,7 @@
 ///\param xml the xml node
 ///\param attr the attribute
 ///\return the value
-SWITCH_DECLARE(const char *) switch_xml_attr(_In_ switch_xml_t xml, _In_z_ const char *attr);
+SWITCH_DECLARE(const char *) switch_xml_attr(_In_opt_ switch_xml_t xml, _In_opt_z_ const char *attr);
 
 ///\brief returns the value of the requested tag attribute, or "" if not found
 ///\param xml the xml node
@@ -209,7 +209,7 @@
 ///\param xml the xml node
 ///\param prn_header add <?xml version..> header too
 ///\return the xml text string
-SWITCH_DECLARE(char *) switch_xml_toxml(_In_ switch_xml_t xml, _In_opt_ switch_bool_t prn_header);
+SWITCH_DECLARE(char *) switch_xml_toxml(_In_ switch_xml_t xml, _In_ switch_bool_t prn_header);
 
 ///\brief Converts an switch_xml structure back to xml using the buffer passed in the parameters.
 ///\param xml the xml node
@@ -218,7 +218,7 @@
 ///\param offset offset to start at
 ///\param prn_header add <?xml version..> header too
 ///\return the xml text string
-SWITCH_DECLARE(char *) switch_xml_toxml_buf(_In_ switch_xml_t xml, _In_z_ char *buf, _In_ switch_size_t buflen, _In_opt_ switch_size_t offset, _In_opt_ switch_bool_t prn_header);
+SWITCH_DECLARE(char *) switch_xml_toxml_buf(_In_ switch_xml_t xml, _In_z_ char *buf, _In_ switch_size_t buflen, _In_ switch_size_t offset, _In_ switch_bool_t prn_header);
 
 ///\brief returns a NULL terminated array of processing instructions for the given
 ///\ target
@@ -230,7 +230,7 @@
 ///\brief frees the memory allocated for an switch_xml structure
 ///\param xml the xml node
 ///\note in the case of the root node the readlock will be lifted
-SWITCH_DECLARE(void) switch_xml_free(_In_ switch_xml_t xml);
+SWITCH_DECLARE(void) switch_xml_free(_In_opt_ switch_xml_t xml);
 SWITCH_DECLARE(void) switch_xml_free_in_thread(_In_ switch_xml_t xml, _In_ int stacksize);
 
 ///\brief returns parser error message or empty string if none
@@ -253,7 +253,7 @@
 ///\param name the name of the tag
 ///\param off the offset
 ///\return an xml node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_add_child(_In_ switch_xml_t xml, _In_z_ const char *name, _In_opt_ switch_size_t off);
+SWITCH_DECLARE(switch_xml_t) switch_xml_add_child(_In_ switch_xml_t xml, _In_z_ const char *name, _In_ switch_size_t off);
 
 ///\brief wrapper for switch_xml_add_child() that strdup()s name
 ///\param xml the xml node
@@ -306,7 +306,7 @@
 SWITCH_DECLARE(switch_xml_t) switch_xml_cut(_In_ switch_xml_t xml);
 
 ///\brief inserts an existing tag into an ezxml structure
-SWITCH_DECLARE(switch_xml_t) switch_xml_insert(_In_ switch_xml_t xml, _In_ switch_xml_t dest, _In_opt_ switch_size_t off);
+SWITCH_DECLARE(switch_xml_t) switch_xml_insert(_In_ switch_xml_t xml, _In_ switch_xml_t dest, _In_ switch_size_t off);
 
 ///\brief Moves an existing tag to become a subtag of dest at the given offset from
 ///\ the start of dest's character content. Returns the moved tag.
@@ -319,7 +319,7 @@
 ///\param reload if it's is already open close it and open it again as soon as permissable (blocking)
 ///\param err a pointer to set error strings
 ///\return the xml root node or NULL
-SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(_In_opt_ uint8_t reload, _Out_ const char **err);
+SWITCH_DECLARE(switch_xml_t) switch_xml_open_root(_In_ uint8_t reload, _Out_ const char **err);
 
 ///\brief initilize the core XML backend
 ///\param pool a memory pool to use
@@ -345,13 +345,13 @@
 ///\param params optional URL formatted params to pass to external gateways
 ///\return SWITCH_STATUS_SUCCESS if successful root and node will be assigned
 SWITCH_DECLARE(switch_status_t) switch_xml_locate(_In_z_ const char *section,
-												  _In_z_ const char *tag_name,
-												  _In_z_ const char *key_name, 
-												  _In_z_ const char *key_value, 
+												  _In_opt_z_ const char *tag_name,
+												  _In_opt_z_ const char *key_name, 
+												  _In_opt_z_ const char *key_value, 
 												  _Out_ switch_xml_t *root, 
 												  _Out_ switch_xml_t *node,
 												  _In_opt_ switch_event_t *params,
-												  _In_opt_ switch_bool_t clone);
+												  _In_ switch_bool_t clone);
 
 SWITCH_DECLARE(switch_status_t) switch_xml_locate_domain(_In_z_ const char *domain_name, _In_opt_ switch_event_t *params, _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain);
 
@@ -365,11 +365,11 @@
 SWITCH_DECLARE(switch_status_t) switch_xml_locate_user(_In_z_ const char *key,
 													   _In_z_ const char *user_name,
 													   _In_z_ const char *domain_name,
-													   _In_z_ const char *ip,
-													   _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain, _Out_ switch_xml_t *user, _Out_ switch_xml_t *ingroup, 
+													   _In_opt_z_ const char *ip,
+													   _Out_ switch_xml_t *root, _Out_ switch_xml_t *domain, _Out_ switch_xml_t *user, _Out_opt_ switch_xml_t *ingroup, 
 													   _In_opt_ switch_event_t *params);
 
-SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_in_domain(_In_z_ const char *user_name, _In_ switch_xml_t domain, _Out_ switch_xml_t *user, _Out_ switch_xml_t *ingroup);
+SWITCH_DECLARE(switch_status_t) switch_xml_locate_user_in_domain(_In_z_ const char *user_name, _In_ switch_xml_t domain, _Out_ switch_xml_t *user, _Out_opt_ switch_xml_t *ingroup);
 
 ///\brief open a config in the core registry
 ///\param file_path the name of the config section e.g. modules.conf
@@ -400,7 +400,7 @@
 ///\brief parse a string for a list of sections
 ///\param str a | delimited list of section names
 ///\return the section mask
-SWITCH_DECLARE(switch_xml_section_t) switch_xml_parse_section_string(_In_z_ const char *str);
+SWITCH_DECLARE(switch_xml_section_t) switch_xml_parse_section_string(_In_opt_z_ const char *str);
 
 SWITCH_END_EXTERN_C
 ///\}

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Mon May 11 17:28:02 2009
@@ -1672,6 +1672,11 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to allocate memory to duplicate execute_app data.\n");
 		goto done;
 	}
+
+	if (!app) {
+		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to find application.\n");
+		goto done;
+	}
 	switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Execute app: %s, %s\n", app, arg);
 
 	channel = switch_core_session_get_channel(member->session);
@@ -2541,10 +2546,10 @@
 		if (imember->session) {
 			const char *p;
 			for (p = dtmf; p && *p; p++) {
-				switch_dtmf_t dtmf = { *p, SWITCH_DEFAULT_DTMF_DURATION};
+				switch_dtmf_t digit = { *p, SWITCH_DEFAULT_DTMF_DURATION};
 				switch_mutex_lock(imember->control_mutex);
 				switch_core_session_kill_channel(imember->session, SWITCH_SIG_BREAK);
-				switch_core_session_send_dtmf(imember->session, &dtmf);
+				switch_core_session_send_dtmf(imember->session, &digit);
 				switch_mutex_unlock(imember->control_mutex);
 			}
 		}
@@ -4562,7 +4567,7 @@
 
 		argc = switch_separate_string(dup, '|', argv, (sizeof(argv) / sizeof(argv[0])));
 
-		for(i = 0; i < argc; i++) {
+		for(i = 0; i < argc && argv[i]; i++) {
 			if (!strcasecmp(argv[i], "mute")) {
 				*f &= ~MFLAG_CAN_SPEAK;
 			} else if (!strcasecmp(argv[i], "deaf")) {

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	Mon May 11 17:28:02 2009
@@ -2352,54 +2352,54 @@
 
 	if ((x_params = switch_xml_child(x_domain, "params"))) {
 		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
-			const char *var = switch_xml_attr(x_param, "name");
+			const char *pvar = switch_xml_attr(x_param, "name");
 			const char *val = switch_xml_attr(x_param, "value");
 
-			if (!strcasecmp(var, "dial-string")) {
+			if (!strcasecmp(pvar, "dial-string")) {
 				dest = val;
 			} else if (!strncasecmp(var, "dial-var-", 9)) {
 				if (!var_event) {
 					switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
 				} else {
-					switch_event_del_header(var_event, var + 9);
+					switch_event_del_header(var_event, pvar + 9);
 				}
-				switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, var + 9, val);
+				switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val);
 			}
 		}
 	}
 
 	if ((x_params = switch_xml_child(x_group, "params"))) {
 		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
-			const char *var = switch_xml_attr(x_param, "name");
+			const char *pvar = switch_xml_attr(x_param, "name");
 			const char *val = switch_xml_attr(x_param, "value");
 
-			if (!strcasecmp(var, "dial-string")) {
+			if (!strcasecmp(pvar, "dial-string")) {
 				dest = val;
-			} else if (!strncasecmp(var, "dial-var-", 9)) {
+			} else if (!strncasecmp(pvar, "dial-var-", 9)) {
 				if (!var_event) {
 					switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
 				} else {
-					switch_event_del_header(var_event, var + 9);
+					switch_event_del_header(var_event, pvar + 9);
 				}
-				switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, var + 9, val);
+				switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val);
 			}
 		}
 	}
 
 	if ((x_params = switch_xml_child(x_user, "params"))) {
 		for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
-			const char *var = switch_xml_attr(x_param, "name");
+			const char *pvar = switch_xml_attr(x_param, "name");
 			const char *val = switch_xml_attr(x_param, "value");
 
-			if (!strcasecmp(var, "dial-string")) {
+			if (!strcasecmp(pvar, "dial-string")) {
 				dest = val;
-			} else if (!strncasecmp(var, "dial-var-", 9)) {
+			} else if (!strncasecmp(pvar, "dial-var-", 9)) {
 				if (!var_event) {
 					switch_event_create(&var_event, SWITCH_EVENT_GENERAL);
 				} else {
-					switch_event_del_header(var_event, var + 9);
+					switch_event_del_header(var_event, pvar + 9);
 				}
-				switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, var + 9, val);
+				switch_event_add_header_string(var_event, SWITCH_STACK_BOTTOM, pvar + 9, val);
 			}
 		}
 	}
@@ -2408,7 +2408,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No dial-string available, please check your user directory.\n");
 		cause = SWITCH_CAUSE_MANDATORY_IE_MISSING;
 	} else {
-		const char *var;
+		const char *varval;
 		char *d_dest = NULL;
 		switch_channel_t *channel;
 		switch_originate_flag_t myflags = SOF_NONE;
@@ -2422,9 +2422,9 @@
 
 		if (session) {
 			channel = switch_core_session_get_channel(session);
-			if ((var = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))
-				|| (var = switch_event_get_header(var_event, "leg_timeout"))) {
-				timelimit = atoi(var);
+			if ((varval = switch_channel_get_variable(channel, SWITCH_CALL_TIMEOUT_VARIABLE))
+				|| (varval = switch_event_get_header(var_event, "leg_timeout"))) {
+				timelimit = atoi(varval);
 			}
 
 			switch_channel_set_variable(channel, "dialed_user", user);
@@ -2439,9 +2439,9 @@
 				switch_event_dup(&event, var_event);
 				switch_event_del_header(event, "dialed_user");
 				switch_event_del_header(event, "dialed_domain");
-				if ((var = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || 
-					(var = switch_event_get_header(var_event, "leg_timeout"))) {
-					timelimit = atoi(var);
+				if ((varval = switch_event_get_header(var_event, SWITCH_CALL_TIMEOUT_VARIABLE)) || 
+					(varval = switch_event_get_header(var_event, "leg_timeout"))) {
+					timelimit = atoi(varval);
 				}
 			} else {
 				switch_event_create(&event, SWITCH_EVENT_REQUEST_PARAMS);
@@ -2485,17 +2485,17 @@
 	if (new_channel && xml) {
 		if ((x_params = switch_xml_child(x_domain, "variables"))) {
 			for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
-				const char *var = switch_xml_attr(x_param, "name");
+				const char *pvar = switch_xml_attr(x_param, "name");
 				const char *val = switch_xml_attr(x_param, "value");
-				switch_channel_set_variable(new_channel, var, val);
+				switch_channel_set_variable(new_channel, pvar, val);
 			}
 		}
 
 		if ((x_params = switch_xml_child(x_user, "variables"))) {
 			for (x_param = switch_xml_child(x_params, "variable"); x_param; x_param = x_param->next) {
-				const char *var = switch_xml_attr(x_param, "name");
+				const char *pvar = switch_xml_attr(x_param, "name");
 				const char *val = switch_xml_attr(x_param, "value");
-				switch_channel_set_variable(new_channel, var, val);
+				switch_channel_set_variable(new_channel, pvar, val);
 			}
 		}
 	}

Modified: freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c	Mon May 11 17:28:02 2009
@@ -2168,8 +2168,7 @@
 		stop_node_thread();
 	}
 		
- top:
-	for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
+	for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_first(NULL, globals.fifo_hash)) {
 		int x = 0;
 		switch_hash_this(hi, NULL, NULL, &val);
 		node = (fifo_node_t *) val;
@@ -2186,8 +2185,8 @@
 		switch_core_hash_destroy(&node->consumer_hash);
 		switch_thread_rwlock_unlock(node->rwlock);
 		switch_core_destroy_memory_pool(&node->pool);
-		goto top;
 	}
+
 	switch_core_hash_destroy(&globals.fifo_hash);
 	memset(&globals, 0, sizeof(globals));
 	switch_mutex_unlock(mutex);

Modified: freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_voicemail/mod_voicemail.c	Mon May 11 17:28:02 2009
@@ -2858,15 +2858,15 @@
 
 	if (id) {
 		int ok = 1;
-		switch_event_t *params = NULL;
+		switch_event_t *locate_params = NULL;
 		const char *email_addr = NULL;
 
-		switch_event_create(&params, SWITCH_EVENT_REQUEST_PARAMS);
-		switch_assert(params);
-		switch_event_add_header_string(params, SWITCH_STACK_BOTTOM, "mailbox", id);
+		switch_event_create(&locate_params, SWITCH_EVENT_REQUEST_PARAMS);
+		switch_assert(locate_params);
+		switch_event_add_header_string(locate_params, SWITCH_STACK_BOTTOM, "mailbox", id);
 
 		if (switch_xml_locate_user("id", id, domain_name, switch_channel_get_variable(channel, "network_addr"),
-								   &x_domain_root, &x_domain, &x_user, NULL, params) == SWITCH_STATUS_SUCCESS) {
+								   &x_domain_root, &x_domain, &x_user, NULL, locate_params) == SWITCH_STATUS_SUCCESS) {
 			if ((x_params = switch_xml_child(x_user, "params"))) {
 				for (x_param = switch_xml_child(x_params, "param"); x_param; x_param = x_param->next) {
 					const char *var = switch_xml_attr_soft(x_param, "name");
@@ -2925,7 +2925,7 @@
 			ok = 0;
 		}
 
-		switch_event_destroy(&params);
+		switch_event_destroy(&locate_params);
 		
 		if (!ok) {
 			goto end;
@@ -3904,13 +3904,13 @@
 	}
 
 	if (!profile) {
-		switch_hash_index_t *hi;
-		void *val;
+		switch_hash_index_t *index;
+		void *value;
 
 		switch_mutex_lock(globals.mutex);
-		for (hi = switch_hash_first(NULL, globals.profile_hash); hi; hi = switch_hash_next(hi)) {
-			switch_hash_this(hi, NULL, NULL, &val);
-			profile = (vm_profile_t *) val;
+		for (index = switch_hash_first(NULL, globals.profile_hash); index; index = switch_hash_next(index)) {
+			switch_hash_this(index, NULL, NULL, &value);
+			profile = (vm_profile_t *) value;
 			if (profile) {
 				switch_thread_rwlock_rdlock(profile->rwlock);
 				break;

Modified: freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c	Mon May 11 17:28:02 2009
@@ -565,7 +565,7 @@
 	if (switch_test_flag(tech_pvt, TFLAG_CNG)) {
 		unsigned char data[SWITCH_RECOMMENDED_BUFFER_SIZE];
 		uint32_t flag = 0;
-		switch_status_t status;
+		switch_status_t encode_status;
 		uint32_t rate = tech_pvt->read_codec.implementation->actual_samples_per_second;
 
 		*frame = &tech_pvt->cng_frame;
@@ -575,7 +575,7 @@
 		memset(&data, 0, sizeof(data));
 
 		if (strcasecmp(tech_pvt->read_codec.implementation->iananame, "L16")) {
-			status = switch_core_codec_encode(&tech_pvt->read_codec,
+			encode_status = switch_core_codec_encode(&tech_pvt->read_codec,
 											  NULL,
 											  data,
 											  sizeof(data),
@@ -585,7 +585,7 @@
 											  &tech_pvt->cng_frame.datalen,											  
 											  &rate,
 											  &flag);
-			if (status != SWITCH_STATUS_SUCCESS) {
+			if (encode_status != SWITCH_STATUS_SUCCESS) {
 				switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
 			}
 													 
@@ -664,7 +664,7 @@
 		}
 	}
 
-	if (switch_test_flag(tech_pvt, TFLAG_LINKED)) {
+	if (switch_test_flag(tech_pvt, TFLAG_LINKED) && tech_pvt->other_tech_pvt) { 
 		switch_frame_t *clone;
 
 		if (frame->codec->implementation != tech_pvt->write_codec.implementation) {

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia.c	Mon May 11 17:28:02 2009
@@ -4096,7 +4096,7 @@
  end:
 
 
-	if (switch_event_create(&event, SWITCH_EVENT_RECV_INFO) == SWITCH_STATUS_SUCCESS) {
+	if (sip && switch_event_create(&event, SWITCH_EVENT_RECV_INFO) == SWITCH_STATUS_SUCCESS) {
 		sip_alert_info_t *alert_info = sip_alert_info(sip);
 
 		if (sip && sip->sip_content_type) {

Modified: freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c
==============================================================================
--- freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	(original)
+++ freeswitch/trunk/src/mod/event_handlers/mod_event_socket/mod_event_socket.c	Mon May 11 17:28:02 2009
@@ -1177,8 +1177,8 @@
 			
 
 			if (listener->session) {
-				switch_channel_t *channel = switch_core_session_get_channel(listener->session);
-				if (switch_channel_get_state(channel) < CS_HANGUP && switch_channel_test_flag(channel, CF_DIVERT_EVENTS)) {
+				switch_channel_t *chan = switch_core_session_get_channel(listener->session);
+				if (switch_channel_get_state(chan) < CS_HANGUP && switch_channel_test_flag(chan, CF_DIVERT_EVENTS)) {
 					switch_event_t *e = NULL;
 					while (switch_core_session_dequeue_event(listener->session, &e, SWITCH_TRUE) == SWITCH_STATUS_SUCCESS) {
 						if (switch_queue_trypush(listener->event_queue, e) != SWITCH_STATUS_SUCCESS) {
@@ -1480,8 +1480,10 @@
 			switch_set_flag_locked(listener, LFLAG_CONNECTED);			
 			switch_event_create(&call_event, SWITCH_EVENT_CHANNEL_DATA);
 			
-			switch_caller_profile_event_set_data(switch_channel_get_caller_profile(channel), "Channel", call_event);
-			switch_channel_event_set_data(channel, call_event);
+			if (channel) {
+				switch_caller_profile_event_set_data(switch_channel_get_caller_profile(channel), "Channel", call_event);
+				switch_channel_event_set_data(channel, call_event);
+			}
 			switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Content-Type", "command/reply");
 			switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Reply-Text", "+OK\n");
 			switch_event_add_header_string(call_event, SWITCH_STACK_BOTTOM, "Socket-Mode", switch_test_flag(listener, LFLAG_ASYNC) ? "async" : "static");

Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c	Mon May 11 17:28:02 2009
@@ -597,6 +597,10 @@
 			}
 		}
 		
+		if (!local_stream_name) {
+			goto usage;
+		}
+
 		source = switch_core_hash_find(globals.source_hash, local_stream_name);
 		if (source) {
 			if (xml) {

Modified: freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	(original)
+++ freeswitch/trunk/src/mod/formats/mod_shout/mod_shout.c	Mon May 11 17:28:02 2009
@@ -712,7 +712,7 @@
 			context->stream_url = switch_core_sprintf(context->memory_pool, "http://%s", path);
 			context->prebuf = handle->prebuf;
 			launch_read_stream_thread(context);
-			while((switch_buffer_inuse(context->audio_buffer) < 1*2*context->samplerate) && ++sanity < 10) { 
+			while((switch_buffer_inuse(context->audio_buffer) < (switch_size_t)(2 * context->samplerate)) && ++sanity < 10) { 
 				/* at least 1s of audio and up to 5s initialize */
 				switch_yield(500000);
 			}



More information about the Freeswitch-svn mailing list