diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 67bd073..7f3ff4d 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -6374,7 +6374,7 @@ SWITCH_STANDARD_APP(conference_function) uint32_t max_members_val; errno = 0; /* sanity first */ max_members_val = strtol(max_members_str, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ - if (errno == ERANGE || errno == EINVAL || max_members_val < 0 || max_members_val == 1) { + if (errno == ERANGE || errno == EINVAL || max_members_val == 1) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "conference_max_members variable %s is invalid, not setting a limit\n", max_members_str); } else { @@ -7105,7 +7105,7 @@ static conference_obj_t *conference_new(char *name, conf_xml_cfg_t cfg, switch_c } else if (!strcasecmp(var, "max-members") && !zstr(val)) { errno = 0; /* sanity first */ max_members = strtol(val, NULL, 0); /* base 0 lets 0x... for hex 0... for octal and base 10 otherwise through */ - if (errno == ERANGE || errno == EINVAL || max_members < 0 || max_members == 1) { + if (errno == ERANGE || errno == EINVAL || max_members == 1) { /* a negative wont work well, and its foolish to have a conference limited to 1 person unless the outbound * stuff is added, see comments above */ diff --git a/src/mod/applications/mod_db/mod_db.c b/src/mod/applications/mod_db/mod_db.c index dccc6c9..d94de1b 100644 --- a/src/mod/applications/mod_db/mod_db.c +++ b/src/mod/applications/mod_db/mod_db.c @@ -597,7 +597,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_db_load) switch_api_interface_t *commands_api_interface; switch_limit_interface_t *limit_interface; - memset(&globals, 0, sizeof(&globals)); + memset(&globals, 0, sizeof(globals)); strncpy(globals.hostname, switch_core_get_switchname(), sizeof(globals.hostname)); globals.pool = pool; diff --git a/src/mod/applications/mod_dptools/mod_dptools.c b/src/mod/applications/mod_dptools/mod_dptools.c index 592bfb4..b58c94b 100755 --- a/src/mod/applications/mod_dptools/mod_dptools.c +++ b/src/mod/applications/mod_dptools/mod_dptools.c @@ -344,13 +344,11 @@ static void bind_to_session(switch_core_session_t *session, if ((var = switch_channel_get_variable(channel, "bind_digit_digit_timeout"))) { tmp = (uint32_t) atol(var); - if (tmp < 0) tmp = 0; digit_timeout = tmp; } if ((var = switch_channel_get_variable(channel, "bind_digit_input_timeout"))) { tmp = (uint32_t) atol(var); - if (tmp < 0) tmp = 0; input_timeout = tmp; } @@ -2218,9 +2216,6 @@ SWITCH_STANDARD_APP(read_function) if (argc > 6) { digit_timeout = atoi(argv[6]); - if (digit_timeout < 0) { - digit_timeout = 0; - } } if (min_digits <= 1) { @@ -2304,9 +2299,6 @@ SWITCH_STANDARD_APP(play_and_get_digits_function) if (argc > 9) { digit_timeout = atoi(argv[9]); - if (digit_timeout < 0) { - digit_timeout = 0; - } } if (argc > 10) { @@ -2590,24 +2582,15 @@ SWITCH_STANDARD_APP(record_function) } if (l) { limit = atoi(l); - if (limit < 0) { - limit = 0; - } } } if (argv[2]) { fh.thresh = atoi(argv[2]); - if (fh.thresh < 0) { - fh.thresh = 0; - } } if (argv[3]) { fh.silence_hits = atoi(argv[3]); - if (fh.silence_hits < 0) { - fh.silence_hits = 0; - } } if ((tmp = switch_channel_get_variable(channel, "record_rate"))) { @@ -3481,9 +3464,7 @@ SWITCH_STANDARD_APP(wait_for_silence_function) listen_hits = atoi(argv[2]); if (argv[3]) { - if ((timeout_ms = atoi(argv[3])) < 0) { - timeout_ms = 0; - } + timeout_ms = atoi(argv[3]); } if (thresh > 0 && silence_hits > 0 && listen_hits > 0) { diff --git a/src/mod/applications/mod_hash/mod_hash.c b/src/mod/applications/mod_hash/mod_hash.c index ced478b..c4a899a 100644 --- a/src/mod/applications/mod_hash/mod_hash.c +++ b/src/mod/applications/mod_hash/mod_hash.c @@ -974,7 +974,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_hash_load) switch_limit_interface_t *limit_interface; switch_status_t status; - memset(&globals, 0, sizeof(&globals)); + memset(&globals, 0, sizeof(globals)); globals.pool = pool; status = switch_event_reserve_subclass(LIMIT_EVENT_USAGE); diff --git a/src/mod/applications/mod_voicemail/mod_voicemail.c b/src/mod/applications/mod_voicemail/mod_voicemail.c index 16dd999..719a800 100644 --- a/src/mod/applications/mod_voicemail/mod_voicemail.c +++ b/src/mod/applications/mod_voicemail/mod_voicemail.c @@ -3422,7 +3422,7 @@ static switch_status_t voicemail_leave_main(switch_core_session_t *session, vm_p status = create_file(session, profile, record_macro, file_path, &message_len, SWITCH_TRUE, key_buf, buf); - if ((status == SWITCH_STATUS_NOTFOUND)) { + if (status == SWITCH_STATUS_NOTFOUND) { goto end; } diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.c index 3a57b4e..5311db5 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey_socket.c @@ -188,56 +188,55 @@ static JSBool socket_read(JSContext * cx, JSObject * obj, uintN argc, jsval * ar return JS_FALSE; } - if (argc >= 0) { - char *delimiter = "\n"; - switch_status_t ret = SWITCH_STATUS_FALSE; - switch_size_t len = 1; - switch_size_t total_length = 0; - int can_run = TRUE; - char tempbuf[2]; - if (argc == 1) - delimiter = JS_GetStringBytes(JS_ValueToString(cx, argv[0])); - - - if (socket->read_buffer == 0) - socket->read_buffer = switch_core_alloc(socket->pool, socket->buffer_size); - - socket->saveDepth = JS_SuspendRequest(cx); - while (can_run == TRUE) { - ret = switch_socket_recv(socket->socket, tempbuf, &len); - if (ret != SWITCH_STATUS_SUCCESS) - break; - - tempbuf[1] = 0; - if (tempbuf[0] == delimiter[0]) - break; - else if (tempbuf[0] == '\r' && delimiter[0] == '\n') - continue; - else { - // Buffer is full, let's increase it. - if (total_length == socket->buffer_size - 1) { - switch_size_t new_size = socket->buffer_size + 4196; - char *new_buffer = switch_core_alloc(socket->pool, socket->buffer_size); - memcpy(new_buffer, socket->read_buffer, total_length); - socket->buffer_size = new_size; - socket->read_buffer = new_buffer; - } - socket->read_buffer[total_length] = tempbuf[0]; - ++total_length; + char *delimiter = "\n"; + switch_status_t ret = SWITCH_STATUS_FALSE; + switch_size_t len = 1; + switch_size_t total_length = 0; + int can_run = TRUE; + char tempbuf[2]; + + if (argc == 1) + delimiter = JS_GetStringBytes(JS_ValueToString(cx, argv[0])); + + + if (socket->read_buffer == 0) + socket->read_buffer = switch_core_alloc(socket->pool, socket->buffer_size); + + socket->saveDepth = JS_SuspendRequest(cx); + while (can_run == TRUE) { + ret = switch_socket_recv(socket->socket, tempbuf, &len); + if (ret != SWITCH_STATUS_SUCCESS) + break; + + tempbuf[1] = 0; + if (tempbuf[0] == delimiter[0]) + break; + else if (tempbuf[0] == '\r' && delimiter[0] == '\n') + continue; + else { + // Buffer is full, let's increase it. + if (total_length == socket->buffer_size - 1) { + switch_size_t new_size = socket->buffer_size + 4196; + char *new_buffer = switch_core_alloc(socket->pool, socket->buffer_size); + memcpy(new_buffer, socket->read_buffer, total_length); + socket->buffer_size = new_size; + socket->read_buffer = new_buffer; } - } - JS_ResumeRequest(cx, socket->saveDepth); - - if (ret != SWITCH_STATUS_SUCCESS) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "socket receive failed: %d.\n", ret); - *rval = BOOLEAN_TO_JSVAL(JS_FALSE); - } else { - socket->read_buffer[total_length] = 0; - *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, socket->read_buffer)); + socket->read_buffer[total_length] = tempbuf[0]; + ++total_length; } } - + JS_ResumeRequest(cx, socket->saveDepth); + + if (ret != SWITCH_STATUS_SUCCESS) { + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "socket receive failed: %d.\n", ret); + *rval = BOOLEAN_TO_JSVAL(JS_FALSE); + } else { + socket->read_buffer[total_length] = 0; + *rval = STRING_TO_JSVAL(JS_NewStringCopyZ(cx, socket->read_buffer)); + } + return JS_TRUE; } diff --git a/src/mod/loggers/mod_logfile/mod_logfile.c b/src/mod/loggers/mod_logfile/mod_logfile.c index b768d6b..5ea735f 100644 --- a/src/mod/loggers/mod_logfile/mod_logfile.c +++ b/src/mod/loggers/mod_logfile/mod_logfile.c @@ -333,14 +333,8 @@ static switch_status_t load_profile(switch_xml_t xml) new_profile->logfile = strdup(val); } else if (!strcmp(var, "rollover")) { new_profile->roll_size = atoi(val); - if (new_profile->roll_size < 0) { - new_profile->roll_size = 0; - } } else if (!strcmp(var, "maximum-rotate")) { new_profile->max_rot = atoi(val); - if (new_profile->max_rot < 0) { - new_profile->max_rot = MAX_ROT; - } } else if (!strcmp(var, "uuid") && switch_true(val)) { new_profile->log_uuid = SWITCH_TRUE; } diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index 06d474e..d7155f4 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -596,12 +596,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load) } } - if (globals.retries < 0) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Retries is negative, setting to 0\n"); - globals.retries = 0; - } - if (globals.retries && globals.delay <= 0) { + if (globals.retries && globals.delay == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Retries set but delay 0 setting to 5 seconds\n"); globals.delay = 5; }