Fix dead nested assignments in various modules

This commit is contained in:
Andrey Volk 2022-01-12 16:30:34 +03:00
parent e53e8a17c1
commit c47c16b1dd
34 changed files with 82 additions and 120 deletions

View File

@ -879,11 +879,11 @@ iks_send_raw (iksparser *prs, const char *xmlstr)
} else
#elif HAVE_SSL
if (data->flags & SF_SECURE) {
int r, err;
int r;
do {
r = SSL_write(data->ssl, xmlstr, strlen (xmlstr));
} while (r == -1 && (err = SSL_get_error(data->ssl, r)) == SSL_ERROR_WANT_WRITE);
} while (r == -1 && SSL_get_error(data->ssl, r) == SSL_ERROR_WANT_WRITE);
if (r < 0) {
return IKS_NET_RWERR;

View File

@ -305,6 +305,7 @@ static void hadamard_8x8x2_avx2(const int16_t *src_diff, ptrdiff_t src_stride,
src[5] = _mm256_loadu_si256((const __m256i *)(src_diff += src_stride));
src[6] = _mm256_loadu_si256((const __m256i *)(src_diff += src_stride));
src[7] = _mm256_loadu_si256((const __m256i *)(src_diff += src_stride));
(void)src_diff;
hadamard_col8x2_avx2(src, 0);
hadamard_col8x2_avx2(src, 1);

View File

@ -276,6 +276,7 @@ static INLINE void hadamard_8x8_sse2(const int16_t *src_diff,
src[5] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
src[6] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
src[7] = _mm_load_si128((const __m128i *)(src_diff += src_stride));
(void)src_diff;
hadamard_col8_sse2(src, 0);
hadamard_col8_sse2(src, 1);

View File

@ -953,7 +953,6 @@ switch_status_t navigate_entrys(switch_core_session_t *session, dir_profile_t *p
SWITCH_STANDARD_APP(directory_function)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
int argc = 0;
char *argv[6] = { 0 };
char *mydata = NULL;
const char *profile_name = NULL;
@ -975,7 +974,7 @@ SWITCH_STANDARD_APP(directory_function)
}
mydata = switch_core_session_strdup(session, data);
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 2) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not enough args [%s]\n", data);
return;
}

View File

@ -1459,7 +1459,6 @@ SWITCH_STANDARD_APP(wait_for_video_ready_function)
SWITCH_STANDARD_APP(presence_function)
{
char *argv[6] = { 0 };
int argc;
char *mydata = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session);
@ -1468,7 +1467,7 @@ SWITCH_STANDARD_APP(presence_function)
return;
}
if ((argc = switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0]))) < 2) {
if (switch_separate_string(mydata, ' ', argv, sizeof(argv) / sizeof(argv[0])) < 2) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "INVALID ARGS!\n");
return;
}

View File

@ -563,10 +563,12 @@ case EXPR_NODEFUNC_RECTTOPOLA:
tmp = atan2(d2, d1);
EXPR_CHECK_ERR();
if (tmp < 0.0)
if (tmp < 0.0) {
*val = tmp = (2.0 * M_PI);
else
(void)tmp;
} else {
*val = tmp;
}
} else
return err;

View File

