From 870f98f02de56e35b87f511544a6cda3d4d8fe69 Mon Sep 17 00:00:00 2001 From: Tilghman Lesher Date: Sat, 3 Dec 2005 19:25:33 +0000 Subject: Bug 5858 - Make the chanvars.c functions return a 'const char *' This should prevent us from unintentionally changing variable values when they're returned from pbx_builtin_getvar_helper. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@7304 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_agent.c | 5 +++-- channels/chan_iax2.c | 3 +-- channels/chan_mgcp.c | 2 +- channels/chan_sip.c | 8 ++++---- channels/chan_zap.c | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) (limited to 'channels') diff --git a/channels/chan_agent.c b/channels/chan_agent.c index a754f8a8f..dfde90f0f 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -1686,7 +1686,7 @@ static int __login_exec(struct ast_channel *chan, void *data, int callbackmode) AST_APP_ARG(options); AST_APP_ARG(extension); ); - char *tmpoptions = NULL; + const char *tmpoptions = NULL; char *context = NULL; int play_announcement = 1; char agent_goodbye[AST_MAX_FILENAME_LEN]; @@ -2231,7 +2231,7 @@ static int agentmonitoroutgoing_exec(struct ast_channel *chan, void *data) int nowarnings = 0; int changeoutgoing = 0; int res = 0; - char agent[AST_MAX_AGENT], *tmp; + char agent[AST_MAX_AGENT]; if (data) { if (strchr(data, 'd')) @@ -2242,6 +2242,7 @@ static int agentmonitoroutgoing_exec(struct ast_channel *chan, void *data) changeoutgoing = 1; } if (chan->cid.cid_num) { + const char *tmp; char agentvar[AST_MAX_BUF]; snprintf(agentvar, sizeof(agentvar), "%s_%s", GETAGENTBYCALLERID, chan->cid.cid_num); if ((tmp = pbx_builtin_getvar_helper(NULL, agentvar))) { diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index 74b5da3f9..00a813ba2 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -9137,7 +9137,6 @@ static int iax2_exec(struct ast_channel *chan, const char *context, const char * char odata[256]; char req[256]; char *ncontext; - char *dialstatus; struct iax2_dpcache *dp; struct ast_app *dial; #if 0 @@ -9145,7 +9144,7 @@ static int iax2_exec(struct ast_channel *chan, const char *context, const char * #endif if (priority == 2) { /* Indicate status, can be overridden in dialplan */ - dialstatus = pbx_builtin_getvar_helper(chan, "DIALSTATUS"); + const char *dialstatus = pbx_builtin_getvar_helper(chan, "DIALSTATUS"); if (dialstatus) { dial = pbx_findapp(dialstatus); if (dial) diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 4447bd7ff..f22616891 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -889,7 +889,7 @@ static int mgcp_call(struct ast_channel *ast, char *dest, int timeout) struct mgcp_endpoint *p; struct mgcp_subchannel *sub; char tone[50] = ""; - char *distinctive_ring = NULL; + const char *distinctive_ring = NULL; struct varshead *headp; struct ast_var_t *current; diff --git a/channels/chan_sip.c b/channels/chan_sip.c index c93f21fa3..7b97b5220 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -462,11 +462,11 @@ struct sip_pkt; /*! \brief Parameters to the transmit_invite function */ struct sip_invite_param { - char *distinctive_ring; /*!< Distinctive ring header */ + const char *distinctive_ring; /*!< Distinctive ring header */ char *osptoken; /*!< OSP token for this call */ int addsipheaders; /*!< Add extra SIP headers */ - char *uri_options; /*!< URI options to add to the URI */ - char *vxml_url; /*!< VXML url for Cisco phones */ + const char *uri_options; /*!< URI options to add to the URI */ + const char *vxml_url; /*!< VXML url for Cisco phones */ char *auth; /*!< Authentication */ char *authheader; /*!< Auth header */ enum sip_auth_type auth_type; /*!< Authentication type */ @@ -2478,7 +2478,7 @@ static int sip_hangup(struct ast_channel *ast) static int sip_answer(struct ast_channel *ast) { int res = 0,fmt; - char *codec; + const char *codec; struct sip_pvt *p = ast->tech_pvt; ast_mutex_lock(&p->lock); diff --git a/channels/chan_zap.c b/channels/chan_zap.c index 8902b57ae..3b8b9b81b 100644 --- a/channels/chan_zap.c +++ b/channels/chan_zap.c @@ -1932,7 +1932,7 @@ static int zt_call(struct ast_channel *ast, char *rdest, int timeout) break; case SIG_FEATDMF_TA: { - char *cic = NULL, *ozz = NULL; + const char *cic, *ozz; /* If you have to go through a Tandem Access point you need to use this */ ozz = pbx_builtin_getvar_helper(p->owner, "FEATDMF_OZZ"); -- cgit v1.2.3