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
1.6.0
Kevin P. Fleming 19 years ago
parent 7cb197a5b7
commit cd73a483f1

@ -3637,7 +3637,7 @@ check_turns:
return res; 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; int res = -1;
struct call_queue *q; struct call_queue *q;
@ -3689,7 +3689,7 @@ static int queue_function_var(struct ast_channel *chan, char *cmd, char *data, c
return 0; 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; int count = 0;
struct call_queue *q; struct call_queue *q;
@ -3731,7 +3731,7 @@ static int queue_function_qac(struct ast_channel *chan, char *cmd, char *data, c
return 0; 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; int count = 0;
struct call_queue *q; struct call_queue *q;
@ -3766,7 +3766,7 @@ static int queue_function_queuewaitingcount(struct ast_channel *chan, char *cmd,
return 0; 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 ast_module_user *u;
struct call_queue *q; struct call_queue *q;

@ -144,7 +144,7 @@ static struct ast_speech_result *find_result(struct ast_speech_result *results,
} }
/*! \brief SPEECH_SCORE() Dialplan Function */ /*! \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) char *buf, size_t len)
{ {
struct ast_speech_result *result = NULL; struct ast_speech_result *result = NULL;
@ -172,7 +172,7 @@ static struct ast_custom_function speech_score_function = {
}; };
/*! \brief SPEECH_TEXT() Dialplan 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) char *buf, size_t len)
{ {
struct ast_speech_result *result = NULL; struct ast_speech_result *result = NULL;
@ -198,7 +198,7 @@ static struct ast_custom_function speech_text_function = {
}; };
/*! \brief SPEECH_GRAMMAR() Dialplan 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) char *buf, size_t len)
{ {
struct ast_speech_result *result = NULL; struct ast_speech_result *result = NULL;
@ -224,7 +224,7 @@ static struct ast_custom_function speech_grammar_function = {
}; };
/*! \brief SPEECH_ENGINE() Dialplan 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); struct ast_speech *speech = find_speech(chan);
@ -247,7 +247,7 @@ static struct ast_custom_function speech_engine_function = {
}; };
/*! \brief SPEECH() Dialplan 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) char *buf, size_t len)
{ {
int results = 0; int results = 0;

@ -6914,7 +6914,7 @@ static int vm_box_exists(struct ast_channel *chan, void *data)
return 0; 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; struct ast_vm_user svm;
AST_DECLARE_APP_ARGS(arg, AST_DECLARE_APP_ARGS(arg,

@ -2384,7 +2384,7 @@ static struct agent_pvt *find_agent(char *agentid)
return cur; 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; char *parse;
AST_DECLARE_APP_ARGS(args, AST_DECLARE_APP_ARGS(args,

@ -9589,7 +9589,7 @@ static int iax2_exec(struct ast_channel *chan, const char *context, const char *
return -1; 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; struct iax2_peer *peer;
char *peername, *colname; char *peername, *colname;

@ -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_notify(int fd, int argc, char *argv[]);
static int sip_do_history(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 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_dtmfmode(struct ast_channel *chan, void *data);
static int sip_addheader(struct ast_channel *chan, void *data); static int sip_addheader(struct ast_channel *chan, void *data);
static int sip_do_reload(enum channelreloadreason reason); 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"; " Provides detailed list of the configuration of the SIP channel.\n";
/*! \brief Read SIP header (dialplan function) */ /*! \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; struct sip_pvt *p;
const char *content = NULL; 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 */ /*! \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)) { if (ast_strlen_zero(data)) {
ast_log(LOG_WARNING, "CHECKSIPDOMAIN requires an argument - A domain name\n"); 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 */ /*! \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; struct sip_peer *peer;
char *colname; char *colname;
@ -11582,7 +11578,7 @@ struct ast_custom_function sippeer_function = {
}; };
/*! \brief ${SIPCHANINFO()} Dialplan function - reads sip channel data */ /*! \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; struct sip_pvt *p;

@ -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_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); int ast_db_del(const char *family, const char *key);

@ -74,8 +74,8 @@ struct ast_custom_function {
const char *synopsis; /*!< Short description for "show functions" */ const char *synopsis; /*!< Short description for "show functions" */
const char *desc; /*!< Help text that explains it all */ const char *desc; /*!< Help text that explains it all */
const char *syntax; /*!< Syntax description */ const char *syntax; /*!< Syntax description */
int (*read)(struct ast_channel *, char *, char *, char *, size_t); /*!< Read function, if read is supported */ int (*read)(struct ast_channel *, const 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 (*write)(struct ast_channel *, const char *, char *, const char *); /*!< Write function, if write is supported */
AST_RWLIST_ENTRY(ast_custom_function) acflist; AST_RWLIST_ENTRY(ast_custom_function) acflist;
}; };
@ -844,7 +844,7 @@ int ast_active_calls(void);
* *
* \return zero on success, non-zero on failure * \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 * \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 * \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); void ast_hint_state_changed(const char *device);

@ -142,7 +142,7 @@ int ast_db_deltree(const char *family, const char *keytree)
return 0; 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]; char fullkey[256];
DBT key, data; DBT key, data;
@ -159,7 +159,7 @@ int ast_db_put(const char *family, const char *keys, char *value)
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
key.data = fullkey; key.data = fullkey;
key.size = fullkeylen + 1; key.size = fullkeylen + 1;
data.data = value; data.data = (char *) value;
data.size = strlen(value) + 1; data.size = strlen(value) + 1;
res = astdb->put(astdb, &key, &data, 0); res = astdb->put(astdb, &key, &data, 0);
astdb->sync(astdb, 0); astdb->sync(astdb, 0);
@ -542,7 +542,7 @@ static int manager_dbput(struct mansession *s, const struct message *m)
return 0; return 0;
} }
res = ast_db_put(family, key, (char *) val); res = ast_db_put(family, key, val);
if (res) { if (res) {
astman_send_error(s, m, "Failed to update entry"); astman_send_error(s, m, "Failed to update entry");
} else { } else {

@ -1407,10 +1407,11 @@ static char *func_args(char *function)
return args; 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); char *copy = ast_strdupa(function);
struct ast_custom_function *acfptr = ast_custom_function_find(function); char *args = func_args(copy);
struct ast_custom_function *acfptr = ast_custom_function_find(copy);
if (acfptr == NULL) if (acfptr == NULL)
ast_log(LOG_ERROR, "Function %s not registered\n", function); 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; 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); char *copy = ast_strdupa(function);
struct ast_custom_function *acfptr = ast_custom_function_find(function); char *args = func_args(copy);
struct ast_custom_function *acfptr = ast_custom_function_find(copy);
if (acfptr == NULL) if (acfptr == NULL)
ast_log(LOG_ERROR, "Function %s not registered\n", function); ast_log(LOG_ERROR, "Function %s not registered\n", function);

@ -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); 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 *context;
char *opts; char *opts;

Loading…
Cancel
Save