add more function details for code analysis.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6911 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-12-20 03:07:00 +00:00
parent a7f1b439fc
commit e3c48c6ac1
4 changed files with 51 additions and 31 deletions

View File

@ -137,7 +137,9 @@ struct switch_caller_extension {
\param extension_number extension number \param extension_number extension number
\return a new extension object allocated from the session's memory pool \return a new extension object allocated from the session's memory pool
*/ */
SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_core_session_t *session, const char *extension_name, const char *extension_number); SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(_In_ switch_core_session_t *session,
_In_z_ const char *extension_name,
_In_z_ const char *extension_number);
/*! /*!
\brief Add an application (instruction) to the given extension \brief Add an application (instruction) to the given extension
@ -146,8 +148,10 @@ SWITCH_DECLARE(switch_caller_extension_t *) switch_caller_extension_new(switch_c
\param application_name the name of the application \param application_name the name of the application
\param extra_data optional argument to the application \param extra_data optional argument to the application
*/ */
SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session_t *session, SWITCH_DECLARE(void) switch_caller_extension_add_application(_In_ switch_core_session_t *session,
switch_caller_extension_t *caller_extension, const char *application_name, const char *extra_data); _In_ switch_caller_extension_t *caller_extension,
_In_z_ const char *application_name,
_In_z_ const char *extra_data);
/*! /*!
@ -156,7 +160,8 @@ SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session
\param name the name \param name the name
\note this function is meant for situations where the name paramater is the contents of the variable \note this function is meant for situations where the name paramater is the contents of the variable
*/ */
SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(switch_caller_profile_t *caller_profile, const char *name); _Check_return_ _Ret_opt_z_ SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(_In_ switch_caller_profile_t *caller_profile,
_In_z_ const char *name);
/*! /*!
\brief Create a new caller profile object \brief Create a new caller profile object
@ -174,30 +179,32 @@ SWITCH_DECLARE(const char *) switch_caller_get_field_by_name(switch_caller_profi
\param destination_number destination number \param destination_number destination number
\return a new profile object allocated from the session's memory pool \return a new profile object allocated from the session's memory pool
*/ */
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(switch_memory_pool_t *pool, SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_new(_In_ switch_memory_pool_t *pool,
const char *username, _In_opt_z_ const char *username,
const char *dialplan, _In_opt_z_ const char *dialplan,
const char *caller_id_name, _In_opt_z_ const char *caller_id_name,
const char *caller_id_number, _In_opt_z_ const char *caller_id_number,
const char *network_addr, _In_opt_z_ const char *network_addr,
const char *ani, _In_opt_z_ const char *ani,
const char *aniii, _In_opt_z_ const char *aniii,
const char *rdnis, const char *source, const char *context, _In_opt_z_ const char *rdnis,
const char *destination_number); _In_opt_z_ const char *source,
_In_opt_z_ const char *context,
_In_opt_z_ const char *destination_number);
/*! /*!
\brief Clone an existing caller profile object \brief Clone an existing caller profile object
\param session session associated with the profile (bound by scope) \param session session associated with the profile (bound by scope)
\param tocopy the existing profile \param tocopy the existing profile
*/ */
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(switch_core_session_t *session, switch_caller_profile_t *tocopy); SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_clone(_In_ switch_core_session_t *session, _In_ switch_caller_profile_t *tocopy);
/*! /*!
\brief Duplicate an existing caller profile object \brief Duplicate an existing caller profile object
\param pool pool to duplicate with \param pool pool to duplicate with
\param tocopy the existing profile \param tocopy the existing profile
*/ */
SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(switch_memory_pool_t *pool, switch_caller_profile_t *tocopy); SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(_In_ switch_memory_pool_t *pool, _In_ switch_caller_profile_t *tocopy);
/*! /*!
\brief Add headers to an existing event in regards to a specific profile \brief Add headers to an existing event in regards to a specific profile
@ -206,7 +213,9 @@ SWITCH_DECLARE(switch_caller_profile_t *) switch_caller_profile_dup(switch_memor
\param event the event to add the information to \param event the event to add the information to
*/ */
SWITCH_DECLARE(void) switch_caller_profile_event_set_data(switch_caller_profile_t *caller_profile, const char *prefix, switch_event_t *event); SWITCH_DECLARE(void) switch_caller_profile_event_set_data(_In_ switch_caller_profile_t *caller_profile,
_In_opt_z_ const char *prefix,
_In_ switch_event_t *event);
SWITCH_END_EXTERN_C SWITCH_END_EXTERN_C
/** @} */ /** @} */

View File

