diff options
author | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-09-20 20:40:39 +0000 |
---|---|---|
committer | tilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b> | 2006-09-20 20:40:39 +0000 |
commit | e8ef9fd3bafa2149743dbc054fee547b432be5a7 (patch) | |
tree | cfe98d62cefd297076949dd1e36255cd7e2c3b9a /apps | |
parent | 9a47f6702095e34ea993fdbebe7e7a7736b8d5f1 (diff) |
Constify the result of a config retrieval function, to avoid mutilation (issue 7983).
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@43364 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_directory.c | 12 | ||||
-rw-r--r-- | apps/app_festival.c | 8 | ||||
-rw-r--r-- | apps/app_meetme.c | 2 | ||||
-rw-r--r-- | apps/app_privacy.c | 2 | ||||
-rw-r--r-- | apps/app_queue.c | 6 | ||||
-rw-r--r-- | apps/app_rpt.c | 77 | ||||
-rw-r--r-- | apps/app_voicemail.c | 91 |
7 files changed, 106 insertions, 92 deletions
diff --git a/apps/app_directory.c b/apps/app_directory.c index 8e893b54b..14d5dd61a 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -183,7 +183,7 @@ static void retrieve_file(char *dir) } #endif -static char *convert(char *lastname) +static char *convert(const char *lastname) { char *tmp; int lcount = 0; @@ -342,8 +342,8 @@ static struct ast_config *realtime_directory(char *context) struct ast_category *cat; struct ast_variable *var; char *mailbox; - char *fullname; - char *hidefromdir; + const char *fullname; + const char *hidefromdir; char tmp[100]; /* Load flat file config. */ @@ -402,7 +402,8 @@ static int do_directory(struct ast_channel *chan, struct ast_config *cfg, struct int res; int found=0; int lastuserchoice = 0; - char *start, *pos, *conv,*stringp=NULL; + char *start, *conv, *stringp = NULL; + const char *pos; if (ast_strlen_zero(context)) { ast_log(LOG_WARNING, @@ -570,7 +571,8 @@ static int directory_exec(struct ast_channel *chan, void *data) int last = 1; int readext = 0; int fromappvm = 0; - char *dirintro, *parse; + const char *dirintro; + char *parse; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(vmcontext); AST_APP_ARG(dialcontext); diff --git a/apps/app_festival.c b/apps/app_festival.c index d365b2410..cf0dfcba4 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -280,10 +280,10 @@ static int festival_exec(struct ast_channel *chan, void *vdata) struct ast_hostent ahp; int fd; FILE *fs; - char *host; - char *cachedir; - char *temp; - char *festivalcommand; + const char *host; + const char *cachedir; + const char *temp; + const char *festivalcommand; int port=1314; int n; char ack[4]; diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 4f3ee3051..df39581a9 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -2948,7 +2948,7 @@ static int slastate(const char *data) static void load_config_meetme(void) { struct ast_config *cfg; - char *val; + const char *val; audio_buffers = DEFAULT_AUDIO_BUFFERS; diff --git a/apps/app_privacy.c b/apps/app_privacy.c index 277ffba4c..5da93eb40 100644 --- a/apps/app_privacy.c +++ b/apps/app_privacy.c @@ -82,7 +82,7 @@ static int privacy_exec (struct ast_channel *chan, void *data) int maxretries = 3; int minlength = 10; int x = 0; - char *s; + const char *s; char phone[30]; struct ast_module_user *u; struct ast_config *cfg = NULL; diff --git a/apps/app_queue.c b/apps/app_queue.c index 982855062..a8eda768b 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -596,7 +596,7 @@ static int statechange_queue(const char *dev, int state, void *ign) return 0; } -static struct member *create_queue_member(char *interface, char *membername, int penalty, int paused) +static struct member *create_queue_member(char *interface, const char *membername, int penalty, int paused) { struct member *cur; @@ -912,7 +912,7 @@ static void queue_set_param(struct call_queue *q, const char *param, const char } } -static void rt_handle_member_record(struct call_queue *q, char *interface, char *membername, const char *penalty_str) +static void rt_handle_member_record(struct call_queue *q, char *interface, const char *membername, const char *penalty_str) { struct member *m, *prev_m; int penalty = 0; @@ -3691,7 +3691,7 @@ static int reload_queues(void) struct ast_variable *var; struct member *prev, *cur, *newm; int new; - char *general_val = NULL; + const char *general_val = NULL; char parse[80]; char *interface; char *membername; diff --git a/apps/app_rpt.c b/apps/app_rpt.c index d9895320e..decd98b7e 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -394,17 +394,17 @@ static struct rpt struct { - char *ourcontext; - char *ourcallerid; - char *acctcode; - char *ident; + const char *ourcontext; + const char *ourcallerid; + const char *acctcode; + const char *ident; char *tonezone; char simple; - char *functions; - char *link_functions; - char *phone_functions; - char *dphone_functions; - char *nodes; + const char *functions; + const char *link_functions; + const char *phone_functions; + const char *dphone_functions; + const char *nodes; int hangtime; int totime; int idtime; @@ -414,9 +414,9 @@ static struct rpt int politeid; char *tailmessages[500]; int tailmessagemax; - char *memory; - char *macro; - char *startupmacro; + const char *memory; + const char *macro; + const char *startupmacro; int iobase; char funcchar; char endchar; @@ -900,7 +900,7 @@ int i; -static int myatoi(char *str) +static int myatoi(const char *str) { int ret; @@ -941,7 +941,7 @@ struct rptfilter *f; static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int min, int max, int defl) { - char *var; + const char *var; int ret; var = ast_variable_retrieve(myrpt->cfg, category, name); @@ -960,7 +960,8 @@ static int retrieve_astcfgint(struct rpt *myrpt,char *category, char *name, int static void load_rpt_vars(int n,int init) { -char *this,*val; +char *this; + const char *val; int j,longestnode; struct ast_variable *vp; struct ast_config *cfg; @@ -1021,11 +1022,11 @@ char *strs[100]; rpt_vars[n].p.idtime = retrieve_astcfgint(&rpt_vars[n],this, "idtime", 60000, 2400000, IDTIME); /* Enforce a min max */ rpt_vars[n].p.politeid = retrieve_astcfgint(&rpt_vars[n],this, "politeid", 30000, 300000, POLITEID); /* Enforce a min max */ val = ast_variable_retrieve(cfg,this,"tonezone"); - if (val) rpt_vars[n].p.tonezone = val; + if (val) rpt_vars[n].p.tonezone = ast_strdupa(val); rpt_vars[n].p.tailmessages[0] = 0; rpt_vars[n].p.tailmessagemax = 0; val = ast_variable_retrieve(cfg,this,"tailmessagelist"); - if (val) rpt_vars[n].p.tailmessagemax = finddelim(val, rpt_vars[n].p.tailmessages, 500); + if (val) rpt_vars[n].p.tailmessagemax = finddelim(ast_strdupa(val), rpt_vars[n].p.tailmessages, 500); val = ast_variable_retrieve(cfg,this,"memory"); if (!val) val = MEMORY; rpt_vars[n].p.memory = val; @@ -1069,7 +1070,7 @@ char *strs[100]; #ifdef __RPT_NOTCH val = ast_variable_retrieve(cfg,this,"rxnotch"); if (val) { - i = finddelim(val,strs,MAXFILTERS * 2); + i = finddelim(ast_strdupa(val),strs,MAXFILTERS * 2); i &= ~1; /* force an even number, rounded down */ if (i >= 2) for(j = 0; j < i; j += 2) { @@ -1523,7 +1524,7 @@ static int play_silence(struct ast_channel *chan, int duration) } -static int send_morse(struct ast_channel *chan, char *string, int speed, int freq, int amplitude) +static int send_morse(struct ast_channel *chan, const char *string, int speed, int freq, int amplitude) { static struct morse_bits mbits[] = { @@ -1685,7 +1686,7 @@ static struct morse_bits mbits[] = { return res; } -static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) +static int send_tone_telemetry(struct ast_channel *chan, const char *tonestring) { char *stringp; char *tonesubset; @@ -1737,7 +1738,7 @@ static int send_tone_telemetry(struct ast_channel *chan, char *tonestring) } -static int sayfile(struct ast_channel *mychannel,char *fname) +static int sayfile(struct ast_channel *mychannel, const char *fname) { int res; @@ -1776,7 +1777,7 @@ static int saynum(struct ast_channel *mychannel, int num) } -static int telem_any(struct rpt *myrpt,struct ast_channel *chan, char *entry) +static int telem_any(struct rpt *myrpt,struct ast_channel *chan, const char *entry) { int res; char c; @@ -1837,8 +1838,8 @@ static int telem_lookup(struct rpt *myrpt,struct ast_channel *chan, char *node, int res; int i; - char *entry; - char *telemetry; + const char *entry; + const char *telemetry; char *telemetry_save; res = 0; @@ -1882,7 +1883,7 @@ static int telem_lookup(struct rpt *myrpt,struct ast_channel *chan, char *node, static int get_wait_interval(struct rpt *myrpt, int type) { int interval; - char *wait_times; + const char *wait_times; char *wait_times_save; wait_times_save = NULL; @@ -1960,7 +1961,8 @@ struct rpt_tele *tlist; struct rpt *myrpt; struct rpt_link *l,*m,linkbase; struct ast_channel *mychannel; -char *p,*ct,*ct_copy,*ident, *nodename; + const char *p, *ct; + char *ct_copy, *ident, *nodename; time_t t; struct tm localtm; @@ -2922,7 +2924,8 @@ struct rpt_link *l; static int function_ilink(struct rpt *myrpt, char *param, char *digits, int command_source, struct rpt_link *mylink) { - char *val, *s, *s1, *s2, *tele; + const char *val; + char *s, *s1, *s2, *tele; char tmp[300], deststr[300] = "",modechange = 0; char digitbuf[MAXNODESTR]; struct rpt_link *l; @@ -3445,7 +3448,7 @@ static int function_status(struct rpt *myrpt, char *param, char *digitbuf, int c static int function_macro(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink) { -char *val; + const char *val; int i; struct ast_channel *mychannel; @@ -4920,7 +4923,8 @@ static int rmt_saycharstr(struct rpt *myrpt, struct ast_channel *chan, int delay static int function_remote(struct rpt *myrpt, char *param, char *digitbuf, int command_source, struct rpt_link *mylink) { - char *s,*s1,*s2,*val; + char *s,*s1,*s2; + const char *val; int i,j,ht,k,l,ls2,m,d,res,offset,offsave, modesave, defmode; char multimode = 0; char oc; @@ -4954,7 +4958,7 @@ static int function_remote(struct rpt *myrpt, char *param, char *digitbuf, int c sayfile(mychannel,"rpt/memory_notfound"); return DC_COMPLETE; } - strncpy(tmp,val,sizeof(tmp) - 1); + ast_copy_string(tmp, val, sizeof(tmp)); s = strchr(tmp,','); if (!s) return DC_ERROR; @@ -5773,7 +5777,8 @@ int res; static int attempt_reconnect(struct rpt *myrpt, struct rpt_link *l) { - char *val, *s, *s1, *s2, *tele; + const char *val; + char *s, *s1, *s2, *tele; char tmp[300], deststr[300] = ""; val = ast_variable_retrieve(myrpt->cfg, myrpt->p.nodes, l->name); @@ -6018,7 +6023,8 @@ static void do_scheduler(struct rpt *myrpt) static void *rpt(void *this) { struct rpt *myrpt = (struct rpt *)this; -char *tele,*idtalkover,c; + char *tele, c; + const char *idtalkover; int ms = MSWAIT,i,lasttx=0,val,remrx=0,identqueued,othertelemqueued,tailmessagequeued,ctqueued; struct ast_channel *who; ZT_CONFINFO ci; /* conference info */ @@ -7156,7 +7162,8 @@ static void *rpt_master(void *config) int i,n; pthread_attr_t attr; struct ast_config *cfg; -char *this,*val; + char *this; + const char *val; /* go thru all the specified repeaters */ this = NULL; @@ -7442,7 +7449,9 @@ static int rpt_exec(struct ast_channel *chan, void *data) struct ast_hostent ahp; struct hostent *hp; struct in_addr ia; - char hisip[100],nodeip[100],*val, *s, *s1, *s2, *b,*b1; + char hisip[100],nodeip[100]; + const char *val; + char *s, *s1, *s2, *b,*b1; /* look at callerid to see what node this comes from */ if (!chan->cid.cid_num) /* if doesn't have caller id */ diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 277f77e2f..a66eb282f 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -3800,7 +3800,8 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st int res = 0, cmd = 0; struct ast_vm_user *receiver = NULL, *vmtmp; AST_LIST_HEAD_NOLOCK_STATIC(extensions, ast_vm_user); - char *stringp, *s; + char *stringp; + const char *s; int saved_messages = 0, found = 0; int valid_extensions = 0; char *dir; @@ -4097,7 +4098,7 @@ static int wait_file(struct ast_channel *chan, struct vm_state *vms, char *file) return ast_control_streamfile(chan, file, "#", "*", "1456789", "0", "2", skipms); } -static int play_message_category(struct ast_channel *chan, char *category) +static int play_message_category(struct ast_channel *chan, const char *category) { int res = 0; @@ -4112,7 +4113,7 @@ static int play_message_category(struct ast_channel *chan, char *category) return res; } -static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *vmu, char *origtime, char *filename) +static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *vmu, const char *origtime, const char *filename) { int res = 0; struct vm_zone *the_zone = NULL; @@ -4180,7 +4181,7 @@ static int play_message_datetime(struct ast_channel *chan, struct ast_vm_user *v -static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms, char *cid, char *context, int callback) +static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms, char *cid, const char *context, int callback) { int res = 0; int i; @@ -4243,7 +4244,7 @@ static int play_message_callerid(struct ast_channel *chan, struct vm_state *vms, return res; } -static int play_message_duration(struct ast_channel *chan, struct vm_state *vms, char *duration, int minduration) +static int play_message_duration(struct ast_channel *chan, struct vm_state *vms, const char *duration, int minduration) { int res = 0; int durationm; @@ -4412,8 +4413,8 @@ static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struc static int play_message(struct ast_channel *chan, struct ast_vm_user *vmu, struct vm_state *vms) { int res = 0; - char filename[256],*origtime, *cid, *context, *duration; - char *category; + char filename[256], *cid; + const char *origtime, *context, *category, *duration; struct ast_config *msg_cfg; vms->starting = 0; @@ -6851,44 +6852,45 @@ static int load_config(void) struct ast_config *cfg, *ucfg; char *cat; struct ast_variable *var; - char *notifystr = NULL; - char *smdistr = NULL; - char *astattach; - char *astsearch; - char *astsaycid; - char *send_voicemail; + const char *notifystr = NULL; + const char *smdistr = NULL; + const char *astattach; + const char *astsearch; + const char *astsaycid; + const char *send_voicemail; #ifdef IMAP_STORAGE - char *imap_server; - char *imap_port; - char *imap_flags; - char *auth_user; - char *auth_password; - char *expunge_on_hangup; + const char *imap_server; + const char *imap_port; + const char *imap_flags; + const char *auth_user; + const char *auth_password; + const char *expunge_on_hangup; #endif - char *astcallop; - char *astreview; - char *asttempgreetwarn; - char *astskipcmd; - char *asthearenv; - char *astsaydurationinfo; - char *astsaydurationminfo; - char *silencestr; - char *maxmsgstr; - char *astdirfwd; - char *thresholdstr; - char *fmt; - char *astemail; - char *ucontext; - char *astmailcmd = SENDMAIL; - char *astforcename; - char *astforcegreet; - char *s,*q,*stringp; - char *dialoutcxt = NULL; - char *callbackcxt = NULL; - char *exitcxt = NULL; - char *extpc; - char *emaildateformatstr; - char *volgainstr; + const char *astcallop; + const char *astreview; + const char *asttempgreetwarn; + const char *astskipcmd; + const char *asthearenv; + const char *astsaydurationinfo; + const char *astsaydurationminfo; + const char *silencestr; + const char *maxmsgstr; + const char *astdirfwd; + const char *thresholdstr; + const char *fmt; + const char *astemail; + const char *ucontext; + const char *astmailcmd = SENDMAIL; + const char *astforcename; + const char *astforcegreet; + const char *s; + char *q,*stringp; + const char *dialoutcxt = NULL; + const char *callbackcxt = NULL; + const char *exitcxt = NULL; + const char *extpc; + const char *emaildateformatstr; + const char *volgainstr; int x; int tmpadsi[4]; @@ -7474,7 +7476,8 @@ static int advanced_options(struct ast_channel *chan, struct ast_vm_user *vmu, s #endif char filename[256]; struct ast_config *msg_cfg; - char *origtime, *cid, *context, *name, *num; + const char *origtime, *context; + char *cid, *name, *num; int retries = 0; vms->starting = 0; |