aboutsummaryrefslogtreecommitdiffstats
path: root/res
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-21 21:13:09 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-21 21:13:09 +0000
commit230a66da7d98b2b6d328a04b0e7180b94d9c76bf (patch)
treeb40d978190102dbe6f14458ab8a70f358db533e4 /res
parentd57c20e50d7105f72bb90e709965ad5e04c5e36a (diff)
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: http://svn.digium.com/svn/asterisk/trunk@196072 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'res')
-rw-r--r--res/res_agi.c216
-rw-r--r--res/res_clioriginate.c5
-rw-r--r--res/res_jabber.c8
-rw-r--r--res/res_limit.c4
-rw-r--r--res/res_monitor.c22
-rw-r--r--res/res_musiconhold.c10
-rw-r--r--res/res_odbc.c4
-rw-r--r--res/res_rtp_asterisk.c6
-rw-r--r--res/res_speech.c16
9 files changed, 145 insertions, 146 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index 93dc6c664..f7ff01c5e 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -425,7 +425,7 @@ enum agi_result {
AGI_RESULT_HANGUP,
};
-static agi_command *find_command(char *cmds[], int exact);
+static agi_command *find_command(const char * const cmds[], int exact);
AST_THREADSTORAGE(agi_buf);
#define AGI_BUF_INITSIZE 256
@@ -1093,7 +1093,7 @@ static void setup_env(struct ast_channel *chan, char *request, int fd, int enhan
ast_agi_send(fd, chan, "\n");
}
-static int handle_answer(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_answer(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res = 0;
@@ -1105,13 +1105,13 @@ static int handle_answer(struct ast_channel *chan, AGI *agi, int argc, char *arg
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_asyncagi_break(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_asyncagi_break(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
ast_agi_send(agi->fd, chan, "200 result=0\n");
return RESULT_FAILURE;
}
-static int handle_waitfordigit(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_waitfordigit(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res, to;
@@ -1124,7 +1124,7 @@ static int handle_waitfordigit(struct ast_channel *chan, AGI *agi, int argc, cha
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_sendtext(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_sendtext(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res;
@@ -1143,7 +1143,7 @@ static int handle_sendtext(struct ast_channel *chan, AGI *agi, int argc, char *a
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_recvchar(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_recvchar(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res;
@@ -1163,7 +1163,7 @@ static int handle_recvchar(struct ast_channel *chan, AGI *agi, int argc, char *a
return RESULT_FAILURE;
}
-static int handle_recvtext(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_recvtext(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
char *buf;
@@ -1180,7 +1180,7 @@ static int handle_recvtext(struct ast_channel *chan, AGI *agi, int argc, char *a
return RESULT_SUCCESS;
}
-static int handle_tddmode(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_tddmode(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res, x;
@@ -1207,7 +1207,7 @@ static int handle_tddmode(struct ast_channel *chan, AGI *agi, int argc, char *ar
return RESULT_SUCCESS;
}
-static int handle_sendimage(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_sendimage(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res;
@@ -1223,10 +1223,10 @@ static int handle_sendimage(struct ast_channel *chan, AGI *agi, int argc, char *
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res = 0, skipms = 3000;
- char *fwd = "#", *rev = "*", *suspend = NULL, *stop = NULL; /* Default values */
+ const char *fwd = "#", *rev = "*", *suspend = NULL, *stop = NULL; /* Default values */
if (argc < 5 || argc > 9) {
return RESULT_SHOWUSAGE;
@@ -1259,12 +1259,12 @@ static int handle_controlstreamfile(struct ast_channel *chan, AGI *agi, int argc
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_streamfile(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_streamfile(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res, vres;
struct ast_filestream *fs, *vfs;
long sample_offset = 0, max_length;
- char *edigits = "";
+ const char *edigits = "";
if (argc < 4 || argc > 5)
return RESULT_SHOWUSAGE;
@@ -1309,13 +1309,13 @@ static int handle_streamfile(struct ast_channel *chan, AGI *agi, int argc, char
}
/*! \brief get option - really similar to the handle_streamfile, but with a timeout */
-static int handle_getoption(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_getoption(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res, vres;
struct ast_filestream *fs, *vfs;
long sample_offset = 0, max_length;
int timeout = 0;
- char *edigits = "";
+ const char *edigits = "";
if ( argc < 4 || argc > 5 )
return RESULT_SHOWUSAGE;
@@ -1378,7 +1378,7 @@ static int handle_getoption(struct ast_channel *chan, AGI *agi, int argc, char *
/*! \brief Say number in various language syntaxes */
/* While waiting, we're sending a NULL. */
-static int handle_saynumber(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_saynumber(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res, num;
@@ -1393,7 +1393,7 @@ static int handle_saynumber(struct ast_channel *chan, AGI *agi, int argc, char *
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_saydigits(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_saydigits(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res, num;
@@ -1409,7 +1409,7 @@ static int handle_saydigits(struct ast_channel *chan, AGI *agi, int argc, char *
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_sayalpha(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_sayalpha(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res;
@@ -1423,7 +1423,7 @@ static int handle_sayalpha(struct ast_channel *chan, AGI *agi, int argc, char *a
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_saydate(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_saydate(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res, num;
@@ -1438,7 +1438,7 @@ static int handle_saydate(struct ast_channel *chan, AGI *agi, int argc, char *ar
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_saytime(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_saytime(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res, num;
@@ -1453,11 +1453,11 @@ static int handle_saytime(struct ast_channel *chan, AGI *agi, int argc, char *ar
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_saydatetime(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_saydatetime(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res = 0;
time_t unixtime;
- char *format, *zone = NULL;
+ const char *format, *zone = NULL;
if (argc < 4)
return RESULT_SHOWUSAGE;
@@ -1487,7 +1487,7 @@ static int handle_saydatetime(struct ast_channel *chan, AGI *agi, int argc, char
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_sayphonetic(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_sayphonetic(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res;
@@ -1501,7 +1501,7 @@ static int handle_sayphonetic(struct ast_channel *chan, AGI *agi, int argc, char
return (res >= 0) ? RESULT_SUCCESS : RESULT_FAILURE;
}
-static int handle_getdata(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_getdata(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res, max, timeout;
char data[1024];
@@ -1528,7 +1528,7 @@ static int handle_getdata(struct ast_channel *chan, AGI *agi, int argc, char *ar
return RESULT_SUCCESS;
}
-static int handle_setcontext(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_setcontext(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
if (argc != 3)
@@ -1538,7 +1538,7 @@ static int handle_setcontext(struct ast_channel *chan, AGI *agi, int argc, char
return RESULT_SUCCESS;
}
-static int handle_setextension(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_setextension(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
if (argc != 3)
return RESULT_SHOWUSAGE;
@@ -1547,7 +1547,7 @@ static int handle_setextension(struct ast_channel *chan, AGI *agi, int argc, cha
return RESULT_SUCCESS;
}
-static int handle_setpriority(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_setpriority(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int pri;
@@ -1564,7 +1564,7 @@ static int handle_setpriority(struct ast_channel *chan, AGI *agi, int argc, char
return RESULT_SUCCESS;
}
-static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
struct ast_filestream *fs;
struct ast_frame *f;
@@ -1741,7 +1741,7 @@ static int handle_recordfile(struct ast_channel *chan, AGI *agi, int argc, char
return RESULT_SUCCESS;
}
-static int handle_autohangup(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_autohangup(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
double timeout;
struct timeval whentohangup = { 0, 0 };
@@ -1761,7 +1761,7 @@ static int handle_autohangup(struct ast_channel *chan, AGI *agi, int argc, char
return RESULT_SUCCESS;
}
-static int handle_hangup(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_hangup(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
struct ast_channel *c;
@@ -1787,7 +1787,7 @@ static int handle_hangup(struct ast_channel *chan, AGI *agi, int argc, char **ar
}
}
-static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res;
struct ast_app *app_to_exec;
@@ -1802,7 +1802,8 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv
ast_masq_park_call(chan, NULL, 0, NULL);
}
if (ast_compat_res_agi && !ast_strlen_zero(argv[2])) {
- char *compat = alloca(strlen(argv[2]) * 2 + 1), *cptr, *vptr;
+ char *compat = alloca(strlen(argv[2]) * 2 + 1), *cptr;
+ const char *vptr;
for (cptr = compat, vptr = argv[2]; *vptr; vptr++) {
if (*vptr == ',') {
*cptr++ = '\\';
@@ -1828,7 +1829,7 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv
return res;
}
-static int handle_setcallerid(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_setcallerid(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
char tmp[256]="";
char *l = NULL, *n = NULL;
@@ -1849,7 +1850,7 @@ static int handle_setcallerid(struct ast_channel *chan, AGI *agi, int argc, char
return RESULT_SUCCESS;
}
-static int handle_channelstatus(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_channelstatus(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
struct ast_channel *c;
if (argc == 2) {
@@ -1871,7 +1872,7 @@ static int handle_channelstatus(struct ast_channel *chan, AGI *agi, int argc, ch
}
}
-static int handle_setvariable(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_setvariable(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
if (argv[3])
pbx_builtin_setvar_helper(chan, argv[2], argv[3]);
@@ -1880,7 +1881,7 @@ static int handle_setvariable(struct ast_channel *chan, AGI *agi, int argc, char
return RESULT_SUCCESS;
}
-static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
char *ret;
char tempstr[1024];
@@ -1903,7 +1904,7 @@ static int handle_getvariable(struct ast_channel *chan, AGI *agi, int argc, char
return RESULT_SUCCESS;
}
-static int handle_getvariablefull(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_getvariablefull(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
struct ast_channel *chan2 = NULL;
@@ -1937,7 +1938,7 @@ static int handle_getvariablefull(struct ast_channel *chan, AGI *agi, int argc,
return RESULT_SUCCESS;
}
-static int handle_verbose(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_verbose(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int level = 0;
@@ -1954,7 +1955,7 @@ static int handle_verbose(struct ast_channel *chan, AGI *agi, int argc, char **a
return RESULT_SUCCESS;
}
-static int handle_dbget(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_dbget(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res;
struct ast_str *buf;
@@ -1987,7 +1988,7 @@ static int handle_dbget(struct ast_channel *chan, AGI *agi, int argc, char **arg
return RESULT_SUCCESS;
}
-static int handle_dbput(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_dbput(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res;
@@ -1998,7 +1999,7 @@ static int handle_dbput(struct ast_channel *chan, AGI *agi, int argc, char **arg
return RESULT_SUCCESS;
}
-static int handle_dbdel(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_dbdel(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res;
@@ -2009,7 +2010,7 @@ static int handle_dbdel(struct ast_channel *chan, AGI *agi, int argc, char **arg
return RESULT_SUCCESS;
}
-static int handle_dbdeltree(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_dbdeltree(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
int res;
@@ -2053,13 +2054,13 @@ static char *handle_cli_agi_debug(struct ast_cli_entry *e, int cmd, struct ast_c
return CLI_SUCCESS;
}
-static int handle_noop(struct ast_channel *chan, AGI *agi, int arg, char *argv[])
+static int handle_noop(struct ast_channel *chan, AGI *agi, int arg, const char * const argv[])
{
ast_agi_send(agi->fd, chan, "200 result=0\n");
return RESULT_SUCCESS;
}
-static int handle_setmusic(struct ast_channel *chan, AGI *agi, int argc, char *argv[])
+static int handle_setmusic(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
if (!strncasecmp(argv[2], "on", 2))
ast_moh_start(chan, argc > 3 ? argv[3] : NULL, NULL);
@@ -2069,7 +2070,7 @@ static int handle_setmusic(struct ast_channel *chan, AGI *agi, int argc, char *a
return RESULT_SUCCESS;
}
-static int handle_speechcreate(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_speechcreate(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
/* If a structure already exists, return an error */
if (agi->speech) {
@@ -2085,7 +2086,7 @@ static int handle_speechcreate(struct ast_channel *chan, AGI *agi, int argc, cha
return RESULT_SUCCESS;
}
-static int handle_speechset(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_speechset(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
/* Check for minimum arguments */
if (argc != 3)
@@ -2103,7 +2104,7 @@ static int handle_speechset(struct ast_channel *chan, AGI *agi, int argc, char *
return RESULT_SUCCESS;
}
-static int handle_speechdestroy(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_speechdestroy(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
if (agi->speech) {
ast_speech_destroy(agi->speech);
@@ -2116,7 +2117,7 @@ static int handle_speechdestroy(struct ast_channel *chan, AGI *agi, int argc, ch
return RESULT_SUCCESS;
}
-static int handle_speechloadgrammar(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_speechloadgrammar(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
if (argc != 5)
return RESULT_SHOWUSAGE;
@@ -2134,7 +2135,7 @@ static int handle_speechloadgrammar(struct ast_channel *chan, AGI *agi, int argc
return RESULT_SUCCESS;
}
-static int handle_speechunloadgrammar(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_speechunloadgrammar(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
if (argc != 4)
return RESULT_SHOWUSAGE;
@@ -2152,7 +2153,7 @@ static int handle_speechunloadgrammar(struct ast_channel *chan, AGI *agi, int ar
return RESULT_SUCCESS;
}
-static int handle_speechactivategrammar(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_speechactivategrammar(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
if (argc != 4)
return RESULT_SHOWUSAGE;
@@ -2170,7 +2171,7 @@ static int handle_speechactivategrammar(struct ast_channel *chan, AGI *agi, int
return RESULT_SUCCESS;
}
-static int handle_speechdeactivategrammar(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_speechdeactivategrammar(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
if (argc != 4)
return RESULT_SHOWUSAGE;
@@ -2207,10 +2208,11 @@ static int speech_streamfile(struct ast_channel *chan, const char *filename, con
return 0;
}
-static int handle_speechrecognize(struct ast_channel *chan, AGI *agi, int argc, char **argv)
+static int handle_speechrecognize(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
struct ast_speech *speech = agi->speech;
- char *prompt, dtmf = 0, tmp[4096] = "", *buf = tmp;
+ const char *prompt;
+ char dtmf = 0, tmp[4096] = "", *buf = tmp;
int timeout = 0, offset = 0, old_read_format = 0, res = 0, i = 0;
long current_offset = 0;
const char *reason = NULL;
@@ -2354,27 +2356,27 @@ static int handle_speechrecognize(struct ast_channel *chan, AGI *agi, int argc,
return RESULT_SUCCESS;
}
-static char usage_verbose[] =
+static const char usage_verbose[] =
" Usage: VERBOSE <message> <level>\n"
" Sends <message> to the console via verbose message system.\n"
" <level> is the the verbose level (1-4)\n"
" Always returns 1.\n";
-static char usage_setvariable[] =
+static const char usage_setvariable[] =
" Usage: SET VARIABLE <variablename> <value>\n";
-static char usage_setcallerid[] =
+static const char usage_setcallerid[] =
" Usage: SET CALLERID <number>\n"
" Changes the callerid of the current channel.\n";
-static char usage_waitfordigit[] =
+static const char usage_waitfordigit[] =
" Usage: WAIT FOR DIGIT <timeout>\n"
" Waits up to 'timeout' milliseconds for channel to receive a DTMF digit.\n"
" Returns -1 on channel failure, 0 if no digit is received in the timeout, or\n"
" the numerical value of the ascii of the digit if one is received. Use -1\n"
" for the timeout value if you desire the call to block indefinitely.\n";
-static char usage_sendtext[] =
+static const char usage_sendtext[] =
" Usage: SEND TEXT \"<text to send>\"\n"
" Sends the given text on a channel. Most channels do not support the\n"
" transmission of text. Returns 0 if text is sent, or if the channel does not\n"
@@ -2382,19 +2384,19 @@ static char usage_sendtext[] =
" consisting of greater than one word should be placed in quotes since the\n"
" command only accepts a single argument.\n";
-static char usage_tddmode[] =
+static const char usage_tddmode[] =
" Usage: TDD MODE <on|off>\n"
" Enable/Disable TDD transmission/reception on a channel. Returns 1 if\n"
" successful, or 0 if channel is not TDD-capable.\n";
-static char usage_sendimage[] =
+static const char usage_sendimage[] =
" Usage: SEND IMAGE <image>\n"
" Sends the given image on a channel. Most channels do not support the\n"
" transmission of images. Returns 0 if image is sent, or if the channel does not\n"
" support image transmission. Returns -1 only on error/hangup. Image names\n"
" should not include extensions.\n";
-static char usage_streamfile[] =
+static const char usage_streamfile[] =
" Usage: STREAM FILE <filename> <escape digits> [sample offset]\n"
" Send the given file, allowing playback to be interrupted by the given\n"
" digits, if any. Use double quotes for the digits if you wish none to be\n"
@@ -2404,7 +2406,7 @@ static char usage_streamfile[] =
" or -1 on error or if the channel was disconnected. Remember, the file\n"
" extension must not be included in the filename.\n";
-static char usage_controlstreamfile[] =
+static const char usage_controlstreamfile[] =
" Usage: CONTROL STREAM FILE <filename> <escape digits> [skipms] [ffchar] [rewchr] [pausechr]\n"
" Send the given file, allowing playback to be controled by the given\n"
" digits, if any. Use double quotes for the digits if you wish none to be\n"
@@ -2414,28 +2416,28 @@ static char usage_controlstreamfile[] =
" extension must not be included in the filename.\n\n"
" Note: ffchar and rewchar default to * and # respectively.\n";
-static char usage_saynumber[] =
+static const char usage_saynumber[] =
" Usage: SAY NUMBER <number> <escape digits> [gender]\n"
" Say a given number, returning early if any of the given DTMF digits\n"
" are received on the channel. Returns 0 if playback completes without a digit\n"
" being pressed, or the ASCII numerical value of the digit if one was pressed or\n"
" -1 on error/hangup.\n";
-static char usage_saydigits[] =
+static const char usage_saydigits[] =
" Usage: SAY DIGITS <number> <escape digits>\n"
" Say a given digit string, returning early if any of the given DTMF digits\n"
" are received on the channel. Returns 0 if playback completes without a digit\n"
" being pressed, or the ASCII numerical value of the digit if one was pressed or\n"
" -1 on error/hangup.\n";
-static char usage_sayalpha[] =
+static const char usage_sayalpha[] =
" Usage: SAY ALPHA <number> <escape digits>\n"
" Say a given character string, returning early if any of the given DTMF digits\n"
" are received on the channel. Returns 0 if playback completes without a digit\n"
" being pressed, or the ASCII numerical value of the digit if one was pressed or\n"
" -1 on error/hangup.\n";
-static char usage_saydate[] =
+static const char usage_saydate[] =
" Usage: SAY DATE <date> <escape digits>\n"
" Say a given date, returning early if any of the given DTMF digits are\n"
" received on the channel. <date> is number of seconds elapsed since 00:00:00\n"
@@ -2443,7 +2445,7 @@ static char usage_saydate[] =
" completes without a digit being pressed, or the ASCII numerical value of the\n"
" digit if one was pressed or -1 on error/hangup.\n";
-static char usage_saytime[] =
+static const char usage_saytime[] =
" Usage: SAY TIME <time> <escape digits>\n"
" Say a given time, returning early if any of the given DTMF digits are\n"
" received on the channel. <time> is number of seconds elapsed since 00:00:00\n"
@@ -2451,7 +2453,7 @@ static char usage_saytime[] =
" completes without a digit being pressed, or the ASCII numerical value of the\n"
" digit if one was pressed or -1 on error/hangup.\n";
-static char usage_saydatetime[] =
+static const char usage_saydatetime[] =
" Usage: SAY DATETIME <time> <escape digits> [format] [timezone]\n"
" Say a given time, returning early if any of the given DTMF digits are\n"
" received on the channel. <time> is number of seconds elapsed since 00:00:00\n"
@@ -2462,61 +2464,61 @@ static char usage_saydatetime[] =
" completes without a digit being pressed, or the ASCII numerical value of the\n"
" digit if one was pressed or -1 on error/hangup.\n";
-static char usage_sayphonetic[] =
+static const char usage_sayphonetic[] =
" Usage: SAY PHONETIC <string> <escape digits>\n"
" Say a given character string with phonetics, returning early if any of the\n"
" given DTMF digits are received on the channel. Returns 0 if playback\n"
" completes without a digit pressed, the ASCII numerical value of the digit\n"
" if one was pressed, or -1 on error/hangup.\n";
-static char usage_setcontext[] =
+static const char usage_setcontext[] =
" Usage: SET CONTEXT <desired context>\n"
" Sets the context for continuation upon exiting the application.\n";
-static char usage_setextension[] =
+static const char usage_setextension[] =
" Usage: SET EXTENSION <new extension>\n"
" Changes the extension for continuation upon exiting the application.\n";
-static char usage_setpriority[] =
+static const char usage_setpriority[] =
" Usage: SET PRIORITY <priority>\n"
" Changes the priority for continuation upon exiting the application.\n"
" The priority must be a valid priority or label.\n";
-static char usage_autohangup[] =
+static const char usage_autohangup[] =
" Usage: SET AUTOHANGUP <time>\n"
" Cause the channel to automatically hangup at <time> seconds in the\n"
" future. Of course it can be hungup before then as well. Setting to 0 will\n"
" cause the autohangup feature to be disabled on this channel.\n";
-static char usage_speechcreate[] =
+static const char usage_speechcreate[] =
" Usage: SPEECH CREATE <engine>\n"
" Create a speech object to be used by the other Speech AGI commands.\n";
-static char usage_speechset[] =
+static const char usage_speechset[] =
" Usage: SPEECH SET <name> <value>\n"
" Set an engine-specific setting.\n";
-static char usage_speechdestroy[] =
+static const char usage_speechdestroy[] =
" Usage: SPEECH DESTROY\n"
" Destroy the speech object created by SPEECH CREATE.\n";
-static char usage_speechloadgrammar[] =
+static const char usage_speechloadgrammar[] =
" Usage: SPEECH LOAD GRAMMAR <grammar name> <path to grammar>\n"
" Loads the specified grammar as the specified name.\n";
-static char usage_speechunloadgrammar[] =
+static const char usage_speechunloadgrammar[] =
" Usage: SPEECH UNLOAD GRAMMAR <grammar name>\n"
" Unloads the specified grammar.\n";
-static char usage_speechactivategrammar[] =
+static const char usage_speechactivategrammar[] =
" Usage: SPEECH ACTIVATE GRAMMAR <grammar name>\n"
" Activates the specified grammar on the speech object.\n";
-static char usage_speechdeactivategrammar[] =
+static const char usage_speechdeactivategrammar[] =
" Usage: SPEECH DEACTIVATE GRAMMAR <grammar name>\n"
" Deactivates the specified grammar on the speech object.\n";
-static char usage_speechrecognize[] =
+static const char usage_speechrecognize[] =
" Usage: SPEECH RECOGNIZE <prompt> <timeout> [<offset>]\n"
" Plays back given prompt while listening for speech and dtmf.\n";
@@ -2574,7 +2576,7 @@ static struct agi_command commands[] = {
static AST_RWLIST_HEAD_STATIC(agi_commands, agi_command);
-static char *help_workhorse(int fd, char *match[])
+static char *help_workhorse(int fd, const char * const match[])
{
char fullcmd[MAX_CMD_LEN], matchstr[MAX_CMD_LEN];
struct agi_command *e;
@@ -2606,15 +2608,15 @@ int ast_agi_register(struct ast_module *mod, agi_command *cmd)
ast_join(fullcmd, sizeof(fullcmd), cmd->cmda);
- if (!find_command(cmd->cmda,1)) {
- cmd->docsrc = AST_STATIC_DOC;
+ if (!find_command(cmd->cmda, 1)) {
+ *((enum ast_doc_src *) &cmd->docsrc) = AST_STATIC_DOC;
#ifdef AST_XML_DOCS
if (ast_strlen_zero(cmd->summary) && ast_strlen_zero(cmd->usage)) {
- cmd->summary = ast_xmldoc_build_synopsis("agi", fullcmd);
- cmd->usage = ast_xmldoc_build_description("agi", fullcmd);
- cmd->syntax = ast_xmldoc_build_syntax("agi", fullcmd);
- cmd->seealso = ast_xmldoc_build_seealso("agi", fullcmd);
- cmd->docsrc = AST_XML_DOC;
+ *((char **) &cmd->summary) = ast_xmldoc_build_synopsis("agi", fullcmd);
+ *((char **) &cmd->usage) = ast_xmldoc_build_description("agi", fullcmd);
+ *((char **) &cmd->syntax) = ast_xmldoc_build_syntax("agi", fullcmd);
+ *((char **) &cmd->seealso) = ast_xmldoc_build_seealso("agi", fullcmd);
+ *((enum ast_doc_src *) &cmd->docsrc) = AST_XML_DOC;
}
#endif
cmd->mod = mod;
@@ -2647,12 +2649,14 @@ int ast_agi_unregister(struct ast_module *mod, agi_command *cmd)
ast_module_unref(ast_module_info->self);
#ifdef AST_XML_DOCS
if (e->docsrc == AST_XML_DOC) {
- ast_free(e->summary);
- ast_free(e->usage);
- ast_free(e->syntax);
- ast_free(e->seealso);
- e->summary = NULL, e->usage = NULL;
- e->syntax = NULL, e->seealso = NULL;
+ ast_free((char *) e->summary);
+ ast_free((char *) e->usage);
+ ast_free((char *) e->syntax);
+ ast_free((char *) e->seealso);
+ *((char **) &e->summary) = NULL;
+ *((char **) &e->usage) = NULL;
+ *((char **) &e->syntax) = NULL;
+ *((char **) &e->seealso) = NULL;
}
#endif
unregistered=1;
@@ -2714,7 +2718,7 @@ int ast_agi_unregister_multiple(struct ast_module *mod, struct agi_command *cmd,
return res;
}
-static agi_command *find_command(char *cmds[], int exact)
+static agi_command *find_command(const char * const cmds[], int exact)
{
int y, match;
struct agi_command *e;
@@ -2752,7 +2756,7 @@ static agi_command *find_command(char *cmds[], int exact)
return NULL;
}
-static int parse_args(char *s, int *max, char *argv[])
+static int parse_args(char *s, int *max, const char *argv[])
{
int x = 0, quoted = 0, escaped = 0, whitespace = 1;
char *cur;
@@ -2817,7 +2821,7 @@ normal:
static int agi_handle_command(struct ast_channel *chan, AGI *agi, char *buf, int dead)
{
- char *argv[MAX_ARGS];
+ const char *argv[MAX_ARGS];
int argc = MAX_ARGS, res;
agi_command *c;
const char *ami_res = "Unknown Result";
@@ -3164,7 +3168,7 @@ static void write_html_escaped(FILE *htmlfile, char *str)
return;
}
-static int write_htmldump(char *filename)
+static int write_htmldump(const char *filename)
{
struct agi_command *command;
char fullcmd[MAX_CMD_LEN];
@@ -3246,10 +3250,10 @@ static char *handle_cli_agi_dump_html(struct ast_cli_entry *e, int cmd, struct a
return CLI_SUCCESS;
}
-static int agi_exec_full(struct ast_channel *chan, void *data, int enhanced, int dead)
+static int agi_exec_full(struct ast_channel *chan, const char *data, int enhanced, int dead)
{
enum agi_result res;
- char buf[AGI_BUF_LEN] = "", *tmp = buf;
+ char *buf;
int fds[2], efd = -1, pid;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(arg)[MAX_ARGS];
@@ -3262,9 +3266,9 @@ static int agi_exec_full(struct ast_channel *chan, void *data, int enhanced, int
}
if (dead)
ast_debug(3, "Hungup channel detected, running agi in dead mode.\n");
- ast_copy_string(buf, data, sizeof(buf));
memset(&agi, 0, sizeof(agi));
- AST_STANDARD_APP_ARGS(args, tmp);
+ buf = ast_strdupa(data);
+ AST_STANDARD_APP_ARGS(args, buf);
args.argv[args.argc] = NULL;
#if 0
/* Answer if need be */
@@ -3313,7 +3317,7 @@ static int agi_exec_full(struct ast_channel *chan, void *data, int enhanced, int
return 0;
}
-static int agi_exec(struct ast_channel *chan, void *data)
+static int agi_exec(struct ast_channel *chan, const char *data)
{
if (!ast_check_hangup(chan))
return agi_exec_full(chan, data, 0, 0);
@@ -3321,7 +3325,7 @@ static int agi_exec(struct ast_channel *chan, void *data)
return agi_exec_full(chan, data, 0, 1);
}
-static int eagi_exec(struct ast_channel *chan, void *data)
+static int eagi_exec(struct ast_channel *chan, const char *data)
{
int readformat, res;
@@ -3343,7 +3347,7 @@ static int eagi_exec(struct ast_channel *chan, void *data)
return res;
}
-static int deadagi_exec(struct ast_channel *chan, void *data)
+static int deadagi_exec(struct ast_channel *chan, const char *data)
{
ast_log(LOG_WARNING, "DeadAGI has been deprecated, please use AGI in all cases!\n");
return agi_exec(chan, data);
diff --git a/res/res_clioriginate.c b/res/res_clioriginate.c
index beb2522f4..c79f06471 100644
--- a/res/res_clioriginate.c
+++ b/res/res_clioriginate.c
@@ -114,11 +114,10 @@ static char *orig_exten(int fd, const char *chan, const char *data)
* \param cmd operation to execute
* \param a structure that contains either application or extension arguments
* \retval CLI_SUCCESS on success.
- * \retval CLI_SHOWUSAGE on failure.
-*/
+ * \retval CLI_SHOWUSAGE on failure.*/
static char *handle_orig(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
- static char *choices[] = { "application", "extension", NULL };
+ static const char * const choices[] = { "application", "extension", NULL };
char *res;
switch (cmd) {
case CLI_INIT:
diff --git a/res/res_jabber.c b/res/res_jabber.c
index ad34e6f37..72f14960c 100644
--- a/res/res_jabber.c
+++ b/res/res_jabber.c
@@ -183,8 +183,6 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
/*-- Forward declarations */
static void aji_buddy_destroy(struct aji_buddy *obj);
static void aji_client_destroy(struct aji_client *obj);
-static int aji_send_exec(struct ast_channel *chan, void *data);
-static int aji_status_exec(struct ast_channel *chan, void *data);
static int aji_is_secure(struct aji_client *client);
#ifdef HAVE_OPENSSL
static int aji_start_tls(struct aji_client *client);
@@ -429,7 +427,7 @@ static iks *jabber_make_auth(iksid * id, const char *pass, const char *sid)
* \param data
* \return 0 on success, -1 on error
*/
-static int aji_status_exec(struct ast_channel *chan, void *data)
+static int aji_status_exec(struct ast_channel *chan, const char *data)
{
struct aji_client *client = NULL;
struct aji_buddy *buddy = NULL;
@@ -545,7 +543,7 @@ static struct ast_custom_function jabberstatus_function = {
* \param data Data is sender|reciever|message.
* \return 0 on success,-1 on error.
*/
-static int aji_send_exec(struct ast_channel *chan, void *data)
+static int aji_send_exec(struct ast_channel *chan, const char *data)
{
struct aji_client *client = NULL;
char *s;
@@ -2972,7 +2970,7 @@ struct aji_client_container *ast_aji_get_clients(void)
return &clients;
}
-static char mandescr_jabber_send[] =
+static const char mandescr_jabber_send[] =
"Description: Sends a message to a Jabber Client.\n"
"Variables: \n"
" Jabber: Client or transport Asterisk uses to connect to JABBER\n"
diff --git a/res/res_limit.c b/res/res_limit.c
index 35bd9d3dc..f3ec856d3 100644
--- a/res/res_limit.c
+++ b/res/res_limit.c
@@ -40,7 +40,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#endif
#endif
-static struct limits {
+static const struct limits {
int resource;
char limit[3];
char desc[40];
@@ -154,7 +154,7 @@ static char *handle_cli_ulimit(struct ast_cli_entry *e, int cmd, struct ast_cli_
if (a->argc == 1) {
char arg2[15];
- char *newargv[2] = { "ulimit", arg2 };
+ const char * const newargv[2] = { "ulimit", arg2 };
for (resource = 0; resource < ARRAY_LEN(limits); resource++) {
struct ast_cli_args newArgs = { .argv = newargv, .argc = 2 };
ast_copy_string(arg2, limits[resource].clicmd, sizeof(arg2));
diff --git a/res/res_monitor.c b/res/res_monitor.c
index b84889e57..491ee0c70 100644
--- a/res/res_monitor.c
+++ b/res/res_monitor.c
@@ -390,13 +390,13 @@ int ast_monitor_unpause(struct ast_channel *chan)
}
/*! \brief Wrapper for ast_monitor_pause */
-static int pause_monitor_exec(struct ast_channel *chan, void *data)
+static int pause_monitor_exec(struct ast_channel *chan, const char *data)
{
return ast_monitor_pause(chan);
}
/*! \brief Wrapper for ast_monitor_unpause */
-static int unpause_monitor_exec(struct ast_channel *chan, void *data)
+static int unpause_monitor_exec(struct ast_channel *chan, const char *data)
{
return ast_monitor_unpause(chan);
}
@@ -457,7 +457,7 @@ int ast_monitor_change_fname(struct ast_channel *chan, const char *fname_base, i
* \retval 0 on success.
* \retval -1 on failure.
*/
-static int start_monitor_exec(struct ast_channel *chan, void *data)
+static int start_monitor_exec(struct ast_channel *chan, const char *data)
{
char *arg = NULL;
char *options = NULL;
@@ -541,18 +541,18 @@ static int start_monitor_exec(struct ast_channel *chan, void *data)
}
/*! \brief Wrapper function \see ast_monitor_stop */
-static int stop_monitor_exec(struct ast_channel *chan, void *data)
+static int stop_monitor_exec(struct ast_channel *chan, const char *data)
{
return ast_monitor_stop(chan, 1);
}
/*! \brief Wrapper function \see ast_monitor_change_fname */
-static int change_monitor_exec(struct ast_channel *chan, void *data)
+static int change_monitor_exec(struct ast_channel *chan, const char *data)
{
- return ast_monitor_change_fname(chan, (const char*)data, 1);
+ return ast_monitor_change_fname(chan, data, 1);
}
-static char start_monitor_action_help[] =
+static const char start_monitor_action_help[] =
"Description: The 'Monitor' action may be used to record the audio on a\n"
" specified channel. The following parameters may be used to control\n"
" this:\n"
@@ -618,7 +618,7 @@ static int start_monitor_action(struct mansession *s, const struct message *m)
return 0;
}
-static char stop_monitor_action_help[] =
+static const char stop_monitor_action_help[] =
"Description: The 'StopMonitor' action may be used to end a previously\n"
" started 'Monitor' action. The only parameter is 'Channel', the name\n"
" of the channel monitored.\n";
@@ -654,7 +654,7 @@ static int stop_monitor_action(struct mansession *s, const struct message *m)
return 0;
}
-static char change_monitor_action_help[] =
+static const char change_monitor_action_help[] =
"Description: The 'ChangeMonitor' action may be used to change the file\n"
" started by a previous 'Monitor' action. The following parameters may\n"
" be used to control this:\n"
@@ -737,7 +737,7 @@ static int do_pause_or_unpause(struct mansession *s, const struct message *m, in
return 0;
}
-static char pause_monitor_action_help[] =
+static const char pause_monitor_action_help[] =
"Description: The 'PauseMonitor' action may be used to temporarily stop the\n"
" recording of a channel. The following parameters may\n"
" be used to control this:\n"
@@ -748,7 +748,7 @@ static int pause_monitor_action(struct mansession *s, const struct message *m)
return do_pause_or_unpause(s, m, MONITOR_ACTION_PAUSE);
}
-static char unpause_monitor_action_help[] =
+static const char unpause_monitor_action_help[] =
"Description: The 'UnpauseMonitor' action may be used to re-enable recording\n"
" of a channel after calling PauseMonitor. The following parameters may\n"
" be used to control this:\n"
diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c
index c1ab05dac..d84a3acc0 100644
--- a/res/res_musiconhold.c
+++ b/res/res_musiconhold.c
@@ -606,7 +606,7 @@ static void *monmp3thread(void *data)
return NULL;
}
-static int play_moh_exec(struct ast_channel *chan, void *data)
+static int play_moh_exec(struct ast_channel *chan, const char *data)
{
char *parse;
char *class;
@@ -646,7 +646,7 @@ static int play_moh_exec(struct ast_channel *chan, void *data)
return res;
}
-static int wait_moh_exec(struct ast_channel *chan, void *data)
+static int wait_moh_exec(struct ast_channel *chan, const char *data)
{
static int deprecation_warning = 0;
int res;
@@ -669,7 +669,7 @@ static int wait_moh_exec(struct ast_channel *chan, void *data)
return res;
}
-static int set_moh_exec(struct ast_channel *chan, void *data)
+static int set_moh_exec(struct ast_channel *chan, const char *data)
{
static int deprecation_warning = 0;
@@ -686,7 +686,7 @@ static int set_moh_exec(struct ast_channel *chan, void *data)
return 0;
}
-static int start_moh_exec(struct ast_channel *chan, void *data)
+static int start_moh_exec(struct ast_channel *chan, const char *data)
{
char *parse;
char *class;
@@ -705,7 +705,7 @@ static int start_moh_exec(struct ast_channel *chan, void *data)
return 0;
}
-static int stop_moh_exec(struct ast_channel *chan, void *data)
+static int stop_moh_exec(struct ast_channel *chan, const char *data)
{
ast_moh_stop(chan);
diff --git a/res/res_odbc.c b/res/res_odbc.c
index a459afcf8..5a651df01 100644
--- a/res/res_odbc.c
+++ b/res/res_odbc.c
@@ -1045,7 +1045,7 @@ int ast_odbc_backslash_is_escape(struct odbc_obj *obj)
return obj->parent->backslash_is_escape;
}
-static int commit_exec(struct ast_channel *chan, void *data)
+static int commit_exec(struct ast_channel *chan, const char *data)
{
struct odbc_txn_frame *tx;
SQLINTEGER nativeerror=0, numfields=0;
@@ -1082,7 +1082,7 @@ static int commit_exec(struct ast_channel *chan, void *data)
return 0;
}
-static int rollback_exec(struct ast_channel *chan, void *data)
+static int rollback_exec(struct ast_channel *chan, const char *data)
{
struct odbc_txn_frame *tx;
SQLINTEGER nativeerror=0, numfields=0;
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index a6a4f3caf..ed01a834f 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -2370,9 +2370,8 @@ static char *rtp_do_debug_ip(struct ast_cli_args *a)
struct hostent *hp;
struct ast_hostent ahp;
int port = 0;
- char *p, *arg;
+ char *p, *arg = ast_strdupa(a->argv[3]);
- arg = a->argv[3];
p = strstr(arg, ":");
if (p) {
*p = '\0';
@@ -2400,9 +2399,8 @@ static char *rtcp_do_debug_ip(struct ast_cli_args *a)
struct hostent *hp;
struct ast_hostent ahp;
int port = 0;
- char *p, *arg;
+ char *p, *arg = ast_strdupa(a->argv[3]);
- arg = a->argv[3];
p = strstr(arg, ":");
if (p) {
*p = '\0';
diff --git a/res/res_speech.c b/res/res_speech.c
index 902955da1..5b8e1a474 100644
--- a/res/res_speech.c
+++ b/res/res_speech.c
@@ -40,7 +40,7 @@ static AST_RWLIST_HEAD_STATIC(engines, ast_speech_engine);
static struct ast_speech_engine *default_engine = NULL;
/*! \brief Find a speech recognition engine of specified name, if NULL then use the default one */
-static struct ast_speech_engine *find_engine(char *engine_name)
+static struct ast_speech_engine *find_engine(const char *engine_name)
{
struct ast_speech_engine *engine = NULL;
@@ -60,25 +60,25 @@ static struct ast_speech_engine *find_engine(char *engine_name)
}
/*! \brief Activate a loaded (either local or global) grammar */
-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)
{
return (speech->engine->activate ? speech->engine->activate(speech, grammar_name) : -1);
}
/*! \brief Deactivate a loaded 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)
{
return (speech->engine->deactivate ? speech->engine->deactivate(speech, grammar_name) : -1);
}
/*! \brief Load a local grammar on a speech structure */
-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)
{
return (speech->engine->load ? speech->engine->load(speech, grammar_name, grammar) : -1);
}
/*! \brief Unload a local grammar from a speech structure */
-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)
{
return (speech->engine->unload ? speech->engine->unload(speech, grammar_name) : -1);
}
@@ -163,13 +163,13 @@ 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)
{
return (speech->engine->change ? speech->engine->change(speech, name, value) : -1);
}
/*! \brief Create a new speech structure using the engine specified */
-struct ast_speech *ast_speech_new(char *engine_name, int formats)
+struct ast_speech *ast_speech_new(const char *engine_name, int formats)
{
struct ast_speech_engine *engine = NULL;
struct ast_speech *new_speech = NULL;
@@ -299,7 +299,7 @@ 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)
{
struct ast_speech_engine *engine = NULL;
int res = -1;