[asterisk-commits] russell: branch group/asterisk-cpp r168395 - in /team/group/asterisk-cpp: inc...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Sat Jan 10 17:44:38 CST 2009
Author: russell
Date: Sat Jan 10 17:44:38 2009
New Revision: 168395
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168395
Log:
Fix a lot of warnings in features.c, next is the AST_APP_OPTION stuff
Modified:
team/group/asterisk-cpp/include/asterisk/features.h
team/group/asterisk-cpp/main/features.c
Modified: team/group/asterisk-cpp/include/asterisk/features.h
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/include/asterisk/features.h?view=diff&rev=168395&r1=168394&r2=168395
==============================================================================
--- team/group/asterisk-cpp/include/asterisk/features.h (original)
+++ team/group/asterisk-cpp/include/asterisk/features.h Sat Jan 10 17:44:38 2009
@@ -49,7 +49,7 @@
struct ast_call_feature {
int feature_mask;
- char *fname;
+ const char *fname;
char sname[FEATURE_SNAME_LEN];
char exten[FEATURE_MAX_LEN];
char default_exten[FEATURE_MAX_LEN];
Modified: team/group/asterisk-cpp/main/features.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/asterisk-cpp/main/features.c?view=diff&rev=168395&r1=168394&r2=168395
==============================================================================
--- team/group/asterisk-cpp/main/features.c (original)
+++ team/group/asterisk-cpp/main/features.c Sat Jan 10 17:44:38 2009
@@ -185,7 +185,7 @@
static AST_RWLIST_HEAD_STATIC(feature_groups, feature_group);
-static char *parkedcall = "ParkedCall";
+static const char parkedcall[] = "ParkedCall";
static char pickup_ext[AST_MAX_EXTENSION]; /*!< Call pickup extension */
@@ -247,10 +247,10 @@
static unsigned int atxferloopdelay;
static unsigned int atxfercallbackretries;
-static char *registrar = "features"; /*!< Registrar for operations */
+static const char registrar[] = "features"; /*!< Registrar for operations */
/* module and CLI command definitions */
-static char *parkcall = PARK_APP_NAME;
+static const char parkcall[] = PARK_APP_NAME;
static struct ast_app *monitor_app = NULL;
static int monitor_ok = 1;
@@ -291,14 +291,15 @@
static int parkinglot_hash_cb(const void *obj, const int flags)
{
- const struct ast_parkinglot *parkinglot = obj;
+ const struct ast_parkinglot *parkinglot = (const struct ast_parkinglot *) obj;
return ast_str_case_hash(parkinglot->name);
}
static int parkinglot_cmp_cb(void *obj, void *arg, int flags)
{
- struct ast_parkinglot *parkinglot = obj, *parkinglot2 = arg;
+ struct ast_parkinglot *parkinglot = (struct ast_parkinglot *) obj;
+ struct ast_parkinglot *parkinglot2 = (struct ast_parkinglot *) arg;
return !strcasecmp(parkinglot->name, parkinglot2->name) ? CMP_MATCH | CMP_STOP : 0;
}
@@ -370,7 +371,7 @@
*/
static void *ast_bridge_call_thread(void *data)
{
- struct ast_bridge_thread_obj *tobj = data;
+ struct ast_bridge_thread_obj *tobj = (struct ast_bridge_thread_obj *) data;
int res;
tobj->chan->appl = !tobj->return_to_pbx ? "Transferred Call" : "ManagerBridge";
@@ -547,7 +548,7 @@
ast_log(LOG_DEBUG, "Parkinglot: %s\n", parkinglot->name);
/* Allocate memory for parking data */
- if (!(pu = ast_calloc(1, sizeof(*pu)))) {
+ if (!(pu = (struct parkeduser *) ast_calloc(1, sizeof(*pu)))) {
parkinglot_unref(parkinglot);
return -1;
}
@@ -724,10 +725,10 @@
/*! \brief Park a call */
int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout)
{
- struct ast_park_call_args args = {
- .timeout = timeout,
- .extout = extout,
- };
+ struct ast_park_call_args args = { 0, };
+
+ args.timeout = timeout;
+ args.extout = extout;
return ast_park_call_full(chan, peer, &args);
}
@@ -762,11 +763,11 @@
}
{
- struct ast_park_call_args args = {
- .timeout = timeout,
- .extout = extout,
- .orig_chan_name = orig_chan_name,
- };
+ struct ast_park_call_args args = { 0, };
+
+ args.timeout = timeout;
+ args.extout = extout;
+ args.orig_chan_name = orig_chan_name;
park_status = ast_park_call_full(chan, peer, &args);
if (park_status == 1) {
@@ -899,7 +900,6 @@
static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data)
{
char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL, *touch_filename = NULL;
- int x = 0;
size_t len;
struct ast_channel *caller_chan, *callee_chan;
const char *automon_message_start = NULL;
@@ -953,21 +953,21 @@
if (touch_monitor) {
len = strlen(touch_monitor) + 50;
- args = alloca(len);
- touch_filename = alloca(len);
+ args = (char *) alloca(len);
+ touch_filename = (char *) alloca(len);
snprintf(touch_filename, len, "%s-%ld-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), touch_monitor);
snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename);
} else {
caller_chan_id = ast_strdupa(S_OR(caller_chan->cid.cid_num, caller_chan->name));
callee_chan_id = ast_strdupa(S_OR(callee_chan->cid.cid_num, callee_chan->name));
len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50;
- args = alloca(len);
- touch_filename = alloca(len);
+ args = (char *) alloca(len);
+ touch_filename = (char *) alloca(len);
snprintf(touch_filename, len, "%s-%ld-%s-%s", S_OR(touch_monitor_prefix, "auto"), (long)time(NULL), caller_chan_id, callee_chan_id);
snprintf(args, len, "%s,%s,m", S_OR(touch_format, "wav"), touch_filename);
}
- for(x = 0; x < strlen(args); x++) {
+ for (unsigned int x = 0; x < strlen(args); x++) {
if (args[x] == '/')
args[x] = '-';
}
@@ -992,7 +992,6 @@
static int builtin_automixmonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data)
{
char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL, *touch_filename = NULL;
- int x = 0;
size_t len;
struct ast_channel *caller_chan, *callee_chan;
const char *mixmonitor_spy_type = "MixMonitor";
@@ -1046,7 +1045,7 @@
ast_log(LOG_ERROR,"Cannot stop recording the call. The stopmixmonitor application is disabled.\n");
return -1;
} else {
- pbx_exec(callee_chan, stopmixmonitor_app, "");
+ pbx_exec(callee_chan, stopmixmonitor_app, (void *) "");
return AST_FEATURE_RETURN_SUCCESS;
}
}
@@ -1066,21 +1065,21 @@
if (touch_monitor) {
len = strlen(touch_monitor) + 50;
- args = alloca(len);
- touch_filename = alloca(len);
+ args = (char *) alloca(len);
+ touch_filename = (char *) alloca(len);
snprintf(touch_filename, len, "auto-%ld-%s", (long)time(NULL), touch_monitor);
snprintf(args, len, "%s.%s,b", touch_filename, (touch_format) ? touch_format : "wav");
} else {
caller_chan_id = ast_strdupa(S_OR(caller_chan->cid.cid_num, caller_chan->name));
callee_chan_id = ast_strdupa(S_OR(callee_chan->cid.cid_num, callee_chan->name));
len = strlen(caller_chan_id) + strlen(callee_chan_id) + 50;
- args = alloca(len);
- touch_filename = alloca(len);
+ args = (char *) alloca(len);
+ touch_filename = (char *) alloca(len);
snprintf(touch_filename, len, "auto-%ld-%s-%s", (long)time(NULL), caller_chan_id, callee_chan_id);
snprintf(args, len, "%s.%s,b", touch_filename, S_OR(touch_format, "wav"));
}
- for( x = 0; x < strlen(args); x++) {
+ for (unsigned int x = 0; x < strlen(args); x++) {
if (args[x] == '/')
args[x] = '-';
}
@@ -1408,7 +1407,7 @@
newchan->_state = AST_STATE_UP;
ast_clear_flag(newchan, AST_FLAGS_ALL);
newchan->_softhangup = 0;
- if (!(tobj = ast_calloc(1, sizeof(*tobj)))) {
+ if (!(tobj = (struct ast_bridge_thread_obj *) ast_calloc(1, sizeof(*tobj)))) {
ast_hangup(xferchan);
ast_hangup(newchan);
return -1;
@@ -1509,7 +1508,7 @@
newchan->_state = AST_STATE_UP;
ast_clear_flag(newchan, AST_FLAGS_ALL);
newchan->_softhangup = 0;
- if (!(tobj = ast_calloc(1, sizeof(*tobj)))) {
+ if (!(tobj = (struct ast_bridge_thread_obj *) ast_calloc(1, sizeof(*tobj)))) {
ast_hangup(xferchan);
ast_hangup(newchan);
return -1;
@@ -1582,7 +1581,7 @@
return NULL;
}
- if (!(fg = ast_calloc(1, sizeof(*fg))))
+ if (!(fg = (struct feature_group *) ast_calloc(1, sizeof(*fg))))
return NULL;
if (ast_string_field_init(fg, 128)) {
@@ -1622,7 +1621,7 @@
return;
}
- if (!(fge = ast_calloc(1, sizeof(*fge))))
+ if (!(fge = (struct feature_group_exten *) ast_calloc(1, sizeof(*fge))))
return;
if (ast_string_field_init(fge, 128)) {
@@ -1727,8 +1726,7 @@
struct ast_call_feature *ast_find_call_feature(const char *name)
{
- int x;
- for (x = 0; x < FEATURES_COUNT; x++) {
+ for (unsigned int x = 0; x < FEATURES_COUNT; x++) {
if (!strcasecmp(name, builtin_features[x].sname))
return &builtin_features[x];
}
@@ -1747,7 +1745,7 @@
static int feature_exec_app(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense, void *data)
{
struct ast_app *app;
- struct ast_call_feature *feature = data;
+ struct ast_call_feature *feature = (struct ast_call_feature *) data;
struct ast_channel *work, *idle;
int res;
@@ -1803,20 +1801,18 @@
static void unmap_features(void)
{
- int x;
-
ast_rwlock_wrlock(&features_lock);
- for (x = 0; x < FEATURES_COUNT; x++)
+ for (unsigned int x = 0; x < FEATURES_COUNT; x++)
strcpy(builtin_features[x].exten, builtin_features[x].default_exten);
ast_rwlock_unlock(&features_lock);
}
static int remap_feature(const char *name, const char *value)
{
- int x, res = -1;
+ int res = -1;
ast_rwlock_wrlock(&features_lock);
- for (x = 0; x < FEATURES_COUNT; x++) {
+ for (unsigned int x = 0; x < FEATURES_COUNT; x++) {
if (strcasecmp(builtin_features[x].sname, name))
continue;
@@ -1839,7 +1835,6 @@
*/
static int ast_feature_interpret(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
{
- int x;
struct ast_flags features;
struct ast_call_feature *feature;
struct feature_group *fg = NULL;
@@ -1860,7 +1855,7 @@
ast_debug(3, "Feature interpret: chan=%s, peer=%s, code=%s, sense=%d, features=%d, dynamic=%s\n", chan->name, peer->name, code, sense, features.flags, dynamic_features);
ast_rwlock_rdlock(&features_lock);
- for (x = 0; x < FEATURES_COUNT; x++) {
+ for (unsigned int x = 0; x < FEATURES_COUNT; x++) {
if ((ast_test_flag(&features, builtin_features[x].feature_mask)) &&
!ast_strlen_zero(builtin_features[x].exten)) {
/* Feature is up for consideration */
@@ -1931,12 +1926,10 @@
static void set_config_flags(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config)
{
- int x;
-
ast_clear_flag(config, AST_FLAGS_ALL);
ast_rwlock_rdlock(&features_lock);
- for (x = 0; x < FEATURES_COUNT; x++) {
+ for (unsigned int x = 0; x < FEATURES_COUNT; x++) {
if (!ast_test_flag(builtin_features + x, AST_FEATURE_FLAG_NEEDSDTMF))
continue;
@@ -1992,7 +1985,8 @@
struct ast_channel *active_channel;
int res = 0, ready = 0;
struct timeval started;
- int x, len = 0;
+ int len = 0;
+ unsigned int x;
char *disconnect_code = NULL, *dialed_code = NULL;
if (!(chan = ast_request(type, format, data, &cause))) {
@@ -2013,7 +2007,7 @@
ast_channel_inherit_variables(caller, chan);
pbx_builtin_setvar_helper(chan, "TRANSFERERNAME", caller->name);
- if (ast_call(chan, data, timeout)) {
+ if (ast_call(chan, (char *) data, timeout)) {
ast_log(LOG_NOTICE, "Unable to call channel %s/%s\n", type, (char *)data);
goto done;
}
@@ -2027,7 +2021,7 @@
disconnect_code = builtin_features[x].exten;
len = strlen(disconnect_code) + 1;
- dialed_code = alloca(len);
+ dialed_code = (char *) alloca(len);
memset(dialed_code, 0, len);
break;
}
@@ -2106,7 +2100,7 @@
if (f->frametype == AST_FRAME_DTMF) {
dialed_code[x++] = f->subclass;
dialed_code[x] = '\0';
- if (strlen(dialed_code) == len) {
+ if ((int) strlen(dialed_code) == len) {
x = 0;
} else if (x && strncmp(dialed_code, disconnect_code, x)) {
x = 0;
@@ -2380,7 +2374,7 @@
ast_indicate_data(other, f->subclass, f->data.ptr, f->datalen);
break;
case AST_CONTROL_OPTION:
- aoh = f->data.ptr;
+ aoh = (struct ast_option_header *) f->data.ptr;
/* Forward option Requests */
if (aoh && aoh->flag == AST_OPTION_FLAG_REQUEST) {
ast_channel_setoption(other, ntohs(aoh->option), aoh->data,
@@ -2673,7 +2667,7 @@
ast_channel_lock(chan);
if ((features_datastore = ast_channel_datastore_find(chan, &dial_features_info, NULL)))
- dialfeatures = features_datastore->data;
+ dialfeatures = (struct ast_dial_features *) features_datastore->data;
ast_channel_unlock(chan);
@@ -2808,7 +2802,7 @@
FD_ZERO(&nefds);
iter = ao2_iterator_init(parkinglots, 0);
- while ((curlot = ao2_iterator_next(&iter))) {
+ while ((curlot = (struct ast_parkinglot *) ao2_iterator_next(&iter))) {
res = manage_parkinglot(curlot, &rfds, &efds, &nrfds, &nefds, &ms, &max);
ao2_ref(curlot, -1);
}
@@ -2836,7 +2830,7 @@
ast_copy_string(tmp_parkinglot.name, name, sizeof(tmp_parkinglot.name));
- parkinglot = ao2_find(parkinglots, &tmp_parkinglot, OBJ_POINTER);
+ parkinglot = (struct ast_parkinglot *) ao2_find(parkinglots, &tmp_parkinglot, OBJ_POINTER);
if (parkinglot && option_debug)
ast_log(LOG_DEBUG, "Found Parkinglot: %s\n", parkinglot->name);
More information about the asterisk-commits
mailing list