Const-ify the world (or at least a good part of it)

This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes:

- CLI command handlers
- CLI command handler arguments
- AGI command handlers
- AGI command handler arguments
- Dialplan application handler arguments
- Speech engine API function arguments

In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing.

Review: https://reviewboard.asterisk.org/r/251/



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@196072 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Kevin P. Fleming
2009-05-21 21:13:09 +00:00
parent 88bda581ec
commit e6b2e9a750
145 changed files with 802 additions and 806 deletions

View File

@@ -78,13 +78,13 @@ struct ast_speech_engine {
/*! Destroy any data set on the speech structure by the engine */
int (*destroy)(struct ast_speech *speech);
/*! Load a local grammar on the speech structure */
int (*load)(struct ast_speech *speech, char *grammar_name, char *grammar);
int (*load)(struct ast_speech *speech, const char *grammar_name, const char *grammar);
/*! Unload a local grammar */
int (*unload)(struct ast_speech *speech, char *grammar_name);
int (*unload)(struct ast_speech *speech, const char *grammar_name);
/*! Activate a loaded grammar */
int (*activate)(struct ast_speech *speech, char *grammar_name);
int (*activate)(struct ast_speech *speech, const char *grammar_name);
/*! Deactivate a loaded grammar */
int (*deactivate)(struct ast_speech *speech, char *grammar_name);
int (*deactivate)(struct ast_speech *speech, const char *grammar_name);
/*! Write audio to the speech engine */
int (*write)(struct ast_speech *speech, void *data, int len);
/*! Signal DTMF was received */
@@ -92,7 +92,7 @@ struct ast_speech_engine {
/*! Prepare engine to accept audio */
int (*start)(struct ast_speech *speech);
/*! Change an engine specific setting */
int (*change)(struct ast_speech *speech, char *name, const char *value);
int (*change)(struct ast_speech *speech, const char *name, const char *value);
/*! Change the type of results we want back */
int (*change_results_type)(struct ast_speech *speech, enum ast_speech_results_type results_type);
/*! Try to get results */
@@ -117,13 +117,13 @@ struct ast_speech_result {
};
/*! \brief Activate a grammar on a speech structure */
int ast_speech_grammar_activate(struct ast_speech *speech, char *grammar_name);
int ast_speech_grammar_activate(struct ast_speech *speech, const char *grammar_name);
/*! \brief Deactivate a grammar on a speech structure */
int ast_speech_grammar_deactivate(struct ast_speech *speech, char *grammar_name);
int ast_speech_grammar_deactivate(struct ast_speech *speech, const char *grammar_name);
/*! \brief Load a grammar on a speech structure (not globally) */
int ast_speech_grammar_load(struct ast_speech *speech, char *grammar_name, char *grammar);
int ast_speech_grammar_load(struct ast_speech *speech, const char *grammar_name, const char *grammar);
/*! \brief Unload a grammar */
int ast_speech_grammar_unload(struct ast_speech *speech, char *grammar_name);
int ast_speech_grammar_unload(struct ast_speech *speech, const char *grammar_name);
/*! \brief Get speech recognition results */
struct ast_speech_result *ast_speech_results_get(struct ast_speech *speech);
/*! \brief Free a set of results */
@@ -131,7 +131,7 @@ int ast_speech_results_free(struct ast_speech_result *result);
/*! \brief Indicate to the speech engine that audio is now going to start being written */
void ast_speech_start(struct ast_speech *speech);
/*! \brief Create a new speech structure */
struct ast_speech *ast_speech_new(char *engine_name, int formats);
struct ast_speech *ast_speech_new(const char *engine_name, int formats);
/*! \brief Destroy a speech structure */
int ast_speech_destroy(struct ast_speech *speech);
/*! \brief Write audio to the speech engine */
@@ -139,7 +139,7 @@ int ast_speech_write(struct ast_speech *speech, void *data, int len);
/*! \brief Signal to the engine that DTMF was received */
int ast_speech_dtmf(struct ast_speech *speech, const char *dtmf);
/*! \brief Change an engine specific attribute */
int ast_speech_change(struct ast_speech *speech, char *name, const char *value);
int ast_speech_change(struct ast_speech *speech, const char *name, const char *value);
/*! \brief Change the type of results we want */
int ast_speech_change_results_type(struct ast_speech *speech, enum ast_speech_results_type results_type);
/*! \brief Change state of a speech structure */
@@ -147,7 +147,7 @@ int ast_speech_change_state(struct ast_speech *speech, int state);
/*! \brief Register a speech recognition engine */
int ast_speech_register(struct ast_speech_engine *engine);
/*! \brief Unregister a speech recognition engine */
int ast_speech_unregister(char *engine_name);
int ast_speech_unregister(const char *engine_name);
#if defined(__cplusplus) || defined(c_plusplus)
}