[asterisk-commits] kpfleming: trunk r196072 - in /trunk: apps/ cdr/ channels/ channels/misdn/ fo...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 21 16:13:19 CDT 2009


Author: kpfleming
Date: Thu May 21 16:13:09 2009
New Revision: 196072

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=196072
Log:
Const-ify the world (or at least a good part of it)

This patch adds 'const' tags to a number of Asterisk APIs where they are appropriate (where the API already demanded that the function argument not be modified, but the compiler was not informed of that fact). The list includes:

- CLI command handlers
- CLI command handler arguments
- AGI command handlers
- AGI command handler arguments
- Dialplan application handler arguments
- Speech engine API function arguments

In addition, various file-scope and function-scope constant arrays got 'const' and/or 'static' qualifiers where they were missing.

Review: https://reviewboard.asterisk.org/r/251/


Modified:
    trunk/apps/app_adsiprog.c
    trunk/apps/app_alarmreceiver.c
    trunk/apps/app_amd.c
    trunk/apps/app_authenticate.c
    trunk/apps/app_cdr.c
    trunk/apps/app_chanisavail.c
    trunk/apps/app_channelredirect.c
    trunk/apps/app_chanspy.c
    trunk/apps/app_confbridge.c
    trunk/apps/app_controlplayback.c
    trunk/apps/app_dahdibarge.c
    trunk/apps/app_dahdiras.c
    trunk/apps/app_db.c
    trunk/apps/app_dial.c
    trunk/apps/app_dictate.c
    trunk/apps/app_directed_pickup.c
    trunk/apps/app_directory.c
    trunk/apps/app_disa.c
    trunk/apps/app_dumpchan.c
    trunk/apps/app_echo.c
    trunk/apps/app_exec.c
    trunk/apps/app_externalivr.c
    trunk/apps/app_fax.c
    trunk/apps/app_festival.c
    trunk/apps/app_flash.c
    trunk/apps/app_followme.c
    trunk/apps/app_forkcdr.c
    trunk/apps/app_getcpeid.c
    trunk/apps/app_ices.c
    trunk/apps/app_image.c
    trunk/apps/app_ivrdemo.c
    trunk/apps/app_jack.c
    trunk/apps/app_macro.c
    trunk/apps/app_meetme.c
    trunk/apps/app_milliwatt.c
    trunk/apps/app_minivm.c
    trunk/apps/app_mixmonitor.c
    trunk/apps/app_morsecode.c
    trunk/apps/app_mp3.c
    trunk/apps/app_nbscat.c
    trunk/apps/app_originate.c
    trunk/apps/app_osplookup.c
    trunk/apps/app_page.c
    trunk/apps/app_parkandannounce.c
    trunk/apps/app_playback.c
    trunk/apps/app_playtones.c
    trunk/apps/app_privacy.c
    trunk/apps/app_queue.c
    trunk/apps/app_read.c
    trunk/apps/app_readexten.c
    trunk/apps/app_readfile.c
    trunk/apps/app_record.c
    trunk/apps/app_rpt.c
    trunk/apps/app_sayunixtime.c
    trunk/apps/app_senddtmf.c
    trunk/apps/app_sendtext.c
    trunk/apps/app_setcallerid.c
    trunk/apps/app_skel.c
    trunk/apps/app_sms.c
    trunk/apps/app_softhangup.c
    trunk/apps/app_speech_utils.c
    trunk/apps/app_stack.c
    trunk/apps/app_system.c
    trunk/apps/app_talkdetect.c
    trunk/apps/app_test.c
    trunk/apps/app_transfer.c
    trunk/apps/app_url.c
    trunk/apps/app_userevent.c
    trunk/apps/app_verbose.c
    trunk/apps/app_voicemail.c
    trunk/apps/app_waitforring.c
    trunk/apps/app_waitforsilence.c
    trunk/apps/app_waituntil.c
    trunk/apps/app_while.c
    trunk/apps/app_zapateller.c
    trunk/cdr/cdr_adaptive_odbc.c
    trunk/cdr/cdr_sqlite.c
    trunk/cdr/cdr_sqlite3_custom.c
    trunk/channels/chan_agent.c
    trunk/channels/chan_alsa.c
    trunk/channels/chan_console.c
    trunk/channels/chan_dahdi.c
    trunk/channels/chan_iax2.c
    trunk/channels/chan_mgcp.c
    trunk/channels/chan_misdn.c
    trunk/channels/chan_nbs.c
    trunk/channels/chan_oss.c
    trunk/channels/chan_sip.c
    trunk/channels/chan_skinny.c
    trunk/channels/chan_unistim.c
    trunk/channels/console_gui.c
    trunk/channels/iax2-parser.c
    trunk/channels/misdn/chan_misdn_config.h
    trunk/channels/misdn_config.c
    trunk/channels/vcodecs.c
    trunk/formats/format_gsm.c
    trunk/funcs/func_devstate.c
    trunk/funcs/func_odbc.c
    trunk/funcs/func_strings.c
    trunk/include/asterisk/abstract_jb.h
    trunk/include/asterisk/agi.h
    trunk/include/asterisk/app.h
    trunk/include/asterisk/cli.h
    trunk/include/asterisk/extconf.h
    trunk/include/asterisk/features.h
    trunk/include/asterisk/image.h
    trunk/include/asterisk/module.h
    trunk/include/asterisk/pbx.h
    trunk/include/asterisk/speech.h
    trunk/include/asterisk/strings.h
    trunk/include/asterisk/taskprocessor.h
    trunk/include/asterisk/utils.h
    trunk/main/abstract_jb.c
    trunk/main/app.c
    trunk/main/ast_expr2.fl
    trunk/main/asterisk.c
    trunk/main/astobj2.c
    trunk/main/cdr.c
    trunk/main/channel.c
    trunk/main/cli.c
    trunk/main/dsp.c
    trunk/main/features.c
    trunk/main/frame.c
    trunk/main/image.c
    trunk/main/loader.c
    trunk/main/manager.c
    trunk/main/pbx.c
    trunk/main/taskprocessor.c
    trunk/main/udptl.c
    trunk/main/ulaw.c
    trunk/main/utils.c
    trunk/pbx/dundi-parser.c
    trunk/pbx/pbx_ael.c
    trunk/pbx/pbx_config.c
    trunk/res/res_agi.c
    trunk/res/res_clioriginate.c
    trunk/res/res_jabber.c
    trunk/res/res_limit.c
    trunk/res/res_monitor.c
    trunk/res/res_musiconhold.c
    trunk/res/res_odbc.c
    trunk/res/res_rtp_asterisk.c
    trunk/res/res_speech.c
    trunk/utils/conf2ael.c
    trunk/utils/extconf.c

