[asterisk-commits] mmichelson: branch group/asterisk-cpp r168467 - in /team/group/asterisk-cpp: ...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sun Jan 11 21:26:24 CST 2009
Author: mmichelson
Date: Sun Jan 11 21:26:24 2009
New Revision: 168467
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168467
Log:
pbx.c compiles
Modified:
team/group/asterisk-cpp/include/asterisk/channel.h
team/group/asterisk-cpp/include/asterisk/cli.h
team/group/asterisk-cpp/include/asterisk/linkedlists.h
team/group/asterisk-cpp/include/asterisk/pbx.h
team/group/asterisk-cpp/main/cli.c
team/group/asterisk-cpp/main/pbx.c
Modified: team/group/asterisk-cpp/include/asterisk/channel.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/channel.h?view=diff&rev=168467&r1=168466&r2=168467
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/channel.h (original)
+++ team/group/asterisk-cpp/include/asterisk/channel.h Sun Jan 11 21:26:24 2009
@@ -397,6 +397,8 @@
*/
struct ast_channel {
+ /* Dummy constructor so pbx.c compiles for now. Need to initialize all the stringfields to something */
+ ast_channel() : name(NULL), language(NULL), musicclass(NULL), accountcode(NULL), call_forward(NULL), uniqueid(NULL), parkinglot(NULL), dialcontext(NULL) {}
const struct ast_channel_tech *tech; /*!< Technology (point to channel driver) */
void *tech_pvt; /*!< Private data used by the technology driver */
void *music_state; /*!< Music State*/
Modified: team/group/asterisk-cpp/include/asterisk/cli.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/cli.h?view=diff&rev=168467&r1=168466&r2=168467
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/cli.h (original)
+++ team/group/asterisk-cpp/include/asterisk/cli.h Sun Jan 11 21:26:24 2009
@@ -195,7 +195,7 @@
}
\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
Modified: team/group/asterisk-cpp/include/asterisk/linkedlists.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/linkedlists.h?view=diff&rev=168467&r1=168466&r2=168467
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/linkedlists.h (original)
+++ team/group/asterisk-cpp/include/asterisk/linkedlists.h Sun Jan 11 21:26:24 2009
@@ -142,6 +142,7 @@
*/
#define AST_LIST_HEAD(name, type) \
struct name { \
+ name() : first(NULL), last(NULL), lock(AST_MUTEX_INIT_VALUE){} \
struct type *first; \
struct type *last; \
ast_mutex_t lock; \
Modified: team/group/asterisk-cpp/include/asterisk/pbx.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/pbx.h?view=diff&rev=168467&r1=168466&r2=168467
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/pbx.h (original)
+++ team/group/asterisk-cpp/include/asterisk/pbx.h Sun Jan 11 21:26:24 2009
@@ -194,7 +194,7 @@
*
* \return 0 on success, and -1 on 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
Modified: team/group/asterisk-cpp/main/cli.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/main/cli.c?view=diff&rev=168467&r1=168466&r2=168467
==============================================================================
--- team/group/asterisk-cpp/main/cli.c (original)
+++ team/group/asterisk-cpp/main/cli.c Sun Jan 11 21:26:24 2009
@@ -1366,7 +1366,7 @@
* 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);
Modified: team/group/asterisk-cpp/main/pbx.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/main/pbx.c?view=diff&rev=168467&r1=168466&r2=168467
==============================================================================
--- team/group/asterisk-cpp/main/pbx.c (original)
+++ team/group/asterisk-cpp/main/pbx.c Sun Jan 11 21:26:24 2009
@@ -843,7 +843,7 @@
struct ast_ignorepat *ignorepats; /*!< Patterns for which to continue playing dialtone */
char *registrar; /*!< Registrar -- make sure you malloc this, as the registrar may have to survive module unloads */
int refcount; /*!< each module that would have created this context should inc/dec this as appropriate */
- AST_LIST_HEAD_NOLOCK(, ast_sw) alts; /*!< Alternative switches */
+ AST_LIST_HEAD_NOLOCK(alts, ast_sw) alts; /*!< Alternative switches */
ast_mutex_t macrolock; /*!< A lock to implement "exclusive" macros - held whilst a call is executing in the macro */
char name[0]; /*!< Name of the context */
};
@@ -881,7 +881,7 @@
struct ast_hint {
struct ast_exten *exten; /*!< Extension */
int laststate; /*!< Last known state */
- AST_LIST_HEAD_NOLOCK(, ast_state_cb) callbacks; /*!< Callback list for this extension */
+ AST_LIST_HEAD_NOLOCK(callbacks, ast_state_cb) callbacks; /*!< Callback list for this extension */
AST_RWLIST_ENTRY(ast_hint) list;/*!< Pointer to next hint in list */
};
@@ -1051,7 +1051,7 @@
AST_RWLOCK_DEFINE_STATIC(globalslock);
-static struct varshead globals = AST_LIST_HEAD_NOLOCK_INIT_VALUE;
+static struct varshead globals;
static int autofallthrough = 1;
static int extenpatternmatchnew = 0;
@@ -1307,7 +1307,7 @@
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 */
+ const char *data) /*!< Data for execution */
{
int res;
struct ast_module_user *u = NULL;
@@ -1317,7 +1317,7 @@
char empty_str[] = "";
if (c->cdr && !ast_check_hangup(c))
- ast_cdr_setapp(c->cdr, app->name, (const char *) data);
+ ast_cdr_setapp(c->cdr, app->name, data);
/* save channel values */
saved_c_appl= c->appl;
@@ -1502,7 +1502,7 @@
log_match_char_tree(node->alt_char, prefix);
}
-static void cli_match_char_tree(struct match_char *node, char *prefix, int fd)
+static void cli_match_char_tree(struct match_char *node, const char *prefix, int fd)
{
char extenstr[40];
struct ast_str *my_prefix = ast_str_alloca(1024);
@@ -2373,7 +2373,7 @@
struct ast_ignorepat *ignorepats;
const char *registrar;
int refcount;
- AST_LIST_HEAD_NOLOCK(, ast_sw) alts;
+ AST_LIST_HEAD_NOLOCK(alts, ast_sw) alts;
ast_mutex_t macrolock;
char name[256];
};
@@ -5368,7 +5368,7 @@
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 const* choices[] = { "like", "describing", NULL };
+ static const char * const choices[] = { "like", "describing", NULL };
switch (cmd) {
case CLI_INIT:
@@ -6295,7 +6295,7 @@
if (!extcontexts) {
ast_rdlock_contexts();
local_contexts = &contexts;
- tmp = ast_hashtab_lookup(contexts_table, &search);
+ tmp = (struct ast_context *) ast_hashtab_lookup(contexts_table, &search);
ast_unlock_contexts();
if (tmp) {
tmp->refcount++;
@@ -6303,14 +6303,14 @@
}
} else { /* local contexts just in a linked list; search there for the new context; slow, linear search, but not frequent */
local_contexts = extcontexts;
- tmp = ast_hashtab_lookup(exttable, &search);
+ tmp = (struct ast_context *) ast_hashtab_lookup(exttable, &search);
if (tmp) {
tmp->refcount++;
return tmp;
}
}
- if ((tmp = ast_calloc(1, length))) {
+ if ((tmp = (struct ast_context *) ast_calloc(1, length))) {
ast_rwlock_init(&tmp->lock);
ast_mutex_init(&tmp->macrolock);
strcpy(tmp->name, name);
@@ -6350,7 +6350,7 @@
struct store_hint {
char *context;
char *exten;
- AST_LIST_HEAD_NOLOCK(, ast_state_cb) callbacks;
+ AST_LIST_HEAD_NOLOCK(callbacks, ast_state_cb) callbacks;
int laststate;
AST_LIST_ENTRY(store_hint) list;
char data[1];
@@ -6358,33 +6358,33 @@
AST_LIST_HEAD(store_hints, store_hint);
-static void context_merge_incls_swits_igps_other_registrars(struct ast_context *new, struct ast_context *old, const char *registrar)
+static void context_merge_incls_swits_igps_other_registrars(struct ast_context *new_context, struct ast_context *old, const char *registrar)
{
struct ast_include *i;
struct ast_ignorepat *ip;
struct ast_sw *sw;
- ast_verb(3, "merging incls/swits/igpats from old(%s) to new(%s) context, registrar = %s\n", ast_get_context_name(old), ast_get_context_name(new), registrar);
+ ast_verb(3, "merging incls/swits/igpats from old(%s) to new(%s) context, registrar = %s\n", ast_get_context_name(old), ast_get_context_name(new_context), registrar);
/* copy in the includes, switches, and ignorepats */
/* walk through includes */
for (i = NULL; (i = ast_walk_context_includes(old, i)) ; ) {
if (strcmp(ast_get_include_registrar(i), registrar) == 0)
continue; /* not mine */
- ast_context_add_include2(new, ast_get_include_name(i), ast_get_include_registrar(i));
+ ast_context_add_include2(new_context, ast_get_include_name(i), ast_get_include_registrar(i));
}
/* walk through switches */
for (sw = NULL; (sw = ast_walk_context_switches(old, sw)) ; ) {
if (strcmp(ast_get_switch_registrar(sw), registrar) == 0)
continue; /* not mine */
- ast_context_add_switch2(new, ast_get_switch_name(sw), ast_get_switch_data(sw), ast_get_switch_eval(sw), ast_get_switch_registrar(sw));
+ ast_context_add_switch2(new_context, ast_get_switch_name(sw), ast_get_switch_data(sw), ast_get_switch_eval(sw), ast_get_switch_registrar(sw));
}
/* walk thru ignorepats ... */
for (ip = NULL; (ip = ast_walk_context_ignorepats(old, ip)); ) {
if (strcmp(ast_get_ignorepat_registrar(ip), registrar) == 0)
continue; /* not mine */
- ast_context_add_ignorepat2(new, ast_get_ignorepat_name(ip), ast_get_ignorepat_registrar(ip));
+ ast_context_add_ignorepat2(new_context, ast_get_ignorepat_name(ip), ast_get_ignorepat_registrar(ip));
}
}
@@ -6393,7 +6393,7 @@
except for any extens that have a matching registrar */
static void context_merge(struct ast_context **extcontexts, struct ast_hashtab *exttable, struct ast_context *context, const char *registrar)
{
- struct ast_context *new = ast_hashtab_lookup(exttable, context); /* is there a match in the new set? */
+ struct ast_context *new_context = (struct ast_context *) ast_hashtab_lookup(exttable, context); /* is there a match in the new set? */
struct ast_exten *exten_item, *prio_item, *new_exten_item, *new_prio_item;
struct ast_hashtab_iter *exten_iter;
struct ast_hashtab_iter *prio_iter;
@@ -6407,19 +6407,19 @@
if (context->root_table) {
exten_iter = ast_hashtab_start_traversal(context->root_table);
- while ((exten_item=ast_hashtab_next(exten_iter))) {
- if (new) {
- new_exten_item = ast_hashtab_lookup(new->root_table, exten_item);
+ while ((exten_item = (struct ast_exten *) ast_hashtab_next(exten_iter))) {
+ if (new_context) {
+ new_exten_item = (struct ast_exten *) ast_hashtab_lookup(new_context->root_table, exten_item);
} else {
new_exten_item = NULL;
}
prio_iter = ast_hashtab_start_traversal(exten_item->peer_table);
- while ((prio_item=ast_hashtab_next(prio_iter))) {
+ while ((prio_item = (struct ast_exten *) ast_hashtab_next(prio_iter))) {
int res1;
char *dupdstr;
if (new_exten_item) {
- new_prio_item = ast_hashtab_lookup(new_exten_item->peer_table, prio_item);
+ new_prio_item = (struct ast_exten *) ast_hashtab_lookup(new_exten_item->peer_table, prio_item);
} else {
new_prio_item = NULL;
}
@@ -6427,17 +6427,17 @@
continue;
}
/* make sure the new context exists, so we have somewhere to stick this exten/prio */
- if (!new) {
- new = ast_context_find_or_create(extcontexts, exttable, context->name, prio_item->registrar); /* a new context created via priority from a different context in the old dialplan, gets its registrar from the prio's registrar */
+ if (!new_context) {
+ new_context = ast_context_find_or_create(extcontexts, exttable, context->name, prio_item->registrar); /* a new context created via priority from a different context in the old dialplan, gets its registrar from the prio's registrar */
}
/* copy in the includes, switches, and ignorepats */
if (first) { /* but, only need to do this once */
- context_merge_incls_swits_igps_other_registrars(new, context, registrar);
+ context_merge_incls_swits_igps_other_registrars(new_context, context, registrar);
first = 0;
}
- if (!new) {
+ if (!new_context) {
ast_log(LOG_ERROR,"Could not allocate a new context for %s in merge_and_delete! Danger!\n", context->name);
return; /* no sense continuing. */
}
@@ -6446,7 +6446,7 @@
dupdstr = ast_strdup(prio_item->data);
- res1 = ast_add_extension2(new, 0, prio_item->exten, prio_item->priority, prio_item->label,
+ res1 = ast_add_extension2(new_context, 0, prio_item->exten, prio_item->priority, prio_item->label,
prio_item->cidmatch, prio_item->app, dupdstr, prio_item->datad, prio_item->registrar);
if (!res1 && new_exten_item && new_prio_item){
ast_verb(3,"Dropping old dialplan item %s/%s/%d [%s(%s)] (registrar=%s) due to conflict with new dialplan\n",
@@ -6462,14 +6462,14 @@
ast_hashtab_end_traversal(exten_iter);
}
- if (!insert_count && !new && (strcmp(context->registrar, registrar) != 0 ||
+ if (!insert_count && !new_context && (strcmp(context->registrar, registrar) != 0 ||
(strcmp(context->registrar, registrar) == 0 && context->refcount > 1))) {
/* we could have given it the registrar of the other module who incremented the refcount,
but that's not available, so we give it the registrar we know about */
- new = ast_context_find_or_create(extcontexts, exttable, context->name, context->registrar);
+ new_context = ast_context_find_or_create(extcontexts, exttable, context->name, context->registrar);
/* copy in the includes, switches, and ignorepats */
- context_merge_incls_swits_igps_other_registrars(new, context, registrar);
+ context_merge_incls_swits_igps_other_registrars(new_context, context, registrar);
}
}
@@ -6480,8 +6480,8 @@
double ft;
struct ast_context *tmp, *oldcontextslist;
struct ast_hashtab *oldtable;
- struct store_hints store = AST_LIST_HEAD_INIT_VALUE;
- struct store_hint *this;
+ struct store_hints store;
+ struct store_hint *this_hint;
struct ast_hint *hint;
struct ast_exten *exten;
int length;
@@ -6503,7 +6503,7 @@
begintime = ast_tvnow();
ast_rdlock_contexts();
iter = ast_hashtab_start_traversal(contexts_table);
- while ((tmp = ast_hashtab_next(iter))) {
+ while ((tmp = (struct ast_context *) ast_hashtab_next(iter))) {
context_merge(extcontexts, exttable, tmp, registrar);
}
ast_hashtab_end_traversal(iter);
@@ -6523,16 +6523,16 @@
/* preserve all watchers for hints associated with this registrar */
AST_RWLIST_TRAVERSE(&hints, hint, list) {
if (!AST_LIST_EMPTY(&hint->callbacks) && !strcmp(registrar, hint->exten->parent->registrar)) {
- length = strlen(hint->exten->exten) + strlen(hint->exten->parent->name) + 2 + sizeof(*this);
- if (!(this = ast_calloc(1, length)))
+ length = strlen(hint->exten->exten) + strlen(hint->exten->parent->name) + 2 + sizeof(*this_hint);
+ if (!(this_hint = (struct store_hint *) ast_calloc(1, length)))
continue;
- AST_LIST_APPEND_LIST(&this->callbacks, &hint->callbacks, entry);
- this->laststate = hint->laststate;
- this->context = this->data;
- strcpy(this->data, hint->exten->parent->name);
- this->exten = this->data + strlen(this->context) + 1;
- strcpy(this->exten, hint->exten->exten);
- AST_LIST_INSERT_HEAD(&store, this, list);
+ AST_LIST_APPEND_LIST(&this_hint->callbacks, &hint->callbacks, entry);
+ this_hint->laststate = hint->laststate;
+ this_hint->context = this_hint->data;
+ strcpy(this_hint->data, hint->exten->parent->name);
+ this_hint->exten = this_hint->data + strlen(this_hint->context) + 1;
+ strcpy(this_hint->exten, hint->exten->exten);
+ AST_LIST_INSERT_HEAD(&store, this_hint, list);
}
}
@@ -6547,18 +6547,19 @@
/* restore the watchers for hints that can be found; notify those that
cannot be restored
*/
- while ((this = AST_LIST_REMOVE_HEAD(&store, list))) {
- struct pbx_find_info q = { .stacklen = 0 };
- exten = pbx_find_extension(NULL, NULL, &q, this->context, this->exten, PRIORITY_HINT, NULL, "", E_MATCH);
+ while ((this_hint = AST_LIST_REMOVE_HEAD(&store, list))) {
+ struct pbx_find_info q;
+ memset(&q, 0, sizeof(q));
+ exten = pbx_find_extension(NULL, NULL, &q, this_hint->context, this_hint->exten, PRIORITY_HINT, NULL, "", E_MATCH);
/* If this is a pattern, dynamically create a new extension for this
* particular match. Note that this will only happen once for each
* individual extension, because the pattern will no longer match first.
*/
if (exten && exten->exten[0] == '_') {
- ast_add_extension(exten->parent->name, 0, this->exten, PRIORITY_HINT, NULL,
+ ast_add_extension(exten->parent->name, 0, this_hint->exten, PRIORITY_HINT, NULL,
0, exten->app, ast_strdup(exten->data), ast_free_ptr, registrar);
/* rwlocks are not recursive locks */
- exten = ast_hint_extension_nolock(NULL, this->context, this->exten);
+ exten = ast_hint_extension_nolock(NULL, this_hint->context, this_hint->exten);
}
/* Find the hint in the list of hints */
@@ -6568,15 +6569,15 @@
}
if (!exten || !hint) {
/* this hint has been removed, notify the watchers */
- while ((thiscb = AST_LIST_REMOVE_HEAD(&this->callbacks, entry))) {
- thiscb->callback(this->context, this->exten, AST_EXTENSION_REMOVED, thiscb->data);
+ while ((thiscb = AST_LIST_REMOVE_HEAD(&this_hint->callbacks, entry))) {
+ thiscb->callback(this_hint->context, this_hint->exten, AST_EXTENSION_REMOVED, (void *) thiscb->data);
ast_free(thiscb);
}
} else {
- AST_LIST_APPEND_LIST(&hint->callbacks, &this->callbacks, entry);
- hint->laststate = this->laststate;
- }
- ast_free(this);
+ AST_LIST_APPEND_LIST(&hint->callbacks, &this_hint->callbacks, entry);
+ hint->laststate = this_hint->laststate;
+ }
+ ast_free(this_hint);
}
AST_RWLIST_UNLOCK(&hints);
@@ -6635,7 +6636,7 @@
* 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 *names[], int max)
{
int i;
@@ -6658,7 +6659,7 @@
/*! \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 *names[], const char *msg)
{
int start, end; /* start and ending position */
unsigned int mask = 0;
@@ -6762,7 +6763,7 @@
return;
}
-static char *days[] =
+static const char *days[] =
{
"sun",
"mon",
@@ -6774,7 +6775,7 @@
NULL,
};
-static char *months[] =
+static const char *months[] =
{
"jan",
"feb",
@@ -6897,7 +6898,7 @@
length += 2 * (strlen(value) + 1);
/* allocate new include structure ... */
- if (!(new_include = ast_calloc(1, length)))
+ if (!(new_include = (struct ast_include *) ast_calloc(1, length)))
return -1;
/* Fill in this structure. Use 'p' for assignments, as the fields
* in the structure are 'const char *'
@@ -6981,7 +6982,7 @@
length++;
/* allocate new sw structure ... */
- if (!(new_sw = ast_calloc(1, length)))
+ if (!(new_sw = (struct ast_sw *) ast_calloc(1, length)))
return -1;
/* ... fill in this structure ... */
p = new_sw->stuff;
@@ -7088,7 +7089,7 @@
char *pattern;
length = sizeof(struct ast_ignorepat);
length += strlen(value) + 1;
- if (!(ignorepat = ast_calloc(1, length)))
+ if (!(ignorepat = (struct ast_ignorepat *) ast_calloc(1, length)))
return -1;
/* The cast to char * is because we need to write the initial value.
* The field is not supposed to be modified otherwise. Also, gcc 4.2
@@ -7298,7 +7299,7 @@
if (!replace) {
ast_log(LOG_WARNING, "Unable to register extension '%s', priority %d in '%s', already in use\n", tmp->exten, tmp->priority, con->name);
if (tmp->datad) {
- tmp->datad(tmp->data);
+ tmp->datad((void *) tmp->data);
/* if you free this, null it out */
tmp->data = NULL;
}
@@ -7381,7 +7382,7 @@
ast_change_hint(e,tmp);
/* Destroy the old one */
if (e->datad)
- e->datad(e->data);
+ e->datad((void *) e->data);
ast_free(e);
} else { /* Slip ourselves in just before e */
tmp->peer = e;
@@ -7468,7 +7469,8 @@
/* If we are adding a hint evalulate in variables and global variables */
if (priority == PRIORITY_HINT && strstr(application, "${") && !strstr(extension, "_")) {
- struct ast_channel c = {0, };
+ struct ast_channel c;
+ memset(&c, 0, sizeof(c));
ast_copy_string(c.exten, extension, sizeof(c.exten));
ast_copy_string(c.context, con->name, sizeof(c.context));
@@ -7487,7 +7489,7 @@
length ++; /* just the '\0' */
/* Be optimistic: Build the extension structure first */
- if (!(tmp = ast_calloc(1, length)))
+ if (!(tmp = (struct ast_exten *) ast_calloc(1, length)))
return -1;
if (ast_strlen_zero(label)) /* let's turn empty labels to a null ptr */
@@ -7514,7 +7516,7 @@
tmp->app = p;
strcpy(p, application);
tmp->parent = con;
- tmp->data = data;
+ tmp->data = (const char *) data;
tmp->datad = datad;
tmp->registrar = registrar;
@@ -7526,7 +7528,7 @@
dummy_exten.exten = dummy_name;
dummy_exten.matchcid = 0;
dummy_exten.cidmatch = 0;
- tmp2 = ast_hashtab_lookup(con->root_table, &dummy_exten);
+ tmp2 = (struct ast_exten *) ast_hashtab_lookup(con->root_table, &dummy_exten);
if (!tmp2) {
/* hmmm, not in the trie; */
add_exten_to_pattern_tree(con, tmp, 0);
@@ -7646,7 +7648,7 @@
static void *async_wait(void *data)
{
- struct async_stat *as = data;
+ struct async_stat *as = (struct async_stat *) data;
struct ast_channel *chan = as->chan;
int timeout = as->timeout;
int res;
@@ -7834,7 +7836,7 @@
}
}
} else {
- if (!(as = ast_calloc(1, sizeof(*as)))) {
+ if (!(as = (struct async_stat *) ast_calloc(1, sizeof(*as)))) {
res = -1;
goto outgoing_exten_cleanup;
}
@@ -7884,7 +7886,7 @@
/*! \brief run the application and free the descriptor once done */
static void *ast_pbx_run_app(void *data)
{
- struct app_tmp *tmp = data;
+ struct app_tmp *tmp = (struct app_tmp *) data;
struct ast_app *app;
app = pbx_findapp(tmp->app);
if (app) {
@@ -7923,7 +7925,7 @@
if (chan->_state == AST_STATE_UP) {
res = 0;
ast_verb(4, "Channel %s was answered.\n", chan->name);
- tmp = ast_calloc(1, sizeof(*tmp));
+ tmp = (struct app_tmp *) ast_calloc(1, sizeof(*tmp));
if (!tmp)
res = -1;
else {
@@ -7976,7 +7978,7 @@
} else {
struct async_stat *as;
- if (!(as = ast_calloc(1, sizeof(*as)))) {
+ if (!(as = (struct async_stat *) ast_calloc(1, sizeof(*as)))) {
res = -1;
goto outgoing_app_cleanup;
}
@@ -8146,9 +8148,9 @@
if (tmp->root_table) { /* it is entirely possible that the context is EMPTY */
exten_iter = ast_hashtab_start_traversal(tmp->root_table);
- while ((exten_item=ast_hashtab_next(exten_iter))) {
+ while ((exten_item = (struct ast_exten *) ast_hashtab_next(exten_iter))) {
prio_iter = ast_hashtab_start_traversal(exten_item->peer_table);
- while ((prio_item=ast_hashtab_next(prio_iter))) {
+ while ((prio_item = (struct ast_exten *) ast_hashtab_next(prio_iter))) {
if (!prio_item->registrar || strcmp(prio_item->registrar, registrar) != 0) {
continue;
}
@@ -8220,7 +8222,7 @@
double waitsec;
int waittime;
- if (ast_strlen_zero(data) || (sscanf(data, "%lg", &waitsec) != 1) || (waitsec < 0))
+ if (ast_strlen_zero((const char *)data) || (sscanf((char *)data, "%lg", &waitsec) != 1) || (waitsec < 0.0))
waitsec = -1;
if (waitsec > -1) {
waittime = waitsec * 1000.0;
@@ -8272,7 +8274,7 @@
busy in audio */
if (chan->_state != AST_STATE_UP)
ast_setstate(chan, AST_STATE_BUSY);
- wait_for_hangup(chan, data);
+ wait_for_hangup(chan, (void *) data);
return -1;
}
@@ -8286,7 +8288,7 @@
congestion in audio */
if (chan->_state != AST_STATE_UP)
ast_setstate(chan, AST_STATE_BUSY);
- wait_for_hangup(chan, data);
+ wait_for_hangup(chan, (void *)data);
return -1;
}
@@ -8309,7 +8311,7 @@
static int pbx_builtin_incomplete(struct ast_channel *chan, const char *data)
{
- char *options = data;
+ char *options = (char *) data;
int answer = 1;
/* Some channels can receive DTMF in unanswered state; some cannot */
@@ -8344,7 +8346,7 @@
if (!ast_strlen_zero(data)) {
args = ast_strdupa(data);
- ast_app_parse_options(resetcdr_opts, &flags, NULL, args);
+ ast_app_parse_options(resetcdr_opts, ARRAY_LEN(resetcdr_opts), &flags, NULL, args);
}
ast_cdr_reset(chan->cdr, &flags);
@@ -8519,7 +8521,7 @@
memset(&args, 0, sizeof(args));
if (args.options)
- ast_app_parse_options(waitexten_opts, &flags, opts, args.options);
+ ast_app_parse_options(waitexten_opts, ARRAY_LEN(waitexten_opts), &flags, opts, args.options);
if (ast_test_flag(&flags, WAITEXTEN_MOH) && !opts[0] ) {
ast_log(LOG_WARNING, "The 'm' option has been specified for WaitExten without a class.\n");
@@ -8601,7 +8603,7 @@
else if (!strcasecmp(args.options, "noanswer"))
flags.flags = BACKGROUND_NOANSWER;
else
- ast_app_parse_options(background_opts, &flags, NULL, args.options);
+ ast_app_parse_options(background_opts, ARRAY_LEN(background_opts), &flags, NULL, args.options);
}
/* Answer if need be */
@@ -8845,7 +8847,7 @@
int pbx_builtin_setvar_multiple(struct ast_channel *chan, const char *vdata)
{
char *data;
- int x;
+ size_t x;
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(pair)[24];
);
@@ -8902,7 +8904,7 @@
if (channel && value && name) { /*! \todo XXX should do !ast_strlen_zero(..) of the args ? */
struct ast_channel *chan2 = ast_get_channel_by_name_locked(channel);
if (chan2) {
- char *s = alloca(strlen(value) + 4);
+ char *s = (char *) alloca(strlen(value) + 4);
if (s) {
sprintf(s, "${%s}", value);
pbx_substitute_variables_helper(chan2, s, tmp, sizeof(tmp) - 1);
@@ -9032,7 +9034,7 @@
return;
}
- if (!(sc = ast_calloc(1, sizeof(*sc) + strlen(device) + 1)))
+ if (!(sc = (struct statechange *) ast_calloc(1, sizeof(*sc) + strlen(device) + 1)))
return;
strcpy(sc->dev, device);
if (ast_taskprocessor_push(device_state_tps, handle_statechange, sc) < 0) {
@@ -9042,11 +9044,11 @@
int load_pbx(void)
{
- int x;
+ size_t x;
/* Initialize the PBX */
ast_verb(1, "Asterisk PBX Core Initializing\n");
- if (!(device_state_tps = ast_taskprocessor_get("pbx-core", 0))) {
+ if (!(device_state_tps = ast_taskprocessor_get("pbx-core", (enum ast_tps_options) 0))) {
ast_log(LOG_WARNING, "failed to create pbx-core taskprocessor\n");
}
More information about the asterisk-commits
mailing list