From a16ae226b685a8c434ec4f7eecf4ee8864fde4c7 Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Wed, 1 Feb 2006 23:05:28 +0000 Subject: use string fields for some stuff in ast_channel const-ify some more APIs remove 'type' field from ast_channel, in favor of the one in the channel's tech structure allow string field module users to specify the 'chunk size' for pool allocations update chan_alsa to be compatible with recent const-ification patches git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@9060 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- res/res_agi.c | 2 +- res/res_features.c | 12 ++++++------ res/res_musiconhold.c | 7 ++++--- 3 files changed, 11 insertions(+), 10 deletions(-) (limited to 'res') diff --git a/res/res_agi.c b/res/res_agi.c index 99f6a1b32..fc36ebb7d 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -341,7 +341,7 @@ static void setup_env(struct ast_channel *chan, char *request, int fd, int enhan fdprintf(fd, "agi_request: %s\n", request); fdprintf(fd, "agi_channel: %s\n", chan->name); fdprintf(fd, "agi_language: %s\n", chan->language); - fdprintf(fd, "agi_type: %s\n", chan->type); + fdprintf(fd, "agi_type: %s\n", chan->tech->type); fdprintf(fd, "agi_uniqueid: %s\n", chan->uniqueid); /* ANI/DNIS */ diff --git a/res/res_features.c b/res/res_features.c index c705b2310..d39212131 100644 --- a/res/res_features.c +++ b/res/res_features.c @@ -174,7 +174,7 @@ static void check_goto_on_transfer(struct ast_channel *chan) for (x = goto_on_transfer; x && *x; x++) if (*x == '^') *x = '|'; - strcpy(xferchan->name, chan->name); + ast_string_field_set(xferchan, name, chan->name); /* Make formats okay */ xferchan->readformat = chan->readformat; xferchan->writeformat = chan->writeformat; @@ -201,9 +201,9 @@ static void *ast_bridge_call_thread(void *data) struct ast_bridge_thread_obj *tobj = data; tobj->chan->appl = "Transferred Call"; - tobj->chan->data = tobj->peer->name; + tobj->chan->data = (char *) tobj->peer->name; tobj->peer->appl = "Transferred Call"; - tobj->peer->data = tobj->chan->name; + tobj->peer->data = (char *) tobj->chan->name; if (tobj->chan->cdr) { ast_cdr_reset(tobj->chan->cdr, NULL); ast_cdr_setdestchan(tobj->chan->cdr, tobj->peer->name); @@ -385,7 +385,7 @@ int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int /* Make a new, fake channel that we'll use to masquerade in the real one */ if ((chan = ast_channel_alloc(0))) { /* Let us keep track of the channel name */ - snprintf(chan->name, sizeof (chan->name), "Parked/%s",rchan->name); + ast_string_field_build(chan, name, "Parked/%s",rchan->name); /* Make formats okay */ chan->readformat = rchan->readformat; @@ -758,7 +758,7 @@ static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, st } if ((xferchan = ast_channel_alloc(0))) { - snprintf(xferchan->name, sizeof (xferchan->name), "Transfered/%s",transferee->name); + ast_string_field_build(xferchan, name, "Transfered/%s", transferee->name); /* Make formats okay */ xferchan->readformat = transferee->readformat; xferchan->writeformat = transferee->writeformat; @@ -1280,7 +1280,7 @@ int ast_bridge_call(struct ast_channel *chan,struct ast_channel *peer,struct ast if (ast_answer(chan)) return -1; peer->appl = "Bridged Call"; - peer->data = chan->name; + peer->data = (char *) chan->name; /* copy the userfield from the B-leg to A-leg if applicable */ if (chan->cdr && peer->cdr && !ast_strlen_zero(peer->cdr->userfield)) { diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c index 7ab065a5c..9b61264bb 100644 --- a/res/res_musiconhold.c +++ b/res/res_musiconhold.c @@ -64,6 +64,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/config.h" #include "asterisk/utils.h" #include "asterisk/cli.h" +#include "asterisk/stringfields.h" #define MAX_MOHFILES 512 #define MAX_MOHFILE_LEN 128 @@ -573,7 +574,7 @@ static int moh2_exec(struct ast_channel *chan, void *data) ast_log(LOG_WARNING, "SetMusicOnHold requires an argument (class)\n"); return -1; } - strncpy(chan->musicclass, data, sizeof(chan->musicclass) - 1); + ast_string_field_set(chan, musicclass, data); return 0; } @@ -595,7 +596,7 @@ static int moh4_exec(struct ast_channel *chan, void *data) return 0; } -static struct mohclass *get_mohbyname(char *name) +static struct mohclass *get_mohbyname(const char *name) { struct mohclass *moh; moh = mohclasses; @@ -862,7 +863,7 @@ static void local_ast_moh_cleanup(struct ast_channel *chan) } } -static int local_ast_moh_start(struct ast_channel *chan, char *class) +static int local_ast_moh_start(struct ast_channel *chan, const char *class) { struct mohclass *mohclass; -- cgit v1.2.3