Fix a bunch of compiler warnings generated by gcc 4.6.0.

Most of these are -Wunused-but-set-variable, but there were a few others
mixed in here, as well.


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@316265 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2011-05-03 19:55:49 +00:00
parent c5ad2f12a0
commit a82f1bb995
34 changed files with 70 additions and 176 deletions

View File

@@ -156,7 +156,6 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
int iTotalTime = 0;
int iWordsCount = 0;
int currentState = STATE_IN_WORD;
int previousState = STATE_IN_SILENCE;
int consecutiveVoiceDuration = 0;
char amdCause[256] = "", amdStatus[256] = "";
char *parse = ast_strdupa(data);
@@ -301,7 +300,6 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
if (silenceDuration >= betweenWordsSilence) {
if (currentState != STATE_IN_SILENCE ) {
previousState = currentState;
ast_verb(3, "AMD: Channel [%s]. Changed state to STATE_IN_SILENCE\n", chan->name);
}
/* Find words less than word duration */
@@ -341,7 +339,6 @@ static void isAnsweringMachine(struct ast_channel *chan, const char *data)
if (consecutiveVoiceDuration >= minimumWordLength && currentState == STATE_IN_SILENCE) {
iWordsCount++;
ast_verb(3, "AMD: Channel [%s]. Word detected. iWordsCount:%d\n", chan->name, iWordsCount);
previousState = currentState;
currentState = STATE_IN_WORD;
}
if (consecutiveVoiceDuration >= maximumWordLength){

View File

@@ -163,7 +163,6 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
{
int res = 0;
int fds[2];
int pid = -1;
int needed = 0;
int owriteformat;
struct ast_frame *f;
@@ -195,7 +194,6 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
res = send_waveform_to_fd(waveform, length, fds[1]);
if (res >= 0) {
pid = res;
/* Order is important -- there's almost always going to be mp3... we want to prioritize the
user */
for (;;) {
@@ -257,10 +255,6 @@ static int send_waveform_to_channel(struct ast_channel *chan, char *waveform, in
close(fds[0]);
close(fds[1]);
#if 0
if (pid > -1)
kill(pid, SIGKILL);
#endif
if (!res && owriteformat)
ast_set_write_format(chan, owriteformat);
return res;
@@ -284,7 +278,6 @@ static int festival_exec(struct ast_channel *chan, const char *vdata)
char ack[4];
char *waveform;
int filesize;
int wave;
char bigstring[MAXFESTLEN];
int i;
struct MD5Context md5ctx;
@@ -493,7 +486,6 @@ static int festival_exec(struct ast_channel *chan, const char *vdata)
/* Read back info from server */
/* This assumes only one waveform will come back, also LP is unlikely */
wave = 0;
do {
int read_data;
for (n = 0; n < 3; ) {

View File

@@ -790,7 +790,6 @@ static void findmeexec(struct fm_args *tpargs)
char *rest, *number;
struct findme_user *tmpuser;
struct findme_user *fmuser;
struct findme_user *headuser;
struct findme_user_listptr *findme_user_list;
int status;
@@ -901,7 +900,6 @@ static void findmeexec(struct fm_args *tpargs)
fmuser = NULL;
tmpuser = NULL;
headuser = NULL;
if (winner)
break;

View File

@@ -112,7 +112,6 @@ static int ices_exec(struct ast_channel *chan, const char *data)
int pid = -1;
int flags;
int oreadformat;
struct timeval last;
struct ast_frame *f;
char filename[256]="";
char *c;
@@ -122,8 +121,6 @@ static int ices_exec(struct ast_channel *chan, const char *data)
return -1;
}
last = ast_tv(0, 0);
if (pipe(fds)) {
ast_log(LOG_WARNING, "Unable to create pipe\n");
return -1;

View File

@@ -1266,13 +1266,22 @@ static int sendmail(struct minivm_template *template, struct minivm_account *vmu
char tmpcmd[PATH_MAX];
int tmpfd;
/**
* XXX
* /bug tmpfd is a leaked fd. The file is also never unlinked.
* See app_voicemail.c for how the code works there that
* doesn't have this bug.
*/
ast_copy_string(newtmp, "/tmp/XXXXXX", sizeof(newtmp));
ast_debug(3, "newtmp: %s\n", newtmp);
tmpfd = mkstemp(newtmp);
snprintf(tmpcmd, sizeof(tmpcmd), "sox -v %.4f %s.%s %s.%s", vmu->volgain, filename, format, newtmp, format);
ast_safe_system(tmpcmd);
finalfilename = newtmp;
ast_debug(3, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", filename, format, vmu->volgain, vmu->username);
if (tmpfd > -1) {
snprintf(tmpcmd, sizeof(tmpcmd), "sox -v %.4f %s.%s %s.%s", vmu->volgain, filename, format, newtmp, format);
ast_safe_system(tmpcmd);
finalfilename = newtmp;
ast_debug(3, "VOLGAIN: Stored at: %s.%s - Level: %.4f - Mailbox: %s\n", filename, format, vmu->volgain, vmu->username);
}
} else {
finalfilename = ast_strdupa(filename);
}
@@ -1828,7 +1837,6 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav
char callerid[256];
FILE *txt;
int res = 0, txtdes;
int msgnum;
int duration = 0;
char date[256];
char tmpdir[PATH_MAX];
@@ -1871,7 +1879,6 @@ static int leave_voicemail(struct ast_channel *chan, char *username, struct leav
pbx_builtin_setvar_helper(chan, "MVM_RECORD_STATUS", "FAILED");
return res;
}
msgnum = 0;
userdir = check_dirpath(tmpdir, sizeof(tmpdir), vmu->domain, username, "tmp");
@@ -2452,7 +2459,6 @@ static int minivm_accmess_exec(struct ast_channel *chan, const char *data)
char *message = NULL;
char *prompt = NULL;
int duration;
int cmd;
if (ast_strlen_zero(data)) {
ast_log(LOG_ERROR, "MinivmAccmess needs at least two arguments: account and option\n");
@@ -2526,7 +2532,7 @@ static int minivm_accmess_exec(struct ast_channel *chan, const char *data)
}
snprintf(filename,sizeof(filename), "%s%s/%s/%s", MVM_SPOOL_DIR, vmu->domain, vmu->username, message);
/* Maybe we should check the result of play_record_review ? */
cmd = play_record_review(chan, prompt, filename, global_maxgreet, default_vmformat, 0, vmu, &duration, NULL, FALSE);
play_record_review(chan, prompt, filename, global_maxgreet, default_vmformat, 0, vmu, &duration, NULL, FALSE);
ast_debug(1, "Recorded new %s message in %s (duration %d)\n", message, filename, duration);
@@ -3238,12 +3244,10 @@ static int minivm_account_func_read(struct ast_channel *chan, const char *cmd, c
check_dirpath(buf, len, vmu->domain, vmu->username, NULL);
} else { /* Look in channel variables */
struct ast_variable *var;
int found = 0;
for (var = vmu->chanvars ; var ; var = var->next)
if (!strcmp(var->name, colname)) {
ast_copy_string(buf, var->value, len);
found = 1;
break;
}
}

View File

@@ -101,7 +101,6 @@ static int originate_exec(struct ast_channel *chan, const char *data)
char *parse;
char *chantech, *chandata;
int res = -1;
int outgoing_res = 0;
int outgoing_status = 0;
static const unsigned int timeout = 30;
static const char default_exten[] = "s";
@@ -148,14 +147,14 @@ static int originate_exec(struct ast_channel *chan, const char *data)
ast_debug(1, "Originating call to '%s/%s' and connecting them to extension %s,%s,%d\n",
chantech, chandata, args.arg1, exten, priority);
outgoing_res = ast_pbx_outgoing_exten(chantech, AST_FORMAT_SLINEAR, chandata,
ast_pbx_outgoing_exten(chantech, AST_FORMAT_SLINEAR, chandata,
timeout * 1000, args.arg1, exten, priority, &outgoing_status, 0, NULL,
NULL, NULL, NULL, NULL);
} else if (!strcasecmp(args.type, "app")) {
ast_debug(1, "Originating call to '%s/%s' and connecting them to %s(%s)\n",
chantech, chandata, args.arg1, S_OR(args.arg2, ""));
outgoing_res = ast_pbx_outgoing_app(chantech, AST_FORMAT_SLINEAR, chandata,
ast_pbx_outgoing_app(chantech, AST_FORMAT_SLINEAR, chandata,
timeout * 1000, args.arg1, args.arg2, &outgoing_status, 0, NULL,
NULL, NULL, NULL, NULL);
} else {

View File

@@ -4323,7 +4323,6 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
char *agiexec = NULL;
char *macroexec = NULL;
char *gosubexec = NULL;
int ret = 0;
const char *monitorfilename;
const char *monitor_exec;
const char *monitor_options;
@@ -4838,7 +4837,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
/* We purposely lock the CDR so that pbx_exec does not update the application data */
if (qe->chan->cdr)
ast_set_flag(qe->chan->cdr, AST_CDR_FLAG_LOCKED);
ret = pbx_exec(qe->chan, mixmonapp, mixmonargs);
pbx_exec(qe->chan, mixmonapp, mixmonargs);
if (qe->chan->cdr)
ast_clear_flag(qe->chan->cdr, AST_CDR_FLAG_LOCKED);
@@ -4970,7 +4969,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce
application = pbx_findapp("agi");
if (application) {
agiexec = ast_strdupa(agi);
ret = pbx_exec(qe->chan, application, agiexec);
pbx_exec(qe->chan, application, agiexec);
} else
ast_log(LOG_WARNING, "Asked to execute an AGI on this channel, but could not find application (agi)!\n");
}

View File

@@ -7071,7 +7071,6 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st
char *dir;
int curmsg;
char urgent_str[7] = "";
char tmptxtfile[PATH_MAX];
int prompt_played = 0;
#ifndef IMAP_STORAGE
char msgfile[PATH_MAX], textfile[PATH_MAX], backup[PATH_MAX], backup_textfile[PATH_MAX];
@@ -7084,7 +7083,6 @@ static int forward_message(struct ast_channel *chan, char *context, struct vm_st
dir = vms->curdir;
curmsg = vms->curmsg;
tmptxtfile[0] = '\0';
while (!res && !valid_extensions) {
int use_directory = 0;
if (ast_test_flag((&globalflags), VM_DIRECFORWARD)) {