Modified: trunk/apps/app_adsiprog.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_adsiprog.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_adsiprog.c (original)
+++ trunk/apps/app_adsiprog.c Thu May 21 16:13:09 2009
@@ -74,7 +74,7 @@
 	char *name;
 };
 
-static struct adsi_event events[] = {
+static const struct adsi_event events[] = {
 	{ 1, "CALLERID" },
 	{ 2, "VMWI" },
 	{ 3, "NEARANSWER" },
@@ -101,7 +101,7 @@
 	{ 24, "CPEID" },
 };
 
-static struct adsi_event justify[] = {
+static const struct adsi_event justify[] = {
 	{ 0, "CENTER" },
 	{ 1, "RIGHT" },
 	{ 2, "LEFT" },
@@ -232,7 +232,7 @@
 	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 *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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 	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 @@
 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 @@
 	{ "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 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 @@
 	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 @@
 	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 @@
 	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 @@
 }
 #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 @@
 	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;
 	

Modified: trunk/apps/app_alarmreceiver.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_alarmreceiver.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_alarmreceiver.c (original)
+++ trunk/apps/app_alarmreceiver.c Thu May 21 16:13:09 2009
@@ -416,7 +416,7 @@
 *
 * 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 @@
 * 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;

Modified: trunk/apps/app_amd.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_amd.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_amd.c (original)
+++ trunk/apps/app_amd.c Thu May 21 16:13:09 2009
@@ -143,7 +143,7 @@
 /* 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 int amd_exec(struct ast_channel *chan, void *data)
+static int amd_exec(struct ast_channel *chan, const char *data)
 {
 	isAnsweringMachine(chan, data);
 

Modified: trunk/apps/app_authenticate.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_authenticate.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_authenticate.c (original)
+++ trunk/apps/app_authenticate.c Thu May 21 16:13:09 2009
@@ -105,7 +105,7 @@
 	</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;

Modified: trunk/apps/app_cdr.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_cdr.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_cdr.c (original)
+++ trunk/apps/app_cdr.c Thu May 21 16:13:09 2009
@@ -44,9 +44,9 @@
 	</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);

Modified: trunk/apps/app_chanisavail.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_chanisavail.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_chanisavail.c (original)
+++ trunk/apps/app_chanisavail.c Thu May 21 16:13:09 2009
@@ -92,7 +92,7 @@
 	</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;

Modified: trunk/apps/app_channelredirect.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_channelredirect.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_channelredirect.c (original)
+++ trunk/apps/app_channelredirect.c Thu May 21 16:13:09 2009
@@ -62,7 +62,7 @@
  ***/
 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;

Modified: trunk/apps/app_chanspy.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_chanspy.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_chanspy.c (original)
+++ trunk/apps/app_chanspy.c Thu May 21 16:13:09 2009
@@ -963,7 +963,7 @@
 	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 @@
 		AST_APP_ARG(options);
 	);
 	char *opts[OPT_ARG_ARRAY_SIZE];
-
-	data = ast_strdupa(data);
-	AST_STANDARD_APP_ARGS(args, data);
+	char *parse = ast_strdupa(data);
+
+	AST_STANDARD_APP_ARGS(args, parse);
 
 	if (args.spec && !strcmp(args.spec, "all"))
 		args.spec = NULL;
@@ -1078,7 +1078,7 @@
 	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 @@
 		AST_APP_ARG(context);
 		AST_APP_ARG(options);
 	);
-
-	data = ast_strdupa(data);
-
-	AST_STANDARD_APP_ARGS(args, data);
+	char *parse = ast_strdupa(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 @@
 	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;

Modified: trunk/apps/app_confbridge.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_confbridge.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_confbridge.c (original)
+++ trunk/apps/app_confbridge.c Thu May 21 16:13:09 2009
@@ -683,7 +683,7 @@
 }
 
 /*! \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;

Modified: trunk/apps/app_controlplayback.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_controlplayback.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_controlplayback.c (original)
+++ trunk/apps/app_controlplayback.c Thu May 21 16:13:09 2009
@@ -125,7 +125,7 @@
 	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;

Modified: trunk/apps/app_dahdibarge.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_dahdibarge.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_dahdibarge.c (original)
+++ trunk/apps/app_dahdibarge.c Thu May 21 16:13:09 2009
@@ -258,7 +258,7 @@
 	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;

Modified: trunk/apps/app_dahdiras.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_dahdiras.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_dahdiras.c (original)
+++ trunk/apps/app_dahdiras.c Thu May 21 16:13:09 2009
@@ -187,7 +187,7 @@
 	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;

Modified: trunk/apps/app_db.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_db.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_db.c (original)
+++ trunk/apps/app_db.c Thu May 21 16:13:09 2009
@@ -83,7 +83,7 @@
 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 @@
 	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;

Modified: trunk/apps/app_dial.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_dial.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_dial.c (original)
+++ trunk/apps/app_dial.c Thu May 21 16:13:09 2009
@@ -1634,7 +1634,7 @@
 	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 @@
 	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 @@
 	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;

Modified: trunk/apps/app_dictate.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_dictate.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_dictate.c (original)
+++ trunk/apps/app_dictate.c Thu May 21 16:13:09 2009
@@ -81,7 +81,7 @@
 	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;

Modified: trunk/apps/app_directed_pickup.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_directed_pickup.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_directed_pickup.c (original)
+++ trunk/apps/app_directed_pickup.c Thu May 21 16:13:09 2009
@@ -262,7 +262,7 @@
 }
 
 /* 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 @@
 }
 
 /* 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);

Modified: trunk/apps/app_directory.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_directory.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_directory.c (original)
+++ trunk/apps/app_directory.c Thu May 21 16:13:09 2009
@@ -714,7 +714,7 @@
 	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;

Modified: trunk/apps/app_disa.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_disa.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_disa.c (original)
+++ trunk/apps/app_disa.c Thu May 21 16:13:09 2009
@@ -140,7 +140,7 @@
 	}
 }
 
-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);

Modified: trunk/apps/app_dumpchan.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_dumpchan.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_dumpchan.c (original)
+++ trunk/apps/app_dumpchan.c Thu May 21 16:13:09 2009
@@ -147,7 +147,7 @@
 	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];

Modified: trunk/apps/app_echo.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_echo.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_echo.c (original)
+++ trunk/apps/app_echo.c Thu May 21 16:13:09 2009
@@ -48,7 +48,7 @@
 
 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;

Modified: trunk/apps/app_exec.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_exec.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_exec.c (original)
+++ trunk/apps/app_exec.c Thu May 21 16:13:09 2009
@@ -129,7 +129,7 @@
 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 @@
 	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 @@
 	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;

Modified: trunk/apps/app_externalivr.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_externalivr.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_externalivr.c (original)
+++ trunk/apps/app_externalivr.c Thu May 21 16:13:09 2009
@@ -311,7 +311,7 @@
 	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];

Modified: trunk/apps/app_fax.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_fax.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_fax.c (original)
+++ trunk/apps/app_fax.c Thu May 21 16:13:09 2009
@@ -705,7 +705,7 @@
 
 /* === 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 @@
 	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;

Modified: trunk/apps/app_festival.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_festival.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_festival.c (original)
+++ trunk/apps/app_festival.c Thu May 21 16:13:09 2009
@@ -264,7 +264,7 @@
 	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;

Modified: trunk/apps/app_flash.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_flash.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_flash.c (original)
+++ trunk/apps/app_flash.c Thu May 21 16:13:09 2009
@@ -72,7 +72,7 @@
 	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;

Modified: trunk/apps/app_followme.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_followme.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_followme.c (original)
+++ trunk/apps/app_followme.c Thu May 21 16:13:09 2009
@@ -275,18 +275,19 @@
 }
 
 /*! \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 @@
 	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;

Modified: trunk/apps/app_forkcdr.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_forkcdr.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_forkcdr.c (original)
+++ trunk/apps/app_forkcdr.c Thu May 21 16:13:09 2009
@@ -226,7 +226,7 @@
 	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;

Modified: trunk/apps/app_getcpeid.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_getcpeid.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_getcpeid.c (original)
+++ trunk/apps/app_getcpeid.c Thu May 21 16:13:09 2009
@@ -61,7 +61,7 @@
 	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];

Modified: trunk/apps/app_ices.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_ices.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_ices.c (original)
+++ trunk/apps/app_ices.c Thu May 21 16:13:09 2009
@@ -104,7 +104,7 @@
 	_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];

Modified: trunk/apps/app_image.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_image.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_image.c (original)
+++ trunk/apps/app_image.c Thu May 21 16:13:09 2009
@@ -69,7 +69,7 @@
 	</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)) {

Modified: trunk/apps/app_ivrdemo.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_ivrdemo.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_ivrdemo.c (original)
+++ trunk/apps/app_ivrdemo.c Thu May 21 16:13:09 2009
@@ -59,7 +59,7 @@
 
 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 @@
 	{ 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;
 }

Modified: trunk/apps/app_jack.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_jack.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_jack.c (original)
+++ trunk/apps/app_jack.c Thu May 21 16:13:09 2009
@@ -740,19 +740,14 @@
 	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;
 	}

Modified: trunk/apps/app_macro.c
URL: http://svn.asterisk.org/svn-view/asterisk/trunk/apps/app_macro.c?view=diff&rev=196072&r1=196071&r2=196072
==============================================================================
--- trunk/apps/app_macro.c (original)
+++ trunk/apps/app_macro.c Thu May 21 16:13:09 2009
@@ -216,7 +216,7 @@
 	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 @@
 			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 @@
 			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';
 				}

[... 5841 lines stripped ...]



More information about the asterisk-commits mailing list