@ -128,49 +128,52 @@ struct switch_core_port_allocator;
\param new_bug pointer to assign new bug to \param new_bug pointer to assign new bug to
\return SWITCH_STATUS_SUCCESS if the operation was a success \return SWITCH_STATUS_SUCCESS if the operation was a success
*/ */
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(switch_core_session_t *session, SWITCH_DECLARE(switch_status_t) switch_core_media_bug_add(_In_ switch_core_session_t *session,
switch_media_bug_callback_t callback, _In_ switch_media_bug_callback_t callback,
void *user_data, time_t stop_time, switch_media_bug_flag_t flags, switch_media_bug_t **new_bug); _In_opt_ void *user_data,
_In_ time_t stop_time,
_In_ switch_media_bug_flag_t flags,
_Out_ switch_media_bug_t **new_bug);
/*! /*!
\brief Obtain private data from a media bug \brief Obtain private data from a media bug
\param bug the bug to get the data from \param bug the bug to get the data from
\return the private data \return the private data
*/ */
SWITCH_DECLARE(void *) switch_core_media_bug_get_user_data(switch_media_bug_t *bug); SWITCH_DECLARE(void *) switch_core_media_bug_get_user_data(_In_ switch_media_bug_t *bug);
/*! /*!
\brief Obtain a replace frame from a media bug \brief Obtain a replace frame from a media bug
\param bug the bug to get the data from \param bug the bug to get the data from
*/ */
SWITCH_DECLARE(switch_frame_t *) switch_core_media_bug_get_write_replace_frame(switch_media_bug_t *bug); SWITCH_DECLARE(switch_frame_t *) switch_core_media_bug_get_write_replace_frame(_In_ switch_media_bug_t *bug);
/*! /*!
\brief Set a return replace frame \brief Set a return replace frame
\param bug the bug to set the frame on \param bug the bug to set the frame on
\param frame the frame to set \param frame the frame to set
*/ */
SWITCH_DECLARE(void) switch_core_media_bug_set_write_replace_frame(switch_media_bug_t *bug, switch_frame_t *frame); SWITCH_DECLARE(void) switch_core_media_bug_set_write_replace_frame(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame);
/*! /*!
\brief Obtain a replace frame from a media bug \brief Obtain a replace frame from a media bug
\param bug the bug to get the data from \param bug the bug to get the data from
*/ */
SWITCH_DECLARE(switch_frame_t *) switch_core_media_bug_get_read_replace_frame(switch_media_bug_t *bug); SWITCH_DECLARE(switch_frame_t *) switch_core_media_bug_get_read_replace_frame(_In_ switch_media_bug_t *bug);
/*! /*!
\brief Obtain the session from a media bug \brief Obtain the session from a media bug
\param bug the bug to get the data from \param bug the bug to get the data from
*/ */
SWITCH_DECLARE(switch_core_session_t *) switch_core_media_bug_get_session(switch_media_bug_t *bug); SWITCH_DECLARE(switch_core_session_t *) switch_core_media_bug_get_session(_In_ switch_media_bug_t *bug);
SWITCH_DECLARE(uint32_t) switch_core_media_bug_test_flag(switch_media_bug_t *bug, uint32_t flag); SWITCH_DECLARE(uint32_t) switch_core_media_bug_test_flag(_In_ switch_media_bug_t *bug, _In_ uint32_t flag);
/*! /*!
\brief Set a return replace frame \brief Set a return replace frame
\param bug the bug to set the frame on \param bug the bug to set the frame on
\param frame the frame to set \param frame the frame to set
*/ */
SWITCH_DECLARE(void) switch_core_media_bug_set_read_replace_frame(switch_media_bug_t *bug, switch_frame_t *frame); SWITCH_DECLARE(void) switch_core_media_bug_set_read_replace_frame(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame);
/*! /*!
\brief Remove a media bug from the session \brief Remove a media bug from the session
@ -178,20 +181,20 @@ SWITCH_DECLARE(void) switch_core_media_bug_set_read_replace_frame(switch_media_b
\param bug bug to remove \param bug bug to remove
\return SWITCH_STATUS_SUCCESS if the operation was a success \return SWITCH_STATUS_SUCCESS if the operation was a success
*/ */
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(switch_core_session_t *session, switch_media_bug_t **bug); SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove(_In_ switch_core_session_t *session, _Inout_ switch_media_bug_t **bug);
/*! /*!
\brief Close and destroy a media bug \brief Close and destroy a media bug
\param bug bug to remove \param bug bug to remove
\return SWITCH_STATUS_SUCCESS if the operation was a success \return SWITCH_STATUS_SUCCESS if the operation was a success
*/ */
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(switch_media_bug_t **bug); SWITCH_DECLARE(switch_status_t) switch_core_media_bug_close(_Inout_ switch_media_bug_t **bug);
/*! /*!
\brief Remove all media bugs from the session \brief Remove all media bugs from the session
\param session the session to remove the bugs from \param session the session to remove the bugs from
\return SWITCH_STATUS_SUCCESS if the operation was a success \return SWITCH_STATUS_SUCCESS if the operation was a success
*/ */
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(switch_core_session_t *session); SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(_In_ switch_core_session_t *session);
/*! /*!
\brief Read a frame from the bug \brief Read a frame from the bug
@ -199,7 +202,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_remove_all(switch_core_ses
\param frame the frame to write the data to \param frame the frame to write the data to
\return the amount of data \return the amount of data
*/ */
SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *bug, switch_frame_t *frame); SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(_In_ switch_media_bug_t *bug, _In_ switch_frame_t *frame);
///\} ///\}

View File

@ -303,10 +303,14 @@ SWITCH_END_EXTERN_C
#define _In_ #define _In_
#define _In_z_ #define _In_z_
#define _In_opt_z_ #define _In_opt_z_
#define _In_opt_
#define _Printf_format_string_ #define _Printf_format_string_
#define _Ret_opt_z_ #define _Ret_opt_z_
#define _Ret_z_ #define _Ret_z_
#define _Out_opt_
#define _Out_
#define _Check_return_ #define _Check_return_
#define _Inout_
#endif #endif

View File

@ -282,6 +282,10 @@ SWITCH_STANDARD_DIALPLAN(asterisk_dialplan_hunt)
switch_regex_safe_free(re); switch_regex_safe_free(re);
if (!extension) { if (!extension) {
if (switch_strlen_zero(field_data)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "No extension!\n");
break;
}
if ((extension = switch_caller_extension_new(session, field_data, field_data)) == 0) { if ((extension = switch_caller_extension_new(session, field_data, field_data)) == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
break; break;