@ -2353,7 +2353,6 @@ SWITCH_STANDARD_API(fifo_check_bridge_function)
SWITCH_STANDARD_API(fifo_add_outbound_function)
{
char *data = NULL, *argv[4] = { 0 };
int argc;
uint32_t priority = 0;
if (zstr(cmd)) {
@ -2362,7 +2361,7 @@ SWITCH_STANDARD_API(fifo_add_outbound_function)
data = strdup(cmd);
if ((argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2 || !argv[0]) {
if (switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 2 || !argv[0]) {
goto fail;
}

View File

@ -435,7 +435,7 @@ SWITCH_STANDARD_APP(hash_function)
if (argc < 4) {
goto usage;
}
if (!(value = switch_core_hash_find(globals.db_hash, hash_key))) {
if (!switch_core_hash_find(globals.db_hash, hash_key)) {
switch_core_hash_insert_dup(globals.db_hash, hash_key, argv[3]);
}
@ -507,7 +507,7 @@ SWITCH_STANDARD_API(hash_api_function)
goto usage;
}
switch_thread_rwlock_wrlock(globals.db_hash_rwlock);
if ((value = switch_core_hash_find(globals.db_hash, hash_key))) {
if (switch_core_hash_find(globals.db_hash, hash_key)) {
stream->write_function(stream, "-ERR key already exists\n");
} else {
switch_core_hash_insert_dup(globals.db_hash, hash_key, argv[3]);

View File

@ -2378,7 +2378,6 @@ static char *load_cache_data(http_file_context_t *context, const char *url)
char digest[SWITCH_MD5_DIGEST_STRING_SIZE] = { 0 };
char meta_buffer[1024] = "";
int fd;
switch_ssize_t bytes;
switch_md5_string(digest, (void *) url, strlen(url));
@ -2390,7 +2389,7 @@ static char *load_cache_data(http_file_context_t *context, const char *url)
ext = find_ext(url);
}
if (ext && (p = strchr(ext, '?'))) {
if (ext && strchr(ext, '?')) {
dext = strdup(ext);
if ((p = strchr(dext, '?'))) {
*p = '\0';
@ -2402,7 +2401,7 @@ static char *load_cache_data(http_file_context_t *context, const char *url)
context->meta_file = switch_core_sprintf(context->pool, "%s%s%s.meta", globals.cache_path, SWITCH_PATH_SEPARATOR, digest);
if (switch_file_exists(context->meta_file, context->pool) == SWITCH_STATUS_SUCCESS && ((fd = open(context->meta_file, O_RDONLY, 0)) > -1)) {
if ((bytes = read(fd, meta_buffer, sizeof(meta_buffer))) > 0) {
if (read(fd, meta_buffer, sizeof(meta_buffer)) > 0) {
char *p;
if ((p = strchr(meta_buffer, ':'))) {

View File

@ -583,10 +583,9 @@ SWITCH_STANDARD_APP(oreka_start_function)
oreka_session_t *oreka = NULL;
switch_media_bug_t *bug = NULL;
char *argv[6];
int argc;
int flags = 0;
int flags = 0;
char *lbuf = NULL;
const char *var;
const char *var;
if ((oreka = (oreka_session_t *) switch_channel_get_private(channel, OREKA_PRIVATE))) {
if (!zstr(data) && !strcasecmp(data, "stop")) {
@ -606,14 +605,14 @@ SWITCH_STANDARD_APP(oreka_start_function)
switch_assert(oreka);
memset(oreka, 0, sizeof(*oreka));
oreka->mux_streams = globals.mux_streams;
oreka->mux_streams = globals.mux_streams;
if ((var = switch_channel_get_variable(channel, "oreka_mux_streams"))) {
oreka->mux_streams = switch_true(var);
}
if ((var = switch_channel_get_variable(channel, "oreka_mux_streams"))) {
oreka->mux_streams = switch_true(var);
}
if (data && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
&& switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
#if 0
if (!strncasecmp(argv[x], "server", sizeof("server"))) {
/* parse server=192.168.1.144 string */
@ -623,11 +622,11 @@ SWITCH_STANDARD_APP(oreka_start_function)
oreka->session = session;
if (oreka->mux_streams) {
flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING | SMBF_ANSWER_REQ;
} else {
flags = SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | SMBF_ANSWER_REQ;
}
if (oreka->mux_streams) {
flags = SMBF_READ_STREAM | SMBF_WRITE_STREAM | SMBF_READ_PING | SMBF_ANSWER_REQ;
} else {
flags = SMBF_READ_REPLACE | SMBF_WRITE_REPLACE | SMBF_ANSWER_REQ;
}
status = switch_core_media_bug_add(session, OREKA_BUG_NAME_READ, NULL, oreka_audio_callback, oreka, 0, flags, &bug);

View File

@ -367,7 +367,7 @@ static int cr_readln(REDIS rhnd, int start, char **line, int *idx)
static int cr_receivemultibulk(REDIS rhnd, char *line)
{
int bnum, blen, i, rc=0, idx=0;
int bnum, blen, i, idx=0;
bnum = atoi(line);
@ -381,7 +381,7 @@ static int cr_receivemultibulk(REDIS rhnd, char *line)
return CREDIS_ERR_NOMEM;
}
for (i = 0; bnum > 0 && (rc = cr_readln(rhnd, 0, &line, NULL)) > 0; i++, bnum--) {
for (i = 0; bnum > 0 && cr_readln(rhnd, 0, &line, NULL) > 0; i++, bnum--) {
if (*(line++) != CR_BULK)
return CREDIS_ERR_PROTOCOL;
@ -389,7 +389,7 @@ static int cr_receivemultibulk(REDIS rhnd, char *line)
if (blen == -1)
rhnd->reply.multibulk.idxs[i] = -1;
else {
if ((rc = cr_readln(rhnd, blen, &line, &idx)) != blen)
if (cr_readln(rhnd, blen, &line, &idx) != blen)
return CREDIS_ERR_PROTOCOL;
rhnd->reply.multibulk.idxs[i] = idx;

View File

@ -305,7 +305,7 @@ SWITCH_STANDARD_APP(rss_function)
char cmd[3];
main_menu:
filename = NULL;
len = idx = 0;
len = 0;
*cmd = '\0';
title_txt = description_txt = rights_txt = "";

View File

@ -464,7 +464,6 @@ done:
#define SIGNALWIRE_SYNTAX "token | token-reset | adoption | adopted | reload | update | debug <level> | kslog <on|off|logfile e.g. /tmp/ks.log>"
SWITCH_STANDARD_API(mod_signalwire_api_function)
{
int argc = 0;
char *argv[2] = { 0 };
char *buf = NULL;
@ -474,7 +473,7 @@ SWITCH_STANDARD_API(mod_signalwire_api_function)
return SWITCH_STATUS_SUCCESS;
}
if ((argc = switch_separate_string(buf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
if (switch_separate_string(buf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
if (!strcmp(argv[0], "token")) {
if (globals.adoption_token[0]) {
stream->write_function(stream,

View File

@ -149,10 +149,9 @@ SWITCH_STANDARD_API(snom_command_api_function)
char *ret = NULL;
switch_cache_db_handle_t *db = NULL;
switch_stream_handle_t apistream = { 0 };
switch_status_t status;
SWITCH_STANDARD_STREAM(apistream);
if ((status = switch_api_execute("sofia_contact", argv[0], NULL, &apistream)) != SWITCH_STATUS_SUCCESS) {
if (switch_api_execute("sofia_contact", argv[0], NULL, &apistream) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR error executing sofia_contact\n");
goto end;
}

View File

@ -246,7 +246,6 @@ static switch_bool_t soundtouch_callback(switch_media_bug_t *bug, void *user_dat
SWITCH_STANDARD_APP(soundtouch_start_function)
{
switch_media_bug_t *bug;
switch_status_t status;
switch_channel_t *channel = switch_core_session_get_channel(session);
struct soundtouch_helper *sth;
char *argv[6];
@ -311,14 +310,13 @@ SWITCH_STANDARD_APP(soundtouch_start_function)
sth->session = session;
if ((status = switch_core_media_bug_add(session, "soundtouch", NULL, soundtouch_callback, sth, 0,
sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
if (switch_core_media_bug_add(session, "soundtouch", NULL, soundtouch_callback, sth, 0,
sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n");
return;
}
switch_channel_set_private(channel, "_soundtouch_", bug);
}
/* API Interface Function */
@ -327,12 +325,11 @@ SWITCH_STANDARD_API(soundtouch_api_function)
{
switch_core_session_t *rsession = NULL;
switch_channel_t *channel = NULL;
switch_media_bug_t *bug;
switch_status_t status;
struct soundtouch_helper *sth;
switch_media_bug_t *bug;
struct soundtouch_helper *sth;
char *mycmd = NULL;
int argc = 0;
char *argv[10] = { 0 };
int argc = 0;
char *argv[10] = { 0 };
char *uuid = NULL;
char *action = NULL;
int x, n;
@ -420,8 +417,8 @@ SWITCH_STANDARD_API(soundtouch_api_function)
sth->session = rsession;
if ((status = switch_core_media_bug_add(rsession, "soundtouch", NULL, soundtouch_callback, sth, 0,
sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
if (switch_core_media_bug_add(rsession, "soundtouch", NULL, soundtouch_callback, sth, 0,
sth->send_not_recv ? SMBF_WRITE_REPLACE : SMBF_READ_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) {
stream->write_function(stream, "-ERR Failure!\n");
goto done;
} else {

View File

@ -1266,32 +1266,29 @@ static t38_mode_t request_t38(pvt_t *pvt)
insist = spandsp_globals.enable_t38_insist;
}
if ((t38_options = switch_channel_get_private(channel, "t38_options"))) {
if (switch_channel_get_private(channel, "t38_options")) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING,
"%s already has T.38 data\n", switch_channel_get_name(channel));
enabled = 0;
}
if (enabled) {
if (!(t38_options = switch_channel_get_private(channel, "_preconfigured_t38_options"))) {
t38_options = switch_core_session_alloc(session, sizeof(*t38_options));
t38_options->T38MaxBitRate = (pvt->disable_v17) ? 9600 : 14400;
t38_options->T38FaxVersion = 0;
t38_options->T38FaxFillBitRemoval = 1;
t38_options->T38FaxTranscodingMMR = 0;
t38_options->T38FaxTranscodingJBIG = 0;
t38_options->T38FaxRateManagement = "transferredTCF";
t38_options->T38FaxMaxBuffer = 2000;
t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM;
t38_options->T38FaxUdpEC = "t38UDPRedundancy";
t38_options->T38VendorInfo = "0 0 0";
}
if (!(t38_options = switch_channel_get_private(channel, "_preconfigured_t38_options"))) {
t38_options = switch_core_session_alloc(session, sizeof(*t38_options));
t38_options->T38MaxBitRate = (pvt->disable_v17) ? 9600 : 14400;
t38_options->T38FaxVersion = 0;
t38_options->T38FaxFillBitRemoval = 1;
t38_options->T38FaxTranscodingMMR = 0;
t38_options->T38FaxTranscodingJBIG = 0;
t38_options->T38FaxRateManagement = "transferredTCF";
t38_options->T38FaxMaxBuffer = 2000;
t38_options->T38FaxMaxDatagram = LOCAL_FAX_MAX_DATAGRAM;
t38_options->T38FaxUdpEC = "t38UDPRedundancy";
t38_options->T38VendorInfo = "0 0 0";
}
switch_channel_set_private(channel, "t38_options", t38_options);
switch_channel_set_private(channel, "_preconfigured_t38_options", NULL);
switch_channel_set_private(channel, "t38_options", t38_options);
switch_channel_set_private(channel, "_preconfigured_t38_options", NULL);
pvt->t38_mode = T38_MODE_REQUESTED;
switch_channel_set_app_flag_key("T38", channel, CF_APP_T38_REQ);

View File

@ -188,7 +188,7 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
seq_no = (buf[0] << 8) | buf[1];
ptr += 2;
/* Break out the primary packet */
if ((stat = decode_open_type(buf, len, &ptr, &msg, &msg_len)) != 0)
if (decode_open_type(buf, len, &ptr, &msg, &msg_len) != 0)
return -1;
/* Decode error_recovery */
if (ptr + 1 > len)
@ -290,7 +290,7 @@ int udptl_rx_packet(udptl_state_t *s, const uint8_t buf[], int len)
/* Decode the elements */
for (i = 0; i < entries; i++) {
if ((stat = decode_open_type(buf, len, &ptr, &data, &s->rx[x].fec_len[i])) != 0)
if (decode_open_type(buf, len, &ptr, &data, &s->rx[x].fec_len[i]) != 0)
return -1;
if (s->rx[x].fec_len[i] > LOCAL_FAX_MAX_DATAGRAM)
return -1;

View File

@ -286,12 +286,11 @@ static void event_handler(switch_event_t *event)
#define USERSPY_SYNTAX "<user@domain> [uuid]"
SWITCH_STANDARD_APP(userspy_function)
{
int argc = 0;
char *argv[2] = { 0 };
char *params = NULL;
if (!zstr(data) && (params = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(params, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
if (switch_separate_string(params, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) >= 1) {
switch_channel_t *channel = switch_core_session_get_channel(session);
char *uuid = switch_core_session_get_uuid(session);
switch_status_t status;

View File

@ -197,11 +197,9 @@ static switch_bool_t stress_callback(switch_media_bug_t *bug, void *user_data, s
SWITCH_STANDARD_APP(stress_start_function)
{
switch_media_bug_t *bug;
switch_status_t status;
switch_channel_t *channel = switch_core_session_get_channel(session);
struct stress_helper *sth;
char *argv[6];
int argc;
char *lbuf = NULL;
int x = 0;
@ -220,7 +218,7 @@ SWITCH_STANDARD_APP(stress_start_function)
if (data && (lbuf = switch_core_session_strdup(session, data))
&& (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
&& switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
if (!strncasecmp(argv[x], "read", 4)) {
sth->read = 1;
}
@ -228,14 +226,12 @@ SWITCH_STANDARD_APP(stress_start_function)
sth->session = session;
if ((status = switch_core_media_bug_add(session, "stress", NULL, stress_callback, sth, 0,
sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug)) != SWITCH_STATUS_SUCCESS) {
if (switch_core_media_bug_add(session, "stress", NULL, stress_callback, sth, 0, sth->read ? SMBF_READ_REPLACE : SMBF_WRITE_REPLACE, &bug) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Failure!\n");
return;
}
switch_channel_set_private(channel, "_stress_", bug);
}
SWITCH_MODULE_LOAD_FUNCTION(mod_stress_load)

View File

@ -333,7 +333,6 @@ SWITCH_STANDARD_API(translate_function)
char *translated = NULL;
switch_event_t *event = NULL;
char *argv[32] = { 0 };
int argc = 0;
if (zstr(cmd)) {
stream->write_function(stream, "USAGE: %s\n", TRANSLATE_SYNTAX);
@ -344,7 +343,7 @@ SWITCH_STANDARD_API(translate_function)
mydata = strdup(cmd);
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
if (switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
if (!session) {
char *areacode = switch_core_get_variable("default_areacode");
switch_core_new_memory_pool(&pool);

View File

@ -3165,7 +3165,6 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t
char *dup = NULL, *user = NULL, *domain = NULL, *profile_name = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS;
int isgroup = 0, isall = 0;
int argc = 0;
char *argv[6] = { 0 };
char *box, *path, *cid_num, *cid_name;
switch_memory_pool_t *pool = NULL;
@ -3181,7 +3180,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t
dup = strdup(data);
switch_assert(dup);
if ((argc = switch_separate_string(dup, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
if (switch_separate_string(dup, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) < 2) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Not enough args [%s]\n", data);
status = SWITCH_STATUS_FALSE;
goto end;
@ -3338,7 +3337,7 @@ static switch_status_t voicemail_inject(const char *data, switch_core_session_t
} else {
switch_xml_t x_group = NULL;
if ((status = switch_xml_locate_user_in_domain(user, x_domain, &ut, &x_group)) == SWITCH_STATUS_SUCCESS) {
if (switch_xml_locate_user_in_domain(user, x_domain, &ut, &x_group) == SWITCH_STATUS_SUCCESS) {
switch_xml_merge_user(ut, x_domain, x_group);
switch_event_create(&my_params, SWITCH_EVENT_REQUEST_PARAMS);
status = deliver_vm(profile, ut, domain, path, 0, read_flags,

View File

@ -440,7 +440,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dahdi_codec_load)
switch_codec_interface_t *codec_interface;
struct stat statbuf;
struct dahdi_transcoder_info info = { 0 };
int32_t fd, res;
int32_t fd;
int mpf = 20000; /* Algorithmic delay of 15ms with 5ms of look-ahead delay */
int spf = 160;
int bpfd = 320;
@ -472,7 +472,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_dahdi_codec_load)
return SWITCH_STATUS_FALSE;
}
for (info.tcnum = 0; !(res = ioctl(fd, DAHDI_TC_GETINFO, &info)); info.tcnum++) {
for (info.tcnum = 0; !ioctl(fd, DAHDI_TC_GETINFO, &info); info.tcnum++) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Found dahdi transcoder name: %s\n", info.name);
if ((info.srcfmts & DAHDI_FORMAT_ULAW) && (info.dstfmts & (DAHDI_FORMAT_G729A | DAHDI_FORMAT_G723_1))) {
total_encoders += info.numchannels;

View File

@ -103,12 +103,11 @@ SWITCH_STANDARD_APP(avoid_function)
SWITCH_STANDARD_APP(goto_function)
{
int argc;
char *argv[3] = { 0 };
char *mydata;
if (data && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, '|', argv, (sizeof(argv) / sizeof(argv[0])))) < 1) {
if (switch_separate_string(mydata, '|', argv, (sizeof(argv) / sizeof(argv[0]))) < 1) {
goto error;
}
@ -352,24 +351,12 @@ static switch_call_cause_t iax2_outgoing_channel(switch_core_session_t *session,
return switch_core_session_outgoing_channel(session, var_event, "iax", outbound_profile, new_session, pool, SOF_NONE, cancel_cause);
}
#define WE_DONT_NEED_NO_STINKIN_KEY "true"
static char *key()
{
return WE_DONT_NEED_NO_STINKIN_KEY;
}
SWITCH_MODULE_LOAD_FUNCTION(mod_dialplan_asterisk_load)
{
switch_dialplan_interface_t *dp_interface;
switch_application_interface_t *app_interface;
char *mykey = NULL;
int x = 0;
if ((mykey = key())) {
mykey = NULL;
}
/* connect my internal structure to the blank pointer passed to me */
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
/* add a dialplan interface */

View File

@ -883,10 +883,9 @@ static void dl_logger(char *file, const char *func, int line, int level, char *f
{
va_list ap;
char *data = NULL;
int ret;
va_start(ap, fmt);
if ((ret = switch_vasprintf(&data, fmt, ap)) != -1) {
if (switch_vasprintf(&data, fmt, ap) != -1) {
if (!strncasecmp(data, "+xml:", 5)) {
switch_xml_t xml;
char *form;
@ -3062,7 +3061,6 @@ SWITCH_STANDARD_API(dl_logout)
SWITCH_STANDARD_API(dingaling)
{
char *argv[10] = { 0 };
int argc = 0;
void *val;
char *myarg = NULL;
mdl_profile_t *profile = NULL;
@ -3077,7 +3075,7 @@ SWITCH_STANDARD_API(dingaling)
return SWITCH_STATUS_FALSE;
}
if ((argc = switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) != 1) {
if (switch_separate_string(myarg, ' ', argv, (sizeof(argv) / sizeof(argv[0]))) != 1) {
stream->write_function(stream, "USAGE: %s\n", DINGALING_SYNTAX);
goto done;
}

View File

@ -2962,7 +2962,6 @@ static switch_status_t list_calls(char **argv, int argc, switch_stream_handle_t
static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t *stream)
{
switch_core_session_t *session;
switch_status_t status = SWITCH_STATUS_SUCCESS;
char *dest = NULL;
if (zstr(argv[0])) {
@ -3025,7 +3024,7 @@ static switch_status_t place_call(char **argv, int argc, switch_stream_handle_t
switch_channel_set_caller_profile(channel, tech_pvt->caller_profile);
}
tech_pvt->session = session;
if ((status = validate_main_audio_stream()) == SWITCH_STATUS_SUCCESS) {
if (validate_main_audio_stream() == SWITCH_STATUS_SUCCESS) {
switch_set_flag_locked(tech_pvt, TFLAG_ANSWER);
switch_channel_mark_answered(channel);
switch_channel_set_state(channel, CS_INIT);

View File

@ -2056,7 +2056,7 @@ sock_fail:
assert(profile->sock);
if ((rv = switch_socket_accept(&inbound_socket, profile->sock, listener_pool))) {
if (switch_socket_accept(&inbound_socket, profile->sock, listener_pool)) {
if (!skinny_globals.running) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n");
goto end;

View File

@ -3007,7 +3007,7 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_event_socket_runtime)
}
if ((rv = switch_socket_accept(&inbound_socket, listen_list.sock, listener_pool))) {
if (switch_socket_accept(&inbound_socket, listen_list.sock, listener_pool)) {
if (prefs.done) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting Down\n");
goto end;

View File

@ -53,7 +53,6 @@ static int read_cookie_from_file(char *filename) {
char cookie[MAXATOMLEN + 1];
char *end;
struct stat buf;
ssize_t res;
if (!stat(filename, &buf)) {
if ((buf.st_mode & S_IRWXG) || (buf.st_mode & S_IRWXO)) {
@ -70,7 +69,7 @@ static int read_cookie_from_file(char *filename) {
return 2;
}
if ((res = read(fd, cookie, MAXATOMLEN)) < 1) {
if (read(fd, cookie, MAXATOMLEN) < 1) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to read cookie file %s : %d.\n", filename, errno);
}

View File

@ -1589,7 +1589,7 @@ static void *SWITCH_THREAD_FUNC xmpp_listener_thread(switch_thread_t *thread, vo
}
/* accept the connection */
if ((rv = switch_socket_accept(&socket, listener->socket, pool))) {
if (switch_socket_accept(&socket, listener->socket, pool)) {
if (context->shutdown) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Shutting down xmpp listener\n");
goto end;

View File

@ -1367,7 +1367,6 @@ SWITCH_STANDARD_API(local_stream_function)
char *mycmd = NULL, *argv[5] = { 0 };
char *local_stream_name = NULL;
int argc = 0;
int ok = 0;
if (zstr(cmd)) {
goto usage;
@ -1461,7 +1460,7 @@ SWITCH_STANDARD_API(local_stream_function)
stream->write_function(stream, "+OK stream: %s", source->name);
switch_thread_rwlock_unlock(source->rwlock);
} else {
if ((ok = launch_streams(local_stream_name))) {
if (launch_streams(local_stream_name)) {
stream->write_function(stream, "+OK stream: %s", local_stream_name);
}
}

View File

@ -130,7 +130,6 @@ static switch_status_t tone_stream_file_open(switch_file_handle_t *handle, const
char *tmp;
int fd = -1;
char buf[1024] = "";
size_t len;
memset(&ts, 0, sizeof(ts));
@ -172,7 +171,7 @@ static switch_status_t tone_stream_file_open(switch_file_handle_t *handle, const
return SWITCH_STATUS_FALSE;
}
while ((len = switch_fd_read_line(fd, buf, sizeof(buf)))) {
while (switch_fd_read_line(fd, buf, sizeof(buf))) {
teletone_run(&ts, buf);
}
close(fd);

View File

@ -241,7 +241,6 @@ static switch_xml_t lua_fetch(const char *section,
if (!zstr(globals.xml_handler)) {
L = lua_init();
const char *str;
int error;
mycmd = strdup(globals.xml_handler);
switch_assert(mycmd);
@ -266,7 +265,7 @@ static switch_xml_t lua_fetch(const char *section,
mod_lua_conjure_event(L, params, "params", 1);
}
if((error = lua_parse_and_execute(L, mycmd, NULL))){
if(lua_parse_and_execute(L, mycmd, NULL)){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "LUA script parse/execute error!\n");
goto end;
}
@ -522,7 +521,6 @@ SWITCH_STANDARD_API(lua_api_function)
{
char *mycmd;
int error;
if (zstr(cmd)) {
stream->write_function(stream, "");
@ -541,7 +539,7 @@ SWITCH_STANDARD_API(lua_api_function)
mod_lua_conjure_event(L, stream->param_event, "env", 1);
}
if ((error = lua_parse_and_execute(L, mycmd, session))) {
if (lua_parse_and_execute(L, mycmd, session)) {
char * http = switch_event_get_header(stream->param_event, "http-uri");
if (http && (!strncasecmp(http, "/api/", 5) || !strncasecmp(http, "/webapi/", 8))) {
/* api -> fs api streams the Content-Type e.g. text/html or text/xml */

View File

@ -144,7 +144,7 @@ void Session::check_hangup_hook()
void Session::do_hangup_hook()
{
PyObject *result, *arglist;
PyObject *arglist;
const char *what = hook_state == CS_HANGUP ? "hangup" : "transfer";
if (hh && !mark) {
@ -167,7 +167,7 @@ void Session::do_hangup_hook()
arglist = Py_BuildValue("(Os)", Self, what);
}
if (!(result = PyEval_CallObject(hangup_func, arglist))) {
if (!PyEval_CallObject(hangup_func, arglist)) {
PyErr_Print();
}

View File

@ -178,7 +178,6 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi
PyThreadState *tstate = NULL;
char *dupargs = NULL;
char *argv[2] = { 0 };
int argc;
char *script = NULL;
PyObject *module_o = NULL, *module = NULL, *sp = NULL, *stp = NULL, *eve = NULL;
PyObject *function = NULL;
@ -198,7 +197,7 @@ static void eval_some_python(const char *funcname, char *args, switch_core_sessi
assert(dupargs != NULL);
if (!(argc = switch_separate_string(dupargs, ' ', argv, (sizeof(argv) / sizeof(argv[0]))))) {
if (!switch_separate_string(dupargs, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No module name specified!\n");
goto done;
}