diff options
145 files changed, 802 insertions, 806 deletions
diff --git a/apps/app_adsiprog.c b/apps/app_adsiprog.c index 8f789c6c4..b889f96f1 100644 --- a/apps/app_adsiprog.c +++ b/apps/app_adsiprog.c @@ -74,7 +74,7 @@ struct adsi_event { char *name; }; -static struct adsi_event events[] = { +static const struct adsi_event events[] = { { 1, "CALLERID" }, { 2, "VMWI" }, { 3, "NEARANSWER" }, @@ -101,7 +101,7 @@ static struct adsi_event events[] = { { 24, "CPEID" }, }; -static struct adsi_event justify[] = { +static const struct adsi_event justify[] = { { 0, "CENTER" }, { 1, "RIGHT" }, { 2, "LEFT" }, @@ -232,7 +232,7 @@ static int process_token(void *out, char *src, int maxlen, int argtype) return 0; } -static char *get_token(char **buf, char *script, int lineno) +static char *get_token(char **buf, const char *script, int lineno) { char *tmp = *buf, *keyword; int quoted = 0; @@ -264,7 +264,7 @@ static char *get_token(char **buf, char *script, int lineno) static char *validdtmf = "123456789*0#ABCD"; -static int send_dtmf(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno) +static int send_dtmf(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno) { char dtmfstr[80], *a; int bytes = 0; @@ -294,7 +294,7 @@ static int send_dtmf(char *buf, char *name, int id, char *args, struct adsi_scri return bytes; } -static int goto_line(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno) +static int goto_line(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno) { char *page = get_token(&args, script, lineno); char *gline = get_token(&args, script, lineno); @@ -327,7 +327,7 @@ static int goto_line(char *buf, char *name, int id, char *args, struct adsi_scri return 2; } -static int goto_line_rel(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno) +static int goto_line_rel(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno) { char *dir = get_token(&args, script, lineno); char *gline = get_token(&args, script, lineno); @@ -360,7 +360,7 @@ static int goto_line_rel(char *buf, char *name, int id, char *args, struct adsi_ return 2; } -static int send_delay(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno) +static int send_delay(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno) { char *gtime = get_token(&args, script, lineno); int ms; @@ -385,7 +385,7 @@ static int send_delay(char *buf, char *name, int id, char *args, struct adsi_scr return 2; } -static int set_state(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno) +static int set_state(char *buf, char *name, int id, char *args, struct adsi_script *istate, const char *script, int lineno) { char *gstate = get_token(&args, script, lineno); int state; @@ -406,7 +406,7 @@ static int set_state(char *buf, char *name, int id, char *args, struct adsi_scri return 2; } -static int cleartimer(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno) +static int cleartimer(char *buf, char *name, int id, char *args, struct adsi_script *istate, const char *script, int lineno) { char *tok = get_token(&args, script, lineno); @@ -424,7 +424,7 @@ static int cleartimer(char *buf, char *name, int id, char *args, struct adsi_scr return 2; } -static struct adsi_flag *getflagbyname(struct adsi_script *state, char *name, char *script, int lineno, int create) +static struct adsi_flag *getflagbyname(struct adsi_script *state, char *name, const char *script, int lineno, int create) { int x; @@ -449,7 +449,7 @@ static struct adsi_flag *getflagbyname(struct adsi_script *state, char *name, ch return &state->flags[state->numflags-1]; } -static int setflag(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno) +static int setflag(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno) { char *tok = get_token(&args, script, lineno); char sname[80]; @@ -476,7 +476,7 @@ static int setflag(char *buf, char *name, int id, char *args, struct adsi_script return 2; } -static int clearflag(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno) +static int clearflag(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno) { char *tok = get_token(&args, script, lineno); struct adsi_flag *flag; @@ -503,7 +503,7 @@ static int clearflag(char *buf, char *name, int id, char *args, struct adsi_scri return 2; } -static int starttimer(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno) +static int starttimer(char *buf, char *name, int id, char *args, struct adsi_script *istate, const char *script, int lineno) { char *tok = get_token(&args, script, lineno); int secs; @@ -549,7 +549,7 @@ static int getjustifybyname(char *name) return -1; } -static struct adsi_soft_key *getkeybyname(struct adsi_script *state, char *name, char *script, int lineno) +static struct adsi_soft_key *getkeybyname(struct adsi_script *state, char *name, const char *script, int lineno) { int x; @@ -570,7 +570,7 @@ static struct adsi_soft_key *getkeybyname(struct adsi_script *state, char *name, return &state->keys[state->numkeys-1]; } -static struct adsi_subscript *getsubbyname(struct adsi_script *state, char *name, char *script, int lineno) +static struct adsi_subscript *getsubbyname(struct adsi_script *state, char *name, const char *script, int lineno) { int x; @@ -591,7 +591,7 @@ static struct adsi_subscript *getsubbyname(struct adsi_script *state, char *name return &state->subs[state->numsubs-1]; } -static struct adsi_state *getstatebyname(struct adsi_script *state, char *name, char *script, int lineno, int create) +static struct adsi_state *getstatebyname(struct adsi_script *state, char *name, const char *script, int lineno, int create) { int x; @@ -616,7 +616,7 @@ static struct adsi_state *getstatebyname(struct adsi_script *state, char *name, return &state->states[state->numstates-1]; } -static struct adsi_display *getdisplaybyname(struct adsi_script *state, char *name, char *script, int lineno, int create) +static struct adsi_display *getdisplaybyname(struct adsi_script *state, char *name, const char *script, int lineno, int create) { int x; @@ -641,7 +641,7 @@ static struct adsi_display *getdisplaybyname(struct adsi_script *state, char *na return &state->displays[state->numdisplays-1]; } -static int showkeys(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno) +static int showkeys(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno) { char *tok, newkey[80]; int bytes, x, flagid = 0; @@ -688,7 +688,7 @@ static int showkeys(char *buf, char *name, int id, char *args, struct adsi_scrip return 2 + x; } -static int showdisplay(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno) +static int showdisplay(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno) { char *tok, dispname[80]; int line = 0, flag = 0, cmd = 3; @@ -739,7 +739,7 @@ static int showdisplay(char *buf, char *name, int id, char *args, struct adsi_sc return 3; } -static int cleardisplay(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno) +static int cleardisplay(char *buf, char *name, int id, char *args, struct adsi_script *istate, const char *script, int lineno) { char *tok = get_token(&args, script, lineno); @@ -751,7 +751,7 @@ static int cleardisplay(char *buf, char *name, int id, char *args, struct adsi_s return 2; } -static int digitdirect(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno) +static int digitdirect(char *buf, char *name, int id, char *args, struct adsi_script *istate, const char *script, int lineno) { char *tok = get_token(&args, script, lineno); @@ -763,7 +763,7 @@ static int digitdirect(char *buf, char *name, int id, char *args, struct adsi_sc return 2; } -static int clearcbone(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno) +static int clearcbone(char *buf, char *name, int id, char *args, struct adsi_script *istate, const char *script, int lineno) { char *tok = get_token(&args, script, lineno); @@ -775,7 +775,7 @@ static int clearcbone(char *buf, char *name, int id, char *args, struct adsi_scr return 2; } -static int digitcollect(char *buf, char *name, int id, char *args, struct adsi_script *istate, char *script, int lineno) +static int digitcollect(char *buf, char *name, int id, char *args, struct adsi_script *istate, const char *script, int lineno) { char *tok = get_token(&args, script, lineno); @@ -787,7 +787,7 @@ static int digitcollect(char *buf, char *name, int id, char *args, struct adsi_s return 2; } -static int subscript(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno) +static int subscript(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno) { char *tok = get_token(&args, script, lineno); char subscr[80]; @@ -812,7 +812,7 @@ static int subscript(char *buf, char *name, int id, char *args, struct adsi_scri return 2; } -static int onevent(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno) +static int onevent(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno) { char *tok = get_token(&args, script, lineno); char subscr[80], sname[80]; @@ -879,10 +879,10 @@ static int onevent(char *buf, char *name, int id, char *args, struct adsi_script struct adsi_key_cmd { char *name; int id; - int (*add_args)(char *buf, char *name, int id, char *args, struct adsi_script *state, char *script, int lineno); + int (*add_args)(char *buf, char *name, int id, char *args, struct adsi_script *state, const char *script, int lineno); }; -static struct adsi_key_cmd kcmds[] = { +static const struct adsi_key_cmd kcmds[] = { { "SENDDTMF", 0, send_dtmf }, /* Encoded DTMF would go here */ { "ONHOOK", 0x81 }, @@ -924,7 +924,7 @@ static struct adsi_key_cmd kcmds[] = { { "EXIT", 0xa0 }, }; -static struct adsi_key_cmd opcmds[] = { +static const struct adsi_key_cmd opcmds[] = { /* 1 - Branch on event -- handled specially */ { "SHOWKEYS", 2, showkeys }, @@ -944,7 +944,7 @@ static struct adsi_key_cmd opcmds[] = { }; -static int process_returncode(struct adsi_soft_key *key, char *code, char *args, struct adsi_script *state, char *script, int lineno) +static int process_returncode(struct adsi_soft_key *key, char *code, char *args, struct adsi_script *state, const char *script, int lineno) { int x, res; char *unused; @@ -973,7 +973,7 @@ static int process_returncode(struct adsi_soft_key *key, char *code, char *args, return -1; } -static int process_opcode(struct adsi_subscript *sub, char *code, char *args, struct adsi_script *state, char *script, int lineno) +static int process_opcode(struct adsi_subscript *sub, char *code, char *args, struct adsi_script *state, const char *script, int lineno) { int x, res, max = sub->id ? MAX_SUB_LEN : MAX_MAIN_LEN; char *unused; @@ -1010,7 +1010,7 @@ static int process_opcode(struct adsi_subscript *sub, char *code, char *args, st return -1; } -static int adsi_process(struct adsi_script *state, char *buf, char *script, int lineno) +static int adsi_process(struct adsi_script *state, char *buf, const char *script, int lineno) { char *keyword = get_token(&buf, script, lineno); char *args, vname[256], tmp[80], tmp2[80]; @@ -1358,7 +1358,7 @@ static int adsi_process(struct adsi_script *state, char *buf, char *script, int return 0; } -static struct adsi_script *compile_script(char *script) +static struct adsi_script *compile_script(const char *script) { FILE *f; char fn[256], buf[256], *c; @@ -1451,7 +1451,7 @@ static void dump_message(char *type, char *vname, unsigned char *buf, int buflen } #endif -static int adsi_prog(struct ast_channel *chan, char *script) +static int adsi_prog(struct ast_channel *chan, const char *script) { struct adsi_script *scr; int x, bytes; @@ -1562,7 +1562,7 @@ static int adsi_prog(struct ast_channel *chan, char *script) return 0; } -static int adsi_exec(struct ast_channel *chan, void *data) +static int adsi_exec(struct ast_channel *chan, const char *data) { int res = 0; diff --git a/apps/app_alarmreceiver.c b/apps/app_alarmreceiver.c index 6b34dfb54..c6fa8980b 100644 --- a/apps/app_alarmreceiver.c +++ b/apps/app_alarmreceiver.c @@ -416,7 +416,7 @@ static int log_events(struct ast_channel *chan, char *signalling_type, event_no * * The function will return 0 when the caller hangs up, else a -1 if there was a problem. */ -static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int fdto, int sdto, int tldn, event_node_t **ehead) +static int receive_ademco_contact_id(struct ast_channel *chan, const void *data, int fdto, int sdto, int tldn, event_node_t **ehead) { int i, j; int res = 0; @@ -564,7 +564,7 @@ static int receive_ademco_contact_id( struct ast_channel *chan, void *data, int * This is the main function called by Asterisk Core whenever the App is invoked in the extension logic. * This function will always return 0. */ -static int alarmreceiver_exec(struct ast_channel *chan, void *data) +static int alarmreceiver_exec(struct ast_channel *chan, const char *data) { int res = 0; event_node_t *elp, *efree; diff --git a/apps/app_amd.c b/apps/app_amd.c index 56fa10fd2..cedd3b67a 100644 --- a/apps/app_amd.c +++ b/apps/app_amd.c @@ -143,7 +143,7 @@ static int dfltMaximumWordLength = 5000; /* Setting this to a large default s /* Set to the lowest ms value provided in amd.conf or application parameters */ static int dfltMaxWaitTimeForFrame = 50; -static void isAnsweringMachine(struct ast_channel *chan, void *data) +static void isAnsweringMachine(struct ast_channel *chan, const char *data) { int res = 0; struct ast_frame *f = NULL; @@ -404,7 +404,7 @@ static void isAnsweringMachine(struct ast_channel *chan, void *data) } -static int amd_exec(struct ast_channel *chan, void *data) +static int amd_exec(struct ast_channel *chan, const char *data) { isAnsweringMachine(chan, data); diff --git a/apps/app_authenticate.c b/apps/app_authenticate.c index 88b2018f0..19570255c 100644 --- a/apps/app_authenticate.c +++ b/apps/app_authenticate.c @@ -105,7 +105,7 @@ static char *app = "Authenticate"; </application> ***/ -static int auth_exec(struct ast_channel *chan, void *data) +static int auth_exec(struct ast_channel *chan, const char *data) { int res = 0, retries, maxdigits; char passwd[256], *prompt = "agent-pass", *argcopy = NULL; diff --git a/apps/app_cdr.c b/apps/app_cdr.c index ca228da03..70036ad82 100644 --- a/apps/app_cdr.c +++ b/apps/app_cdr.c @@ -44,9 +44,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") </application> ***/ -static char *nocdr_app = "NoCDR"; +static const char nocdr_app[] = "NoCDR"; -static int nocdr_exec(struct ast_channel *chan, void *data) +static int nocdr_exec(struct ast_channel *chan, const char *data) { if (chan->cdr) ast_set_flag(chan->cdr, AST_CDR_FLAG_POST_DISABLED); diff --git a/apps/app_chanisavail.c b/apps/app_chanisavail.c index 556bafd71..c7af4af7d 100644 --- a/apps/app_chanisavail.c +++ b/apps/app_chanisavail.c @@ -92,7 +92,7 @@ static char *app = "ChanIsAvail"; </application> ***/ -static int chanavail_exec(struct ast_channel *chan, void *data) +static int chanavail_exec(struct ast_channel *chan, const char *data) { int inuse=-1, option_state=0, string_compare=0, option_all_avail=0; int status; diff --git a/apps/app_channelredirect.c b/apps/app_channelredirect.c index f604151ee..727162194 100644 --- a/apps/app_channelredirect.c +++ b/apps/app_channelredirect.c @@ -62,7 +62,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ static char *app = "ChannelRedirect"; -static int asyncgoto_exec(struct ast_channel *chan, void *data) +static int asyncgoto_exec(struct ast_channel *chan, const char *data) { int res = -1; char *info; diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index 76d82305e..580038326 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -963,7 +963,7 @@ exit: return res; } -static int chanspy_exec(struct ast_channel *chan, void *data) +static int chanspy_exec(struct ast_channel *chan, const char *data) { char *myenforced = NULL; char *mygroup = NULL; @@ -985,9 +985,9 @@ static int chanspy_exec(struct ast_channel *chan, void *data) AST_APP_ARG(options); ); char *opts[OPT_ARG_ARRAY_SIZE]; + char *parse = ast_strdupa(data); - data = ast_strdupa(data); - AST_STANDARD_APP_ARGS(args, data); + AST_STANDARD_APP_ARGS(args, parse); if (args.spec && !strcmp(args.spec, "all")) args.spec = NULL; @@ -1078,7 +1078,7 @@ static int chanspy_exec(struct ast_channel *chan, void *data) return res; } -static int extenspy_exec(struct ast_channel *chan, void *data) +static int extenspy_exec(struct ast_channel *chan, const char *data) { char *ptr, *exten = NULL; char *mygroup = NULL; @@ -1099,10 +1099,9 @@ static int extenspy_exec(struct ast_channel *chan, void *data) AST_APP_ARG(context); AST_APP_ARG(options); ); + char *parse = ast_strdupa(data); - data = ast_strdupa(data); - - AST_STANDARD_APP_ARGS(args, data); + AST_STANDARD_APP_ARGS(args, parse); if (!ast_strlen_zero(args.context) && (ptr = strchr(args.context, '@'))) { exten = args.context; *ptr++ = '\0'; @@ -1199,7 +1198,7 @@ static int extenspy_exec(struct ast_channel *chan, void *data) return res; } -static int dahdiscan_exec(struct ast_channel *chan, void *data) +static int dahdiscan_exec(struct ast_channel *chan, const char *data) { const char *spec = "DAHDI"; struct ast_flags flags; diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c index 41edb2be3..d7a0bad40 100644 --- a/apps/app_confbridge.c +++ b/apps/app_confbridge.c @@ -683,7 +683,7 @@ static int menu_callback(struct ast_bridge *bridge, struct ast_bridge_channel *b } /*! \brief The ConfBridge application */ -static int confbridge_exec(struct ast_channel *chan, void *data) +static int confbridge_exec(struct ast_channel *chan, const char *data) { int res = 0, volume_adjustments[2]; char *parse; diff --git a/apps/app_controlplayback.c b/apps/app_controlplayback.c index fbcf69157..11a162d58 100644 --- a/apps/app_controlplayback.c +++ b/apps/app_controlplayback.c @@ -125,7 +125,7 @@ static int is_argument(const char *haystack, int needle) return 0; } -static int controlplayback_exec(struct ast_channel *chan, void *data) +static int controlplayback_exec(struct ast_channel *chan, const char *data) { int res = 0; int skipms = 0; diff --git a/apps/app_dahdibarge.c b/apps/app_dahdibarge.c index cfa445acc..124318115 100644 --- a/apps/app_dahdibarge.c +++ b/apps/app_dahdibarge.c @@ -258,7 +258,7 @@ outrun: return ret; } -static int conf_exec(struct ast_channel *chan, void *data) +static int conf_exec(struct ast_channel *chan, const char *data) { int res = -1; int retrycnt = 0; diff --git a/apps/app_dahdiras.c b/apps/app_dahdiras.c index a69d092f5..67f434e6f 100644 --- a/apps/app_dahdiras.c +++ b/apps/app_dahdiras.c @@ -187,7 +187,7 @@ static void run_ras(struct ast_channel *chan, char *args) ast_safe_fork_cleanup(); } -static int dahdiras_exec(struct ast_channel *chan, void *data) +static int dahdiras_exec(struct ast_channel *chan, const char *data) { int res=-1; char *args; diff --git a/apps/app_db.c b/apps/app_db.c index 3a89b867b..8171ed202 100644 --- a/apps/app_db.c +++ b/apps/app_db.c @@ -83,7 +83,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *d_app = "DBdel"; static char *dt_app = "DBdeltree"; -static int deltree_exec(struct ast_channel *chan, void *data) +static int deltree_exec(struct ast_channel *chan, const char *data) { char *argv, *family, *keytree; @@ -114,7 +114,7 @@ static int deltree_exec(struct ast_channel *chan, void *data) return 0; } -static int del_exec(struct ast_channel *chan, void *data) +static int del_exec(struct ast_channel *chan, const char *data) { char *argv, *family, *key; static int deprecation_warning = 0; diff --git a/apps/app_dial.c b/apps/app_dial.c index 790e49ffa..2548e8e09 100644 --- a/apps/app_dial.c +++ b/apps/app_dial.c @@ -1634,7 +1634,7 @@ static void end_bridge_callback_data_fixup(struct ast_bridge_config *bconfig, st bconfig->end_bridge_callback_data = originator; } -static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags64 *peerflags, int *continue_exec) +static int dial_exec_full(struct ast_channel *chan, const char *data, struct ast_flags64 *peerflags, int *continue_exec) { int res = -1; /* default: error */ char *rest, *cur; /* scan the list of destinations */ @@ -2423,7 +2423,7 @@ done: return res; } -static int dial_exec(struct ast_channel *chan, void *data) +static int dial_exec(struct ast_channel *chan, const char *data) { struct ast_flags64 peerflags; @@ -2432,7 +2432,7 @@ static int dial_exec(struct ast_channel *chan, void *data) return dial_exec_full(chan, data, &peerflags, NULL); } -static int retrydial_exec(struct ast_channel *chan, void *data) +static int retrydial_exec(struct ast_channel *chan, const char *data) { char *parse; const char *context = NULL; diff --git a/apps/app_dictate.c b/apps/app_dictate.c index b187998a8..d940b67fc 100644 --- a/apps/app_dictate.c +++ b/apps/app_dictate.c @@ -81,7 +81,7 @@ static int play_and_wait(struct ast_channel *chan, char *file, char *digits) return res; } -static int dictate_exec(struct ast_channel *chan, void *data) +static int dictate_exec(struct ast_channel *chan, const char *data) { char *path = NULL, filein[256], *filename = ""; char *parse; diff --git a/apps/app_directed_pickup.c b/apps/app_directed_pickup.c index 2f4c18237..f0f74f1fe 100644 --- a/apps/app_directed_pickup.c +++ b/apps/app_directed_pickup.c @@ -262,7 +262,7 @@ static int pickup_by_mark(struct ast_channel *chan, const char *mark) } /* application entry point for Pickup() */ -static int pickup_exec(struct ast_channel *chan, void *data) +static int pickup_exec(struct ast_channel *chan, const char *data) { int res = 0; char *tmp = ast_strdupa(data); @@ -291,7 +291,7 @@ static int pickup_exec(struct ast_channel *chan, void *data) } /* application entry point for PickupChan() */ -static int pickupchan_exec(struct ast_channel *chan, void *data) +static int pickupchan_exec(struct ast_channel *chan, const char *data) { int res = 0; char *tmp = ast_strdupa(data); diff --git a/apps/app_directory.c b/apps/app_directory.c index fe8139de5..d0172e79e 100644 --- a/apps/app_directory.c +++ b/apps/app_directory.c @@ -714,7 +714,7 @@ exit: return res; } -static int directory_exec(struct ast_channel *chan, void *data) +static int directory_exec(struct ast_channel *chan, const char *data) { int res = 0, digit = 3; struct ast_config *cfg, *ucfg; diff --git a/apps/app_disa.c b/apps/app_disa.c index 691fa94ab..b7ca23cfc 100644 --- a/apps/app_disa.c +++ b/apps/app_disa.c @@ -140,7 +140,7 @@ static void play_dialtone(struct ast_channel *chan, char *mailbox) } } -static int disa_exec(struct ast_channel *chan, void *data) +static int disa_exec(struct ast_channel *chan, const char *data) { int i = 0, j, k = 0, did_ignore = 0, special_noanswer = 0; int firstdigittimeout = (chan->pbx ? chan->pbx->rtimeoutms : 20000); diff --git a/apps/app_dumpchan.c b/apps/app_dumpchan.c index 739fe241b..476f2f1fd 100644 --- a/apps/app_dumpchan.c +++ b/apps/app_dumpchan.c @@ -147,7 +147,7 @@ static int serialize_showchan(struct ast_channel *c, char *buf, size_t size) return 0; } -static int dumpchan_exec(struct ast_channel *chan, void *data) +static int dumpchan_exec(struct ast_channel *chan, const char *data) { struct ast_str *vars = ast_str_thread_get(&ast_str_thread_global_buf, 16); char info[1024]; diff --git a/apps/app_echo.c b/apps/app_echo.c index 8b0d21f06..dcdebed46 100644 --- a/apps/app_echo.c +++ b/apps/app_echo.c @@ -48,7 +48,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app = "Echo"; -static int echo_exec(struct ast_channel *chan, void *data) +static int echo_exec(struct ast_channel *chan, const char *data) { int res = -1; int format; diff --git a/apps/app_exec.c b/apps/app_exec.c index 3c5be33b6..b840e24b9 100644 --- a/apps/app_exec.c +++ b/apps/app_exec.c @@ -129,7 +129,7 @@ static char *app_exec = "Exec"; static char *app_tryexec = "TryExec"; static char *app_execif = "ExecIf"; -static int exec_exec(struct ast_channel *chan, void *data) +static int exec_exec(struct ast_channel *chan, const char *data) { int res = 0; char *s, *appname, *endargs; @@ -163,7 +163,7 @@ static int exec_exec(struct ast_channel *chan, void *data) return res; } -static int tryexec_exec(struct ast_channel *chan, void *data) +static int tryexec_exec(struct ast_channel *chan, const char *data) { int res = 0; char *s, *appname, *endargs; @@ -198,7 +198,7 @@ static int tryexec_exec(struct ast_channel *chan, void *data) return 0; } -static int execif_exec(struct ast_channel *chan, void *data) +static int execif_exec(struct ast_channel *chan, const char *data) { int res = 0; char *truedata = NULL, *falsedata = NULL, *end, *firstcomma, *firstquestion; diff --git a/apps/app_externalivr.c b/apps/app_externalivr.c index 5c6cc0a8e..db3db3db8 100644 --- a/apps/app_externalivr.c +++ b/apps/app_externalivr.c @@ -311,7 +311,7 @@ static struct playlist_entry *make_entry(const char *filename) return entry; } -static int app_exec(struct ast_channel *chan, void *data) +static int app_exec(struct ast_channel *chan, const char *data) { struct ast_flags flags = { 0, }; char *opts[0]; diff --git a/apps/app_fax.c b/apps/app_fax.c index ed7fe16e6..6cb18848e 100644 --- a/apps/app_fax.c +++ b/apps/app_fax.c @@ -705,7 +705,7 @@ static int transmit(fax_session *s) /* === Application functions === */ -static int sndfax_exec(struct ast_channel *chan, void *data) +static int sndfax_exec(struct ast_channel *chan, const char *data) { int res = 0; char *parse; @@ -749,7 +749,7 @@ static int sndfax_exec(struct ast_channel *chan, void *data) return res; } -static int rcvfax_exec(struct ast_channel *chan, void *data) +static int rcvfax_exec(struct ast_channel *chan, const char *data) { int res = 0; char *parse; diff --git a/apps/app_festival.c b/apps/app_festival.c index 2d57a51dc..6b3d5122e 100644 --- a/apps/app_festival.c +++ b/apps/app_festival.c @@ -264,7 +264,7 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in return res; } -static int festival_exec(struct ast_channel *chan, void *vdata) +static int festival_exec(struct ast_channel *chan, const char *vdata) { int usecache; int res = 0; diff --git a/apps/app_flash.c b/apps/app_flash.c index 90329b6b8..dedadfeab 100644 --- a/apps/app_flash.c +++ b/apps/app_flash.c @@ -72,7 +72,7 @@ static inline int dahdi_wait_event(int fd) return j; } -static int flash_exec(struct ast_channel *chan, void *data) +static int flash_exec(struct ast_channel *chan, const char *data) { int res = -1; int x; diff --git a/apps/app_followme.c b/apps/app_followme.c index d27aa36d8..504ff7c76 100644 --- a/apps/app_followme.c +++ b/apps/app_followme.c @@ -275,18 +275,19 @@ static void profile_set_param(struct call_followme *f, const char *param, const } /*! \brief Add a new number */ -static struct number *create_followme_number(char *number, int timeout, int numorder) +static struct number *create_followme_number(const char *number, int timeout, int numorder) { struct number *cur; + char *buf = ast_strdupa(number); char *tmp; if (!(cur = ast_calloc(1, sizeof(*cur)))) return NULL; cur->timeout = timeout; - if ((tmp = strchr(number, ','))) + if ((tmp = strchr(buf, ','))) *tmp = '\0'; - ast_copy_string(cur->number, number, sizeof(cur->number)); + ast_copy_string(cur->number, buf, sizeof(cur->number)); cur->order = numorder; ast_debug(1, "Created a number, %s, order of , %d, with a timeout of %ld.\n", cur->number, cur->order, cur->timeout); @@ -996,7 +997,7 @@ static void end_bridge_callback_data_fixup(struct ast_bridge_config *bconfig, st bconfig->end_bridge_callback_data = originator; } -static int app_exec(struct ast_channel *chan, void *data) +static int app_exec(struct ast_channel *chan, const char *data) { struct fm_args targs = { 0, }; struct ast_bridge_config config; diff --git a/apps/app_forkcdr.c b/apps/app_forkcdr.c index 341e52a8d..66ba9d40f 100644 --- a/apps/app_forkcdr.c +++ b/apps/app_forkcdr.c @@ -226,7 +226,7 @@ static void ast_cdr_fork(struct ast_channel *chan, struct ast_flags optflags, ch ast_set_flag(cdr, AST_CDR_FLAG_CHILD | AST_CDR_FLAG_LOCKED); } -static int forkcdr_exec(struct ast_channel *chan, void *data) +static int forkcdr_exec(struct ast_channel *chan, const char *data) { int res = 0; char *argcopy = NULL; diff --git a/apps/app_getcpeid.c b/apps/app_getcpeid.c index 9c1009242..93df1623a 100644 --- a/apps/app_getcpeid.c +++ b/apps/app_getcpeid.c @@ -61,7 +61,7 @@ static int cpeid_setstatus(struct ast_channel *chan, char *stuff[], int voice) return ast_adsi_print(chan, tmp, justify, voice); } -static int cpeid_exec(struct ast_channel *chan, void *idata) +static int cpeid_exec(struct ast_channel *chan, const char *idata) { int res=0; unsigned char cpeid[4]; diff --git a/apps/app_ices.c b/apps/app_ices.c index c5bc315d4..f2b9498a6 100644 --- a/apps/app_ices.c +++ b/apps/app_ices.c @@ -104,7 +104,7 @@ static int icesencode(char *filename, int fd) _exit(0); } -static int ices_exec(struct ast_channel *chan, void *data) +static int ices_exec(struct ast_channel *chan, const char *data) { int res = 0; int fds[2]; diff --git a/apps/app_image.c b/apps/app_image.c index a6fbac50c..af4abd7e9 100644 --- a/apps/app_image.c +++ b/apps/app_image.c @@ -69,7 +69,7 @@ static char *app = "SendImage"; </application> ***/ -static int sendimage_exec(struct ast_channel *chan, void *data) +static int sendimage_exec(struct ast_channel *chan, const char *data) { if (ast_strlen_zero(data)) { diff --git a/apps/app_ivrdemo.c b/apps/app_ivrdemo.c index 13f4bcc9c..a9c61209a 100644 --- a/apps/app_ivrdemo.c +++ b/apps/app_ivrdemo.c @@ -59,7 +59,7 @@ static char *app = "IVRDemo"; static int ivr_demo_func(struct ast_channel *chan, void *data) { - ast_verbose("IVR Demo, data is %s!\n", (char *)data); + ast_verbose("IVR Demo, data is %s!\n", (char *) data); return 0; } @@ -93,22 +93,24 @@ AST_IVR_DECLARE_MENU(ivr_demo, "IVR Demo Main Menu", 0, { NULL }, }); - -static int skel_exec(struct ast_channel *chan, void *data) +static int skel_exec(struct ast_channel *chan, const char *data) { int res=0; + char *tmp; if (ast_strlen_zero(data)) { ast_log(LOG_WARNING, "skel requires an argument (filename)\n"); return -1; } + tmp = ast_strdupa(data); + /* Do our thing here */ if (chan->_state != AST_STATE_UP) res = ast_answer(chan); if (!res) - res = ast_ivr_menu_run(chan, &ivr_demo, data); + res = ast_ivr_menu_run(chan, &ivr_demo, tmp); return res; } diff --git a/apps/app_jack.c b/apps/app_jack.c index 02d7a21dd..95726a4eb 100644 --- a/apps/app_jack.c +++ b/apps/app_jack.c @@ -740,19 +740,14 @@ static int handle_options(struct jack_data *jack_data, const char *__options_str return 0; } -static int jack_exec(struct ast_channel *chan, void *data) +static int jack_exec(struct ast_channel *chan, const char *data) { struct jack_data *jack_data; - AST_DECLARE_APP_ARGS(args, - AST_APP_ARG(options); - ); if (!(jack_data = jack_data_alloc())) return -1; - args.options = data; - - if (!ast_strlen_zero(args.options) && handle_options(jack_data, args.options)) { + if (!ast_strlen_zero(data) && handle_options(jack_data, data)) { destroy_jack_data(jack_data); return -1; } diff --git a/apps/app_macro.c b/apps/app_macro.c index 19cc04ff6..1db3b27a8 100644 --- a/apps/app_macro.c +++ b/apps/app_macro.c @@ -216,7 +216,7 @@ static struct ast_exten *find_matching_priority(struct ast_context *c, const cha return NULL; } -static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) +static int _macro_exec(struct ast_channel *chan, const char *data, int exclusive) { const char *s; char *tmp; @@ -426,7 +426,8 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) gosub_level++; ast_debug(1, "Incrementing gosub_level\n"); } else if (!strcasecmp(runningapp, "GOSUBIF")) { - char *cond, *app_arg, *app2; + char *cond, *app_arg; + char *app2; ast_str_substitute_variables(&tmp_subst, 0, chan, runningdata); app2 = ast_str_buffer(tmp_subst); cond = strsep(&app2, "?"); @@ -454,8 +455,7 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) ast_str_substitute_variables(&tmp_subst, 0, chan, runningdata); tmp2 = ast_str_buffer(tmp_subst); if (!strcasecmp(runningapp, "EXECIF")) { - tmp3 = strchr(tmp2, '|'); - if (tmp3) { + if ((tmp3 = strchr(tmp2, '|'))) { *tmp3++ = '\0'; } if (!pbx_checkcondition(tmp2)) { @@ -569,17 +569,17 @@ static int _macro_exec(struct ast_channel *chan, void *data, int exclusive) return res; } -static int macro_exec(struct ast_channel *chan, void *data) +static int macro_exec(struct ast_channel *chan, const char *data) { return _macro_exec(chan, data, 0); } -static int macroexclusive_exec(struct ast_channel *chan, void *data) +static int macroexclusive_exec(struct ast_channel *chan, const char *data) { return _macro_exec(chan, data, 1); } -static int macroif_exec(struct ast_channel *chan, void *data) +static int macroif_exec(struct ast_channel *chan, const char *data) { char *expr = NULL, *label_a = NULL, *label_b = NULL; int res = 0; @@ -604,7 +604,7 @@ static int macroif_exec(struct ast_channel *chan, void *data) return res; } -static int macro_exit_exec(struct ast_channel *chan, void *data) +static int macro_exit_exec(struct ast_channel *chan, const char *data) { return MACRO_EXIT_RESULT; } diff --git a/apps/app_meetme.c b/apps/app_meetme.c index 09858c17d..ba278ba76 100644 --- a/apps/app_meetme.c +++ b/apps/app_meetme.c @@ -861,7 +861,7 @@ static int audio_buffers; * conversion... the numbers have been modified * to give the user a better level of adjustability */ -static char const gain_map[] = { +static const char gain_map[] = { -15, -13, -10, @@ -876,7 +876,7 @@ static char const gain_map[] = { }; -static int admin_exec(struct ast_channel *chan, void *data); +static int admin_exec(struct ast_channel *chan, const char *data); static void *recordthread(void *args); static char *istalking(int x) @@ -1144,7 +1144,7 @@ cnfout: static char *complete_meetmecmd(const char *line, const char *word, int pos, int state) { - static char *cmds[] = {"concise", "lock", "unlock", "mute", "unmute", "kick", "list", NULL}; + static const char * const cmds[] = {"concise", "lock", "unlock", "mute", "unmute", "kick", "list", NULL}; int len = strlen(word); int which = 0; @@ -3600,7 +3600,7 @@ static struct ast_conference *find_conf(struct ast_channel *chan, char *confno, } /*! \brief The MeetmeCount application */ -static int count_exec(struct ast_channel *chan, void *data) +static int count_exec(struct ast_channel *chan, const char *data) { int res = 0; struct ast_conference *conf; @@ -3646,7 +3646,7 @@ static int count_exec(struct ast_channel *chan, void *data) } /*! \brief The meetme() application */ -static int conf_exec(struct ast_channel *chan, void *data) +static int conf_exec(struct ast_channel *chan, const char *data) { int res = -1; char confno[MAX_CONFNUM] = ""; @@ -3657,7 +3657,8 @@ static int conf_exec(struct ast_channel *chan, void *data) int dynamic = 0; int empty = 0, empty_no_pin = 0; int always_prompt = 0; - char *notdata, *info, the_pin[MAX_PIN] = ""; + const char *notdata; + char *info, the_pin[MAX_PIN] = ""; AST_DECLARE_APP_ARGS(args, AST_APP_ARG(confno); AST_APP_ARG(options); @@ -3920,7 +3921,7 @@ static struct ast_conf_user *find_user(struct ast_conference *conf, char *caller /*! \brief The MeetMeadmin application */ /* MeetMeAdmin(confno, command, caller) */ -static int admin_exec(struct ast_channel *chan, void *data) { +static int admin_exec(struct ast_channel *chan, const char *data) { char *params; struct ast_conference *cnf; struct ast_conf_user *user = NULL; @@ -4102,7 +4103,7 @@ static int admin_exec(struct ast_channel *chan, void *data) { /*--- channel_admin_exec: The MeetMeChannelAdmin application */ /* MeetMeChannelAdmin(channel, command) */ -static int channel_admin_exec(struct ast_channel *chan, void *data) { +static int channel_admin_exec(struct ast_channel *chan, const char *data) { char *params; struct ast_conference *conf = NULL; struct ast_conf_user *user = NULL; @@ -4235,7 +4236,7 @@ static int action_meetmeunmute(struct mansession *s, const struct message *m) return meetmemute(s, m, 0); } -static char mandescr_meetmelist[] = +static const char mandescr_meetmelist[] = "Description: Lists all users in a particular MeetMe conference.\n" "MeetmeList will follow as separate events, followed by a final event called\n" "MeetmeListComplete.\n" @@ -5552,7 +5553,7 @@ static struct sla_trunk_ref *sla_choose_idle_trunk(const struct sla_station *sta return trunk_ref; } -static int sla_station_exec(struct ast_channel *chan, void *data) +static int sla_station_exec(struct ast_channel *chan, const char *data) { char *station_name, *trunk_name; struct sla_station *station; @@ -5759,7 +5760,7 @@ AST_APP_OPTIONS(sla_trunk_opts, BEGIN_OPTIONS AST_APP_OPTION_ARG('M', SLA_TRUNK_OPT_MOH, SLA_TRUNK_OPT_ARG_MOH_CLASS), END_OPTIONS ); -static int sla_trunk_exec(struct ast_channel *chan, void *data) +static int sla_trunk_exec(struct ast_channel *chan, const char *data) { char conf_name[MAX_CONFNUM]; struct ast_conference *conf; diff --git a/apps/app_milliwatt.c b/apps/app_milliwatt.c index 4f27fa795..aa7a118a0 100644 --- a/apps/app_milliwatt.c +++ b/apps/app_milliwatt.c @@ -55,9 +55,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") </application> ***/ -static char *app = "Milliwatt"; +static const char app[] = "Milliwatt"; -static char digital_milliwatt[] = {0x1e,0x0b,0x0b,0x1e,0x9e,0x8b,0x8b,0x9e} ; +static const char digital_milliwatt[] = {0x1e,0x0b,0x0b,0x1e,0x9e,0x8b,0x8b,0x9e} ; static void *milliwatt_alloc(struct ast_channel *chan, void *params) { @@ -139,7 +139,7 @@ static int old_milliwatt_exec(struct ast_channel *chan) return -1; } -static int milliwatt_exec(struct ast_channel *chan, void *data) +static int milliwatt_exec(struct ast_channel *chan, const char *data) { const char *options = data; struct ast_app *playtones_app; diff --git a/apps/app_minivm.c b/apps/app_minivm.c index fffa714e0..59323ee4e 100644 --- a/apps/app_minivm.c +++ b/apps/app_minivm.c @@ -1922,7 +1922,7 @@ static void queue_mwi_event(const char *mbx, const char *ctx, int urgent, int ne /*!\internal * \brief Send MWI using interal Asterisk event subsystem */ -static int minivm_mwi_exec(struct ast_channel *chan, void *data) +static int minivm_mwi_exec(struct ast_channel *chan, const char *data) { int argc; char *argv[4]; @@ -1964,7 +1964,7 @@ static int minivm_mwi_exec(struct ast_channel *chan, void *data) /*!\internal * \brief Notify voicemail account owners - either generic template or user specific */ -static int minivm_notify_exec(struct ast_channel *chan, void *data) +static int minivm_notify_exec(struct ast_channel *chan, const char *data) { int argc; char *argv[2]; @@ -2044,7 +2044,7 @@ static int minivm_notify_exec(struct ast_channel *chan, void *data) /*!\internal * \brief Dialplan function to record voicemail */ -static int minivm_record_exec(struct ast_channel *chan, void *data) +static int minivm_record_exec(struct ast_channel *chan, const char *data) { int res = 0; char *tmp; @@ -2101,7 +2101,7 @@ static int minivm_record_exec(struct ast_channel *chan, void *data) /*!\internal * \brief Play voicemail prompts - either generic or user specific */ -static int minivm_greet_exec(struct ast_channel *chan, void *data) +static int minivm_greet_exec(struct ast_channel *chan, const char *data) { struct leave_vm_options leave_options = { 0, '\0'}; int argc; @@ -2288,7 +2288,7 @@ static int minivm_greet_exec(struct ast_channel *chan, void *data) /*!\internal * \brief Dialplan application to delete voicemail */ -static int minivm_delete_exec(struct ast_channel *chan, void *data) +static int minivm_delete_exec(struct ast_channel *chan, const char *data) { int res = 0; char filename[BUFSIZ]; @@ -2326,7 +2326,7 @@ static int minivm_delete_exec(struct ast_channel *chan, void *data) } /*! \brief Record specific messages for voicemail account */ -static int minivm_accmess_exec(struct ast_channel *chan, void *data) +static int minivm_accmess_exec(struct ast_channel *chan, const char *data) { int argc = 0; char *argv[2]; diff --git a/apps/app_mixmonitor.c b/apps/app_mixmonitor.c index b8a4e5d65..6cd5871bd 100644 --- a/apps/app_mixmonitor.c +++ b/apps/app_mixmonitor.c @@ -322,7 +322,7 @@ static void launch_monitor_thread(struct ast_channel *chan, const char *filename ast_pthread_create_detached_background(&thread, NULL, mixmonitor_thread, mixmonitor); } -static int mixmonitor_exec(struct ast_channel *chan, void *data) +static int mixmonitor_exec(struct ast_channel *chan, const char *data) { int x, readvol = 0, writevol = 0; struct ast_flags flags = {0}; @@ -403,7 +403,7 @@ static int mixmonitor_exec(struct ast_channel *chan, void *data) return 0; } -static int stop_mixmonitor_exec(struct ast_channel *chan, void *data) +static int stop_mixmonitor_exec(struct ast_channel *chan, const char *data) { ast_audiohook_detach_source(chan, mixmonitor_spy_type); return 0; diff --git a/apps/app_morsecode.c b/apps/app_morsecode.c index 25b5c49e3..0947681e9 100644 --- a/apps/app_morsecode.c +++ b/apps/app_morsecode.c @@ -63,9 +63,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") </see-also> </application> ***/ -static char *app_morsecode = "Morsecode"; +static const char app_morsecode[] = "Morsecode"; -static char *morsecode[] = { +static const char * const morsecode[] = { "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* 0-15 */ "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", /* 16-31 */ " ", /* 32 - <space> */ @@ -118,10 +118,10 @@ static void playtone(struct ast_channel *chan, int tone, int len) ast_playtones_stop(chan); } -static int morsecode_exec(struct ast_channel *chan, void *data) +static int morsecode_exec(struct ast_channel *chan, const char *data) { int res=0, ditlen, tone; - char *digit; + const char *digit; const char *ditlenc, *tonec; if (ast_strlen_zero(data)) { @@ -147,7 +147,7 @@ static int morsecode_exec(struct ast_channel *chan, void *data) for (digit = data; *digit; digit++) { int digit2 = *digit; - char *dahdit; + const char *dahdit; if (digit2 < 0) { continue; } diff --git a/apps/app_mp3.c b/apps/app_mp3.c index 41e27f9b3..dbab73bca 100644 --- a/apps/app_mp3.c +++ b/apps/app_mp3.c @@ -117,7 +117,7 @@ static int timed_read(int fd, void *data, int datalen, int timeout) } -static int mp3_exec(struct ast_channel *chan, void *data) +static int mp3_exec(struct ast_channel *chan, const char *data) { int res=0; int fds[2]; diff --git a/apps/app_nbscat.c b/apps/app_nbscat.c index 112e01297..ec9347803 100644 --- a/apps/app_nbscat.c +++ b/apps/app_nbscat.c @@ -105,7 +105,7 @@ static int timed_read(int fd, void *data, int datalen) } -static int NBScat_exec(struct ast_channel *chan, void *data) +static int NBScat_exec(struct ast_channel *chan, const char *data) { int res=0; int fds[2]; diff --git a/apps/app_originate.c b/apps/app_originate.c index 15d34a5d3..b9bb8821b 100644 --- a/apps/app_originate.c +++ b/apps/app_originate.c @@ -89,7 +89,7 @@ static const char app_originate[] = "Originate"; </application> ***/ -static int originate_exec(struct ast_channel *chan, void *data) +static int originate_exec(struct ast_channel *chan, const char *data) { AST_DECLARE_APP_ARGS(args, AST_APP_ARG(tech_data); diff --git a/apps/app_osplookup.c b/apps/app_osplookup.c index 7c553b573..a5a57bca7 100644 --- a/apps/app_osplookup.c +++ b/apps/app_osplookup.c @@ -1296,8 +1296,8 @@ static int osp_finish( * \return 0 Success, -1 Failed */ static int ospauth_exec( - struct ast_channel* chan, - void* data) + struct ast_channel *chan, + const char *data) { int res; const char* provider = OSP_DEF_PROVIDER; @@ -1377,7 +1377,7 @@ static int ospauth_exec( */ static int osplookup_exec( struct ast_channel* chan, - void* data) + const void* data) { int res, cres; const char* provider = OSP_DEF_PROVIDER; @@ -1551,7 +1551,7 @@ static int osplookup_exec( */ static int ospnext_exec( struct ast_channel* chan, - void* data) + const void* data) { int res; const char* provider = OSP_DEF_PROVIDER; @@ -1707,7 +1707,7 @@ static int ospnext_exec( */ static int ospfinished_exec( struct ast_channel* chan, - void* data) + const void* data) { int res = 1; int cause = 0; diff --git a/apps/app_page.c b/apps/app_page.c index 9e0547be6..b277dab56 100644 --- a/apps/app_page.c +++ b/apps/app_page.c @@ -118,7 +118,7 @@ AST_APP_OPTIONS(page_opts, { }); -static int page_exec(struct ast_channel *chan, void *data) +static int page_exec(struct ast_channel *chan, const char *data) { char *tech, *resource, *tmp; char meetmeopts[88], originator[AST_CHANNEL_NAME], *opts[0]; diff --git a/apps/app_parkandannounce.c b/apps/app_parkandannounce.c index 42a7c2849..d8858b64e 100644 --- a/apps/app_parkandannounce.c +++ b/apps/app_parkandannounce.c @@ -85,7 +85,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app = "ParkAndAnnounce"; -static int parkandannounce_exec(struct ast_channel *chan, void *data) +static int parkandannounce_exec(struct ast_channel *chan, const char *data) { int res = -1; int lot, timeout = 0, dres; diff --git a/apps/app_playback.c b/apps/app_playback.c index a61c49bc9..54e90ffc2 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -380,7 +380,7 @@ static int say_init_mode(const char *mode) { static char *__say_cli_init(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { const char *old_mode = say_api_buf[0] ? say_new : say_old; - char *mode; + const char *mode; switch (cmd) { case CLI_INIT: e->command = "say load [new|old]"; @@ -415,7 +415,7 @@ static struct ast_cli_entry cli_playback[] = { AST_CLI_DEFINE(__say_cli_init, "Set or show the say mode"), }; -static int playback_exec(struct ast_channel *chan, void *data) +static int playback_exec(struct ast_channel *chan, const char *data) { int res = 0; int mres = 0; diff --git a/apps/app_playtones.c b/apps/app_playtones.c index 6aff16860..c9c0fbb99 100644 --- a/apps/app_playtones.c +++ b/apps/app_playtones.c @@ -72,7 +72,7 @@ static const char stopplaytones_app[] = "StopPlayTones"; </application> ***/ -static int handle_playtones(struct ast_channel *chan, void *data) +static int handle_playtones(struct ast_channel *chan, const char *data) { struct ast_tone_zone_sound *ts; int res; @@ -99,7 +99,7 @@ static int handle_playtones(struct ast_channel *chan, void *data) return res; } -static int handle_stopplaytones(struct ast_channel *chan, void *data) +static int handle_stopplaytones(struct ast_channel *chan, const char *data) { ast_playtones_stop(chan); diff --git a/apps/app_privacy.c b/apps/app_privacy.c index a2e7152b7..37b440b8a 100644 --- a/apps/app_privacy.c +++ b/apps/app_privacy.c @@ -80,7 +80,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app = "PrivacyManager"; -static int privacy_exec (struct ast_channel *chan, void *data) +static int privacy_exec(struct ast_channel *chan, const char *data) { int res=0; int retries; diff --git a/apps/app_queue.c b/apps/app_queue.c index c88c77e24..d792cdfd5 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -593,7 +593,7 @@ enum queue_result { QUEUE_CONTINUE = 7, }; -const struct { +static const struct { enum queue_result id; char *text; } queue_results[] = { @@ -2403,7 +2403,7 @@ static void do_hang(struct callattempt *o) static char *vars2manager(struct ast_channel *chan, char *vars, size_t len) { struct ast_str *buf = ast_str_thread_get(&ast_str_thread_global_buf, len + 1); - char *tmp; + const char *tmp; if (pbx_builtin_serialize_variables(chan, &buf)) { int i, j; @@ -4651,7 +4651,7 @@ static int set_member_paused(const char *queuename, const char *interface, const } /* \brief Sets members penalty, if queuename=NULL we set member penalty in all the queues. */ -static int set_member_penalty(char *queuename, char *interface, int penalty) +static int set_member_penalty(const char *queuename, const char *interface, int penalty) { int foundinterface = 0, foundqueue = 0; struct call_queue *q; @@ -4828,7 +4828,7 @@ static void reload_queue_members(void) } /*! \brief PauseQueueMember application */ -static int pqm_exec(struct ast_channel *chan, void *data) +static int pqm_exec(struct ast_channel *chan, const char *data) { char *parse; AST_DECLARE_APP_ARGS(args, @@ -4864,7 +4864,7 @@ static int pqm_exec(struct ast_channel *chan, void *data) } /*! \brief UnPauseQueueMember application */ -static int upqm_exec(struct ast_channel *chan, void *data) +static int upqm_exec(struct ast_channel *chan, const char *data) { char *parse; AST_DECLARE_APP_ARGS(args, @@ -4900,7 +4900,7 @@ static int upqm_exec(struct ast_channel *chan, void *data) } /*! \brief RemoveQueueMember application */ -static int rqm_exec(struct ast_channel *chan, void *data) +static int rqm_exec(struct ast_channel *chan, const char *data) { int res=-1; char *parse, *temppos = NULL; @@ -4957,7 +4957,7 @@ static int rqm_exec(struct ast_channel *chan, void *data) } /*! \brief AddQueueMember application */ -static int aqm_exec(struct ast_channel *chan, void *data) +static int aqm_exec(struct ast_channel *chan, const char *data) { int res=-1; char *parse, *temppos = NULL; @@ -5020,7 +5020,7 @@ static int aqm_exec(struct ast_channel *chan, void *data) } /*! \brief QueueLog application */ -static int ql_exec(struct ast_channel *chan, void *data) +static int ql_exec(struct ast_channel *chan, const char *data) { char *parse; @@ -5095,7 +5095,7 @@ static void copy_rules(struct queue_ent *qe, const char *rulename) * 6. Try 4 again unless some condition (such as an expiration time) causes us to * exit the queue. */ -static int queue_exec(struct ast_channel *chan, void *data) +static int queue_exec(struct ast_channel *chan, const char *data) { int res=-1; int ringing=0; @@ -6145,7 +6145,7 @@ static void do_print(struct mansession *s, int fd, const char *str) * List the queues strategy, calls processed, members logged in, * other queue statistics such as avg hold time. */ -static char *__queues_show(struct mansession *s, int fd, int argc, char **argv) +static char *__queues_show(struct mansession *s, int fd, int argc, const char * const *argv) { struct call_queue *q; struct ast_str *out = ast_str_alloca(240); @@ -6320,7 +6320,7 @@ static char *queue_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a */ static int manager_queues_show(struct mansession *s, const struct message *m) { - char *a[] = { "queue", "show" }; + static const char * const a[] = { "queue", "show" }; __queues_show(s, -1, 2, a); astman_append(s, "\r\n\r\n"); /* Properly terminate Manager output */ @@ -6756,7 +6756,7 @@ static int manager_queue_member_penalty(struct mansession *s, const struct messa static char *handle_queue_add_member(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *queuename, *interface, *membername = NULL, *state_interface = NULL; + const char *queuename, *interface, *membername = NULL, *state_interface = NULL; int penalty; switch ( cmd ) { @@ -6871,7 +6871,7 @@ static char *complete_queue_remove_member(const char *line, const char *word, in static char *handle_queue_remove_member(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *queuename, *interface; + const char *queuename, *interface; switch (cmd) { case CLI_INIT: @@ -6936,7 +6936,7 @@ static char *complete_queue_pause_member(const char *line, const char *word, int static char *handle_queue_pause_member(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *queuename, *interface, *reason; + const char *queuename, *interface, *reason; int paused; switch (cmd) { @@ -7010,7 +7010,7 @@ static char *complete_queue_set_member_penalty(const char *line, const char *wor static char *handle_queue_set_member_penalty(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *queuename = NULL, *interface; + const char *queuename = NULL, *interface; int penalty = 0; switch (cmd) { @@ -7072,7 +7072,7 @@ static char *complete_queue_rule_show(const char *line, const char *word, int po static char *handle_queue_rule_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *rule; + const char *rule; struct rule_list *rl_iter; struct penalty_rule *pr_iter; switch (cmd) { diff --git a/apps/app_read.c b/apps/app_read.c index d845c5900..3e22d2ef8 100644 --- a/apps/app_read.c +++ b/apps/app_read.c @@ -122,9 +122,7 @@ AST_APP_OPTIONS(read_app_options, { static char *app = "Read"; -#define ast_next_data(instr,ptr,delim) if((ptr=strchr(instr,delim))) { *(ptr) = '\0' ; ptr++;} - -static int read_exec(struct ast_channel *chan, void *data) +static int read_exec(struct ast_channel *chan, const char *data) { int res = 0; char tmp[256] = ""; diff --git a/apps/app_readexten.c b/apps/app_readexten.c index d5075ede8..ef59aa538 100644 --- a/apps/app_readexten.c +++ b/apps/app_readexten.c @@ -125,7 +125,7 @@ AST_APP_OPTIONS(readexten_app_options, { static char *app = "ReadExten"; -static int readexten_exec(struct ast_channel *chan, void *data) +static int readexten_exec(struct ast_channel *chan, const char *data) { int res = 0; char exten[256] = ""; diff --git a/apps/app_readfile.c b/apps/app_readfile.c index b65dbf656..252c4454d 100644 --- a/apps/app_readfile.c +++ b/apps/app_readfile.c @@ -67,7 +67,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app_readfile = "ReadFile"; -static int readfile_exec(struct ast_channel *chan, void *data) +static int readfile_exec(struct ast_channel *chan, const char *data) { int res=0; char *s, *varname=NULL, *file=NULL, *length=NULL, *returnvar=NULL; diff --git a/apps/app_record.c b/apps/app_record.c index 69bbd5387..06d9c2cdd 100644 --- a/apps/app_record.c +++ b/apps/app_record.c @@ -129,7 +129,7 @@ AST_APP_OPTIONS(app_opts,{ AST_APP_OPTION('x', OPTION_IGNORE_TERMINATE), }); -static int record_exec(struct ast_channel *chan, void *data) +static int record_exec(struct ast_channel *chan, const char *data) { int res = 0; int count = 0; diff --git a/apps/app_rpt.c b/apps/app_rpt.c index c62ab9924..a261fc144 100644 --- a/apps/app_rpt.c +++ b/apps/app_rpt.c @@ -439,7 +439,7 @@ static char *descrip = static int debug = 0; /* Set this >0 for extra debug output */ static int nrpts = 0; -static char remdtmfstr[] = "0123456789*#ABCD"; +static const char remdtmfstr[] = "0123456789*#ABCD"; enum {TOP_TOP,TOP_WON,WON_BEFREAD,BEFREAD_AFTERREAD}; @@ -13114,7 +13114,7 @@ char *this,*val; pthread_exit(NULL); } -static int rpt_exec(struct ast_channel *chan, void *data) +static int rpt_exec(struct ast_channel *chan, const void *data) { int res=-1,i,rem_totx,rem_rx,remkeyed,n,phone_mode = 0; int iskenwood_pci4,authtold,authreq,setting,notremming,reming; diff --git a/apps/app_sayunixtime.c b/apps/app_sayunixtime.c index a4dc0afdc..55afdf463 100644 --- a/apps/app_sayunixtime.c +++ b/apps/app_sayunixtime.c @@ -89,7 +89,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app_sayunixtime = "SayUnixTime"; static char *app_datetime = "DateTime"; -static int sayunixtime_exec(struct ast_channel *chan, void *data) +static int sayunixtime_exec(struct ast_channel *chan, const char *data) { AST_DECLARE_APP_ARGS(args, AST_APP_ARG(timeval); diff --git a/apps/app_senddtmf.c b/apps/app_senddtmf.c index a1c28a8f9..68f2d784f 100644 --- a/apps/app_senddtmf.c +++ b/apps/app_senddtmf.c @@ -62,7 +62,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") ***/ static char *app = "SendDTMF"; -static int senddtmf_exec(struct ast_channel *chan, void *vdata) +static int senddtmf_exec(struct ast_channel *chan, const char *vdata) { int res = 0; char *data; @@ -90,7 +90,7 @@ static int senddtmf_exec(struct ast_channel *chan, void *vdata) return res; } -static char mandescr_playdtmf[] = +static const char mandescr_playdtmf[] = "Description: Plays a dtmf digit on the specified channel.\n" "Variables: (all are required)\n" " Channel: Channel name to send digit to\n" diff --git a/apps/app_sendtext.c b/apps/app_sendtext.c index 2d8ccf811..100358ecf 100644 --- a/apps/app_sendtext.c +++ b/apps/app_sendtext.c @@ -72,7 +72,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static const char * const app = "SendText"; -static int sendtext_exec(struct ast_channel *chan, void *data) +static int sendtext_exec(struct ast_channel *chan, const char *data) { int res = 0; char *status = "UNSUPPORTED"; diff --git a/apps/app_setcallerid.c b/apps/app_setcallerid.c index 6592249b4..d2dbb8913 100644 --- a/apps/app_setcallerid.c +++ b/apps/app_setcallerid.c @@ -84,7 +84,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app2 = "SetCallerPres"; -static int setcallerid_pres_exec(struct ast_channel *chan, void *data) +static int setcallerid_pres_exec(struct ast_channel *chan, const char *data) { int pres = -1; static int deprecated = 0; diff --git a/apps/app_skel.c b/apps/app_skel.c index 338a32f8a..1796ab4f5 100644 --- a/apps/app_skel.c +++ b/apps/app_skel.c @@ -94,7 +94,7 @@ AST_APP_OPTIONS(app_opts,{ }); -static int app_exec(struct ast_channel *chan, void *data) +static int app_exec(struct ast_channel *chan, const char *data) { int res = 0; struct ast_flags flags; diff --git a/apps/app_sms.c b/apps/app_sms.c index 0c53391d3..a0e0c2fc0 100644 --- a/apps/app_sms.c +++ b/apps/app_sms.c @@ -123,7 +123,7 @@ static char *app = "SMS"; * To pick the two carriers (1300Hz for '1' and 2100 Hz for '0') used by * the modulation, we should take one every 13 and 21 samples respectively. */ -static signed short wave[] = { +static const signed short wave[] = { 0, 392, 782, 1167, 1545, 1913, 2270, 2612, 2939, 3247, 3536, 3802, 4045, 4263, 4455, 4619, 4755, 4862, 4938, 4985, 5000, 4985, 4938, 4862, 4755, 4619, 4455, 4263, 4045, 3802, 3536, 3247, 2939, 2612, 2270, 1913, 1545, 1167, 782, 392, 0, -392, -782, -1167, @@ -1855,7 +1855,7 @@ AST_APP_OPTIONS(sms_options, { AST_APP_OPTION_ARG('p', OPTION_PAUSE, OPTION_ARG_PAUSE), } ); -static int sms_exec(struct ast_channel *chan, void *data) +static int sms_exec(struct ast_channel *chan, const char *data) { int res = -1; sms_t h = { 0 }; diff --git a/apps/app_softhangup.c b/apps/app_softhangup.c index 6a4889acf..2a7ab113a 100644 --- a/apps/app_softhangup.c +++ b/apps/app_softhangup.c @@ -69,7 +69,7 @@ AST_APP_OPTIONS(app_opts,{ AST_APP_OPTION('a', OPTION_ALL), }); -static int softhangup_exec(struct ast_channel *chan, void *data) +static int softhangup_exec(struct ast_channel *chan, const char *data) { struct ast_channel *c = NULL; char *cut, *opts[0]; diff --git a/apps/app_speech_utils.c b/apps/app_speech_utils.c index 8ad5e748b..cd1c4d106 100644 --- a/apps/app_speech_utils.c +++ b/apps/app_speech_utils.c @@ -481,7 +481,7 @@ static struct ast_custom_function speech_function = { /*! \brief SpeechCreate() Dialplan Application */ -static int speech_create(struct ast_channel *chan, void *data) +static int speech_create(struct ast_channel *chan, const char *data) { struct ast_speech *speech = NULL; struct ast_datastore *datastore = NULL; @@ -508,7 +508,7 @@ static int speech_create(struct ast_channel *chan, void *data) } /*! \brief SpeechLoadGrammar(Grammar Name,Path) Dialplan Application */ -static int speech_load(struct ast_channel *chan, void *vdata) +static int speech_load(struct ast_channel *chan, const char *vdata) { int res = 0; struct ast_speech *speech = find_speech(chan); @@ -534,7 +534,7 @@ static int speech_load(struct ast_channel *chan, void *vdata) } /*! \brief SpeechUnloadGrammar(Grammar Name) Dialplan Application */ -static int speech_unload(struct ast_channel *chan, void *data) +static int speech_unload(struct ast_channel *chan, const char *data) { int res = 0; struct ast_speech *speech = find_speech(chan); @@ -549,7 +549,7 @@ static int speech_unload(struct ast_channel *chan, void *data) } /*! \brief SpeechDeactivateGrammar(Grammar Name) Dialplan Application */ -static int speech_deactivate(struct ast_channel *chan, void *data) +static int speech_deactivate(struct ast_channel *chan, const char *data) { int res = 0; struct ast_speech *speech = find_speech(chan); @@ -564,7 +564,7 @@ static int speech_deactivate(struct ast_channel *chan, void *data) } /*! \brief SpeechActivateGrammar(Grammar Name) Dialplan Application */ -static int speech_activate(struct ast_channel *chan, void *data) +static int speech_activate(struct ast_channel *chan, const char *data) { int res = 0; struct ast_speech *speech = find_speech(chan); @@ -579,7 +579,7 @@ static int speech_activate(struct ast_channel *chan, void *data) } /*! \brief SpeechStart() Dialplan Application */ -static int speech_start(struct ast_channel *chan, void *data) +static int speech_start(struct ast_channel *chan, const char *data) { int res = 0; struct ast_speech *speech = find_speech(chan); @@ -593,7 +593,7 @@ static int speech_start(struct ast_channel *chan, void *data) } /*! \brief SpeechProcessingSound(Sound File) Dialplan Application */ -static int speech_processing_sound(struct ast_channel *chan, void *data) +static int speech_processing_sound(struct ast_channel *chan, const char *data) { int res = 0; struct ast_speech *speech = find_speech(chan); @@ -636,7 +636,7 @@ AST_APP_OPTIONS(speech_background_options, BEGIN_OPTIONS END_OPTIONS ); /*! \brief SpeechBackground(Sound File,Timeout) Dialplan Application */ -static int speech_background(struct ast_channel *chan, void *data) +static int speech_background(struct ast_channel *chan, const char *data) { unsigned int timeout = 0; int res = 0, done = 0, started = 0, quieted = 0, max_dtmf_len = 0; @@ -888,7 +888,7 @@ static int speech_background(struct ast_channel *chan, void *data) /*! \brief SpeechDestroy() Dialplan Application */ -static int speech_destroy(struct ast_channel *chan, void *data) +static int speech_destroy(struct ast_channel *chan, const char *data) { int res = 0; struct ast_speech *speech = find_speech(chan); diff --git a/apps/app_stack.c b/apps/app_stack.c index 64522afdd..27652c3bd 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -266,7 +266,7 @@ static void gosub_free(void *data) ast_free(oldlist); } -static int pop_exec(struct ast_channel *chan, void *data) +static int pop_exec(struct ast_channel *chan, const char *data) { struct ast_datastore *stack_store = ast_channel_datastore_find(chan, &stack_info, NULL); struct gosub_stack_frame *oldframe; @@ -290,12 +290,12 @@ static int pop_exec(struct ast_channel *chan, void *data) return 0; } -static int return_exec(struct ast_channel *chan, void *data) +static int return_exec(struct ast_channel *chan, const char *data) { struct ast_datastore *stack_store = ast_channel_datastore_find(chan, &stack_info, NULL); struct gosub_stack_frame *oldframe; AST_LIST_HEAD(, gosub_stack_frame) *oldlist; - char *retval = data; + const char *retval = data; if (!stack_store) { ast_log(LOG_ERROR, "Return without Gosub: stack is unallocated\n"); @@ -320,7 +320,7 @@ static int return_exec(struct ast_channel *chan, void *data) return 0; } -static int gosub_exec(struct ast_channel *chan, void *data) +static int gosub_exec(struct ast_channel *chan, const char *data) { struct ast_datastore *stack_store = ast_channel_datastore_find(chan, &stack_info, NULL); AST_LIST_HEAD(, gosub_stack_frame) *oldlist; @@ -410,7 +410,7 @@ static int gosub_exec(struct ast_channel *chan, void *data) return 0; } -static int gosubif_exec(struct ast_channel *chan, void *data) +static int gosubif_exec(struct ast_channel *chan, const char *data) { char *args; int res=0; @@ -537,7 +537,7 @@ static struct ast_custom_function peek_function = { .read = peek_read, }; -static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, char **argv) +static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, const char * const *argv) { int old_priority, priority; char old_context[AST_MAX_CONTEXT], old_extension[AST_MAX_EXTENSION]; @@ -627,7 +627,7 @@ static int handle_gosub(struct ast_channel *chan, AGI *agi, int argc, char **arg return RESULT_SUCCESS; } -static char usage_gosub[] = +static const char usage_gosub[] = " Usage: GOSUB <context> <extension> <priority> [<optional-argument>]\n" " Cause the channel to execute the specified dialplan subroutine, returning\n" " to the dialplan with execution of a Return()\n"; diff --git a/apps/app_system.c b/apps/app_system.c index e06a9cb5d..6fa2fc962 100644 --- a/apps/app_system.c +++ b/apps/app_system.c @@ -100,7 +100,7 @@ static char *app2 = "TrySystem"; static char *chanvar = "SYSTEMSTATUS"; -static int system_exec_helper(struct ast_channel *chan, void *data, int failmode) +static int system_exec_helper(struct ast_channel *chan, const char *data, int failmode) { int res = 0; struct ast_str *buf = ast_str_thread_get(&buf_buf, 16); @@ -140,12 +140,12 @@ static int system_exec_helper(struct ast_channel *chan, void *data, int failmode return res; } -static int system_exec(struct ast_channel *chan, void *data) +static int system_exec(struct ast_channel *chan, const char *data) { return system_exec_helper(chan, data, -1); } -static int trysystem_exec(struct ast_channel *chan, void *data) +static int trysystem_exec(struct ast_channel *chan, const char *data) { return system_exec_helper(chan, data, 0); } diff --git a/apps/app_talkdetect.c b/apps/app_talkdetect.c index 85f0dff4e..c90b60d36 100644 --- a/apps/app_talkdetect.c +++ b/apps/app_talkdetect.c @@ -73,7 +73,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app = "BackgroundDetect"; -static int background_detect_exec(struct ast_channel *chan, void *data) +static int background_detect_exec(struct ast_channel *chan, const char *data) { int res = 0; char *tmp; diff --git a/apps/app_test.c b/apps/app_test.c index 76a953f0c..64ce7b43f 100644 --- a/apps/app_test.c +++ b/apps/app_test.c @@ -143,10 +143,10 @@ static int sendnoise(struct ast_channel *chan, int ms) return res; } -static int testclient_exec(struct ast_channel *chan, void *data) +static int testclient_exec(struct ast_channel *chan, const char *data) { int res = 0; - char *testid=data; + const char *testid=data; char fn[80]; char serverver[80]; FILE *f; @@ -318,7 +318,7 @@ static int testclient_exec(struct ast_channel *chan, void *data) return res; } -static int testserver_exec(struct ast_channel *chan, void *data) +static int testserver_exec(struct ast_channel *chan, const char *data) { int res = 0; char testid[80]=""; diff --git a/apps/app_transfer.c b/apps/app_transfer.c index 11107a1ba..ad6e8011e 100644 --- a/apps/app_transfer.c +++ b/apps/app_transfer.c @@ -74,7 +74,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static const char * const app = "Transfer"; -static int transfer_exec(struct ast_channel *chan, void *data) +static int transfer_exec(struct ast_channel *chan, const char *data) { int res; int len; diff --git a/apps/app_url.c b/apps/app_url.c index af72b44ef..234cff619 100644 --- a/apps/app_url.c +++ b/apps/app_url.c @@ -90,7 +90,7 @@ AST_APP_OPTIONS(app_opts,{ AST_APP_OPTION('w', OPTION_WAIT), }); -static int sendurl_exec(struct ast_channel *chan, void *data) +static int sendurl_exec(struct ast_channel *chan, const char *data) { int res = 0; char *tmp; diff --git a/apps/app_userevent.c b/apps/app_userevent.c index f716ccba6..092f22f25 100644 --- a/apps/app_userevent.c +++ b/apps/app_userevent.c @@ -56,7 +56,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app = "UserEvent"; -static int userevent_exec(struct ast_channel *chan, void *data) +static int userevent_exec(struct ast_channel *chan, const char *data) { char *parse; int x; diff --git a/apps/app_verbose.c b/apps/app_verbose.c index a900dcacb..ed86e5e6a 100644 --- a/apps/app_verbose.c +++ b/apps/app_verbose.c @@ -72,7 +72,7 @@ static char *app_log = "Log"; ***/ -static int verbose_exec(struct ast_channel *chan, void *data) +static int verbose_exec(struct ast_channel *chan, const char *data) { int vsize; char *parse; @@ -118,7 +118,7 @@ static int verbose_exec(struct ast_channel *chan, void *data) return 0; } -static int log_exec(struct ast_channel *chan, void *data) +static int log_exec(struct ast_channel *chan, const char *data) { char *parse; int lnum = -1; diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c index 07bd8aa19..4362dbcd8 100644 --- a/apps/app_voicemail.c +++ b/apps/app_voicemail.c @@ -5090,8 +5090,7 @@ static int leave_voicemail(struct ast_channel *chan, char *ext, struct leave_vm_ return -1; } - ast_str_set(&tmp, 0, "%s", ext); - ext = ast_str_buffer(tmp); + ext = ast_strdupa(ext); if ((context = strchr(ext, '@'))) { *context++ = '\0'; tmpptr = strchr(context, '&'); @@ -8947,7 +8946,7 @@ static int vm_authenticate(struct ast_channel *chan, char *mailbox, int mailbox_ return 0; } -static int vm_execmain(struct ast_channel *chan, void *data) +static int vm_execmain(struct ast_channel *chan, const char *data) { /* XXX This is, admittedly, some pretty horrendous code. For some reason it just seemed a lot easier to do with GOTO's. I feel @@ -9655,7 +9654,7 @@ out: return res; } -static int vm_exec(struct ast_channel *chan, void *data) +static int vm_exec(struct ast_channel *chan, const char *data) { int res = 0; char *tmp; @@ -9787,7 +9786,7 @@ static int append_mailbox(const char *context, const char *box, const char *data return 0; } -static int vm_box_exists(struct ast_channel *chan, void *data) +static int vm_box_exists(struct ast_channel *chan, const char *data) { struct ast_vm_user svm; char *context, *box; @@ -9851,16 +9850,16 @@ static struct ast_custom_function mailbox_exists_acf = { .read = acf_mailbox_exists, }; -static int vmauthenticate(struct ast_channel *chan, void *data) +static int vmauthenticate(struct ast_channel *chan, const char *data) { - char *s = data, *user=NULL, *context=NULL, mailbox[AST_MAX_EXTENSION] = ""; + char *s, *user=NULL, *context=NULL, mailbox[AST_MAX_EXTENSION] = ""; struct ast_vm_user vmus; char *options = NULL; int silent = 0, skipuser = 0; int res = -1; - if (s) { - s = ast_strdupa(s); + if (data) { + s = ast_strdupa(data); user = strsep(&s, ","); options = strsep(&s, ","); if (user) { diff --git a/apps/app_waitforring.c b/apps/app_waitforring.c index fd5913e04..8edd249f5 100644 --- a/apps/app_waitforring.c +++ b/apps/app_waitforring.c @@ -53,7 +53,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app = "WaitForRing"; -static int waitforring_exec(struct ast_channel *chan, void *data) +static int waitforring_exec(struct ast_channel *chan, const char *data) { struct ast_frame *f; int res = 0; diff --git a/apps/app_waitforsilence.c b/apps/app_waitforsilence.c index f68b70ad3..6339b0192 100644 --- a/apps/app_waitforsilence.c +++ b/apps/app_waitforsilence.c @@ -202,7 +202,7 @@ static int do_waiting(struct ast_channel *chan, int timereqd, time_t waitstart, return res; } -static int waitfor_exec(struct ast_channel *chan, void *data, int wait_for_silence) +static int waitfor_exec(struct ast_channel *chan, const char *data, int wait_for_silence) { int res = 1; int timereqd = 1000; @@ -232,12 +232,12 @@ static int waitfor_exec(struct ast_channel *chan, void *data, int wait_for_silen return res; } -static int waitforsilence_exec(struct ast_channel *chan, void *data) +static int waitforsilence_exec(struct ast_channel *chan, const char *data) { return waitfor_exec(chan, data, 1); } -static int waitfornoise_exec(struct ast_channel *chan, void *data) +static int waitfornoise_exec(struct ast_channel *chan, const char *data) { return waitfor_exec(chan, data, 0); } diff --git a/apps/app_waituntil.c b/apps/app_waituntil.c index 0b6ccc677..9f13157be 100644 --- a/apps/app_waituntil.c +++ b/apps/app_waituntil.c @@ -67,7 +67,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app = "WaitUntil"; -static int waituntil_exec(struct ast_channel *chan, void *data) +static int waituntil_exec(struct ast_channel *chan, const char *data) { int res; double fraction; diff --git a/apps/app_while.c b/apps/app_while.c index 055613628..f8144fc07 100644 --- a/apps/app_while.c +++ b/apps/app_while.c @@ -186,7 +186,7 @@ static int find_matching_endwhile(struct ast_channel *chan) return res; } -static int _while_exec(struct ast_channel *chan, void *data, int end) +static int _while_exec(struct ast_channel *chan, const char *data, int end) { int res=0; const char *while_pri = NULL; @@ -296,19 +296,19 @@ static int _while_exec(struct ast_channel *chan, void *data, int end) return res; } -static int while_start_exec(struct ast_channel *chan, void *data) { +static int while_start_exec(struct ast_channel *chan, const char *data) { return _while_exec(chan, data, 0); } -static int while_end_exec(struct ast_channel *chan, void *data) { +static int while_end_exec(struct ast_channel *chan, const char *data) { return _while_exec(chan, data, 1); } -static int while_exit_exec(struct ast_channel *chan, void *data) { +static int while_exit_exec(struct ast_channel *chan, const char *data) { return _while_exec(chan, data, 2); } -static int while_continue_exec(struct ast_channel *chan, void *data) +static int while_continue_exec(struct ast_channel *chan, const char *data) { int x; const char *prefix = "WHILE", *while_pri=NULL; diff --git a/apps/app_zapateller.c b/apps/app_zapateller.c index bf9408090..4be09b59c 100644 --- a/apps/app_zapateller.c +++ b/apps/app_zapateller.c @@ -74,7 +74,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") static char *app = "Zapateller"; -static int zapateller_exec(struct ast_channel *chan, void *data) +static int zapateller_exec(struct ast_channel *chan, const char *data) { int res = 0; int i, answer = 0, nocallerid = 0; diff --git a/cdr/cdr_adaptive_odbc.c b/cdr/cdr_adaptive_odbc.c index 6c72d19c7..205c2075d 100644 --- a/cdr/cdr_adaptive_odbc.c +++ b/cdr/cdr_adaptive_odbc.c @@ -282,7 +282,6 @@ static int free_config(void) static SQLHSTMT generic_prepare(struct odbc_obj *obj, void *data) { int res, i; - char *sql = data; SQLHSTMT stmt; SQLINTEGER nativeerror = 0, numfields = 0; SQLSMALLINT diagbytes = 0; @@ -294,9 +293,9 @@ static SQLHSTMT generic_prepare(struct odbc_obj *obj, void *data) return NULL; } - res = SQLPrepare(stmt, (unsigned char *)sql, SQL_NTS); + res = SQLPrepare(stmt, (unsigned char *) data, SQL_NTS); if ((res != SQL_SUCCESS) && (res != SQL_SUCCESS_WITH_INFO)) { - ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", sql); + ast_log(LOG_WARNING, "SQL Prepare failed![%s]\n", (char *) data); SQLGetDiagField(SQL_HANDLE_STMT, stmt, 1, SQL_DIAG_NUMBER, &numfields, SQL_IS_INTEGER, &diagbytes); for (i = 0; i < numfields; i++) { SQLGetDiagRec(SQL_HANDLE_STMT, stmt, i + 1, state, &nativeerror, diagnostic, sizeof(diagnostic), &diagbytes); diff --git a/cdr/cdr_sqlite.c b/cdr/cdr_sqlite.c index 98b6b7c4c..8eecee453 100644 --- a/cdr/cdr_sqlite.c +++ b/cdr/cdr_sqlite.c @@ -61,7 +61,7 @@ static sqlite* db = NULL; AST_MUTEX_DEFINE_STATIC(sqlite_lock); /*! \brief SQL table format */ -static char sql_create_table[] = "CREATE TABLE cdr (" +static const char sql_create_table[] = "CREATE TABLE cdr (" " AcctId INTEGER PRIMARY KEY," " clid VARCHAR(80)," " src VARCHAR(80)," diff --git a/cdr/cdr_sqlite3_custom.c b/cdr/cdr_sqlite3_custom.c index 08b675225..3bd926268 100644 --- a/cdr/cdr_sqlite3_custom.c +++ b/cdr/cdr_sqlite3_custom.c @@ -56,8 +56,8 @@ AST_MUTEX_DEFINE_STATIC(lock); static const char config_file[] = "cdr_sqlite3_custom.conf"; -static char *desc = "Customizable SQLite3 CDR Backend"; -static char *name = "cdr_sqlite3_custom"; +static const char desc[] = "Customizable SQLite3 CDR Backend"; +static const char name[] = "cdr_sqlite3_custom"; static sqlite3 *db = NULL; static char table[80]; diff --git a/channels/chan_agent.c b/channels/chan_agent.c index b705b6f04..d922d4927 100644 --- a/channels/chan_agent.c +++ b/channels/chan_agent.c @@ -1708,7 +1708,7 @@ static int agent_logoff(const char *agent, int soft) static char *agent_logoff_cmd(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { int ret; - char *agent; + const char *agent; switch (cmd) { case CLI_INIT: @@ -1956,7 +1956,7 @@ static struct ast_cli_entry cli_agents[] = { * \returns * \sa agentmonitoroutgoing_exec(), load_module(). */ -static int login_exec(struct ast_channel *chan, void *data) +static int login_exec(struct ast_channel *chan, const char *data) { int res=0; int tries = 0; @@ -2284,7 +2284,7 @@ static int login_exec(struct ast_channel *chan, void *data) * \returns * \sa login_exec(), load_module(). */ -static int agentmonitoroutgoing_exec(struct ast_channel *chan, void *data) +static int agentmonitoroutgoing_exec(struct ast_channel *chan, const char *data) { int exitifnoagentid = 0; int nowarnings = 0; diff --git a/channels/chan_alsa.c b/channels/chan_alsa.c index 16efefbbf..520ef940a 100644 --- a/channels/chan_alsa.c +++ b/channels/chan_alsa.c @@ -782,7 +782,7 @@ static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args { char tmp[256], *tmp2; char *mye, *myc; - char *d; + const char *d; char *res = CLI_SUCCESS; switch (cmd) { diff --git a/channels/chan_console.c b/channels/chan_console.c index ee26f2195..5bdfa99ba 100644 --- a/channels/chan_console.c +++ b/channels/chan_console.c @@ -797,6 +797,7 @@ static char *cli_console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_a if (pvt->owner) { /* already in a call */ int i; struct ast_frame f = { AST_FRAME_DTMF, 0 }; + const char *s; if (a->argc == e->args) { /* argument is mandatory here */ ast_cli(a->fd, "Already in a call. You can only dial digits until you hangup.\n"); @@ -883,7 +884,7 @@ static char *cli_console_hangup(struct ast_cli_entry *e, int cmd, struct ast_cli static char *cli_console_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *s; + const char *s; struct console_pvt *pvt = get_active_pvt(); char *res = CLI_SUCCESS; diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index da16b57b5..ce490e6ad 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -620,7 +620,7 @@ struct dahdi_distRings { struct ringContextData ringContext[3]; }; -static char *subnames[] = { +static const char * const subnames[] = { "Real", "Callwait", "Threeway" @@ -2364,7 +2364,7 @@ out: return res; } -static char *events[] = { +static const char * const events[] = { "No event", "On hook", "Ring/Answered", @@ -2409,7 +2409,7 @@ static char *alarm2str(int alm) return alm ? "Unknown Alarm" : "No Alarm"; } -static char *event2str(int event) +static const char *event2str(int event) { static char buf[256]; if ((event < (ARRAY_LEN(events))) && (event > -1)) @@ -3987,11 +3987,11 @@ static void destroy_all_channels(void) #if defined(HAVE_PRI) static char *dahdi_send_keypad_facility_app = "DAHDISendKeypadFacility"; -static int dahdi_send_keypad_facility_exec(struct ast_channel *chan, void *data) +static int dahdi_send_keypad_facility_exec(struct ast_channel *chan, const char *data) { /* Data will be our digit string */ struct dahdi_pvt *p; - char *digits = (char *) data; + const char *digits = (const char *) data; if (ast_strlen_zero(digits)) { ast_debug(1, "No digit string sent to application!\n"); @@ -4032,7 +4032,7 @@ static int dahdi_send_keypad_facility_exec(struct ast_channel *chan, void *data) #if defined(HAVE_PRI_PROG_W_CAUSE) static char *dahdi_send_callrerouting_facility_app = "DAHDISendCallreroutingFacility"; -static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, void *data) +static int dahdi_send_callrerouting_facility_exec(struct ast_channel *chan, const char *data) { /* Data will be our digit string */ struct dahdi_pvt *p; diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index f343b3d24..383f97ed9 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1051,7 +1051,7 @@ static int iax2_fixup(struct ast_channel *oldchannel, struct ast_channel *newcha static int iax2_hangup(struct ast_channel *c); static int iax2_indicate(struct ast_channel *c, int condition, const void *data, size_t datalen); static int iax2_poke_peer(struct iax2_peer *peer, int heldcall); -static int iax2_provision(struct sockaddr_in *end, int sockfd, char *dest, const char *template, int force); +static int iax2_provision(struct sockaddr_in *end, int sockfd, const char *dest, const char *template, int force); static int iax2_send(struct chan_iax2_pvt *pvt, struct ast_frame *f, unsigned int ts, int seqno, int now, int transfer, int final); static int iax2_sendhtml(struct ast_channel *c, int subclass, const char *data, int datalen); static int iax2_sendimage(struct ast_channel *c, struct ast_frame *img); @@ -2660,7 +2660,7 @@ static char *handle_cli_iax2_prune_realtime(struct ast_cli_entry *e, int cmd, st { struct iax2_peer *peer = NULL; struct iax2_user *user = NULL; - static char *choices[] = { "all", NULL }; + static const char * const choices[] = { "all", NULL }; char *cmplt; switch (cmd) { @@ -5377,7 +5377,7 @@ static char *handle_cli_iax2_show_users(struct ast_cli_entry *e, int cmd, struct #undef FORMAT2 } -static int __iax2_show_peers(int manager, int fd, struct mansession *s, int argc, char *argv[]) +static int __iax2_show_peers(int manager, int fd, struct mansession *s, const int argc, const char * const argv[]) { regex_t regexbuf; int havepattern = 0; @@ -5708,14 +5708,14 @@ static char *handle_cli_iax2_show_firmware(struct ast_cli_entry *e, int cmd, str /*! \brief callback to display iax peers in manager */ static int manager_iax2_show_peers(struct mansession *s, const struct message *m) { - char *a[] = { "iax2", "show", "users" }; + static const char * const a[] = { "iax2", "show", "peers" }; const char *id = astman_get_header(m,"ActionID"); char idtext[256] = ""; if (!ast_strlen_zero(id)) snprintf(idtext, sizeof(idtext), "ActionID: %s\r\n", id); astman_send_ack(s, m, "Peer status list will follow"); - return __iax2_show_peers(1, -1, s, 3, a ); + return __iax2_show_peers(1, -1, s, 3, a); } /*! \brief callback to display iax peers in manager format */ @@ -7987,9 +7987,6 @@ static int iax_park(struct ast_channel *chan1, struct ast_channel *chan2) return -1; } - -static int iax2_provision(struct sockaddr_in *end, int sockfd, char *dest, const char *template, int force); - static int check_provisioning(struct sockaddr_in *sin, int sockfd, char *si, unsigned int ver) { unsigned int ourver; @@ -10279,7 +10276,7 @@ static int iax2_do_register(struct iax2_registry *reg) return 0; } -static int iax2_provision(struct sockaddr_in *end, int sockfd, char *dest, const char *template, int force) +static int iax2_provision(struct sockaddr_in *end, int sockfd, const char *dest, const char *template, int force) { /* Returns 1 if provisioned, -1 if not able to find destination, or 0 if no provisioning is found for template */ @@ -10331,7 +10328,7 @@ static char *papp = "IAX2Provision"; /*! iax2provision \ingroup applications */ -static int iax2_prov_app(struct ast_channel *chan, void *data) +static int iax2_prov_app(struct ast_channel *chan, const char *data) { int res; char *sdata; diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index 0ba8290a1..be38e87b6 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -119,7 +119,7 @@ static const char config[] = "mgcp.conf"; #define MGCP_CX_INACTIVE 4 /*! } */ -static char *mgcp_cxmodes[] = { +static const char * const mgcp_cxmodes[] = { "sendonly", "recvonly", "sendrecv", @@ -1098,7 +1098,7 @@ static char *handle_mgcp_audit_endpoint(struct ast_cli_entry *e, int cmd, struct if (a->argc != 4) return CLI_SHOWUSAGE; /* split the name into parts by null */ - ename = a->argv[3]; + ename = ast_strdupa(a->argv[3]); gname = ename; while (*gname) { if (*gname == '@') { @@ -1919,7 +1919,7 @@ static int process_sdp(struct mgcp_subchannel *sub, struct mgcp_request *req) return 0; } -static int add_header(struct mgcp_request *req, char *var, char *value) +static int add_header(struct mgcp_request *req, const char *var, const char *value) { if (req->len >= sizeof(req->data) - 4) { ast_log(LOG_WARNING, "Out of space, can't add anymore\n"); diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index 01af221fe..d75798483 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -711,11 +711,11 @@ static void release_chan(struct misdn_bchannel *bc); #if defined(AST_MISDN_ENHANCEMENTS) static const char misdn_command_name[] = "misdn_command"; -static int misdn_command_exec(struct ast_channel *chan, void *data); +static int misdn_command_exec(struct ast_channel *chan, const char *data); #endif /* defined(AST_MISDN_ENHANCEMENTS) */ -static int misdn_check_l2l1(struct ast_channel *chan, void *data); -static int misdn_set_opt_exec(struct ast_channel *chan, void *data); -static int misdn_facility_exec(struct ast_channel *chan, void *data); +static int misdn_check_l2l1(struct ast_channel *chan, const char *data); +static int misdn_set_opt_exec(struct ast_channel *chan, const char *data); +static int misdn_facility_exec(struct ast_channel *chan, const char *data); int chan_misdn_jb_empty(struct misdn_bchannel *bc, char *buf, int len); @@ -748,7 +748,7 @@ static struct chan_list *get_chan_by_ast(struct ast_channel *ast) return NULL; } -static struct chan_list *get_chan_by_ast_name(char *name) +static struct chan_list *get_chan_by_ast_name(const char *name) { struct chan_list *tmp; @@ -4025,7 +4025,7 @@ struct state_struct { char txt[255]; }; -static struct state_struct state_array[] = { +static const struct state_struct state_array[] = { /* *INDENT-OFF* */ { MISDN_NOTHING, "NOTHING" }, /* at beginning */ { MISDN_WAITING4DIGS, "WAITING4DIGS" }, /* when waiting for infos */ @@ -5125,11 +5125,11 @@ static const struct FacParm Fac_Msgs[] = { static char *handle_cli_misdn_send_facility(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *channame; - char *nr; + const char *channame; + const char *nr; struct chan_list *tmp; int port; - char *served_nr; + const char *served_nr; struct misdn_bchannel dummy, *bc=&dummy; unsigned max_len; @@ -5381,8 +5381,8 @@ static char *handle_cli_misdn_send_restart(struct ast_cli_entry *e, int cmd, str static char *handle_cli_misdn_send_digit(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *channame; - char *msg; + const char *channame; + const char *msg; struct chan_list *tmp; int i, msglen; @@ -5430,7 +5430,7 @@ static char *handle_cli_misdn_send_digit(struct ast_cli_entry *e, int cmd, struc static char *handle_cli_misdn_toggle_echocancel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *channame; + const char *channame; struct chan_list *tmp; switch (cmd) { @@ -5476,8 +5476,8 @@ static char *handle_cli_misdn_toggle_echocancel(struct ast_cli_entry *e, int cmd static char *handle_cli_misdn_send_display(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *channame; - char *msg; + const char *channame; + const char *msg; struct chan_list *tmp; switch (cmd) { @@ -11357,7 +11357,7 @@ static const struct misdn_command_table misdn_commands[] = { * \retval 0 on success. * \retval -1 on error. */ -static int misdn_command_exec(struct ast_channel *chan, void *data) +static int misdn_command_exec(struct ast_channel *chan, const char *data) { char *parse; unsigned index; @@ -11397,7 +11397,7 @@ static int misdn_command_exec(struct ast_channel *chan, void *data) } #endif /* defined(AST_MISDN_ENHANCEMENTS) */ -static int misdn_facility_exec(struct ast_channel *chan, void *data) +static int misdn_facility_exec(struct ast_channel *chan, const char *data) { struct chan_list *ch = MISDN_ASTERISK_TECH_PVT(chan); char *parse; @@ -11476,7 +11476,7 @@ static int misdn_facility_exec(struct ast_channel *chan, void *data) return 0; } -static int misdn_check_l2l1(struct ast_channel *chan, void *data) +static int misdn_check_l2l1(struct ast_channel *chan, const char *data) { char *parse; char group[BUFFERSIZE + 1]; @@ -11550,7 +11550,7 @@ static int misdn_check_l2l1(struct ast_channel *chan, void *data) return 0; } -static int misdn_set_opt_exec(struct ast_channel *chan, void *data) +static int misdn_set_opt_exec(struct ast_channel *chan, const char *data) { struct chan_list *ch = MISDN_ASTERISK_TECH_PVT(chan); char *tok; diff --git a/channels/chan_nbs.c b/channels/chan_nbs.c index 92b93553a..8729f1074 100644 --- a/channels/chan_nbs.c +++ b/channels/chan_nbs.c @@ -53,7 +53,7 @@ static const char tdesc[] = "Network Broadcast Sound Driver"; static int prefformat = AST_FORMAT_SLINEAR; static char context[AST_MAX_EXTENSION] = "default"; -static char type[] = "NBS"; +static const char type[] = "NBS"; /* NBS creates private structures on demand */ diff --git a/channels/chan_oss.c b/channels/chan_oss.c index a967cc911..b3ff44883 100644 --- a/channels/chan_oss.c +++ b/channels/chan_oss.c @@ -305,7 +305,7 @@ struct chan_oss_pvt { }; /*! forward declaration */ -static struct chan_oss_pvt *find_desc(char *dev); +static struct chan_oss_pvt *find_desc(const char *dev); static char *oss_active; /*!< the active device */ @@ -367,7 +367,7 @@ static struct ast_channel_tech oss_tech = { /*! * \brief returns a pointer to the descriptor with the given name */ -static struct chan_oss_pvt *find_desc(char *dev) +static struct chan_oss_pvt *find_desc(const char *dev) { struct chan_oss_pvt *o = NULL; @@ -1075,7 +1075,8 @@ static char *console_flash(struct ast_cli_entry *e, int cmd, struct ast_cli_args static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *s = NULL, *mye = NULL, *myc = NULL; + char *s = NULL; + char *mye = NULL, *myc = NULL; struct chan_oss_pvt *o = find_desc(oss_active); if (cmd == CLI_INIT) { @@ -1092,6 +1093,7 @@ static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args if (o->owner) { /* already in a call */ int i; struct ast_frame f = { AST_FRAME_DTMF, 0 }; + const char *s; if (a->argc == e->args) { /* argument is mandatory here */ ast_cli(a->fd, "Already in a call. You can only dial digits until you hangup.\n"); @@ -1126,7 +1128,7 @@ static char *console_dial(struct ast_cli_entry *e, int cmd, struct ast_cli_args static char *console_mute(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { struct chan_oss_pvt *o = find_desc(oss_active); - char *s; + const char *s; int toggle = 0; if (cmd == CLI_INIT) { diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 1f3f1554b..4679265e9 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -2348,7 +2348,7 @@ static void free_old_route(struct sip_route *route); static void list_route(struct sip_route *route); static void build_route(struct sip_pvt *p, struct sip_request *req, int backwards); static enum check_auth_result register_verify(struct sip_pvt *p, struct sockaddr_in *sin, - struct sip_request *req, char *uri); + struct sip_request *req, const char *uri); static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *totag, const char *fromtag); static void check_pendings(struct sip_pvt *p); static void *sip_park_thread(void *stuff); @@ -2376,11 +2376,11 @@ static int reply_digest(struct sip_pvt *p, struct sip_request *req, char *header static int build_reply_digest(struct sip_pvt *p, int method, char *digest, int digest_len); static enum check_auth_result check_auth(struct sip_pvt *p, struct sip_request *req, const char *username, const char *secret, const char *md5secret, int sipmethod, - char *uri, enum xmittype reliable, int ignore); + const char *uri, enum xmittype reliable, int ignore); static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_request *req, - int sipmethod, char *uri, enum xmittype reliable, + int sipmethod, const char *uri, enum xmittype reliable, struct sockaddr_in *sin, struct sip_peer **authpeer); -static int check_user(struct sip_pvt *p, struct sip_request *req, int sipmethod, char *uri, enum xmittype reliable, struct sockaddr_in *sin); +static int check_user(struct sip_pvt *p, struct sip_request *req, int sipmethod, const char *uri, enum xmittype reliable, struct sockaddr_in *sin); /*--- Domain handling */ static int check_sip_domain(const char *domain, char *context, size_t len); /* Check if domain is one of our local domains */ @@ -2485,13 +2485,13 @@ static char *complete_sipnotify(const char *line, const char *word, int pos, int static char *sip_show_channel(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); static char *sip_show_channelstats(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); static char *sip_show_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); -static char *sip_do_debug_ip(int fd, char *arg); -static char *sip_do_debug_peer(int fd, char *arg); +static char *sip_do_debug_ip(int fd, const char *arg); +static char *sip_do_debug_peer(int fd, const char *arg); static char *sip_do_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); static char *sip_cli_notify(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); static char *sip_set_history(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); -static int sip_dtmfmode(struct ast_channel *chan, void *data); -static int sip_addheader(struct ast_channel *chan, void *data); +static int sip_dtmfmode(struct ast_channel *chan, const char *data); +static int sip_addheader(struct ast_channel *chan, const char *data); static int sip_do_reload(enum channelreloadreason reason); static char *sip_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen); @@ -2619,26 +2619,26 @@ static void build_contact(struct sip_pvt *p); /*------Request handling functions */ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int *recount, int *nounlock); static int handle_request_update(struct sip_pvt *p, struct sip_request *req); -static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, char *e, int *nounlock); +static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, const char *e, int *nounlock); static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, int *nounlock); static int handle_request_bye(struct sip_pvt *p, struct sip_request *req); -static int handle_request_register(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, char *e); +static int handle_request_register(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, const char *e); static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req); static int handle_request_message(struct sip_pvt *p, struct sip_request *req); -static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, char *e); +static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, const char *e); static void handle_request_info(struct sip_pvt *p, struct sip_request *req); static int handle_request_options(struct sip_pvt *p, struct sip_request *req); static int handle_invite_replaces(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin); -static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, char *e); +static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, const char *e); static int local_attended_transfer(struct sip_pvt *transferer, struct sip_dual *current, struct sip_request *req, int seqno); /*------Response handling functions */ -static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno); -static void handle_response_notify(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno); -static void handle_response_refer(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno); -static void handle_response_subscribe(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno); -static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno); -static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno); +static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); +static void handle_response_notify(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); +static void handle_response_refer(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); +static void handle_response_subscribe(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); +static int handle_response_register(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); +static void handle_response(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno); /*------ T38 Support --------- */ static int transmit_response_with_t38_sdp(struct sip_pvt *p, char *msg, struct sip_request *req, int retrans); @@ -6598,9 +6598,9 @@ static const char *__get_header(const struct sip_request *req, const char *name, for (pass = 0; name && pass < 2;pass++) { int x, len = strlen(name); for (x = *start; x < req->headers; x++) { - char *header = REQ_OFFSET_TO_STR(req, header[x]); + const char *header = REQ_OFFSET_TO_STR(req, header[x]); if (!strncasecmp(header, name, len)) { - char *r = header + len; /* skip name */ + const char *r = header + len; /* skip name */ if (sip_cfg.pedanticsipchecking) r = ast_skip_blanks(r); @@ -7545,7 +7545,7 @@ static int find_sdp(struct sip_request *req) sdp part and the end boundry if it exists */ for (x = 0; x < (req->lines); x++) { - char *line = REQ_OFFSET_TO_STR(req, line[x]); + const char *line = REQ_OFFSET_TO_STR(req, line[x]); if (!strncasecmp(line, boundary, strlen(boundary))){ if (found_application_sdp && found_end_of_headers) { req->sdp_end = x-1; @@ -10859,7 +10859,7 @@ static int manager_sipnotify(struct mansession *s, const struct message *m) return 0; } -static char mandescr_sipnotify[] = +static const char mandescr_sipnotify[] = "Description: Sends a SIP Notify event\n" "All parameters for this event must be specified in the body of this request\n" "via multiple Variable: name=value sequences.\n" @@ -12039,7 +12039,7 @@ AST_THREADSTORAGE(check_auth_buf); */ static enum check_auth_result check_auth(struct sip_pvt *p, struct sip_request *req, const char *username, const char *secret, const char *md5secret, int sipmethod, - char *uri, enum xmittype reliable, int ignore) + const char *uri, enum xmittype reliable, int ignore) { const char *response; char *reqheader, *respheader; @@ -12404,15 +12404,16 @@ static char *terminate_uri(char *uri) - Registration requests are only matched with peers that are marked as "dynamic" */ static enum check_auth_result register_verify(struct sip_pvt *p, struct sockaddr_in *sin, - struct sip_request *req, char *uri) + struct sip_request *req, const char *uri) { enum check_auth_result res = AUTH_NOT_FOUND; struct sip_peer *peer; char tmp[256]; char *name, *c; char *domain; + char *uri2 = ast_strdupa(uri); - terminate_uri(uri); /* warning, overwrite the string */ + terminate_uri(uri2); ast_copy_string(tmp, get_header(req, "To"), sizeof(tmp)); if (sip_cfg.pedanticsipchecking) @@ -12472,7 +12473,7 @@ static enum check_auth_result register_verify(struct sip_pvt *p, struct sockaddr ast_copy_flags(&p->flags[0], &peer->flags[0], SIP_NAT); if (ast_test_flag(&p->flags[1], SIP_PAGE2_REGISTERTRYING)) transmit_response(p, "100 Trying", req); - if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri, XMIT_UNRELIABLE, req->ignore))) { + if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri2, XMIT_UNRELIABLE, req->ignore))) { if (sip_cancel_destroy(p)) ast_log(LOG_WARNING, "Unable to cancel SIP destruction. Expect bad things.\n"); @@ -13695,7 +13696,7 @@ static enum check_auth_result check_peer_ok(struct sip_pvt *p, char *of, \return 0 on success, non-zero on failure */ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_request *req, - int sipmethod, char *uri, enum xmittype reliable, + int sipmethod, const char *uri, enum xmittype reliable, struct sockaddr_in *sin, struct sip_peer **authpeer) { char from[256]; @@ -13813,7 +13814,7 @@ static enum check_auth_result check_user_full(struct sip_pvt *p, struct sip_requ /*! \brief Find user If we get a match, this will add a reference pointer to the user object in ASTOBJ, that needs to be unreferenced */ -static int check_user(struct sip_pvt *p, struct sip_request *req, int sipmethod, char *uri, enum xmittype reliable, struct sockaddr_in *sin) +static int check_user(struct sip_pvt *p, struct sip_request *req, int sipmethod, const char *uri, enum xmittype reliable, struct sockaddr_in *sin) { return check_user_full(p, req, sipmethod, uri, reliable, sin, NULL); } @@ -13830,7 +13831,7 @@ static int get_msg_text(char *buf, int len, struct sip_request *req, int addnewl if (y < 0) y = 0; for (x = 0; x < req->lines; x++) { - char *line = REQ_OFFSET_TO_STR(req, line[x]); + const char *line = REQ_OFFSET_TO_STR(req, line[x]); strncat(buf, line, y); /* safe */ y -= strlen(line) + 1; if (y < 0) @@ -13949,7 +13950,7 @@ static char *transfermode2str(enum transfermodes mode) return "strict"; } -static struct _map_x_s natmodes[] = { +static const struct _map_x_s natmodes[] = { { SIP_NAT_NEVER, "No"}, { SIP_NAT_ROUTE, "Route"}, { SIP_NAT_ALWAYS, "Always"}, @@ -13968,7 +13969,7 @@ static const char *nat2str(int nat) delete it. Keeping it enabled generates compiler warnings. */ -static struct _map_x_s natcfgmodes[] = { +static const struct _map_x_s natcfgmodes[] = { { SIP_NAT_NEVER, "never"}, { SIP_NAT_ROUTE, "route"}, { SIP_NAT_ALWAYS, "yes"}, @@ -13989,7 +13990,7 @@ static const char *nat2strconfig(int nat) /* Session-Timer Modes */ -static struct _map_x_s stmodes[] = { +static const struct _map_x_s stmodes[] = { { SESSION_TIMER_MODE_ACCEPT, "Accept"}, { SESSION_TIMER_MODE_ORIGINATE, "Originate"}, { SESSION_TIMER_MODE_REFUSE, "Refuse"}, @@ -14007,7 +14008,7 @@ static enum st_mode str2stmode(const char *s) } /* Session-Timer Refreshers */ -static struct _map_x_s strefreshers[] = { +static const struct _map_x_s strefreshers[] = { { SESSION_TIMER_REFRESHER_AUTO, "auto"}, { SESSION_TIMER_REFRESHER_UAC, "uac"}, { SESSION_TIMER_REFRESHER_UAS, "uas"}, @@ -14166,7 +14167,7 @@ static char *sip_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_arg } /*! \brief Manager Action SIPShowRegistry description */ -static char mandescr_show_registry[] = +static const char mandescr_show_registry[] = "Description: Lists all registration requests and status\n" "Registrations will follow as separate events. followed by a final event called\n" "RegistrationsComplete.\n" @@ -14211,7 +14212,7 @@ static int manager_show_registry(struct mansession *s, const struct message *m) return 0; } -static char mandescr_show_peers[] = +static const char mandescr_show_peers[] = "Description: Lists SIP peers in text format with details on current status.\n" "Peerlist will follow as separate events, followed by a final event called\n" "PeerlistComplete.\n" @@ -14447,10 +14448,10 @@ static int peer_dump_func(void *userobj, void *arg, int flags) { struct sip_peer *peer = userobj; int refc = ao2_t_ref(userobj, 0, ""); - int *fd = arg; + struct ast_cli_args *a = (struct ast_cli_args *) arg; - ast_cli(*fd, "name: %s\ntype: peer\nobjflags: %d\nrefcount: %d\n\n", - peer->name, 0, refc); + ast_cli(a->fd, "name: %s\ntype: peer\nobjflags: %d\nrefcount: %d\n\n", + peer->name, 0, refc); return 0; } @@ -14458,10 +14459,10 @@ static int dialog_dump_func(void *userobj, void *arg, int flags) { struct sip_pvt *pvt = userobj; int refc = ao2_t_ref(userobj, 0, ""); - int *fd = arg; + struct ast_cli_args *a = (struct ast_cli_args *) arg; - ast_cli(*fd, "name: %s\ntype: dialog\nobjflags: %d\nrefcount: %d\n\n", - pvt->callid, 0, refc); + ast_cli(a->fd, "name: %s\ntype: dialog\nobjflags: %d\nrefcount: %d\n\n", + pvt->callid, 0, refc); return 0; } @@ -14485,22 +14486,22 @@ static char *sip_show_objects(struct ast_cli_entry *e, int cmd, struct ast_cli_a if (a->argc != 3) return CLI_SHOWUSAGE; ast_cli(a->fd, "-= Peer objects: %d static, %d realtime, %d autocreate =-\n\n", speerobjs, rpeerobjs, apeerobjs); - ao2_t_callback(peers, OBJ_NODATA, peer_dump_func, &a->fd, "initiate ao2_callback to dump peers"); + ao2_t_callback(peers, OBJ_NODATA, peer_dump_func, a, "initiate ao2_callback to dump peers"); ast_cli(a->fd, "-= Registry objects: %d =-\n\n", regobjs); ASTOBJ_CONTAINER_DUMP(a->fd, tmp, sizeof(tmp), ®l); ast_cli(a->fd, "-= Dialog objects:\n\n"); - ao2_t_callback(dialogs, OBJ_NODATA, dialog_dump_func, &a->fd, "initiate ao2_callback to dump dialogs"); + ao2_t_callback(dialogs, OBJ_NODATA, dialog_dump_func, a, "initiate ao2_callback to dump dialogs"); return CLI_SUCCESS; } /*! \brief Print call group and pickup group */ -static void print_group(int fd, ast_group_t group, int crlf) +static void print_group(int fd, ast_group_t group, int crlf) { char buf[256]; ast_cli(fd, crlf ? "%s\r\n" : "%s\n", ast_print_group(buf, sizeof(buf), group) ); } /*! \brief mapping between dtmf flags and strings */ -static struct _map_x_s dtmfstr[] = { +static const struct _map_x_s dtmfstr[] = { { SIP_DTMF_RFC2833, "rfc2833" }, { SIP_DTMF_INFO, "info" }, { SIP_DTMF_SHORTINFO, "shortinfo" }, @@ -14521,7 +14522,7 @@ static int str2dtmfmode(const char *str) return map_s_x(dtmfstr, str, -1); } -static struct _map_x_s insecurestr[] = { +static const struct _map_x_s insecurestr[] = { { SIP_INSECURE_PORT, "port" }, { SIP_INSECURE_INVITE, "invite" }, { SIP_INSECURE_PORT | SIP_INSECURE_INVITE, "port,invite" }, @@ -14644,10 +14645,10 @@ static char *sip_prune_realtime(struct ast_cli_entry *e, int cmd, struct ast_cli struct sip_peer *peer, *pi; int prunepeer = FALSE; int multi = FALSE; - char *name = NULL; + const char *name = NULL; regex_t regexbuf; struct ao2_iterator i; - static char *choices[] = { "all", "like", NULL }; + static const char * const choices[] = { "all", "like", NULL }; char *cmplt; if (cmd == CLI_INIT) { @@ -14836,7 +14837,7 @@ static char *sip_show_domains(struct ast_cli_entry *e, int cmd, struct ast_cli_a } #undef FORMAT -static char mandescr_show_peer[] = +static const char mandescr_show_peer[] = "Description: Show one SIP peer with details on current status.\n" "Variables: \n" " Peer: <name> The peer name you want to check.\n" @@ -16393,14 +16394,14 @@ static void handle_request_info(struct sip_pvt *p, struct sip_request *req) } /*! \brief Enable SIP Debugging for a single IP */ -static char *sip_do_debug_ip(int fd, char *arg) +static char *sip_do_debug_ip(int fd, const char *arg) { struct hostent *hp; struct ast_hostent ahp; int port = 0; char *p; - p = arg; + p = ast_strdupa(arg); strsep(&p, ":"); if (p) port = atoi(p); @@ -16422,7 +16423,7 @@ static char *sip_do_debug_ip(int fd, char *arg) } /*! \brief Turn on SIP debugging for a given peer */ -static char *sip_do_debug_peer(int fd, char *arg) +static char *sip_do_debug_peer(int fd, const char *arg) { struct sip_peer *peer = find_peer(arg, NULL, TRUE, FINDPEERS, FALSE); if (!peer) @@ -16446,7 +16447,7 @@ static char *sip_do_debug_peer(int fd, char *arg) static char *sip_do_debug(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { int oldsipdebug = sipdebug & sip_debug_console; - char *what; + const char *what; if (cmd == CLI_INIT) { e->command = "sip set debug {on|off|ip|peer}"; @@ -17310,7 +17311,7 @@ static int sip_reinvite_retry(const void *data) * * This function is only called upon the receipt of a 401/407 response to an UPDATE. */ -static void handle_response_update(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno) +static void handle_response_update(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) { if (p->options) { p->options->auth_type = (resp == 401 ? WWW_AUTH : PROXY_AUTH); @@ -17321,7 +17322,7 @@ static void handle_response_update(struct sip_pvt *p, int resp, char *rest, stru } /*! \brief Handle SIP response to INVITE dialogue */ -static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno) +static void handle_response_invite(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) { int outgoing = ast_test_flag(&p->flags[0], SIP_OUTGOING); int res = 0; @@ -17689,7 +17690,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru /* \brief Handle SIP response in NOTIFY transaction We've sent a NOTIFY, now handle responses to it */ -static void handle_response_notify(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno) +static void handle_response_notify(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) { switch (resp) { case 200: /* Notify accepted */ @@ -17732,7 +17733,7 @@ static void handle_response_notify(struct sip_pvt *p, int resp, char *rest, stru } /* \brief Handle SIP response in SUBSCRIBE transaction */ -static void handle_response_subscribe(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno) +static void handle_response_subscribe(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) { struct sip_peer *peer; if (!p->mwi) { @@ -17803,7 +17804,7 @@ static void handle_response_subscribe(struct sip_pvt *p, int resp, char *rest, s /* \brief Handle SIP response in REFER transaction We've sent a REFER, now handle responses to it */ -static void handle_response_refer(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno) +static void handle_response_refer(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) { enum ast_control_transfer message = AST_TRANSFER_FAILED; @@ -17874,7 +17875,7 @@ static void handle_response_refer(struct sip_pvt *p, int resp, char *rest, struc } /*! \brief Handle responses on REGISTER to services */ -static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno) +static int handle_response_register(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) { int expires, expires_ms; struct sip_registry *r; @@ -18100,7 +18101,7 @@ static void stop_media_flows(struct sip_pvt *p) /*! \brief Handle SIP response in dialogue \note only called by handle_incoming */ -static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno) +static void handle_response(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, int seqno) { struct ast_channel *owner; int sipmethod; @@ -18810,7 +18811,7 @@ static const char *gettag(const struct sip_request *req, const char *header, cha } /*! \brief Handle incoming notifications */ -static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, char *e) +static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, const char *e) { /* This is mostly a skeleton for future improvements */ /* Mostly created to return proper answers on notifications on outbound REFER's */ @@ -19517,7 +19518,7 @@ static int handle_request_update(struct sip_pvt *p, struct sip_request *req) * plan but try to find the active call and masquerade * into it */ -static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, char *e, int *nounlock) +static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, const char *e, int *nounlock) { int res = 1; int gotdest; @@ -19580,8 +19581,8 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int /* If pedantic is on, we need to check the tags. If they're different, this is in fact a forked call through a SIP proxy somewhere. */ int different; - char *initial_rlPart2 = REQ_OFFSET_TO_STR(&p->initreq, rlPart2); - char *this_rlPart2 = REQ_OFFSET_TO_STR(req, rlPart2); + const char *initial_rlPart2 = REQ_OFFSET_TO_STR(&p->initreq, rlPart2); + const char *this_rlPart2 = REQ_OFFSET_TO_STR(req, rlPart2); if (sip_cfg.pedanticsipchecking) different = sip_uri_cmp(initial_rlPart2, this_rlPart2); else @@ -21013,7 +21014,7 @@ static void add_peer_mwi_subs(struct sip_peer *peer) } /*! \brief Handle incoming SUBSCRIBE request */ -static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, char *e) +static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, const char *e) { int gotdest = 0; int res = 0; @@ -21333,7 +21334,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, } /*! \brief Handle incoming REGISTER request */ -static int handle_request_register(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, char *e) +static int handle_request_register(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, const char *e) { enum check_auth_result res; @@ -21401,7 +21402,7 @@ static int handle_incoming(struct sip_pvt *p, struct sip_request *req, struct so int respid; int res = 0; int debug = sip_debug_test_pvt(p); - char *e; + const char *e; int error = 0; /* Get Method and Cseq */ @@ -25058,10 +25059,10 @@ static char *app_sipaddheader = "SIPAddHeader"; static char *app_sipremoveheader = "SIPRemoveHeader"; /*! \brief Set the DTMFmode for an outbound SIP call (application) */ -static int sip_dtmfmode(struct ast_channel *chan, void *data) +static int sip_dtmfmode(struct ast_channel *chan, const char *data) { struct sip_pvt *p; - char *mode = data; + const char *mode = data; if (!data) { ast_log(LOG_WARNING, "This application requires the argument: info, inband, rfc2833\n"); @@ -25116,12 +25117,13 @@ static int sip_dtmfmode(struct ast_channel *chan, void *data) } /*! \brief Add a SIP header to an outbound INVITE */ -static int sip_addheader(struct ast_channel *chan, void *data) +static int sip_addheader(struct ast_channel *chan, const char *data) { int no = 0; int ok = FALSE; char varbuf[30]; - char *inbuf = data, *subbuf; + const char *inbuf = data; + char *subbuf; if (ast_strlen_zero(inbuf)) { ast_log(LOG_WARNING, "This application requires the argument: Header\n"); @@ -25155,7 +25157,7 @@ static int sip_addheader(struct ast_channel *chan, void *data) } /*! \brief Remove SIP headers added previously with SipAddHeader application */ -static int sip_removeheader(struct ast_channel *chan, void *data) +static int sip_removeheader(struct ast_channel *chan, const char *data) { struct ast_var_t *newvariable; struct varshead *headp; diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c index ebea1491a..dbb90a5d5 100644 --- a/channels/chan_skinny.c +++ b/channels/chan_skinny.c @@ -1076,7 +1076,7 @@ static int callnums = 1; #define SKINNY_CX_INACTIVE 4 #if 0 -static char *skinny_cxmodes[] = { +static const char * const skinny_cxmodes[] = { "sendonly", "recvonly", "sendrecv", @@ -3049,7 +3049,7 @@ static char *_skinny_show_devices(int fd, int *total, struct mansession *s, cons return CLI_SUCCESS; } -static char mandescr_show_devices[] = +static const char mandescr_show_devices[] = "Description: Lists Skinny devices in text format with details on current status.\n" "Devicelist will follow as separate events, followed by a final event called\n" "DevicelistComplete.\n" @@ -3194,7 +3194,7 @@ static char *_skinny_show_device(int type, int fd, struct mansession *s, const s return CLI_SUCCESS; } -static char mandescr_show_device[] = +static const char mandescr_show_device[] = "Description: Show one SKINNY device with details on current status.\n" "Variables: \n" " Device: <name> The device name you want to check.\n" @@ -3310,7 +3310,7 @@ static char *_skinny_show_lines(int fd, int *total, struct mansession *s, const return CLI_SUCCESS; } -static char mandescr_show_lines[] = +static const char mandescr_show_lines[] = "Description: Lists Skinny lines in text format with details on current status.\n" "Linelist will follow as separate events, followed by a final event called\n" "LinelistComplete.\n" @@ -3502,7 +3502,7 @@ static char *_skinny_show_line(int type, int fd, struct mansession *s, const str return CLI_SUCCESS; } -static char mandescr_show_line[] = +static const char mandescr_show_line[] = "Description: Show one SKINNY line with details on current status.\n" "Variables: \n" " Line: <name> The line name you want to check.\n" diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c index 95a8ce869..27e8e0cb2 100644 --- a/channels/chan_unistim.c +++ b/channels/chan_unistim.c @@ -502,7 +502,7 @@ static struct unistimsession { static const unsigned char packet_rcv_discovery[] = { 0xff, 0xff, 0xff, 0xff, 0x02, 0x02, 0xff, 0xff, 0xff, 0xff, 0x9e, 0x03, 0x08 }; -static unsigned char packet_send_discovery_ack[] = +static const unsigned char packet_send_discovery_ack[] = { 0x00, 0x00, /*Initial Seq (2 bytes) */ 0x00, 0x00, 0x00, 0x01 }; static const unsigned char packet_recv_firm_version[] = @@ -733,8 +733,8 @@ static unsigned int get_tick_count(void) } /* Send data to a phone without retransmit nor buffering */ -static void send_raw_client(int size, unsigned char *data, struct sockaddr_in *addr_to, - const struct sockaddr_in *addr_ourip) +static void send_raw_client(int size, const unsigned char *data, struct sockaddr_in *addr_to, + const struct sockaddr_in *addr_ourip) { #ifdef HAVE_PKTINFO struct iovec msg_iov; @@ -743,7 +743,12 @@ static void send_raw_client(int size, unsigned char *data, struct sockaddr_in *a struct cmsghdr *ip_msg = (struct cmsghdr *) buffer; struct in_pktinfo *pki = (struct in_pktinfo *) CMSG_DATA(ip_msg); - msg_iov.iov_base = data; + /* cast this to a non-const pointer, since the sendmsg() API + * does not provide read-only and write-only flavors of the + * structures used for its arguments, but in this case we know + * the data will not be modified + */ + msg_iov.iov_base = (char *) data; msg_iov.iov_len = size; msg.msg_name = addr_to; /* optional address */ diff --git a/channels/console_gui.c b/channels/console_gui.c index 21088baa0..375a4019c 100644 --- a/channels/console_gui.c +++ b/channels/console_gui.c @@ -1505,7 +1505,7 @@ static int kp_match_area(const struct keypad_entry *e, int x, int y) } struct _s_k { const char *s; int k; }; -static struct _s_k gui_key_map[] = { +static const struct _s_k gui_key_map[] = { {"FREEZE", KEY_FREEZE}, {"PIP", KEY_PIP}, {"PICK_UP", KEY_PICK_UP }, diff --git a/channels/iax2-parser.c b/channels/iax2-parser.c index 950fc78dd..f23ae5033 100644 --- a/channels/iax2-parser.c +++ b/channels/iax2-parser.c @@ -279,7 +279,7 @@ static struct iax2_ie { { IAX_IE_OSPTOKEN, "OSPTOKEN" }, }; -static struct iax2_ie prov_ies[] = { +static const struct iax2_ie prov_ies[] = { { PROV_IE_USEDHCP, "USEDHCP" }, { PROV_IE_IPADDR, "IPADDR", dump_ipaddr }, { PROV_IE_SUBNET, "SUBNET", dump_ipaddr }, diff --git a/channels/misdn/chan_misdn_config.h b/channels/misdn/chan_misdn_config.h index 40df71f97..e1fe16766 100644 --- a/channels/misdn/chan_misdn_config.h +++ b/channels/misdn/chan_misdn_config.h @@ -136,7 +136,7 @@ void misdn_cfg_update_ptp( void ); void misdn_cfg_get(int port, enum misdn_cfg_elements elem, void* buf, int bufsize); /* returns the enum element for the given name, returns MISDN_CFG_FIRST if none was found */ -enum misdn_cfg_elements misdn_cfg_get_elem (char *name); +enum misdn_cfg_elements misdn_cfg_get_elem (const char *name); /* fills the buffer with the name of the given config element */ void misdn_cfg_get_name (enum misdn_cfg_elements elem, void *buf, int bufsize); diff --git a/channels/misdn_config.c b/channels/misdn_config.c index 1b645f27c..70bc8a6c2 100644 --- a/channels/misdn_config.c +++ b/channels/misdn_config.c @@ -600,7 +600,7 @@ void misdn_cfg_get(int port, enum misdn_cfg_elements elem, void *buf, int bufsiz misdn_cfg_unlock(); } -enum misdn_cfg_elements misdn_cfg_get_elem(char *name) +enum misdn_cfg_elements misdn_cfg_get_elem(const char *name) { int pos; diff --git a/channels/vcodecs.c b/channels/vcodecs.c index ecb7a8c71..c667fdb13 100644 --- a/channels/vcodecs.c +++ b/channels/vcodecs.c @@ -1113,7 +1113,7 @@ struct _cm { /* map ffmpeg codec types to asterisk formats */ //struct video_codec_desc *codec_desc; }; -static struct _cm video_formats[] = { +static const struct _cm video_formats[] = { { AST_FORMAT_H263_PLUS, CODEC_ID_H263, CM_RD }, /* incoming H263P ? */ { AST_FORMAT_H263_PLUS, CODEC_ID_H263P, CM_WR }, { AST_FORMAT_H263, CODEC_ID_H263, CM_RD }, @@ -1137,7 +1137,7 @@ static enum CodecID map_video_format(uint32_t ast_format, int rw) } /* pointers to supported codecs. We assume the first one to be non null. */ -static struct video_codec_desc *supported_codecs[] = { +static const struct video_codec_desc *supported_codecs[] = { &h263p_codec, &h264_codec, &h263_codec, diff --git a/formats/format_gsm.c b/formats/format_gsm.c index 571fed8e1..480c63bd6 100644 --- a/formats/format_gsm.c +++ b/formats/format_gsm.c @@ -42,7 +42,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") /* silent gsm frame */ /* begin binary data: */ -char gsm_silence[] = /* 33 */ +static const char gsm_silence[] = /* 33 */ {0xD8,0x20,0xA2,0xE1,0x5A,0x50,0x00,0x49,0x24,0x92,0x49,0x24,0x50,0x00,0x49 ,0x24,0x92,0x49,0x24,0x50,0x00,0x49,0x24,0x92,0x49,0x24,0x50,0x00,0x49,0x24 ,0x92,0x49,0x24}; diff --git a/funcs/func_devstate.c b/funcs/func_devstate.c index a25638867..6e4a674d0 100644 --- a/funcs/func_devstate.c +++ b/funcs/func_devstate.c @@ -255,8 +255,8 @@ static char *handle_cli_devstate_change(struct ast_cli_entry *e, int cmd, struct return NULL; case CLI_GENERATE: { - static char * const cmds[] = { "UNKNOWN", "NOT_INUSE", "INUSE", "BUSY", - "UNAVAILABLE", "RINGING", "RINGINUSE", "ONHOLD", NULL }; + static const char * const cmds[] = { "UNKNOWN", "NOT_INUSE", "INUSE", "BUSY", + "UNAVAILABLE", "RINGING", "RINGINUSE", "ONHOLD", NULL }; if (a->pos == e->args + 1) return ast_cli_complete(a->word, cmds, a->n); diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c index 4bfe1a23d..85fdd09b4 100644 --- a/funcs/func_odbc.c +++ b/funcs/func_odbc.c @@ -732,7 +732,7 @@ static struct ast_custom_function fetch_function = { static char *app_odbcfinish = "ODBCFinish"; -static int exec_odbcfinish(struct ast_channel *chan, void *data) +static int exec_odbcfinish(struct ast_channel *chan, const char *data) { struct ast_datastore *store = ast_channel_datastore_find(chan, &odbc_info, data); if (!store) /* Already freed; no big deal. */ diff --git a/funcs/func_strings.c b/funcs/func_strings.c index a2ba285d4..b4f29b132 100644 --- a/funcs/func_strings.c +++ b/funcs/func_strings.c @@ -654,7 +654,7 @@ static void clearvar_prefix(struct ast_channel *chan, const char *prefix) AST_LIST_TRAVERSE_SAFE_END } -static int exec_clearhash(struct ast_channel *chan, void *data) +static int exec_clearhash(struct ast_channel *chan, const char *data) { char prefix[80]; snprintf(prefix, sizeof(prefix), HASH_PREFIX, data ? (char *)data : "null"); diff --git a/include/asterisk/abstract_jb.h b/include/asterisk/abstract_jb.h index d884ce3d5..1e9508b71 100644 --- a/include/asterisk/abstract_jb.h +++ b/include/asterisk/abstract_jb.h @@ -84,7 +84,7 @@ struct ast_jb /*! \brief Jitterbuffer configuration. */ struct ast_jb_conf conf; /*! \brief Jitterbuffer implementation to be used. */ - struct ast_jb_impl *impl; + const struct ast_jb_impl *impl; /*! \brief Jitterbuffer object, passed to the implementation. */ void *jbobj; /*! \brief The time the jitterbuffer was created. */ diff --git a/include/asterisk/agi.h b/include/asterisk/agi.h index 9c7759576..9df9afe4d 100644 --- a/include/asterisk/agi.h +++ b/include/asterisk/agi.h @@ -39,22 +39,22 @@ typedef struct agi_state { } AGI; typedef struct agi_command { - char *cmda[AST_MAX_CMD_LEN]; /*!< Null terminated list of the words of the command */ + const char * const cmda[AST_MAX_CMD_LEN]; /*!< Null terminated list of the words of the command */ /*! Handler for the command (channel, AGI state, # of arguments, argument list). Returns RESULT_SHOWUSAGE for improper arguments */ - int (*handler)(struct ast_channel *chan, AGI *agi, int argc, char *argv[]); + int (* const handler)(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[]); /*! Summary of the command (< 60 characters) */ - char *summary; + const char * const summary; /*! Detailed usage information */ - char *usage; + const char * const usage; /*! Does this application run dead */ - int dead; + const int dead; /*! AGI command syntax description */ - char *syntax; + const char * const syntax; /*! See also content */ - char *seealso; + const char * const seealso; /*! Where the documentation come from. */ - enum ast_doc_src docsrc; + const enum ast_doc_src docsrc; /*! Pointer to module that registered the agi command */ struct ast_module *mod; /*! Linked list pointer */ diff --git a/include/asterisk/app.h b/include/asterisk/app.h index 8e0d86952..d442e5292 100644 --- a/include/asterisk/app.h +++ b/include/asterisk/app.h @@ -106,7 +106,7 @@ int ast_ivr_menu_run(struct ast_channel *c, struct ast_ivr_menu *menu, void *cbd int ast_app_getdata(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout); /*! \brief Full version with audiofd and controlfd. NOTE: returns '2' on ctrlfd available, not '1' like other full functions */ -int ast_app_getdata_full(struct ast_channel *c, char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd); +int ast_app_getdata_full(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd); /*! * \brief Set voicemail function callbacks diff --git a/include/asterisk/cli.h b/include/asterisk/cli.h index a02764dfa..f03a39ffe 100644 --- a/include/asterisk/cli.h +++ b/include/asterisk/cli.h @@ -97,7 +97,7 @@ void ast_cli(int fd, const char *fmt, ...) \code static char *test_new_cli(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - static char *choices = { "one", "two", "three", NULL }; + static const char * const choices = { "one", "two", "three", NULL }; switch (cmd) { case CLI_INIT: @@ -128,7 +128,7 @@ static char *test_new_cli(struct ast_cli_entry *e, int cmd, struct ast_cli_args /*! \brief calling arguments for new-style handlers. * \arg \ref CLI_command_API */ -enum ast_cli_fn { +enum ast_cli_command { CLI_INIT = -2, /* return the usage string */ CLI_GENERATE = -3, /* behave as 'generator', remap argv to struct ast_cli_args */ CLI_HANDLER = -4, /* run the normal handler */ @@ -136,27 +136,25 @@ enum ast_cli_fn { /* argument for new-style CLI handler */ struct ast_cli_args { - int fd; - int argc; - char **argv; + const int fd; + const int argc; + const char * const *argv; const char *line; /* the current input line */ const char *word; /* the word we want to complete */ - int pos; /* position of the word to complete */ - int n; /* the iteration count (n-th entry we generate) */ + const int pos; /* position of the word to complete */ + const int n; /* the iteration count (n-th entry we generate) */ }; -struct ast_cli_entry; -typedef char *(*cli_fn)(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); - /*! \brief descriptor for a cli entry. * \arg \ref CLI_command_API */ struct ast_cli_entry { - char * const cmda[AST_MAX_CMD_LEN]; /*!< words making up the command. - * set the first entry to NULL for a new-style entry. */ + const char * const cmda[AST_MAX_CMD_LEN]; /*!< words making up the command. + * set the first entry to NULL for a new-style entry. + */ - const char *summary; /*!< Summary of the command (< 60 characters) */ - const char *usage; /*!< Detailed usage information */ + const char * const summary; /*!< Summary of the command (< 60 characters) */ + const char * usage; /*!< Detailed usage information */ int inuse; /*!< For keeping track of usage */ struct module *module; /*!< module this belongs to */ @@ -166,7 +164,7 @@ struct ast_cli_entry { */ int args; /*!< number of non-null entries in cmda */ char *command; /*!< command, non-null for new-style entries */ - cli_fn handler; + char *(*handler)(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a); /*! For linking */ AST_LIST_ENTRY(ast_cli_entry) list; }; @@ -183,7 +181,7 @@ struct ast_cli_entry { \code char *my_generate(const char *line, const char *word, int pos, int n) { - static char *choices = { "one", "two", "three", NULL }; + static const char * const choices = { "one", "two", "three", NULL }; if (pos == 2) return ast_cli_complete(word, choices, n); else @@ -191,7 +189,7 @@ struct ast_cli_entry { } \endcode */ -char *ast_cli_complete(const char *word, char *const choices[], int pos); +char *ast_cli_complete(const char *word, const char * const choices[], int pos); /*! * \brief Interprets a command diff --git a/include/asterisk/extconf.h b/include/asterisk/extconf.h index eeccc7b33..3aa15785b 100644 --- a/include/asterisk/extconf.h +++ b/include/asterisk/extconf.h @@ -185,7 +185,7 @@ int localized_pbx_load_module(void); * \version 1.6.1 renamed function from localized_context_create to localized_context_find_or_create */ struct ast_context *localized_context_find_or_create(struct ast_context **extcontexts, void *tab, const char *name, const char *registrar); -int localized_pbx_builtin_setvar(struct ast_channel *chan, void *data); +int localized_pbx_builtin_setvar(struct ast_channel *chan, const void *data); int localized_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar); int localized_context_add_switch2(struct ast_context *con, const char *value, const char *data, int eval, const char *registrar); diff --git a/include/asterisk/features.h b/include/asterisk/features.h index 9a666c743..a660b9e8a 100644 --- a/include/asterisk/features.h +++ b/include/asterisk/features.h @@ -49,7 +49,7 @@ #define FEATURE_SENSE_CHAN (1 << 0) #define FEATURE_SENSE_PEER (1 << 1) -typedef int (*ast_feature_operation)(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data); +typedef int (*ast_feature_operation)(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data); /*! \brief main call feature structure */ @@ -136,7 +136,7 @@ void ast_unregister_feature(struct ast_call_feature *feature); \param char ptr of input code \retval ast_call_feature ptr to be set if found \return result, was feature found or not */ -int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, char *code, struct ast_call_feature *feature); +int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, const char *code, struct ast_call_feature *feature); /*! \brief look for a call feature entry by its sname \param name a string ptr, should match "automon", "blindxfer", "atxfer", etc. */ diff --git a/include/asterisk/image.h b/include/asterisk/image.h index cfe511904..a3e2e015e 100644 --- a/include/asterisk/image.h +++ b/include/asterisk/image.h @@ -51,7 +51,7 @@ int ast_supports_images(struct ast_channel *chan); * \retval 0 on success * \retval -1 on error */ -int ast_send_image(struct ast_channel *chan, char *filename); +int ast_send_image(struct ast_channel *chan, const char *filename); /*! * \brief Make an image @@ -62,7 +62,7 @@ int ast_send_image(struct ast_channel *chan, char *filename); * \retval an ast_frame on success * \retval NULL on failure */ -struct ast_frame *ast_read_image(char *filename, const char *preflang, int format); +struct ast_frame *ast_read_image(const char *filename, const char *preflang, int format); /*! * \brief Register image format diff --git a/include/asterisk/module.h b/include/asterisk/module.h index c952db448..3ffe0b7d8 100644 --- a/include/asterisk/module.h +++ b/include/asterisk/module.h @@ -415,7 +415,7 @@ static void __restore_globals(void) * \retval 0 success * \retval -1 failure. */ -int ast_register_application2(const char *app, int (*execute)(struct ast_channel *, void *), +int ast_register_application2(const char *app, int (*execute)(struct ast_channel *, const char *), const char *synopsis, const char *description, void *mod); /*! diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h index 95a23f8cc..c2f999eb6 100644 --- a/include/asterisk/pbx.h +++ b/include/asterisk/pbx.h @@ -210,7 +210,7 @@ struct ast_app *pbx_findapp(const char *app); * \retval 0 success * \retval -1 failure */ -int pbx_exec(struct ast_channel *c, struct ast_app *app, void *data); +int pbx_exec(struct ast_channel *c, struct ast_app *app, const char *data); /*! * \brief Register a new context or find an existing one @@ -976,14 +976,14 @@ void pbx_builtin_clear_globals(void); /*!\brief Parse and set a single channel variable, where the name and value are separated with an '=' character. * \note Will lock the channel. */ -int pbx_builtin_setvar(struct ast_channel *chan, void *data); +int pbx_builtin_setvar(struct ast_channel *chan, const char *data); /*!\brief Parse and set multiple channel variables, where the pairs are separated by the ',' character, and name and value are separated with an '=' character. * \note Will lock the channel. */ -int pbx_builtin_setvar_multiple(struct ast_channel *chan, void *data); +int pbx_builtin_setvar_multiple(struct ast_channel *chan, const char *data); -int pbx_builtin_raise_exception(struct ast_channel *chan, void *data); +int pbx_builtin_raise_exception(struct ast_channel *chan, const char *data); /*! @name Substitution routines, using static string buffers * @{ */ diff --git a/include/asterisk/speech.h b/include/asterisk/speech.h index 54e9c69ac..cb167d5b5 100644 --- a/include/asterisk/speech.h +++ b/include/asterisk/speech.h @@ -78,13 +78,13 @@ struct ast_speech_engine { /*! Destroy any data set on the speech structure by the engine */ int (*destroy)(struct ast_speech *speech); /*! Load a local grammar on the speech structure */ - int (*load)(struct ast_speech *speech, char *grammar_name, char *grammar); + int (*load)(struct ast_speech *speech, const char *grammar_name, const char *grammar); /*! Unload a local grammar */ - int (*unload)(struct ast_speech *speech, char *grammar_name); + int (*unload)(struct ast_speech *speech, const char *grammar_name); /*! Activate a loaded grammar */ - int (*activate)(struct ast_speech *speech, char *grammar_name); + int (*activate)(struct ast_speech *speech, const char *grammar_name); /*! Deactivate a loaded grammar */ - int (*deactivate)(struct ast_speech *speech, char *grammar_name); + int (*deactivate)(struct ast_speech *speech, const char *grammar_name); /*! Write audio to the speech engine */ int (*write)(struct ast_speech *speech, void *data, int len); /*! Signal DTMF was received */ @@ -92,7 +92,7 @@ struct ast_speech_engine { /*! Prepare engine to accept audio */ int (*start)(struct ast_speech *speech); /*! Change an engine specific setting */ - int (*change)(struct ast_speech *speech, char *name, const char *value); + int (*change)(struct ast_speech *speech, const char *name, const char *value); /*! Change the type of results we want back */ int (*change_results_type)(struct ast_speech *speech, enum ast_speech_results_type results_type); /*! Try to get results */ @@ -117,13 +117,13 @@ struct ast_speech_result { }; /*! \brief Activate a grammar on a speech structure */ -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); /*! \brief Deactivate a 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); /*! \brief Load a grammar on a speech structure (not globally) */ -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); /*! \brief Unload a grammar */ -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); /*! \brief Get speech recognition results */ struct ast_speech_result *ast_speech_results_get(struct ast_speech *speech); /*! \brief Free a set of results */ @@ -131,7 +131,7 @@ int ast_speech_results_free(struct ast_speech_result *result); /*! \brief Indicate to the speech engine that audio is now going to start being written */ void ast_speech_start(struct ast_speech *speech); /*! \brief Create a new speech structure */ -struct ast_speech *ast_speech_new(char *engine_name, int formats); +struct ast_speech *ast_speech_new(const char *engine_name, int formats); /*! \brief Destroy a speech structure */ int ast_speech_destroy(struct ast_speech *speech); /*! \brief Write audio to the speech engine */ @@ -139,7 +139,7 @@ int ast_speech_write(struct ast_speech *speech, void *data, int len); /*! \brief Signal to the engine that DTMF was received */ 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); /*! \brief Change the type of results we want */ int ast_speech_change_results_type(struct ast_speech *speech, enum ast_speech_results_type results_type); /*! \brief Change state of a speech structure */ @@ -147,7 +147,7 @@ int ast_speech_change_state(struct ast_speech *speech, int state); /*! \brief Register a speech recognition engine */ 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); #if defined(__cplusplus) || defined(c_plusplus) } diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h index 43ba361f4..ae58af3ef 100644 --- a/include/asterisk/strings.h +++ b/include/asterisk/strings.h @@ -281,7 +281,7 @@ int attribute_pure ast_false(const char *val); * string. It will also place a space in the result buffer in between each * string from 'w'. */ -void ast_join(char *s, size_t len, char * const w[]); +void ast_join(char *s, size_t len, const char * const w[]); /* \brief Parse a time (integer) string. @@ -454,7 +454,7 @@ void ast_str_trim_blanks(struct ast_str *buf), * \param buf A pointer to the ast_str structure. */ AST_INLINE_API( -size_t attribute_pure ast_str_strlen(struct ast_str *buf), +size_t attribute_pure ast_str_strlen(const struct ast_str *buf), { return buf->__AST_STR_USED; } @@ -465,7 +465,7 @@ size_t attribute_pure ast_str_strlen(struct ast_str *buf), * \retval Current maximum length of the buffer. */ AST_INLINE_API( -size_t attribute_pure ast_str_size(struct ast_str *buf), +size_t attribute_pure ast_str_size(const struct ast_str *buf), { return buf->__AST_STR_LEN; } @@ -476,9 +476,13 @@ size_t attribute_pure ast_str_size(struct ast_str *buf), * \retval A pointer to the enclosed string. */ AST_INLINE_API( -char * attribute_pure ast_str_buffer(struct ast_str *buf), +char * attribute_pure ast_str_buffer(const struct ast_str *buf), { - return buf->__AST_STR_STR; + /* for now, cast away the const qualifier on the pointer + * being returned; eventually, it should become truly const + * and only be modified via accessor functions + */ + return (char *) buf->__AST_STR_STR; } ) diff --git a/include/asterisk/taskprocessor.h b/include/asterisk/taskprocessor.h index 6929b8fb4..aa37477dd 100644 --- a/include/asterisk/taskprocessor.h +++ b/include/asterisk/taskprocessor.h @@ -73,7 +73,7 @@ enum ast_tps_options { * TPS_REF_IF_EXISTS reference type is specified and the taskprocessor does not exist * \since 1.6.1 */ -struct ast_taskprocessor *ast_taskprocessor_get(char *name, enum ast_tps_options create); +struct ast_taskprocessor *ast_taskprocessor_get(const char *name, enum ast_tps_options create); /*! \brief Unreference the specified taskprocessor and its reference count will decrement. * diff --git a/include/asterisk/utils.h b/include/asterisk/utils.h index aac5a4651..cd1c7fa6b 100644 --- a/include/asterisk/utils.h +++ b/include/asterisk/utils.h @@ -215,9 +215,9 @@ struct ast_hostent { struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp); /*! \brief Produces MD5 hash based on input string */ -void ast_md5_hash(char *output, char *input); +void ast_md5_hash(char *output, const char *input); /*! \brief Produces SHA1 hash based on input string */ -void ast_sha1_hash(char *output, char *input); +void ast_sha1_hash(char *output, const char *input); int ast_base64encode_full(char *dst, const unsigned char *src, int srclen, int max, int linebreaks); diff --git a/main/abstract_jb.c b/main/abstract_jb.c index d7ff7354a..cda9a6dca 100644 --- a/main/abstract_jb.c +++ b/main/abstract_jb.c @@ -110,8 +110,7 @@ static void jb_force_resynch_adaptive(void *jb); static void jb_empty_and_reset_adaptive(void *jb); /* Available jb implementations */ -static struct ast_jb_impl avail_impl[] = -{ +static const struct ast_jb_impl avail_impl[] = { { .name = "fixed", .create = jb_create_fixed, @@ -150,13 +149,13 @@ enum { }; /* Translations between impl and abstract return codes */ -static int fixed_to_abstract_code[] = +static const int fixed_to_abstract_code[] = {JB_IMPL_OK, JB_IMPL_DROP, JB_IMPL_INTERP, JB_IMPL_NOFRAME}; -static int adaptive_to_abstract_code[] = +static const int adaptive_to_abstract_code[] = {JB_IMPL_OK, JB_IMPL_NOFRAME, JB_IMPL_NOFRAME, JB_IMPL_INTERP, JB_IMPL_DROP, JB_IMPL_OK}; /* JB_GET actions (used only for the frames log) */ -static char *jb_get_actions[] = {"Delivered", "Dropped", "Interpolated", "No"}; +static const char * const jb_get_actions[] = {"Delivered", "Dropped", "Interpolated", "No"}; /*! \brief Macros for the frame log files */ #define jb_framelog(...) do { \ @@ -181,7 +180,7 @@ static void jb_choose_impl(struct ast_channel *chan) { struct ast_jb *jb = &chan->jb; struct ast_jb_conf *jbconf = &jb->conf; - struct ast_jb_impl *test_impl; + const struct ast_jb_impl *test_impl; int i, avail_impl_count = ARRAY_LEN(avail_impl); jb->impl = &avail_impl[default_impl]; @@ -303,7 +302,7 @@ int ast_jb_get_when_to_wakeup(struct ast_channel *c0, struct ast_channel *c1, in int ast_jb_put(struct ast_channel *chan, struct ast_frame *f) { struct ast_jb *jb = &chan->jb; - struct ast_jb_impl *jbimpl = jb->impl; + const struct ast_jb_impl *jbimpl = jb->impl; void *jbobj = jb->jbobj; struct ast_frame *frr; long now = 0; @@ -385,7 +384,7 @@ void ast_jb_get_and_deliver(struct ast_channel *c0, struct ast_channel *c1) static void jb_get_and_deliver(struct ast_channel *chan) { struct ast_jb *jb = &chan->jb; - struct ast_jb_impl *jbimpl = jb->impl; + const struct ast_jb_impl *jbimpl = jb->impl; void *jbobj = jb->jbobj; struct ast_frame *f, finterp; long now; @@ -450,7 +449,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr) { struct ast_jb *jb = &chan->jb; struct ast_jb_conf *jbconf = &jb->conf; - struct ast_jb_impl *jbimpl = jb->impl; + const struct ast_jb_impl *jbimpl = jb->impl; void *jbobj; struct ast_channel *bridged; long now; @@ -534,7 +533,7 @@ static int create_jb(struct ast_channel *chan, struct ast_frame *frr) void ast_jb_destroy(struct ast_channel *chan) { struct ast_jb *jb = &chan->jb; - struct ast_jb_impl *jbimpl = jb->impl; + const struct ast_jb_impl *jbimpl = jb->impl; void *jbobj = jb->jbobj; struct ast_frame *f; diff --git a/main/app.c b/main/app.c index 8e28b0c9a..72af3e085 100644 --- a/main/app.c +++ b/main/app.c @@ -180,7 +180,7 @@ enum ast_getdata_result ast_app_getdata(struct ast_channel *c, const char *promp /* The lock type used by ast_lock_path() / ast_unlock_path() */ static enum AST_LOCK_TYPE ast_lock_type = AST_LOCK_TYPE_LOCKFILE; -int ast_app_getdata_full(struct ast_channel *c, char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd) +int ast_app_getdata_full(struct ast_channel *c, const char *prompt, char *s, int maxlen, int timeout, int audiofd, int ctrlfd) { int res, to = 2000, fto = 6000; @@ -949,8 +949,8 @@ static int __ast_play_and_record(struct ast_channel *chan, const char *playfile, return res; } -static char default_acceptdtmf[] = "#"; -static char default_canceldtmf[] = ""; +static const char default_acceptdtmf[] = "#"; +static const char default_canceldtmf[] = ""; int ast_play_and_record_full(struct ast_channel *chan, const char *playfile, const char *recordfile, int maxtime, const char *fmt, int *duration, int silencethreshold, int maxsilence, const char *path, const char *acceptdtmf, const char *canceldtmf) { diff --git a/main/ast_expr2.fl b/main/ast_expr2.fl index 499706811..98d2ea5c4 100644 --- a/main/ast_expr2.fl +++ b/main/ast_expr2.fl @@ -313,7 +313,7 @@ void ast_expr_clear_extra_error_info(void) extra_error_message[0] = 0; } -static char *expr2_token_equivs1[] = +static const char * const expr2_token_equivs1[] = { "TOKEN", "TOK_COND", @@ -339,7 +339,7 @@ static char *expr2_token_equivs1[] = "TOK_LP" }; -static char *expr2_token_equivs2[] = +static const char * const expr2_token_equivs2[] = { "<token>", "?", diff --git a/main/asterisk.c b/main/asterisk.c index 744ed2959..c45f6d8c8 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -765,7 +765,7 @@ int64_t ast_mark(int i, int startstop) static char *handle_show_profile(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { int i, min, max; - char *search = NULL; + const char *search = NULL; switch (cmd) { case CLI_INIT: e->command = "core show profile"; @@ -800,7 +800,7 @@ static char *handle_show_profile(struct ast_cli_entry *e, int cmd, struct ast_cl static char *handle_clear_profile(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { int i, min, max; - char *search = NULL; + const char *search = NULL; switch (cmd) { case CLI_INIT: e->command = "core clear profile"; diff --git a/main/astobj2.c b/main/astobj2.c index 78c4cc00f..13e0c54b2 100644 --- a/main/astobj2.c +++ b/main/astobj2.c @@ -927,10 +927,10 @@ static void container_destruct_debug(void *_c) #ifdef AO2_DEBUG static int print_cb(void *obj, void *arg, int flag) { - int *fd = arg; + struct ast_cli_args *a = (struct ast_cli_args *) arg; char *s = (char *)obj; - ast_cli(*fd, "string <%s>\n", s); + ast_cli(a->fd, "string <%s>\n", s); return 0; } @@ -1017,7 +1017,7 @@ static char *handle_astobj2_test(struct ast_cli_entry *e, int cmd, struct ast_cl ao2_t_ref(obj, -1, "test"); } ast_cli(a->fd, "testing callbacks\n"); - ao2_t_callback(c1, 0, print_cb, &a->fd, "test callback"); + ao2_t_callback(c1, 0, print_cb, a, "test callback"); ast_cli(a->fd, "testing iterators, remove every second object\n"); { struct ao2_iterator ai; @@ -1038,7 +1038,7 @@ static char *handle_astobj2_test(struct ast_cli_entry *e, int cmd, struct ast_cl } } ast_cli(a->fd, "testing callbacks again\n"); - ao2_t_callback(c1, 0, print_cb, &a->fd, "test callback"); + ao2_t_callback(c1, 0, print_cb, a, "test callback"); ast_verbose("now you should see an error message:\n"); ao2_t_ref(&i, -1, ""); /* i is not a valid object so we print an error here */ diff --git a/main/cdr.c b/main/cdr.c index 65c4e3e01..169625fca 100644 --- a/main/cdr.c +++ b/main/cdr.c @@ -282,10 +282,10 @@ void ast_cdr_getvar(struct ast_cdr *cdr, const char *name, char **ret, char *wor } /* readonly cdr variables */ -static const char *cdr_readonly_vars[] = { "clid", "src", "dst", "dcontext", "channel", "dstchannel", - "lastapp", "lastdata", "start", "answer", "end", "duration", - "billsec", "disposition", "amaflags", "accountcode", "uniqueid", - "userfield", NULL }; +static const char * const cdr_readonly_vars[] = { "clid", "src", "dst", "dcontext", "channel", "dstchannel", + "lastapp", "lastdata", "start", "answer", "end", "duration", + "billsec", "disposition", "amaflags", "accountcode", "uniqueid", + "userfield", NULL }; /*! Set a CDR channel variable \note You can't set the CDR variables that belong to the actual CDR record, like "billsec". */ diff --git a/main/channel.c b/main/channel.c index 91bc8869c..969c0cfd6 100644 --- a/main/channel.c +++ b/main/channel.c @@ -3541,7 +3541,7 @@ int ast_senddigit_begin(struct ast_channel *chan, char digit) { /* Device does not support DTMF tones, lets fake * it by doing our own generation. */ - static const char* dtmf_tones[] = { + static const char * const dtmf_tones[] = { "941+1336", /* 0 */ "697+1209", /* 1 */ "697+1336", /* 2 */ diff --git a/main/cli.c b/main/cli.c index 8217e52d1..136d56a1e 100644 --- a/main/cli.c +++ b/main/cli.c @@ -365,13 +365,13 @@ static char *handle_verbose(struct ast_cli_entry *e, int cmd, struct ast_cli_arg int atleast = 0; int fd = a->fd; int argc = a->argc; - char **argv = a->argv; - char *argv3 = a->argv ? S_OR(a->argv[3], "") : ""; + const char * const *argv = a->argv; + const char *argv3 = a->argv ? S_OR(a->argv[3], "") : ""; int *dst; char *what; struct debug_file_list *dfl; struct ast_debug_file *adf; - char *fn; + const char *fn; switch (cmd) { case CLI_INIT: @@ -387,7 +387,7 @@ static char *handle_verbose(struct ast_cli_entry *e, int cmd, struct ast_cli_arg case CLI_GENERATE: if (a->pos == 3 || (a->pos == 4 && !strcasecmp(a->argv[3], "atleast"))) { - char *pos = a->pos == 3 ? argv3 : S_OR(a->argv[4], ""); + const char *pos = a->pos == 3 ? argv3 : S_OR(a->argv[4], ""); int numbermatch = (ast_strlen_zero(pos) || strchr("123456789", pos[0])) ? 0 : 21; if (a->n < 21 && numbermatch == 0) { return complete_number(pos, 0, 0x7fffffff, a->n); @@ -534,7 +534,7 @@ static char *handle_unload(struct ast_cli_entry *e, int cmd, struct ast_cli_args /* "module unload mod_1 [mod_2 .. mod_N]" */ int x; int force = AST_FORCE_SOFT; - char *s; + const char *s; switch (cmd) { case CLI_INIT: @@ -685,7 +685,7 @@ static char * handle_showuptime(struct ast_cli_entry *e, int cmd, struct ast_cli static char *handle_modlist(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { - char *like; + const char *like; switch (cmd) { case CLI_INIT: @@ -787,8 +787,6 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar struct ast_channel *c = NULL; int numchans = 0, concise = 0, verbose = 0, count = 0; - int fd, argc; - char **argv; struct ast_channel_iterator *iter = NULL; switch (cmd) { @@ -808,16 +806,13 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar case CLI_GENERATE: return NULL; } - fd = a->fd; - argc = a->argc; - argv = a->argv; if (a->argc == e->args) { - if (!strcasecmp(argv[e->args-1],"concise")) + if (!strcasecmp(a->argv[e->args-1],"concise")) concise = 1; - else if (!strcasecmp(argv[e->args-1],"verbose")) + else if (!strcasecmp(a->argv[e->args-1],"verbose")) verbose = 1; - else if (!strcasecmp(argv[e->args-1],"count")) + else if (!strcasecmp(a->argv[e->args-1],"count")) count = 1; else return CLI_SHOWUSAGE; @@ -826,9 +821,9 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar if (!count) { if (!concise && !verbose) - ast_cli(fd, FORMAT_STRING2, "Channel", "Location", "State", "Application(Data)"); + ast_cli(a->fd, FORMAT_STRING2, "Channel", "Location", "State", "Application(Data)"); else if (verbose) - ast_cli(fd, VERBOSE_FORMAT_STRING2, "Channel", "Context", "Extension", "Priority", "State", "Application", "Data", + ast_cli(a->fd, VERBOSE_FORMAT_STRING2, "Channel", "Context", "Extension", "Priority", "State", "Application", "Data", "CallerID", "Duration", "Accountcode", "BridgedTo"); } @@ -857,7 +852,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar } } if (concise) { - ast_cli(fd, CONCISE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state), + ast_cli(a->fd, CONCISE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state), c->appl ? c->appl : "(None)", S_OR(c->data, ""), /* XXX different from verbose ? */ S_OR(c->cid.cid_num, ""), @@ -867,7 +862,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar bc ? bc->name : "(None)", c->uniqueid); } else if (verbose) { - ast_cli(fd, VERBOSE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state), + ast_cli(a->fd, VERBOSE_FORMAT_STRING, c->name, c->context, c->exten, c->priority, ast_state2str(c->_state), c->appl ? c->appl : "(None)", c->data ? S_OR(c->data, "(Empty)" ): "(None)", S_OR(c->cid.cid_num, ""), @@ -882,7 +877,7 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar snprintf(locbuf, sizeof(locbuf), "%s@%s:%d", c->exten, c->context, c->priority); if (c->appl) snprintf(appdata, sizeof(appdata), "%s(%s)", c->appl, S_OR(c->data, "")); - ast_cli(fd, FORMAT_STRING, c->name, locbuf, ast_state2str(c->_state), appdata); + ast_cli(a->fd, FORMAT_STRING, c->name, locbuf, ast_state2str(c->_state), appdata); } } ast_channel_unlock(c); @@ -894,15 +889,15 @@ static char *handle_chanlist(struct ast_cli_entry *e, int cmd, struct ast_cli_ar if (!concise) { numchans = ast_active_channels(); - ast_cli(fd, "%d active channel%s\n", numchans, ESS(numchans)); + ast_cli(a->fd, "%d active channel%s\n", numchans, ESS(numchans)); if (option_maxcalls) - ast_cli(fd, "%d of %d max active call%s (%5.2f%% of capacity)\n", + ast_cli(a->fd, "%d of %d max active call%s (%5.2f%% of capacity)\n", ast_active_calls(), option_maxcalls, ESS(ast_active_calls()), ((double)ast_active_calls() / (double)option_maxcalls) * 100.0); else - ast_cli(fd, "%d active call%s\n", ast_active_calls(), ESS(ast_active_calls())); + ast_cli(a->fd, "%d active call%s\n", ast_active_calls(), ESS(ast_active_calls())); - ast_cli(fd, "%d call%s processed\n", ast_processed_calls(), ESS(ast_processed_calls())); + ast_cli(a->fd, "%d call%s processed\n", ast_processed_calls(), ESS(ast_processed_calls())); } return CLI_SUCCESS; @@ -1238,7 +1233,6 @@ static char *handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, str "Usage: core set debug channel <all|channel> [off]\n" " Enables/disables debugging on all or on a specific channel.\n"; return NULL; - case CLI_GENERATE: /* XXX remember to handle the optional "off" */ if (a->pos != e->args) @@ -1246,8 +1240,11 @@ static char *handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, str return a->n == 0 ? ast_strdup("all") : ast_complete_channels(a->line, a->word, a->pos, a->n - 1, e->args); } - /* 'core set debug channel {all|chan_id}' */ - if (a->argc == e->args + 2) { + if (cmd == (CLI_HANDLER + 1000)) { + /* called from handle_nodebugchan_deprecated */ + args.is_off = 1; + } else if (a->argc == e->args + 2) { + /* 'core set debug channel {all|chan_id}' */ if (!strcasecmp(a->argv[e->args + 1], "off")) args.is_off = 1; else @@ -1282,18 +1279,27 @@ static char *handle_core_set_debug_channel(struct ast_cli_entry *e, int cmd, str static char *handle_nodebugchan_deprecated(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { char *res; - if (cmd == CLI_HANDLER) { - if (a->argc != e->args + 1) - return CLI_SHOWUSAGE; - /* pretend we have an extra "off" at the end. We can do this as the array - * is NULL terminated so we overwrite that entry. - */ - a->argv[e->args+1] = "off"; - a->argc++; - } - res = handle_core_set_debug_channel(e, cmd, a); - if (cmd == CLI_INIT) + + switch (cmd) { + case CLI_INIT: e->command = "no debug channel"; + return NULL; + case CLI_HANDLER: + /* exit out of switch statement */ + break; + default: + return NULL; + } + + if (a->argc != e->args + 1) + return CLI_SHOWUSAGE; + + /* add a 'magic' value to the CLI_HANDLER command so that + * handle_core_set_debug_channel() will act as if 'off' + * had been specified as part of the command + */ + res = handle_core_set_debug_channel(e, CLI_HANDLER + 1000, a); + return res; } @@ -1421,7 +1427,7 @@ static char *handle_showchan(struct ast_cli_entry *e, int cmd, struct ast_cli_ar * helper function to generate CLI matches from a fixed set of values. * A NULL word is acceptable. */ -char *ast_cli_complete(const char *word, char *const choices[], int state) +char *ast_cli_complete(const char *word, const char * const choices[], int state) { int i, which = 0, len; len = ast_strlen_zero(word) ? 0 : strlen(word); @@ -1823,15 +1829,15 @@ static char *is_prefix(const char *word, const char *token, * 1 true only on complete, exact match. * */ -static struct ast_cli_entry *find_cli(char *const cmds[], int match_type) +static struct ast_cli_entry *find_cli(const char * const cmds[], int match_type) { int matchlen = -1; /* length of longest match so far */ struct ast_cli_entry *cand = NULL, *e=NULL; while ( (e = cli_next(e)) ) { /* word-by word regexp comparison */ - char * const *src = cmds; - char * const *dst = e->cmda; + const char * const *src = cmds; + const char * const *dst = e->cmda; int n = 0; for (;; dst++, src += n) { n = word_match(*src, *dst); @@ -1867,16 +1873,15 @@ static struct ast_cli_entry *find_cli(char *const cmds[], int match_type) return e ? e : cand; } -static char *find_best(char *argv[]) +static char *find_best(const char *argv[]) { static char cmdline[80]; int x; /* See how close we get, then print the candidate */ - char *myargv[AST_MAX_CMD_LEN]; - for (x=0;x<AST_MAX_CMD_LEN;x++) - myargv[x]=NULL; + const char *myargv[AST_MAX_CMD_LEN] = { NULL, }; + AST_RWLIST_RDLOCK(&helpers); - for (x=0;argv[x];x++) { + for (x = 0; argv[x]; x++) { myargv[x] = argv[x]; if (!find_cli(myargv, -1)) break; @@ -2002,7 +2007,7 @@ int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len) /*! \brief helper for final part of handle_help * if locked = 1, assume the list is already locked */ -static char *help1(int fd, char *match[], int locked) +static char *help1(int fd, const char * const match[], int locked) { char matchstr[80] = ""; struct ast_cli_entry *e = NULL; @@ -2077,7 +2082,7 @@ static char *handle_help(struct ast_cli_entry *e, int cmd, struct ast_cli_args * return res; } -static char *parse_args(const char *s, int *argc, char *argv[], int max, int *trailingwhitespace) +static char *parse_args(const char *s, int *argc, const char *argv[], int max, int *trailingwhitespace) { char *duplicate, *cur; int x = 0; @@ -2208,7 +2213,7 @@ char **ast_cli_completion_matches(const char *text, const char *word) } /*! \brief returns true if there are more words to match */ -static int more_words (char * const *dst) +static int more_words (const char * const *dst) { int i; for (i = 0; dst[i]; i++) { @@ -2223,7 +2228,7 @@ static int more_words (char * const *dst) */ static char *__ast_cli_generator(const char *text, const char *word, int state, int lock) { - char *argv[AST_MAX_ARGS]; + const char *argv[AST_MAX_ARGS]; struct ast_cli_entry *e = NULL; int x = 0, argindex, matchlen; int matchnum=0; @@ -2311,7 +2316,7 @@ char *ast_cli_generator(const char *text, const char *word, int state) int ast_cli_command_full(int uid, int gid, int fd, const char *s) { - char *args[AST_MAX_ARGS + 1]; + const char *args[AST_MAX_ARGS + 1]; struct ast_cli_entry *e; int x; char *duplicate = parse_args(s, &x, args + 1, AST_MAX_ARGS, NULL); diff --git a/main/dsp.c b/main/dsp.c index 6c0b013e4..ab7cacf1a 100644 --- a/main/dsp.c +++ b/main/dsp.c @@ -283,24 +283,17 @@ typedef struct } td; } digit_detect_state_t; -static float dtmf_row[] = -{ +static const float dtmf_row[] = { 697.0, 770.0, 852.0, 941.0 }; -static float dtmf_col[] = -{ +static const float dtmf_col[] = { 1209.0, 1336.0, 1477.0, 1633.0 }; - -static float mf_tones[] = -{ +static const float mf_tones[] = { 700.0, 900.0, 1100.0, 1300.0, 1500.0, 1700.0 }; - -static char dtmf_positions[] = "123A" "456B" "789C" "*0#D"; - -static char bell_mf_positions[] = "1247C-358A--69*---0B----#"; - +static const char dtmf_positions[] = "123A" "456B" "789C" "*0#D"; +static const char bell_mf_positions[] = "1247C-358A--69*---0B----#"; static int thresholds[THRESHOLD_MAX]; static inline void goertzel_sample(goertzel_state_t *s, short sample) diff --git a/main/features.c b/main/features.c index 5315140ba..8da3c7baa 100644 --- a/main/features.c +++ b/main/features.c @@ -921,7 +921,7 @@ static void set_peers(struct ast_channel **caller, struct ast_channel **callee, * Setup channel, set return exten,priority to 's,1' * answer chan, sleep chan, park call */ -static int builtin_parkcall(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data) +static int builtin_parkcall(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data) { struct ast_channel *parker; struct ast_channel *parkee; @@ -991,7 +991,7 @@ static int play_message_in_bridged_call(struct ast_channel *caller_chan, struct * \retval AST_FEATURE_RETURN_SUCCESS on success. * \retval -1 on error. */ -static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data) +static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data) { char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL, *touch_filename = NULL; int x = 0; @@ -1084,7 +1084,7 @@ static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *pee return -1; } -static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data) +static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data) { char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL, *touch_filename = NULL; int x = 0; @@ -1194,7 +1194,7 @@ static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel * } -static int builtin_disconnect(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data) +static int builtin_disconnect(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data) { ast_verb(4, "User hit '%s' to disconnect call.\n", code); return AST_FEATURE_RETURN_HANGUP; @@ -1244,7 +1244,7 @@ static const char *real_ctx(struct ast_channel *transferer, struct ast_channel * * \retval AST_FEATURE_RETURN_SUCCESS. * \retval -1 on failure. */ -static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data) +static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data) { struct ast_channel *transferer; struct ast_channel *transferee; @@ -1375,7 +1375,7 @@ static int check_compat(struct ast_channel *c, struct ast_channel *newchan) * * \return -1 on failure */ -static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data) +static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data) { struct ast_channel *transferer; struct ast_channel *transferee; @@ -1719,8 +1719,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st AST_RWLOCK_DEFINE_STATIC(features_lock); -static struct ast_call_feature builtin_features[] = -{ +static struct ast_call_feature builtin_features[] = { { AST_FEATURE_REDIRECT, "Blind Transfer", "blindxfer", "#", "#", builtin_blindtransfer, AST_FEATURE_FLAG_NEEDSDTMF, "" }, { AST_FEATURE_REDIRECT, "Attended Transfer", "atxfer", "", "", builtin_atxfer, AST_FEATURE_FLAG_NEEDSDTMF, "" }, { AST_FEATURE_AUTOMON, "One Touch Monitor", "automon", "", "", builtin_automonitor, AST_FEATURE_FLAG_NEEDSDTMF, "" }, @@ -1925,7 +1924,7 @@ struct ast_call_feature *ast_find_call_feature(const char *name) * \retval -1 error. * \retval -2 when an application cannot be found. */ -static int feature_exec_app(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data) +static int feature_exec_app(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense, void *data) { struct ast_app *app; struct ast_call_feature *feature = data; @@ -2021,7 +2020,7 @@ static int remap_feature(const char *name, const char *value) * \retval -1 on failure. */ static int feature_interpret_helper(struct ast_channel *chan, struct ast_channel *peer, - struct ast_bridge_config *config, char *code, int sense, char *dynamic_features_buf, + struct ast_bridge_config *config, const char *code, int sense, char *dynamic_features_buf, struct ast_flags *features, int operation, struct ast_call_feature *feature) { int x; @@ -2124,7 +2123,7 @@ static int feature_interpret_helper(struct ast_channel *chan, struct ast_channel * \retval -1 on failure. */ -static int feature_interpret(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense) { +static int feature_interpret(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, const char *code, int sense) { char dynamic_features_buf[128]; const char *peer_dynamic_features, *chan_dynamic_features; @@ -2153,7 +2152,7 @@ static int feature_interpret(struct ast_channel *chan, struct ast_channel *peer, } -int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, char *code, struct ast_call_feature *feature) { +int ast_feature_detect(struct ast_channel *chan, struct ast_flags *features, const char *code, struct ast_call_feature *feature) { return feature_interpret_helper(chan, NULL, NULL, code, 0, NULL, features, 0, feature); } @@ -3254,7 +3253,7 @@ AST_APP_OPTIONS(park_call_options, BEGIN_OPTIONS END_OPTIONS ); /*! \brief Park a call */ -static int park_call_exec(struct ast_channel *chan, void *data) +static int park_call_exec(struct ast_channel *chan, const char *data) { /* Cache the original channel name in case we get masqueraded in the middle * of a park--it is still theoretically possible for a transfer to happen before @@ -3340,7 +3339,7 @@ static int park_call_exec(struct ast_channel *chan, void *data) } /*! \brief Pickup parked call */ -static int park_exec_full(struct ast_channel *chan, void *data, struct ast_parkinglot *parkinglot) +static int park_exec_full(struct ast_channel *chan, const char *data, struct ast_parkinglot *parkinglot) { int res = 0; struct ast_channel *peer=NULL; @@ -3350,7 +3349,7 @@ static int park_exec_full(struct ast_channel *chan, void *data, struct ast_parki struct ast_bridge_config config; if (data) - park = atoi((char *)data); + park = atoi((char *) data); parkinglot = find_parkinglot(findparkinglotname(chan)); if (!parkinglot) @@ -3503,7 +3502,7 @@ static int park_exec_full(struct ast_channel *chan, void *data, struct ast_parki return -1; } -static int park_exec(struct ast_channel *chan, void *data) +static int park_exec(struct ast_channel *chan, const char *data) { return park_exec_full(chan, data, default_parkinglot); } @@ -4110,7 +4109,7 @@ static char *handle_features_reload(struct ast_cli_entry *e, int cmd, struct ast return CLI_SUCCESS; } -static char mandescr_bridge[] = +static const char mandescr_bridge[] = "Description: Bridge together two channels already in the PBX\n" "Variables: ( Headers marked with * are required )\n" " *Channel1: Channel to Bridge to Channel2\n" @@ -4383,7 +4382,7 @@ static int manager_parking_status(struct mansession *s, const struct message *m) return RESULT_SUCCESS; } -static char mandescr_park[] = +static const char mandescr_park[] = "Description: Park a channel.\n" "Variables: (Names marked with * are required)\n" " *Channel: Channel name to park\n" @@ -4556,7 +4555,7 @@ END_OPTIONS ); * answer call if not already, check compatible channels, setup bridge config * now bridge call, if transfered party hangs up return to PBX extension. */ -static int bridge_exec(struct ast_channel *chan, void *data) +static int bridge_exec(struct ast_channel *chan, const char *data) { struct ast_channel *current_dest_chan, *final_dest_chan; char *tmp_data = NULL; diff --git a/main/frame.c b/main/frame.c index a0feb6558..bc1c60b8a 100644 --- a/main/frame.c +++ b/main/frame.c @@ -1354,7 +1354,7 @@ static unsigned char get_n_bits_at(unsigned char *data, int n, int bit) static int speex_get_wb_sz_at(unsigned char *data, int len, int bit) { - static int SpeexWBSubModeSz[] = { + static const int SpeexWBSubModeSz[] = { 0, 36, 112, 192, 352, 0, 0, 0 }; int off = bit; @@ -1384,12 +1384,12 @@ static int speex_get_wb_sz_at(unsigned char *data, int len, int bit) static int speex_samples(unsigned char *data, int len) { - static int SpeexSubModeSz[] = { + static const int SpeexSubModeSz[] = { 5, 43, 119, 160, 220, 300, 364, 492, 79, 0, 0, 0, 0, 0, 0, 0 }; - static int SpeexInBandSz[] = { + static const int SpeexInBandSz[] = { 1, 1, 4, 4, 4, 4, 4, 4, 8, 8, 16, 16, diff --git a/main/image.c b/main/image.c index c47f808a6..8ecea603b 100644 --- a/main/image.c +++ b/main/image.c @@ -81,7 +81,7 @@ static int file_exists(char *filename) return 0; } -static void make_filename(char *buf, int len, char *filename, const char *preflang, char *ext) +static void make_filename(char *buf, int len, const char *filename, const char *preflang, char *ext) { if (filename[0] == '/') { if (!ast_strlen_zero(preflang)) @@ -96,7 +96,7 @@ static void make_filename(char *buf, int len, char *filename, const char *prefla } } -struct ast_frame *ast_read_image(char *filename, const char *preflang, int format) +struct ast_frame *ast_read_image(const char *filename, const char *preflang, int format) { struct ast_imager *i; char buf[256]; @@ -152,7 +152,7 @@ struct ast_frame *ast_read_image(char *filename, const char *preflang, int forma return f; } -int ast_send_image(struct ast_channel *chan, char *filename) +int ast_send_image(struct ast_channel *chan, const char *filename) { struct ast_frame *f; int res = -1; diff --git a/main/loader.c b/main/loader.c index 4e07e843b..fefd29e80 100644 --- a/main/loader.c +++ b/main/loader.c @@ -69,7 +69,7 @@ struct ast_module_user { AST_LIST_HEAD(module_user_list, ast_module_user); -static unsigned char expected_key[] = +static const unsigned char expected_key[] = { 0x87, 0x76, 0x79, 0x35, 0x23, 0xea, 0x3a, 0xd3, 0x25, 0x2a, 0xbb, 0x35, 0x87, 0xe4, 0x22, 0x24 }; diff --git a/main/manager.c b/main/manager.c index d9cc3e846..7d5ee7a59 100644 --- a/main/manager.c +++ b/main/manager.c @@ -1208,7 +1208,7 @@ static int authenticate(struct mansession *s, const struct message *m) } /*! \brief Manager PING */ -static char mandescr_ping[] = +static const char mandescr_ping[] = "Description: A 'Ping' action will ellicit a 'Pong' response. Used to keep the\n" " manager connection open.\n" "Variables: NONE\n"; @@ -1225,7 +1225,7 @@ static int action_ping(struct mansession *s, const struct message *m) return 0; } -static char mandescr_getconfig[] = +static const char mandescr_getconfig[] = "Description: A 'GetConfig' action will dump the contents of a configuration\n" "file by category and contents or optionally by specified category only.\n" "Variables: (Names marked with * are required)\n" @@ -1273,7 +1273,7 @@ static int action_getconfig(struct mansession *s, const struct message *m) return 0; } -static char mandescr_listcategories[] = +static const char mandescr_listcategories[] = "Description: A 'ListCategories' action will dump the categories in\n" "a given file.\n" "Variables:\n" @@ -1324,7 +1324,7 @@ static void json_escape(char *out, const char *in) *out = '\0'; } -static char mandescr_getconfigjson[] = +static const char mandescr_getconfigjson[] = "Description: A 'GetConfigJSON' action will dump the contents of a configuration\n" "file by category and contents in JSON format. This only makes sense to be used\n" "using rawman over the HTTP interface.\n" @@ -1543,7 +1543,7 @@ static enum error_type handle_updates(struct mansession *s, const struct message return result; } -static char mandescr_updateconfig[] = +static const char mandescr_updateconfig[] = "Description: A 'UpdateConfig' action will modify, create, or delete\n" "configuration elements in Asterisk configuration files.\n" "Variables (X's represent 6 digit number beginning with 000000):\n" @@ -1632,7 +1632,7 @@ static int action_updateconfig(struct mansession *s, const struct message *m) return 0; } -static char mandescr_createconfig[] = +static const char mandescr_createconfig[] = "Description: A 'CreateConfig' action will create an empty file in the\n" "configuration directory. This action is intended to be used before an\n" "UpdateConfig action.\n" @@ -1658,7 +1658,7 @@ static int action_createconfig(struct mansession *s, const struct message *m) } /*! \brief Manager WAITEVENT */ -static char mandescr_waitevent[] = +static const char mandescr_waitevent[] = "Description: A 'WaitEvent' action will ellicit a 'Success' response. Whenever\n" "a manager event is queued. Once WaitEvent has been called on an HTTP manager\n" "session, events will be generated and queued.\n" @@ -1771,7 +1771,7 @@ static int action_waitevent(struct mansession *s, const struct message *m) return 0; } -static char mandescr_listcommands[] = +static const char mandescr_listcommands[] = "Description: Returns the action name and synopsis for every\n" " action that is available to the user\n" "Variables: NONE\n"; @@ -1794,7 +1794,7 @@ static int action_listcommands(struct mansession *s, const struct message *m) return 0; } -static char mandescr_events[] = +static const char mandescr_events[] = "Description: Enable/Disable sending of events to this manager\n" " client.\n" "Variables:\n" @@ -1817,7 +1817,7 @@ static int action_events(struct mansession *s, const struct message *m) return 0; } -static char mandescr_logoff[] = +static const char mandescr_logoff[] = "Description: Logoff this manager session\n" "Variables: NONE\n"; @@ -1867,7 +1867,7 @@ static int action_challenge(struct mansession *s, const struct message *m) return 0; } -static char mandescr_hangup[] = +static const char mandescr_hangup[] = "Description: Hangup a channel\n" "Variables: \n" " Channel: The channel name to be hungup\n" @@ -1916,7 +1916,7 @@ static int action_hangup(struct mansession *s, const struct message *m) return 0; } -static char mandescr_setvar[] = +static const char mandescr_setvar[] = "Description: Set a global or local channel variable.\n" "Variables: (Names marked with * are required)\n" " Channel: Channel to set variable for\n" @@ -1953,7 +1953,7 @@ static int action_setvar(struct mansession *s, const struct message *m) return 0; } -static char mandescr_getvar[] = +static const char mandescr_getvar[] = "Description: Get the value of a global or local channel variable.\n" "Variables: (Names marked with * are required)\n" " Channel: Channel to read variable from\n" @@ -2006,7 +2006,7 @@ static int action_getvar(struct mansession *s, const struct message *m) return 0; } -static char mandescr_status[] = +static const char mandescr_status[] = "Description: Lists channel status along with requested channel vars.\n" "Variables: (Names marked with * are required)\n" " *Channel: Name of the channel to query for status\n" @@ -2163,7 +2163,7 @@ static int action_status(struct mansession *s, const struct message *m) return 0; } -static char mandescr_sendtext[] = +static const char mandescr_sendtext[] = "Description: Sends A Text Message while in a call.\n" "Variables: (Names marked with * are required)\n" " *Channel: Channel to send message to\n" @@ -2206,7 +2206,7 @@ static int action_sendtext(struct mansession *s, const struct message *m) return res; } -static char mandescr_redirect[] = +static const char mandescr_redirect[] = "Description: Redirect (transfer) a call.\n" "Variables: (Names marked with * are required)\n" " *Channel: Channel to redirect\n" @@ -2306,7 +2306,7 @@ static int action_redirect(struct mansession *s, const struct message *m) return 0; } -static char mandescr_atxfer[] = +static const char mandescr_atxfer[] = "Description: Attended transfer.\n" "Variables: (Names marked with * are required)\n" " *Channel: Transferer's channel\n" @@ -2399,7 +2399,7 @@ static int check_blacklist(const char *cmd) return 0; } -static char mandescr_command[] = +static const char mandescr_command[] = "Description: Run a CLI command.\n" "Variables: (Names marked with * are required)\n" " *Command: Asterisk CLI command to run\n" @@ -2526,7 +2526,7 @@ static void *fast_originate(void *data) return NULL; } -static char mandescr_originate[] = +static const char mandescr_originate[] = "Description: Generates an outgoing call to a Extension/Context/Priority or\n" " Application/Data\n" "Variables: (Names marked with * are required)\n" @@ -2673,7 +2673,7 @@ static int action_originate(struct mansession *s, const struct message *m) /*! \brief Help text for manager command mailboxstatus */ -static char mandescr_mailboxstatus[] = +static const char mandescr_mailboxstatus[] = "Description: Checks a voicemail account for status.\n" "Variables: (Names marked with * are required)\n" " *Mailbox: Full mailbox ID <mailbox>@<vm-context>\n" @@ -2701,7 +2701,7 @@ static int action_mailboxstatus(struct mansession *s, const struct message *m) return 0; } -static char mandescr_mailboxcount[] = +static const char mandescr_mailboxcount[] = "Description: Checks a voicemail account for new messages.\n" "Variables: (Names marked with * are required)\n" " *Mailbox: Full mailbox ID <mailbox>@<vm-context>\n" @@ -2734,7 +2734,7 @@ static int action_mailboxcount(struct mansession *s, const struct message *m) return 0; } -static char mandescr_extensionstate[] = +static const char mandescr_extensionstate[] = "Description: Report the extension state for given extension.\n" " If the extension has a hint, will use devicestate to check\n" " the status of the device connected to the extension.\n" @@ -2770,7 +2770,7 @@ static int action_extensionstate(struct mansession *s, const struct message *m) return 0; } -static char mandescr_timeout[] = +static const char mandescr_timeout[] = "Description: Hangup a channel after a certain time.\n" "Variables: (Names marked with * are required)\n" " *Channel: Channel name to hangup\n" @@ -2839,7 +2839,7 @@ static int process_events(struct mansession *s) return ret; } -static char mandescr_userevent[] = +static const char mandescr_userevent[] = "Description: Send an event to manager sessions.\n" "Variables: (Names marked with * are required)\n" " *UserEvent: EventStringToSend\n" @@ -2864,7 +2864,7 @@ static int action_userevent(struct mansession *s, const struct message *m) return 0; } -static char mandescr_coresettings[] = +static const char mandescr_coresettings[] = "Description: Query for Core PBX settings.\n" "Variables: (Names marked with * are optional)\n" " *ActionID: ActionID of this transaction\n"; @@ -2911,7 +2911,7 @@ static int action_coresettings(struct mansession *s, const struct message *m) return 0; } -static char mandescr_corestatus[] = +static const char mandescr_corestatus[] = "Description: Query for Core PBX status.\n" "Variables: (Names marked with * are optional)\n" " *ActionID: ActionID of this transaction\n"; @@ -2950,7 +2950,7 @@ static int action_corestatus(struct mansession *s, const struct message *m) return 0; } -static char mandescr_reload[] = +static const char mandescr_reload[] = "Description: Send a reload event.\n" "Variables: (Names marked with * are optional)\n" " *ActionID: ActionID of this transaction\n" @@ -2970,7 +2970,7 @@ static int action_reload(struct mansession *s, const struct message *m) return 0; } -static char mandescr_coreshowchannels[] = +static const char mandescr_coreshowchannels[] = "Description: List currently defined channels and some information\n" " about them.\n" "Variables:\n" @@ -3052,7 +3052,7 @@ static int action_coreshowchannels(struct mansession *s, const struct message *m return 0; } -static char mandescr_modulecheck[] = +static const char mandescr_modulecheck[] = "Description: Checks if Asterisk module is loaded\n" "Variables: \n" " ActionID: <id> Action ID for this transaction. Will be returned.\n" @@ -3105,7 +3105,7 @@ static int manager_modulecheck(struct mansession *s, const struct message *m) return 0; } -static char mandescr_moduleload[] = +static const char mandescr_moduleload[] = "Description: Loads, unloads or reloads an Asterisk module in a running system.\n" "Variables: \n" " ActionID: <id> Action ID for this transaction. Will be returned.\n" @@ -3684,7 +3684,7 @@ enum output_format { FORMAT_XML, }; -static char *contenttype[] = { +static const char * const contenttype[] = { [FORMAT_RAW] = "plain", [FORMAT_HTML] = "html", [FORMAT_XML] = "xml", diff --git a/main/pbx.c b/main/pbx.c index 28c04802d..a24690278 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -855,7 +855,7 @@ struct ast_context { /*! \brief ast_app: A registered application */ struct ast_app { - int (*execute)(struct ast_channel *chan, void *data); + int (*execute)(struct ast_channel *chan, const char *data); AST_DECLARE_STRING_FIELDS( AST_STRING_FIELD(synopsis); /*!< Synopsis text for 'show applications' */ AST_STRING_FIELD(description); /*!< Description (help text) for 'show application <name>' */ @@ -919,33 +919,33 @@ struct pbx_exception { int priority; /*!< Priority associated with this exception */ }; -static int pbx_builtin_answer(struct ast_channel *, void *); -static int pbx_builtin_goto(struct ast_channel *, void *); -static int pbx_builtin_hangup(struct ast_channel *, void *); -static int pbx_builtin_background(struct ast_channel *, void *); -static int pbx_builtin_wait(struct ast_channel *, void *); -static int pbx_builtin_waitexten(struct ast_channel *, void *); -static int pbx_builtin_incomplete(struct ast_channel *, void *); -static int pbx_builtin_resetcdr(struct ast_channel *, void *); -static int pbx_builtin_setamaflags(struct ast_channel *, void *); -static int pbx_builtin_ringing(struct ast_channel *, void *); -static int pbx_builtin_proceeding(struct ast_channel *, void *); -static int pbx_builtin_progress(struct ast_channel *, void *); -static int pbx_builtin_congestion(struct ast_channel *, void *); -static int pbx_builtin_busy(struct ast_channel *, void *); -static int pbx_builtin_noop(struct ast_channel *, void *); -static int pbx_builtin_gotoif(struct ast_channel *, void *); -static int pbx_builtin_gotoiftime(struct ast_channel *, void *); -static int pbx_builtin_execiftime(struct ast_channel *, void *); -static int pbx_builtin_saynumber(struct ast_channel *, void *); -static int pbx_builtin_saydigits(struct ast_channel *, void *); -static int pbx_builtin_saycharacters(struct ast_channel *, void *); -static int pbx_builtin_sayphonetic(struct ast_channel *, void *); +static int pbx_builtin_answer(struct ast_channel *, const char *); +static int pbx_builtin_goto(struct ast_channel *, const char *); +static int pbx_builtin_hangup(struct ast_channel *, const char *); +static int pbx_builtin_background(struct ast_channel *, const char *); +static int pbx_builtin_wait(struct ast_channel *, const char *); +static int pbx_builtin_waitexten(struct ast_channel *, const char *); +static int pbx_builtin_incomplete(struct ast_channel *, const char *); +static int pbx_builtin_resetcdr(struct ast_channel *, const char *); +static int pbx_builtin_setamaflags(struct ast_channel *, const char *); +static int pbx_builtin_ringing(struct ast_channel *, const char *); +static int pbx_builtin_proceeding(struct ast_channel *, const char *); +static int pbx_builtin_progress(struct ast_channel *, const char *); +static int pbx_builtin_congestion(struct ast_channel *, const char *); +static int pbx_builtin_busy(struct ast_channel *, const char *); +static int pbx_builtin_noop(struct ast_channel *, const char *); +static int pbx_builtin_gotoif(struct ast_channel *, const char *); +static int pbx_builtin_gotoiftime(struct ast_channel *, const char *); +static int pbx_builtin_execiftime(struct ast_channel *, const char *); +static int pbx_builtin_saynumber(struct ast_channel *, const char *); +static int pbx_builtin_saydigits(struct ast_channel *, const char *); +static int pbx_builtin_saycharacters(struct ast_channel *, const char *); +static int pbx_builtin_sayphonetic(struct ast_channel *, const char *); static int matchcid(const char *cidpattern, const char *callerid); -int pbx_builtin_setvar(struct ast_channel *, void *); +int pbx_builtin_setvar(struct ast_channel *, const char *); void log_match_char_tree(struct match_char *node, char *prefix); /* for use anywhere */ -int pbx_builtin_setvar_multiple(struct ast_channel *, void *); -static int pbx_builtin_importvar(struct ast_channel *, void *); +int pbx_builtin_setvar_multiple(struct ast_channel *, const char *); +static int pbx_builtin_importvar(struct ast_channel *, const char *); static void set_ext_pri(struct ast_channel *c, const char *exten, int pri); static void new_find_extension(const char *str, struct scoreboard *score, struct match_char *tree, int length, int spec, const char *callerid, @@ -1083,7 +1083,7 @@ static AST_RWLIST_HEAD_STATIC(acf_root, ast_custom_function); /*! \brief Declaration of builtin applications */ static struct pbx_builtin { char name[AST_MAX_APP]; - int (*execute)(struct ast_channel *chan, void *data); + int (*execute)(struct ast_channel *chan, const char *data); } builtins[] = { /* These applications are built into the PBX core and do not @@ -1320,9 +1320,9 @@ int check_contexts(char *file, int line ) /* \note This function is special. It saves the stack so that no matter how many times it is called, it returns to the same place */ -int pbx_exec(struct ast_channel *c, /*!< Channel */ - struct ast_app *app, /*!< Application */ - void *data) /*!< Data for execution */ +int pbx_exec(struct ast_channel *c, /*!< Channel */ + struct ast_app *app, /*!< Application */ + const char *data) /*!< Data for execution */ { int res; struct ast_module_user *u = NULL; @@ -3040,9 +3040,8 @@ static struct ast_datastore_info exception_store_info = { .destroy = exception_store_free, }; -int pbx_builtin_raise_exception(struct ast_channel *chan, void *vreason) +int pbx_builtin_raise_exception(struct ast_channel *chan, const char *reason) { - const char *reason = vreason; struct ast_datastore *ds = ast_channel_datastore_find(chan, &exception_store_info, NULL); struct pbx_exception *exception = NULL; @@ -5332,7 +5331,7 @@ int ast_context_unlockmacro(const char *context) } /*! \brief Dynamically register a new dial plan application */ -int ast_register_application2(const char *app, int (*execute)(struct ast_channel *, void *), const char *synopsis, const char *description, void *mod) +int ast_register_application2(const char *app, int (*execute)(struct ast_channel *, const char *), const char *synopsis, const char *description, void *mod) { struct ast_app *tmp, *cur = NULL; char tmps[80]; @@ -5757,7 +5756,7 @@ static char *handle_show_applications(struct ast_cli_entry *e, int cmd, struct a int like = 0, describing = 0; int total_match = 0; /* Number of matches in like clause */ int total_apps = 0; /* Number of apps registered */ - static char* choices[] = { "like", "describing", NULL }; + static const char * const choices[] = { "like", "describing", NULL }; switch (cmd) { case CLI_INIT: @@ -6127,7 +6126,7 @@ static char *handle_show_dialplan(struct ast_cli_entry *e, int cmd, struct ast_c if (ast_strlen_zero(exten)) exten = NULL; } else { /* no '@' char, only context given */ - context = a->argv[2]; + context = ast_strdupa(a->argv[2]); } if (ast_strlen_zero(context)) context = NULL; @@ -6195,7 +6194,7 @@ static char *handle_debug_dialplan(struct ast_cli_entry *e, int cmd, struct ast_ if (ast_strlen_zero(exten)) exten = NULL; } else { /* no '@' char, only context given */ - context = a->argv[2]; + context = ast_strdupa(a->argv[2]); } if (ast_strlen_zero(context)) context = NULL; @@ -6417,7 +6416,7 @@ static int manager_show_dialplan(struct mansession *s, const struct message *m) return 0; } -static char mandescr_show_dialplan[] = +static const char mandescr_show_dialplan[] = "Description: Show dialplan contexts and extensions.\n" "Be aware that showing the full dialplan may take a lot of capacity\n" "Variables: \n" @@ -7025,7 +7024,7 @@ int ast_context_add_include(const char *context, const char *include, const char * return the index of the matching entry, starting from 1. * If names is not supplied, try numeric values. */ -static int lookup_name(const char *s, char *const names[], int max) +static int lookup_name(const char *s, const char * const names[], int max) { int i; @@ -7048,7 +7047,7 @@ static int lookup_name(const char *s, char *const names[], int max) /*! \brief helper function to return a range up to max (7, 12, 31 respectively). * names, if supplied, is an array of names that should be mapped to numbers. */ -static unsigned get_range(char *src, int max, char *const names[], const char *msg) +static unsigned get_range(char *src, int max, const char * const names[], const char *msg) { int start, end; /* start and ending position */ unsigned int mask = 0; @@ -7151,7 +7150,7 @@ static void get_timerange(struct ast_timing *i, char *times) return; } -static char *days[] = +static const char * const days[] = { "sun", "mon", @@ -7163,7 +7162,7 @@ static char *days[] = NULL, }; -static char *months[] = +static const char * const months[] = { "jan", "feb", @@ -8659,7 +8658,7 @@ void ast_context_destroy(struct ast_context *con, const char *registrar) ast_unlock_contexts(); } -static void wait_for_hangup(struct ast_channel *chan, void *data) +static void wait_for_hangup(struct ast_channel *chan, const void *data) { int res; struct ast_frame *f; @@ -8684,7 +8683,7 @@ static void wait_for_hangup(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_proceeding(struct ast_channel *chan, void *data) +static int pbx_builtin_proceeding(struct ast_channel *chan, const char *data) { ast_indicate(chan, AST_CONTROL_PROCEEDING); return 0; @@ -8693,7 +8692,7 @@ static int pbx_builtin_proceeding(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_progress(struct ast_channel *chan, void *data) +static int pbx_builtin_progress(struct ast_channel *chan, const char *data) { ast_indicate(chan, AST_CONTROL_PROGRESS); return 0; @@ -8702,7 +8701,7 @@ static int pbx_builtin_progress(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_ringing(struct ast_channel *chan, void *data) +static int pbx_builtin_ringing(struct ast_channel *chan, const char *data) { ast_indicate(chan, AST_CONTROL_RINGING); return 0; @@ -8711,7 +8710,7 @@ static int pbx_builtin_ringing(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_busy(struct ast_channel *chan, void *data) +static int pbx_builtin_busy(struct ast_channel *chan, const char *data) { ast_indicate(chan, AST_CONTROL_BUSY); /* Don't change state of an UP channel, just indicate @@ -8727,7 +8726,7 @@ static int pbx_builtin_busy(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_congestion(struct ast_channel *chan, void *data) +static int pbx_builtin_congestion(struct ast_channel *chan, const char *data) { ast_indicate(chan, AST_CONTROL_CONGESTION); /* Don't change state of an UP channel, just indicate @@ -8741,7 +8740,7 @@ static int pbx_builtin_congestion(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_answer(struct ast_channel *chan, void *data) +static int pbx_builtin_answer(struct ast_channel *chan, const char *data) { int delay = 0; int answer_cdr = 1; @@ -8773,9 +8772,9 @@ static int pbx_builtin_answer(struct ast_channel *chan, void *data) return __ast_answer(chan, delay, answer_cdr); } -static int pbx_builtin_incomplete(struct ast_channel *chan, void *data) +static int pbx_builtin_incomplete(struct ast_channel *chan, const char *data) { - char *options = data; + const char *options = data; int answer = 1; /* Some channels can receive DTMF in unanswered state; some cannot */ @@ -8803,7 +8802,7 @@ AST_APP_OPTIONS(resetcdr_opts, { /*! * \ingroup applications */ -static int pbx_builtin_resetcdr(struct ast_channel *chan, void *data) +static int pbx_builtin_resetcdr(struct ast_channel *chan, const char *data) { char *args; struct ast_flags flags = { 0 }; @@ -8821,7 +8820,7 @@ static int pbx_builtin_resetcdr(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_setamaflags(struct ast_channel *chan, void *data) +static int pbx_builtin_setamaflags(struct ast_channel *chan, const char *data) { /* Copy the AMA Flags as specified */ ast_cdr_setamaflags(chan, data ? data : ""); @@ -8831,7 +8830,7 @@ static int pbx_builtin_setamaflags(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_hangup(struct ast_channel *chan, void *data) +static int pbx_builtin_hangup(struct ast_channel *chan, const char *data) { if (!ast_strlen_zero(data)) { int cause; @@ -8861,7 +8860,7 @@ static int pbx_builtin_hangup(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_gotoiftime(struct ast_channel *chan, void *data) +static int pbx_builtin_gotoiftime(struct ast_channel *chan, const char *data) { char *s, *ts, *branch1, *branch2, *branch; struct ast_timing timing; @@ -8896,7 +8895,7 @@ static int pbx_builtin_gotoiftime(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_execiftime(struct ast_channel *chan, void *data) +static int pbx_builtin_execiftime(struct ast_channel *chan, const char *data) { char *s, *appname; struct ast_timing timing; @@ -8950,7 +8949,7 @@ static int pbx_builtin_execiftime(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_wait(struct ast_channel *chan, void *data) +static int pbx_builtin_wait(struct ast_channel *chan, const char *data) { double s; int ms; @@ -8966,7 +8965,7 @@ static int pbx_builtin_wait(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_waitexten(struct ast_channel *chan, void *data) +static int pbx_builtin_waitexten(struct ast_channel *chan, const char *data) { int ms, res; double s; @@ -9035,7 +9034,7 @@ static int pbx_builtin_waitexten(struct ast_channel *chan, void *data) /*! * \ingroup applications */ -static int pbx_builtin_background(struct ast_channel *chan, void *data) +static int pbx_builtin_background(struct ast_channel *chan, const char *data) { int res = 0; int mres = 0; @@ -9133,7 +9132,7 @@ done: /*! Goto * \ingroup applications */ -static int pbx_builtin_goto(struct ast_channel *chan, void *data) +static int pbx_builtin_goto(struct ast_channel *chan, const char *data) { int res = ast_parseable_goto(chan, data); if (!res) @@ -9302,7 +9301,7 @@ void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const ast_rwlock_unlock(&globalslock); } -int pbx_builtin_setvar(struct ast_channel *chan, void *data) +int pbx_builtin_setvar(struct ast_channel *chan, const char *data) { char *name, *value, *mydata; @@ -9325,7 +9324,7 @@ int pbx_builtin_setvar(struct ast_channel *chan, void *data) return(0); } -int pbx_builtin_setvar_multiple(struct ast_channel *chan, void *vdata) +int pbx_builtin_setvar_multiple(struct ast_channel *chan, const char *vdata) { char *data; int x; @@ -9361,7 +9360,7 @@ int pbx_builtin_setvar_multiple(struct ast_channel *chan, void *vdata) return 0; } -int pbx_builtin_importvar(struct ast_channel *chan, void *data) +int pbx_builtin_importvar(struct ast_channel *chan, const char *data) { char *name; char *value; @@ -9398,7 +9397,7 @@ int pbx_builtin_importvar(struct ast_channel *chan, void *data) return(0); } -static int pbx_builtin_noop(struct ast_channel *chan, void *data) +static int pbx_builtin_noop(struct ast_channel *chan, const char *data) { return 0; } @@ -9425,7 +9424,7 @@ int pbx_checkcondition(const char *condition) } } -static int pbx_builtin_gotoif(struct ast_channel *chan, void *data) +static int pbx_builtin_gotoif(struct ast_channel *chan, const char *data) { char *condition, *branch1, *branch2, *branch; char *stringp; @@ -9449,7 +9448,7 @@ static int pbx_builtin_gotoif(struct ast_channel *chan, void *data) return pbx_builtin_goto(chan, branch); } -static int pbx_builtin_saynumber(struct ast_channel *chan, void *data) +static int pbx_builtin_saynumber(struct ast_channel *chan, const char *data) { char tmp[256]; char *number = tmp; @@ -9477,7 +9476,7 @@ static int pbx_builtin_saynumber(struct ast_channel *chan, void *data) return 0; } -static int pbx_builtin_saydigits(struct ast_channel *chan, void *data) +static int pbx_builtin_saydigits(struct ast_channel *chan, const char *data) { int res = 0; @@ -9486,7 +9485,7 @@ static int pbx_builtin_saydigits(struct ast_channel *chan, void *data) return res; } -static int pbx_builtin_saycharacters(struct ast_channel *chan, void *data) +static int pbx_builtin_saycharacters(struct ast_channel *chan, const char *data) { int res = 0; @@ -9495,7 +9494,7 @@ static int pbx_builtin_saycharacters(struct ast_channel *chan, void *data) return res; } -static int pbx_builtin_sayphonetic(struct ast_channel *chan, void *data) +static int pbx_builtin_sayphonetic(struct ast_channel *chan, const char *data) { int res = 0; diff --git a/main/taskprocessor.c b/main/taskprocessor.c index 9aa86ce00..0de97e503 100644 --- a/main/taskprocessor.c +++ b/main/taskprocessor.c @@ -62,7 +62,7 @@ struct tps_taskprocessor_stats { /*! \brief A ast_taskprocessor structure is a singleton by name */ struct ast_taskprocessor { /*! \brief Friendly name of the taskprocessor */ - char *name; + const char *name; /*! \brief Thread poll condition */ ast_cond_t poll_cond; /*! \brief Taskprocessor thread */ @@ -189,7 +189,7 @@ static int tps_ping_handler(void *datap) static char *cli_tps_ping(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { struct timeval begin, end, delta; - char *name; + const char *name; struct timeval when; struct timespec ts; struct ast_taskprocessor *tps = NULL; @@ -366,7 +366,7 @@ static void tps_taskprocessor_destroy(void *tps) ast_free(t->stats); t->stats = NULL; } - ast_free(t->name); + ast_free((char *) t->name); } /* pop the front task and return it */ @@ -404,7 +404,7 @@ const char *ast_taskprocessor_name(struct ast_taskprocessor *tps) /* Provide a reference to a taskprocessor. Create the taskprocessor if necessary, but don't * create the taskprocessor if we were told via ast_tps_options to return a reference only * if it already exists */ -struct ast_taskprocessor *ast_taskprocessor_get(char *name, enum ast_tps_options create) +struct ast_taskprocessor *ast_taskprocessor_get(const char *name, enum ast_tps_options create) { struct ast_taskprocessor *p, tmp_tps = { .name = name, diff --git a/main/udptl.c b/main/udptl.c index 478ce8f5f..dfe89e126 100644 --- a/main/udptl.c +++ b/main/udptl.c @@ -1134,7 +1134,7 @@ static char *handle_cli_udptl_set_debug(struct ast_cli_entry *e, int cmd, struct if (strncasecmp(a->argv[3], "ip", 2)) return CLI_SHOWUSAGE; port = 0; - arg = a->argv[4]; + arg = ast_strdupa(a->argv[4]); p = strstr(arg, ":"); if (p) { *p = '\0'; diff --git a/main/ulaw.c b/main/ulaw.c index 18a118f60..0be633c4c 100644 --- a/main/ulaw.c +++ b/main/ulaw.c @@ -177,7 +177,7 @@ void ast_ulaw_init(void) #ifndef G711_NEW_ALGORITHM for (i = 0;i < 256;i++) { short mu,e,f,y; - static short etab[]={0,132,396,924,1980,4092,8316,16764}; + static const short etab[]={0,132,396,924,1980,4092,8316,16764}; mu = 255-i; e = (mu & 0x70)/16; diff --git a/main/utils.c b/main/utils.c index e724160f4..59a29ce5a 100644 --- a/main/utils.c +++ b/main/utils.c @@ -227,7 +227,7 @@ struct hostent *ast_gethostbyname(const char *host, struct ast_hostent *hp) } /*! \brief Produce 32 char MD5 hash of value. */ -void ast_md5_hash(char *output, char *input) +void ast_md5_hash(char *output, const char *input) { struct MD5Context md5; unsigned char digest[16]; @@ -235,7 +235,7 @@ void ast_md5_hash(char *output, char *input) int x; MD5Init(&md5); - MD5Update(&md5, (unsigned char *)input, strlen(input)); + MD5Update(&md5, (const unsigned char *) input, strlen(input)); MD5Final(digest, &md5); ptr = output; for (x = 0; x < 16; x++) @@ -243,7 +243,7 @@ void ast_md5_hash(char *output, char *input) } /*! \brief Produce 40 char SHA1 hash of value. */ -void ast_sha1_hash(char *output, char *input) +void ast_sha1_hash(char *output, const char *input) { struct SHA1Context sha; char *ptr; @@ -1446,7 +1446,7 @@ char *ast_process_quotes_and_slashes(char *start, char find, char replace_with) return dataPut; } -void ast_join(char *s, size_t len, char * const w[]) +void ast_join(char *s, size_t len, const char * const w[]) { int x, ofs = 0; const char *src; diff --git a/pbx/dundi-parser.c b/pbx/dundi-parser.c index 15dae84d6..3c57442a4 100644 --- a/pbx/dundi-parser.c +++ b/pbx/dundi-parser.c @@ -155,7 +155,7 @@ static void dump_hint(char *output, int maxlen, void *value, int len) static void dump_cause(char *output, int maxlen, void *value, int len) { - static char *causes[] = { + static const char * const causes[] = { "SUCCESS", "GENERAL", "DYNAMIC", diff --git a/pbx/pbx_ael.c b/pbx/pbx_ael.c index f1b8fb00e..f6371f1e4 100644 --- a/pbx/pbx_ael.c +++ b/pbx/pbx_ael.c @@ -251,7 +251,7 @@ AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "Asterisk Extension Langu ); #ifdef AAL_ARGCHECK -static char *ael_funclist[] = +static const char * const ael_funclist[] = { "AGENT", "ARRAY", diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index 5bd106db2..8bebf1385 100644 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -328,7 +328,7 @@ static char *handle_cli_dialplan_remove_extension(struct ast_cli_entry *e, int c * Priority input checking ... */ if (a->argc == 5) { - char *c = a->argv[4]; + const char *c = a->argv[4]; /* check for digits in whole parameter for right priority ... * why? because atoi (strtol) returns 0 if any characters in @@ -935,8 +935,7 @@ static char *handle_cli_dialplan_add_extension(struct ast_cli_entry *e, int cmd, if (strcmp(a->argv[6], "replace")) return CLI_SHOWUSAGE; - /* XXX overwrite argv[3] */ - whole_exten = a->argv[3]; + whole_exten = ast_strdupa(a->argv[3]); exten = strsep(&whole_exten,","); if (strchr(exten, '/')) { cidmatch = exten; 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; diff --git a/utils/conf2ael.c b/utils/conf2ael.c index e0711808b..f08020686 100644 --- a/utils/conf2ael.c +++ b/utils/conf2ael.c @@ -568,7 +568,7 @@ int main(int argc, char **argv) /* ==================================== for linking internal stuff to external stuff */ -int pbx_builtin_setvar(struct ast_channel *chan, void *data) +int pbx_builtin_setvar(struct ast_channel *chan, const char *data) { return localized_pbx_builtin_setvar(chan, data); } diff --git a/utils/extconf.c b/utils/extconf.c index e47e41c17..11d4de60a 100644 --- a/utils/extconf.c +++ b/utils/extconf.c @@ -3090,7 +3090,7 @@ static void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name } -static int pbx_builtin_setvar(struct ast_channel *chan, void *data) +static int pbx_builtin_setvar(struct ast_channel *chan, const void *data) { char *name, *value, *mydata; int argc; @@ -3125,9 +3125,9 @@ static int pbx_builtin_setvar(struct ast_channel *chan, void *data) return(0); } -int localized_pbx_builtin_setvar(struct ast_channel *chan, void *data); +int localized_pbx_builtin_setvar(struct ast_channel *chan, const void *data); -int localized_pbx_builtin_setvar(struct ast_channel *chan, void *data) +int localized_pbx_builtin_setvar(struct ast_channel *chan, const void *data) { return pbx_builtin_setvar(chan, data); } |