]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
cleanup msvc code analysis tagging and warnings
authorMichael Jerris <mike@jerris.com>
Mon, 11 May 2009 22:28:02 +0000 (22:28 +0000)
committerMichael Jerris <mike@jerris.com>
Mon, 11 May 2009 22:28:02 +0000 (22:28 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13280 d0543943-73ff-0310-b7d9-9358b9ac24b2

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

index 4f4f75f9338f56eefa57b990eb598785da756dea..47ee84caf3fc919f8f39730713012484c00b84b7 100644 (file)
@@ -1505,7 +1505,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(_In_ switch_speech_handl
                                                                                                                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
index 0cbcbc7d52ad92871544431da915b6e0f72a15e6..96639d4a88be5d64c8462fc4dcd13d62f100d6ea 100644 (file)
@@ -104,7 +104,7 @@ struct switch_xml {
  * \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 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_child(_In_ switch_xml_t xml, _In_z_ cons
 ///\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 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_find_child_multi(_In_ switch_xml_t node,
 ///\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 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_find_child_multi(_In_ switch_xml_t node,
 ///\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 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_get(_In_ switch_xml_t xml, ...);
 ///\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 @@ SWITCH_DECLARE(char *) switch_xml_toxml(_In_ switch_xml_t xml, _In_opt_ switch_b
 ///\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 @@ SWITCH_DECLARE(const char **) switch_xml_pi(_In_ switch_xml_t xml, _In_z_ const
 ///\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 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_new(_In_z_ const char *name);
 ///\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_set_flag(switch_xml_t xml, switch_xml_fl
 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 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_insert(_In_ switch_xml_t xml, _In_ switc
 ///\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 @@ SWITCH_DECLARE(switch_xml_t) switch_xml_root(void);
 ///\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_group(_In_z_ const char *group
 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 @@ SWITCH_DECLARE(switch_status_t) switch_xml_unbind_search_function_ptr(_In_ switc
 ///\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
 ///\}
index 8de27a76be55b509af29bfb7ccc0b9c7eb8492f3..60e1c5cbaed8e65babca729a717557be65545ad5 100644 (file)
@@ -1672,6 +1672,11 @@ static void conference_loop_fn_exec_app(conference_member_t *member, caller_cont
                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 @@ static void conference_send_all_dtmf(conference_member_t *member, conference_obj
                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 @@ static void set_mflags(char *flags, member_flag_t *f)
 
                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")) {
index 25a2590e56ad96b363fd1d16f71bbba1ffac000e..bdcc38e84bbe25d2581edb1f9d3cbce67bc9c05f 100644 (file)
@@ -2352,54 +2352,54 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
 
        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 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
                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 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
 
                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 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
                                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 @@ static switch_call_cause_t user_outgoing_channel(switch_core_session_t *session,
        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);
                        }
                }
        }
index 022ac59b9b5313894811631672633e1e4e0a0732..caa2b60fa96cadf01a6860ca5abad9f47cbeecfa 100644 (file)
@@ -2168,8 +2168,7 @@ SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
                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_MODULE_SHUTDOWN_FUNCTION(mod_fifo_shutdown)
                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);
index f2ff641849fcf7887cbcb9c35a40767dd00dc0bc..30eee87ecfeac5a06231fb07a6fcc477e198fcd5 100644 (file)
@@ -2858,15 +2858,15 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
 
        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 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p
                        ok = 0;
                }
 
-               switch_event_destroy(&params);
+               switch_event_destroy(&locate_params);
                
                if (!ok) {
                        goto end;
@@ -3904,13 +3904,13 @@ SWITCH_STANDARD_API(voicemail_api_function)
        }
 
        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;
index b47c99f74614e5e93ce51fb061f3caf6cfb8a7ba..d522e0e3b7534129645c239965f377562c2d891f 100644 (file)
@@ -565,7 +565,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
        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 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
                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 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
                                                                                          &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 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
                }
        }
 
-       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) {
index 8bcc130dac2b3077bec3a926030f134684a7ad2f..221f9dd7260155a43cb7a281987522b757418c7c 100644 (file)
@@ -4096,7 +4096,7 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
  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) {
index 42970fb33cb768eb4d8a95201577ca18957d9309..84fb2999c9726dc04fa5b94e91a2a758ec06a5eb 100644 (file)
@@ -1177,8 +1177,8 @@ static switch_status_t read_packet(listener_t *listener, switch_event_t **event,
                        
 
                        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 @@ static switch_status_t parse_command(listener_t *listener, switch_event_t **even
                        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");
index 2cc866145d8bf46551633a1a76e52a8608d61fd1..d431fe496a8e2ed3fb1ffd04a09b81ed9d531108 100644 (file)
@@ -597,6 +597,10 @@ SWITCH_STANDARD_API(show_local_stream_function)
                        }
                }
                
+               if (!local_stream_name) {
+                       goto usage;
+               }
+
                source = switch_core_hash_find(globals.source_hash, local_stream_name);
                if (source) {
                        if (xml) {
index a8d14d1eea9678b5fcbecfd3743aa073767cb691..278abfbfdcd664df855dd252e9b8bfe3faa1bd8a 100644 (file)
@@ -712,7 +712,7 @@ static switch_status_t shout_file_open(switch_file_handle_t *handle, const char
                        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);
                        }