From 7b6182aa13cc4fd105930095637a6f74c61093eb Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Thu, 1 Nov 2007 11:55:00 +0000 Subject: [PATCH] const qualifiers in asr/tts interfaces. git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6121 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/include/switch_core.h | 12 ++++++++---- src/include/switch_ivr.h | 7 +++++-- src/include/switch_module_interfaces.h | 6 +++--- src/switch_core_asr.c | 12 ++++++++---- src/switch_ivr_async.c | 8 ++++++-- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/src/include/switch_core.h b/src/include/switch_core.h index 93bac7cdef..34bd23fe65 100644 --- a/src/include/switch_core.h +++ b/src/include/switch_core.h @@ -1252,8 +1252,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_close(switch_speech_handle_t \return SWITCH_STATUS_SUCCESS if the asr handle was opened */ SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah, - char *module_name, - char *codec, int rate, char *dest, switch_asr_flag_t *flags, switch_memory_pool_t *pool); + const char *module_name, + const char *codec, + int rate, + const char *dest, + switch_asr_flag_t *flags, + switch_memory_pool_t *pool); /*! \brief Close an asr handle @@ -1297,7 +1301,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_get_results(switch_asr_handle_t \param path the path to the grammaar file \return SWITCH_STATUS_SUCCESS */ -SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, char *grammar, char *path); +SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path); /*! \brief Unload a grammar from an asr handle @@ -1305,7 +1309,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t \param grammar the grammar to unload \return SWITCH_STATUS_SUCCESS */ -SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, char *grammar); +SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar); /*! \brief Pause detection on an asr handle diff --git a/src/include/switch_ivr.h b/src/include/switch_ivr.h index 54188285e1..fbc23153be 100644 --- a/src/include/switch_ivr.h +++ b/src/include/switch_ivr.h @@ -153,7 +153,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess \return SWITCH_STATUS_SUCCESS if all is well */ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session, - char *mod_name, char *grammar, char *path, char *dest, switch_asr_handle_t *ah); + const char *mod_name, + const char *grammar, + const char *path, + const char *dest, switch_asr_handle_t *ah); /*! \brief Stop background Speech detection on a session @@ -191,7 +194,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_cor \param grammar the grammar name \return SWITCH_STATUS_SUCCESS if all is well */ -SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, char *grammar); +SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *grammar); /*! \brief Record a session to disk diff --git a/src/include/switch_module_interfaces.h b/src/include/switch_module_interfaces.h index a6be73c393..40a870ce40 100644 --- a/src/include/switch_module_interfaces.h +++ b/src/include/switch_module_interfaces.h @@ -294,11 +294,11 @@ struct switch_asr_interface { /*! the name of the interface */ const char *interface_name; /*! function to open the asr interface */ - switch_status_t (*asr_open) (switch_asr_handle_t *ah, char *codec, int rate, char *dest, switch_asr_flag_t *flags); + switch_status_t (*asr_open) (switch_asr_handle_t *ah, const char *codec, int rate, const char *dest, switch_asr_flag_t *flags); /*! function to load a grammar to the asr interface */ - switch_status_t (*asr_load_grammar) (switch_asr_handle_t *ah, char *grammar, char *path); + switch_status_t (*asr_load_grammar) (switch_asr_handle_t *ah, const char *grammar, const char *path); /*! function to unload a grammar to the asr interface */ - switch_status_t (*asr_unload_grammar) (switch_asr_handle_t *ah, char *grammar); + switch_status_t (*asr_unload_grammar) (switch_asr_handle_t *ah, const char *grammar); /*! function to close the asr interface */ switch_status_t (*asr_close) (switch_asr_handle_t *ah, switch_asr_flag_t *flags); /*! function to feed audio to the ASR */ diff --git a/src/switch_core_asr.c b/src/switch_core_asr.c index aa510f3f26..a3324e9b06 100644 --- a/src/switch_core_asr.c +++ b/src/switch_core_asr.c @@ -35,8 +35,12 @@ #include "private/switch_core_pvt.h" SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah, - char *module_name, - char *codec, int rate, char *dest, switch_asr_flag_t *flags, switch_memory_pool_t *pool) + const char *module_name, + const char *codec, + int rate, + const char *dest, + switch_asr_flag_t *flags, + switch_memory_pool_t *pool) { switch_status_t status; char buf[256] = ""; @@ -77,7 +81,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_open(switch_asr_handle_t *ah, return ah->asr_interface->asr_open(ah, codec, rate, dest, flags); } -SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, char *grammar, char *path) +SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t *ah, const char *grammar, const char *path) { char *epath = NULL; switch_status_t status; @@ -95,7 +99,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_asr_load_grammar(switch_asr_handle_t return status; } -SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, char *grammar) +SWITCH_DECLARE(switch_status_t) switch_core_asr_unload_grammar(switch_asr_handle_t *ah, const char *grammar) { switch_status_t status; diff --git a/src/switch_ivr_async.c b/src/switch_ivr_async.c index a323eafda3..ec8dd9c783 100644 --- a/src/switch_ivr_async.c +++ b/src/switch_ivr_async.c @@ -1042,7 +1042,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_load_grammar(switch_cor } -SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, char *grammar) +SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_core_session_t *session, const char *grammar) { switch_channel_t *channel = switch_core_session_get_channel(session); switch_asr_flag_t flags = SWITCH_ASR_FLAG_NONE; @@ -1064,7 +1064,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech_unload_grammar(switch_c } SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *session, - char *mod_name, char *grammar, char *path, char *dest, switch_asr_handle_t *ah) + const char *mod_name, + const char *grammar, + const char *path, + const char *dest, + switch_asr_handle_t *ah) { switch_channel_t *channel; switch_codec_t *read_codec;