summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin P. Fleming <kpfleming@digium.com>2007-01-05 23:32:42 +0000
committerKevin P. Fleming <kpfleming@digium.com>2007-01-05 23:32:42 +0000
commitcd73a483f15033a2c619e7551d8014638e05db4f (patch)
tree76ff7f6c897bdfda963986fdaacae6e6ffc39542
parent7cb197a5b723eaf131a3534436a451669105dd8a (diff)
const-ify some more APIs, and fix rev 49710 from branch-1.4 in a better way here
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49711 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r--apps/app_queue.c8
-rw-r--r--apps/app_speech_utils.c10
-rw-r--r--apps/app_voicemail.c2
-rw-r--r--channels/chan_agent.c2
-rw-r--r--channels/chan_iax2.c2
-rw-r--r--channels/chan_sip.c12
-rw-r--r--include/asterisk/astdb.h2
-rw-r--r--include/asterisk/pbx.h8
-rw-r--r--main/db.c6
-rw-r--r--main/pbx.c14
-rw-r--r--pbx/pbx_dundi.c2
11 files changed, 33 insertions, 35 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c
index da4ec749e..716141c4a 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -3637,7 +3637,7 @@ check_turns:
return res;
}
-static int queue_function_var(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int queue_function_var(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
int res = -1;
struct call_queue *q;
@@ -3689,7 +3689,7 @@ static int queue_function_var(struct ast_channel *chan, char *cmd, char *data, c
return 0;
}
-static int queue_function_qac(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int queue_function_qac(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
int count = 0;
struct call_queue *q;
@@ -3731,7 +3731,7 @@ static int queue_function_qac(struct ast_channel *chan, char *cmd, char *data, c
return 0;
}
-static int queue_function_queuewaitingcount(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int queue_function_queuewaitingcount(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
int count = 0;
struct call_queue *q;
@@ -3766,7 +3766,7 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, char *cmd,
return 0;
}
-static int queue_function_queuememberlist(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int queue_function_queuememberlist(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
struct ast_module_user *u;
struct call_queue *q;
diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c
index 42b7fb031..e2b2d76f1 100644
--- a/apps/app_speech_utils.c
+++ b/apps/app_speech_utils.c
@@ -144,7 +144,7 @@ static struct ast_speech_result *find_result(struct ast_speech_result *results,
}
/*! \brief SPEECH_SCORE() Dialplan Function */
-static int speech_score(struct ast_channel *chan, char *cmd, char *data,
+static int speech_score(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
struct ast_speech_result *result = NULL;
@@ -172,7 +172,7 @@ static struct ast_custom_function speech_score_function = {
};
/*! \brief SPEECH_TEXT() Dialplan Function */
-static int speech_text(struct ast_channel *chan, char *cmd, char *data,
+static int speech_text(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
struct ast_speech_result *result = NULL;
@@ -198,7 +198,7 @@ static struct ast_custom_function speech_text_function = {
};
/*! \brief SPEECH_GRAMMAR() Dialplan Function */
-static int speech_grammar(struct ast_channel *chan, char *cmd, char *data,
+static int speech_grammar(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
struct ast_speech_result *result = NULL;
@@ -224,7 +224,7 @@ static struct ast_custom_function speech_grammar_function = {
};
/*! \brief SPEECH_ENGINE() Dialplan Function */
-static int speech_engine_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
+static int speech_engine_write(struct ast_channel *chan, const char *cmd, char *data, const char *value)
{
struct ast_speech *speech = find_speech(chan);
@@ -247,7 +247,7 @@ static struct ast_custom_function speech_engine_function = {
};
/*! \brief SPEECH() Dialplan Function */
-static int speech_read(struct ast_channel *chan, char *cmd, char *data,
+static int speech_read(struct ast_channel *chan, const char *cmd, char *data,
char *buf, size_t len)
{
int results = 0;
diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c
index 26773006c..7de25c116 100644
--- a/apps/app_voicemail.c
+++ b/apps/app_voicemail.c
@@ -6914,7 +6914,7 @@ static int vm_box_exists(struct ast_channel *chan, void *data)
return 0;
}
-static int acf_mailbox_exists(struct ast_channel *chan, char *cmd, char *args, char *buf, size_t len)
+static int acf_mailbox_exists(struct ast_channel *chan, const char *cmd, char *args, char *buf, size_t len)
{
struct ast_vm_user svm;
AST_DECLARE_APP_ARGS(arg,
diff --git a/channels/chan_agent.c b/channels/chan_agent.c
index 1229a0606..c83df41f0 100644
--- a/channels/chan_agent.c
+++ b/channels/chan_agent.c
@@ -2384,7 +2384,7 @@ static struct agent_pvt *find_agent(char *agentid)
return cur;
}
-static int function_agent(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int function_agent(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
char *parse;
AST_DECLARE_APP_ARGS(args,
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 536419d89..532308f0f 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -9589,7 +9589,7 @@ static int iax2_exec(struct ast_channel *chan, const char *context, const char *
return -1;
}
-static int function_iaxpeer(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int function_iaxpeer(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
struct iax2_peer *peer;
char *peername, *colname;
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 4b25f151d..16d9c4b34 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1395,10 +1395,6 @@ static int sip_no_debug(int fd, int argc, char *argv[]);
static int sip_notify(int fd, int argc, char *argv[]);
static int sip_do_history(int fd, int argc, char *argv[]);
static int sip_no_history(int fd, int argc, char *argv[]);
-static int func_header_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len);
-static int func_check_sipdomain(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len);
-static int function_sippeer(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len);
-static int function_sipchaninfo_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len);
static int sip_dtmfmode(struct ast_channel *chan, void *data);
static int sip_addheader(struct ast_channel *chan, void *data);
static int sip_do_reload(enum channelreloadreason reason);
@@ -11403,7 +11399,7 @@ static const char show_settings_usage[] =
" Provides detailed list of the configuration of the SIP channel.\n";
/*! \brief Read SIP header (dialplan function) */
-static int func_header_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len)
+static int func_header_read(struct ast_channel *chan, const char *function, char *data, char *buf, size_t len)
{
struct sip_pvt *p;
const char *content = NULL;
@@ -11467,7 +11463,7 @@ static struct ast_custom_function sip_header_function = {
};
/*! \brief Dial plan function to check if domain is local */
-static int func_check_sipdomain(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int func_check_sipdomain(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "CHECKSIPDOMAIN requires an argument - A domain name\n");
@@ -11492,7 +11488,7 @@ static struct ast_custom_function checksipdomain_function = {
};
/*! \brief ${SIPPEER()} Dialplan function - reads peer data */
-static int function_sippeer(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int function_sippeer(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
struct sip_peer *peer;
char *colname;
@@ -11582,7 +11578,7 @@ struct ast_custom_function sippeer_function = {
};
/*! \brief ${SIPCHANINFO()} Dialplan function - reads sip channel data */
-static int function_sipchaninfo_read(struct ast_channel *chan, char *cmd, char *data, char *buf, size_t len)
+static int function_sipchaninfo_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
{
struct sip_pvt *p;
diff --git a/include/asterisk/astdb.h b/include/asterisk/astdb.h
index 828fe9725..887d9af5b 100644
--- a/include/asterisk/astdb.h
+++ b/include/asterisk/astdb.h
@@ -35,7 +35,7 @@ struct ast_db_entry {
int ast_db_get(const char *family, const char *key, char *out, int outlen);
-int ast_db_put(const char *family, const char *key, char *value);
+int ast_db_put(const char *family, const char *key, const char *value);
int ast_db_del(const char *family, const char *key);
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 0c94ea323..56d50eb56 100644
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -74,8 +74,8 @@ struct ast_custom_function {
const char *synopsis; /*!< Short description for "show functions" */
const char *desc; /*!< Help text that explains it all */
const char *syntax; /*!< Syntax description */
- int (*read)(struct ast_channel *, char *, char *, char *, size_t); /*!< Read function, if read is supported */
- int (*write)(struct ast_channel *, char *, char *, const char *); /*!< Write function, if write is supported */
+ int (*read)(struct ast_channel *, const char *, char *, char *, size_t); /*!< Read function, if read is supported */
+ int (*write)(struct ast_channel *, const char *, char *, const char *); /*!< Write function, if write is supported */
AST_RWLIST_ENTRY(ast_custom_function) acflist;
};
@@ -844,7 +844,7 @@ int ast_active_calls(void);
*
* \return zero on success, non-zero on failure
*/
-int ast_func_read(struct ast_channel *chan, char *function, char *workspace, size_t len);
+int ast_func_read(struct ast_channel *chan, const char *function, char *workspace, size_t len);
/*!
* \brief executes a write operation on a function
@@ -857,7 +857,7 @@ int ast_func_read(struct ast_channel *chan, char *function, char *workspace, siz
*
* \return zero on success, non-zero on failure
*/
-int ast_func_write(struct ast_channel *chan, char *function, const char *value);
+int ast_func_write(struct ast_channel *chan, const char *function, const char *value);
void ast_hint_state_changed(const char *device);
diff --git a/main/db.c b/main/db.c
index 84fe2cd0a..e51b9268c 100644
--- a/main/db.c
+++ b/main/db.c
@@ -142,7 +142,7 @@ int ast_db_deltree(const char *family, const char *keytree)
return 0;
}
-int ast_db_put(const char *family, const char *keys, char *value)
+int ast_db_put(const char *family, const char *keys, const char *value)
{
char fullkey[256];
DBT key, data;
@@ -159,7 +159,7 @@ int ast_db_put(const char *family, const char *keys, char *value)
memset(&data, 0, sizeof(data));
key.data = fullkey;
key.size = fullkeylen + 1;
- data.data = value;
+ data.data = (char *) value;
data.size = strlen(value) + 1;
res = astdb->put(astdb, &key, &data, 0);
astdb->sync(astdb, 0);
@@ -542,7 +542,7 @@ static int manager_dbput(struct mansession *s, const struct message *m)
return 0;
}
- res = ast_db_put(family, key, (char *) val);
+ res = ast_db_put(family, key, val);
if (res) {
astman_send_error(s, m, "Failed to update entry");
} else {
diff --git a/main/pbx.c b/main/pbx.c
index 8d8d1899d..e45495e5b 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -1407,10 +1407,11 @@ static char *func_args(char *function)
return args;
}
-int ast_func_read(struct ast_channel *chan, char *function, char *workspace, size_t len)
+int ast_func_read(struct ast_channel *chan, const char *function, char *workspace, size_t len)
{
- char *args = func_args(function);
- struct ast_custom_function *acfptr = ast_custom_function_find(function);
+ char *copy = ast_strdupa(function);
+ char *args = func_args(copy);
+ struct ast_custom_function *acfptr = ast_custom_function_find(copy);
if (acfptr == NULL)
ast_log(LOG_ERROR, "Function %s not registered\n", function);
@@ -1421,10 +1422,11 @@ int ast_func_read(struct ast_channel *chan, char *function, char *workspace, siz
return -1;
}
-int ast_func_write(struct ast_channel *chan, char *function, const char *value)
+int ast_func_write(struct ast_channel *chan, const char *function, const char *value)
{
- char *args = func_args(function);
- struct ast_custom_function *acfptr = ast_custom_function_find(function);
+ char *copy = ast_strdupa(function);
+ char *args = func_args(copy);
+ struct ast_custom_function *acfptr = ast_custom_function_find(copy);
if (acfptr == NULL)
ast_log(LOG_ERROR, "Function %s not registered\n", function);
diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c
index 44f6c2c38..d2fcfb454 100644
--- a/pbx/pbx_dundi.c
+++ b/pbx/pbx_dundi.c
@@ -3755,7 +3755,7 @@ int dundi_query_eid(struct dundi_entity_info *dei, const char *dcontext, dundi_e
return dundi_query_eid_internal(dei, dcontext, &eid, &hmd, dundi_ttl, 0, avoid);
}
-static int dundifunc_read(struct ast_channel *chan, char *cmd, char *num, char *buf, size_t len)
+static int dundifunc_read(struct ast_channel *chan, const char *cmd, char *num, char *buf, size_t len)
{
char *context;
char *opts;