turn on higher warning level in msvc for the core and libteletone and resolve warnings.
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@634 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
8d1967d7eb
commit
fc341792be
|
@ -46,7 +46,7 @@
|
|||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
|
@ -107,7 +107,7 @@
|
|||
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
|
|
|
@ -267,7 +267,7 @@ int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state,
|
|||
int sample;
|
||||
int best_row;
|
||||
int best_col;
|
||||
int hit;
|
||||
char hit;
|
||||
int limit;
|
||||
|
||||
hit = 0;
|
||||
|
|
|
@ -76,7 +76,7 @@ int teletone_init_session(teletone_generation_session_t *ts, int buflen, tone_ha
|
|||
ts->user_data = user_data;
|
||||
ts->volume = 1500;
|
||||
ts->decay_step = 0;
|
||||
if (!(ts->buffer = calloc(buflen, sizeof(teletone_audio_t)))) {
|
||||
if ((ts->buffer = calloc(buflen, sizeof(teletone_audio_t))) == 0) {
|
||||
return -1;
|
||||
}
|
||||
ts->datalen = buflen;
|
||||
|
@ -220,7 +220,7 @@ int teletone_run(teletone_generation_session_t *ts, char *cmd)
|
|||
continue;
|
||||
}
|
||||
|
||||
if ((end = strchr(cur, ';'))) {
|
||||
if ((end = strchr(cur, ';')) != 0) {
|
||||
*end++ = '\0';
|
||||
}
|
||||
|
||||
|
@ -283,11 +283,11 @@ int teletone_run(teletone_generation_session_t *ts, char *cmd)
|
|||
if (*cur) {
|
||||
char *next;
|
||||
int i = 0;
|
||||
if ((e = strchr(p, ')'))) {
|
||||
if ((e = strchr(p, ')')) != 0) {
|
||||
*e++ = '\0';
|
||||
}
|
||||
do {
|
||||
if ((next = strchr(p, ','))) {
|
||||
if ((next = strchr(p, ',')) != 0) {
|
||||
*next++ = '\0';
|
||||
}
|
||||
if (i == 0) {
|
||||
|
|
|
@ -76,6 +76,9 @@ extern "C" {
|
|||
* @{
|
||||
*/
|
||||
|
||||
typedef apr_size_t swtich_size_t;
|
||||
typedef apr_int16_t switch_int16_t;
|
||||
|
||||
/**
|
||||
* @defgroup switch_file_io File I/O Handling Functions
|
||||
* @ingroup switch_apr
|
||||
|
|
|
@ -80,7 +80,7 @@ SWITCH_DECLARE(int) switch_buffer_freespace(switch_buffer *buffer);
|
|||
* \param buffer any buffer of type switch_buffer
|
||||
* \return int ammount of buffer curently in use
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_buffer_inuse(switch_buffer *buffer);
|
||||
SWITCH_DECLARE(size_t) switch_buffer_inuse(switch_buffer *buffer);
|
||||
|
||||
/*! \brief Read data from a switch_buffer up to the ammount of datalen if it is available. Remove read data from buffer.
|
||||
* \param buffer any buffer of type switch_buffer
|
||||
|
|
|
@ -249,7 +249,7 @@ SWITCH_DECLARE(switch_status) switch_channel_hangup(switch_channel *channel);
|
|||
\param channel channel to test
|
||||
\return number of digits in the queue
|
||||
*/
|
||||
SWITCH_DECLARE(int) switch_channel_has_dtmf(switch_channel *channel);
|
||||
SWITCH_DECLARE(size_t) switch_channel_has_dtmf(switch_channel *channel);
|
||||
|
||||
/*!
|
||||
\brief Queue DTMF on a given channel
|
||||
|
|
|
@ -417,7 +417,7 @@ struct switch_codec_implementation {
|
|||
/*! number of samples that denote one frame */
|
||||
int samples_per_frame;
|
||||
/*! number of bytes that denote one frame decompressed */
|
||||
int bytes_per_frame;
|
||||
size_t bytes_per_frame;
|
||||
/*! number of bytes that denote one frame compressed */
|
||||
int encoded_bytes_per_frame;
|
||||
/*! number of channels represented */
|
||||
|
|
|
@ -38,6 +38,10 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable:4152 4054 4100)
|
||||
#endif
|
||||
|
||||
#if (_MSC_VER >= 1400) // VC8+
|
||||
#ifndef _CRT_SECURE_NO_DEPRECATE
|
||||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
|
|
@ -123,7 +123,7 @@ SWITCH_DECLARE(unsigned int) switch_separate_string(char *buf, char delim, char
|
|||
\param pool the memory pool to use
|
||||
\return SWITCH_STATUS_SUCCESS when successful
|
||||
*/
|
||||
SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock, unsigned int flags, switch_memory_pool *pool);
|
||||
SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock, switch_int16_t flags, switch_memory_pool *pool);
|
||||
|
||||
/*!
|
||||
\brief Wait for a socket
|
||||
|
|
|
@ -41,8 +41,8 @@ SWITCH_DECLARE(switch_status) switch_buffer_create(switch_memory_pool *pool, swi
|
|||
{
|
||||
switch_buffer *new_buffer;
|
||||
|
||||
if ((new_buffer = switch_core_alloc(pool, sizeof(switch_buffer)))
|
||||
&& (new_buffer->data = switch_core_alloc(pool, max_len))) {
|
||||
if ((new_buffer = switch_core_alloc(pool, sizeof(switch_buffer))) != 0
|
||||
&& (new_buffer->data = switch_core_alloc(pool, max_len)) != 0) {
|
||||
new_buffer->datalen = max_len;
|
||||
*buffer = new_buffer;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
@ -67,7 +67,7 @@ SWITCH_DECLARE(int) switch_buffer_freespace(switch_buffer *buffer)
|
|||
return (int) (buffer->datalen - buffer->used);
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(int) switch_buffer_inuse(switch_buffer *buffer)
|
||||
SWITCH_DECLARE(size_t) switch_buffer_inuse(switch_buffer *buffer)
|
||||
{
|
||||
assert(buffer != NULL);
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_new(switch_core_se
|
|||
|
||||
switch_caller_profile *profile = NULL;
|
||||
|
||||
if ((profile = switch_core_session_alloc(session, sizeof(switch_caller_profile)))) {
|
||||
if ((profile = switch_core_session_alloc(session, sizeof(switch_caller_profile))) != 0) {
|
||||
profile->dialplan = switch_core_session_strdup(session, dialplan);
|
||||
profile->caller_id_name = switch_core_session_strdup(session, caller_id_name);
|
||||
profile->caller_id_number = switch_core_session_strdup(session, caller_id_number);
|
||||
|
@ -60,7 +60,7 @@ SWITCH_DECLARE(switch_caller_profile *) switch_caller_profile_clone(switch_core_
|
|||
switch_caller_profile *tocopy)
|
||||
{
|
||||
switch_caller_profile *profile = NULL;
|
||||
if ((profile = switch_core_session_alloc(session, sizeof(switch_caller_profile)))) {
|
||||
if ((profile = switch_core_session_alloc(session, sizeof(switch_caller_profile))) != 0) {
|
||||
profile->dialplan = switch_core_session_strdup(session, tocopy->dialplan);
|
||||
profile->caller_id_name = switch_core_session_strdup(session, tocopy->caller_id_name);
|
||||
profile->ani = switch_core_session_strdup(session, tocopy->ani);
|
||||
|
@ -114,7 +114,7 @@ SWITCH_DECLARE(switch_caller_extension *) switch_caller_extension_new(switch_cor
|
|||
{
|
||||
switch_caller_extension *caller_extension = NULL;
|
||||
|
||||
if ((caller_extension = switch_core_session_alloc(session, sizeof(switch_caller_extension)))) {
|
||||
if ((caller_extension = switch_core_session_alloc(session, sizeof(switch_caller_extension))) != 0) {
|
||||
caller_extension->extension_name = switch_core_session_strdup(session, extension_name);
|
||||
caller_extension->extension_number = switch_core_session_strdup(session, extension_number);
|
||||
caller_extension->current_application = caller_extension->last_application = caller_extension->applications;
|
||||
|
@ -132,7 +132,7 @@ SWITCH_DECLARE(void) switch_caller_extension_add_application(switch_core_session
|
|||
|
||||
assert(session != NULL);
|
||||
|
||||
if ((caller_application = switch_core_session_alloc(session, sizeof(switch_caller_application)))) {
|
||||
if ((caller_application = switch_core_session_alloc(session, sizeof(switch_caller_application))) != 0) {
|
||||
caller_application->application_name = switch_core_session_strdup(session, application_name);
|
||||
caller_application->application_data = switch_core_session_strdup(session, application_data);
|
||||
if (!caller_extension->applications) {
|
||||
|
|
|
@ -60,7 +60,7 @@ SWITCH_DECLARE(switch_status) switch_channel_alloc(switch_channel **channel, swi
|
|||
{
|
||||
assert(pool != NULL);
|
||||
|
||||
if (!((*channel) = switch_core_alloc(pool, sizeof(switch_channel)))) {
|
||||
if (((*channel) = switch_core_alloc(pool, sizeof(switch_channel))) == 0) {
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
|
||||
|
@ -112,9 +112,9 @@ SWITCH_DECLARE(switch_status) switch_channel_get_raw_mode(switch_channel *channe
|
|||
}
|
||||
|
||||
|
||||
SWITCH_DECLARE(int) switch_channel_has_dtmf(switch_channel *channel)
|
||||
SWITCH_DECLARE(size_t) switch_channel_has_dtmf(switch_channel *channel)
|
||||
{
|
||||
int has;
|
||||
size_t has;
|
||||
|
||||
assert(channel != NULL);
|
||||
switch_mutex_lock(channel->dtmf_mutex);
|
||||
|
|
|
@ -52,7 +52,7 @@ SWITCH_DECLARE(int) switch_config_open_file(switch_config *cfg, char *file_path)
|
|||
path = path_buf;
|
||||
}
|
||||
|
||||
if (!path || !(f = fopen(path, "r"))) {
|
||||
if (!path || (f = fopen(path, "r")) == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -93,7 +93,7 @@ SWITCH_DECLARE(int) switch_config_next_pair(switch_config *cfg, char **var, char
|
|||
|
||||
*var = cfg->buf;
|
||||
|
||||
if (**var == '[' && (end = strchr(*var, ']'))) {
|
||||
if (**var == '[' && (end = strchr(*var, ']')) != 0) {
|
||||
*end = '\0';
|
||||
(*var)++;
|
||||
switch_copy_string(cfg->category, *var, sizeof(cfg->category));
|
||||
|
@ -109,10 +109,10 @@ SWITCH_DECLARE(int) switch_config_next_pair(switch_config *cfg, char **var, char
|
|||
break;
|
||||
}
|
||||
|
||||
if ((end = strchr(*var, '#'))) {
|
||||
if ((end = strchr(*var, '#')) != 0) {
|
||||
*end = '\0';
|
||||
end--;
|
||||
} else if ((end = strchr(*var, '\n'))) {
|
||||
} else if ((end = strchr(*var, '\n')) != 0) {
|
||||
if (*(end - 1) == '\r') {
|
||||
end--;
|
||||
}
|
||||
|
@ -126,7 +126,7 @@ SWITCH_DECLARE(int) switch_config_next_pair(switch_config *cfg, char **var, char
|
|||
}
|
||||
*var = p;
|
||||
|
||||
if (!(*val = strchr(*var, '='))) {
|
||||
if ((*val = strchr(*var, '=')) == 0) {
|
||||
ret = -1;
|
||||
//log_printf(0, server.log, "Invalid syntax on %s: line %d\n", cfg->path, cfg->lineno);
|
||||
continue;
|
||||
|
|
|
@ -66,11 +66,11 @@ static int switch_console_process(char *cmd)
|
|||
return 1;
|
||||
}
|
||||
#endif
|
||||
if ((arg = strchr(cmd, '\r')) || (arg = strchr(cmd, '\n'))) {
|
||||
if ((arg = strchr(cmd, '\r')) != 0 || (arg = strchr(cmd, '\n')) != 0 ) {
|
||||
*arg = '\0';
|
||||
arg = NULL;
|
||||
}
|
||||
if ((arg = strchr(cmd, ' '))) {
|
||||
if ((arg = strchr(cmd, ' ')) != 0) {
|
||||
*arg++ = '\0';
|
||||
}
|
||||
if (switch_api_execute(cmd, arg, retbuf, sizeof(retbuf)) == SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -160,8 +160,8 @@ SWITCH_DECLARE(void) switch_console_loop(void)
|
|||
}
|
||||
|
||||
memset(&cmd, 0, sizeof(cmd));
|
||||
for (x = 0; sizeof(cmd); x++) {
|
||||
cmd[x] = getchar();
|
||||
for (x = 0; x < sizeof(cmd); x++) {
|
||||
cmd[x] = (char)getchar();
|
||||
if (cmd[x] == '\n') {
|
||||
cmd[x] = '\0';
|
||||
break;
|
||||
|
|
|
@ -215,7 +215,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_message_send(char *uuid_str, s
|
|||
{
|
||||
switch_core_session *session = NULL;
|
||||
|
||||
if ((session = switch_core_hash_find(runtime.session_table, uuid_str))) {
|
||||
if ((session = switch_core_hash_find(runtime.session_table, uuid_str)) != 0) {
|
||||
if (switch_channel_get_state(session->channel) < CS_HANGUP) {
|
||||
return switch_core_session_receive_message(session, message);
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ SWITCH_DECLARE(switch_status) switch_core_codec_init(switch_codec *codec, char *
|
|||
|
||||
memset(codec, 0, sizeof(*codec));
|
||||
|
||||
if (!(codec_interface = switch_loadable_module_get_codec_interface(codec_name))) {
|
||||
if ((codec_interface = switch_loadable_module_get_codec_interface(codec_name)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "invalid codec %s!\n", codec_name);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
@ -397,13 +397,13 @@ SWITCH_DECLARE(switch_status) switch_core_file_open(switch_file_handle *fh, char
|
|||
char *ext;
|
||||
switch_status status;
|
||||
|
||||
if (!(ext = strrchr(file_path, '.'))) {
|
||||
if ((ext = strrchr(file_path, '.')) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid Format\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
ext++;
|
||||
|
||||
if (!(fh->file_interface = switch_loadable_module_get_file_interface(ext))) {
|
||||
if ((fh->file_interface = switch_loadable_module_get_file_interface(ext)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "invalid file format [%s]!\n", ext);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
@ -455,7 +455,7 @@ SWITCH_DECLARE(switch_status) switch_core_directory_open(switch_directory_handle
|
|||
{
|
||||
switch_status status;
|
||||
|
||||
if (!(dh->directory_interface = switch_loadable_module_get_directory_interface(module_name))) {
|
||||
if ((dh->directory_interface = switch_loadable_module_get_directory_interface(module_name)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "invalid directory module [%s]!\n", module_name);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
@ -499,7 +499,7 @@ SWITCH_DECLARE(switch_status) switch_core_speech_open(switch_speech_handle *sh,
|
|||
{
|
||||
switch_status status;
|
||||
|
||||
if (!(sh->speech_interface = switch_loadable_module_get_speech_interface(module_name))) {
|
||||
if ((sh->speech_interface = switch_loadable_module_get_speech_interface(module_name)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "invalid speech module [%s]!\n", module_name);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
@ -561,7 +561,7 @@ SWITCH_DECLARE(switch_status) switch_core_timer_init(switch_timer *timer, char *
|
|||
switch_timer_interface *timer_interface;
|
||||
switch_status status;
|
||||
memset(timer, 0, sizeof(*timer));
|
||||
if (!(timer_interface = switch_loadable_module_get_timer_interface(timer_name))) {
|
||||
if ((timer_interface = switch_loadable_module_get_timer_interface(timer_name)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "invalid timer %s!\n", timer_name);
|
||||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
@ -688,7 +688,7 @@ SWITCH_DECLARE(void *) switch_core_session_alloc(switch_core_session *session, s
|
|||
assert(session != NULL);
|
||||
assert(session->pool != NULL);
|
||||
|
||||
if ((ptr = apr_palloc(session->pool, memory))) {
|
||||
if ((ptr = apr_palloc(session->pool, memory)) != 0) {
|
||||
memset(ptr, 0, memory);
|
||||
}
|
||||
return ptr;
|
||||
|
@ -702,7 +702,7 @@ SWITCH_DECLARE(void *) switch_core_permenant_alloc(size_t memory)
|
|||
void *ptr = NULL;
|
||||
assert(runtime.memory_pool != NULL);
|
||||
|
||||
if ((ptr = apr_palloc(runtime.memory_pool, memory))) {
|
||||
if ((ptr = apr_palloc(runtime.memory_pool, memory)) != 0) {
|
||||
memset(ptr, 0, memory);
|
||||
}
|
||||
return ptr;
|
||||
|
@ -719,7 +719,7 @@ SWITCH_DECLARE(char *) switch_core_permenant_strdup(char *todup)
|
|||
return NULL;
|
||||
|
||||
len = strlen(todup) + 1;
|
||||
if (todup && (duped = apr_palloc(runtime.memory_pool, len))) {
|
||||
if (todup && (duped = apr_palloc(runtime.memory_pool, len)) != 0) {
|
||||
strncpy(duped, todup, len);
|
||||
}
|
||||
return duped;
|
||||
|
@ -738,7 +738,7 @@ SWITCH_DECLARE(char *) switch_core_session_strdup(switch_core_session *session,
|
|||
|
||||
len = strlen(todup) + 1;
|
||||
|
||||
if (todup && (duped = apr_palloc(session->pool, len))) {
|
||||
if (todup && (duped = apr_palloc(session->pool, len)) != 0) {
|
||||
strncpy(duped, todup, len);
|
||||
}
|
||||
return duped;
|
||||
|
@ -756,7 +756,7 @@ SWITCH_DECLARE(char *) switch_core_strdup(switch_memory_pool *pool, char *todup)
|
|||
return NULL;
|
||||
len = strlen(todup) + 1;
|
||||
|
||||
if (todup && (duped = apr_palloc(pool, len))) {
|
||||
if (todup && (duped = apr_palloc(pool, len)) != 0) {
|
||||
strncpy(duped, todup, len);
|
||||
}
|
||||
return duped;
|
||||
|
@ -802,7 +802,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_outgoing_channel(switch_core_s
|
|||
switch_status status = SWITCH_STATUS_FALSE;
|
||||
const switch_endpoint_interface *endpoint_interface;
|
||||
|
||||
if (!(endpoint_interface = switch_loadable_module_get_endpoint_interface(endpoint_name))) {
|
||||
if ((endpoint_interface = switch_loadable_module_get_endpoint_interface(endpoint_name)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Could not locate channel type %s\n", endpoint_name);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
@ -823,21 +823,21 @@ SWITCH_DECLARE(switch_status) switch_core_session_outgoing_channel(switch_core_s
|
|||
switch_caller_profile *profile = NULL, *peer_profile = NULL, *cloned_profile = NULL;
|
||||
switch_channel *channel = NULL, *peer_channel = NULL;
|
||||
|
||||
if ((channel = switch_core_session_get_channel(session))) {
|
||||
if ((channel = switch_core_session_get_channel(session)) != 0) {
|
||||
profile = switch_channel_get_caller_profile(channel);
|
||||
}
|
||||
if ((peer_channel = switch_core_session_get_channel(*new_session))) {
|
||||
if ((peer_channel = switch_core_session_get_channel(*new_session)) != 0) {
|
||||
peer_profile = switch_channel_get_caller_profile(peer_channel);
|
||||
}
|
||||
|
||||
if (channel && peer_channel) {
|
||||
if (profile) {
|
||||
if ((cloned_profile = switch_caller_profile_clone(*new_session, profile))) {
|
||||
if ((cloned_profile = switch_caller_profile_clone(*new_session, profile)) != 0) {
|
||||
switch_channel_set_originator_caller_profile(peer_channel, cloned_profile);
|
||||
}
|
||||
}
|
||||
if (peer_profile) {
|
||||
if ((cloned_profile = switch_caller_profile_clone(session, peer_profile))) {
|
||||
if ((cloned_profile = switch_caller_profile_clone(session, peer_profile)) != 0) {
|
||||
switch_channel_set_originatee_caller_profile(channel, cloned_profile);
|
||||
}
|
||||
}
|
||||
|
@ -989,7 +989,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_read_frame(switch_core_session
|
|||
perfect = TRUE;
|
||||
} else {
|
||||
if (!session->raw_read_buffer) {
|
||||
int bytes = session->read_codec->implementation->bytes_per_frame * 10;
|
||||
size_t bytes = session->read_codec->implementation->bytes_per_frame * 10;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Engaging Read Buffer at %d bytes\n", bytes);
|
||||
switch_buffer_create(session->pool, &session->raw_read_buffer, bytes);
|
||||
}
|
||||
|
@ -1146,7 +1146,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio
|
|||
perfect = TRUE;
|
||||
} else {
|
||||
if (!session->raw_write_buffer) {
|
||||
int bytes = session->write_codec->implementation->bytes_per_frame * 10;
|
||||
size_t bytes = session->write_codec->implementation->bytes_per_frame * 10;
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE,
|
||||
"Engaging Write Buffer at %d bytes to accomidate %d->%d\n",
|
||||
bytes,
|
||||
|
@ -1197,16 +1197,16 @@ SWITCH_DECLARE(switch_status) switch_core_session_write_frame(switch_core_sessio
|
|||
status = perform_write(session, write_frame, timeout, io_flag, stream_id);
|
||||
return status;
|
||||
} else {
|
||||
int used = switch_buffer_inuse(session->raw_write_buffer);
|
||||
int bytes = session->write_codec->implementation->bytes_per_frame;
|
||||
int frames = (used / bytes);
|
||||
size_t used = switch_buffer_inuse(session->raw_write_buffer);
|
||||
size_t bytes = session->write_codec->implementation->bytes_per_frame;
|
||||
size_t frames = (used / bytes);
|
||||
|
||||
|
||||
if (frames) {
|
||||
int x;
|
||||
size_t x;
|
||||
for (x = 0; x < frames; x++) {
|
||||
if ((session->raw_write_frame.datalen =
|
||||
switch_buffer_read(session->raw_write_buffer, session->raw_write_frame.data, bytes))) {
|
||||
switch_buffer_read(session->raw_write_buffer, session->raw_write_frame.data, bytes)) != 0) {
|
||||
|
||||
enc_frame = &session->raw_write_frame;
|
||||
session->raw_write_frame.rate = session->write_codec->implementation->samples_per_second;
|
||||
|
@ -1366,7 +1366,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_add_event_hook_outgoing(switch
|
|||
switch_io_event_hook_outgoing_channel *hook, *ptr;
|
||||
|
||||
assert(outgoing_channel != NULL);
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook)))) {
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) {
|
||||
hook->outgoing_channel = outgoing_channel;
|
||||
if (!session->event_hooks.outgoing_channel) {
|
||||
session->event_hooks.outgoing_channel = hook;
|
||||
|
@ -1389,7 +1389,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_add_event_hook_answer_channel(
|
|||
switch_io_event_hook_answer_channel *hook, *ptr;
|
||||
|
||||
assert(answer_channel != NULL);
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook)))) {
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) {
|
||||
hook->answer_channel = answer_channel;
|
||||
if (!session->event_hooks.answer_channel) {
|
||||
session->event_hooks.answer_channel = hook;
|
||||
|
@ -1412,7 +1412,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_add_event_hook_read_frame(swit
|
|||
switch_io_event_hook_read_frame *hook, *ptr;
|
||||
|
||||
assert(read_frame != NULL);
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook)))) {
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) {
|
||||
hook->read_frame = read_frame;
|
||||
if (!session->event_hooks.read_frame) {
|
||||
session->event_hooks.read_frame = hook;
|
||||
|
@ -1435,7 +1435,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_add_event_hook_write_frame(swi
|
|||
switch_io_event_hook_write_frame *hook, *ptr;
|
||||
|
||||
assert(write_frame != NULL);
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook)))) {
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) {
|
||||
hook->write_frame = write_frame;
|
||||
if (!session->event_hooks.write_frame) {
|
||||
session->event_hooks.write_frame = hook;
|
||||
|
@ -1458,7 +1458,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_add_event_hook_kill_channel(sw
|
|||
switch_io_event_hook_kill_channel *hook, *ptr;
|
||||
|
||||
assert(kill_channel != NULL);
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook)))) {
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) {
|
||||
hook->kill_channel = kill_channel;
|
||||
if (!session->event_hooks.kill_channel) {
|
||||
session->event_hooks.kill_channel = hook;
|
||||
|
@ -1481,7 +1481,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_add_event_hook_waitfor_read(sw
|
|||
switch_io_event_hook_waitfor_read *hook, *ptr;
|
||||
|
||||
assert(waitfor_read != NULL);
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook)))) {
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) {
|
||||
hook->waitfor_read = waitfor_read;
|
||||
if (!session->event_hooks.waitfor_read) {
|
||||
session->event_hooks.waitfor_read = hook;
|
||||
|
@ -1504,7 +1504,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_add_event_hook_waitfor_write(s
|
|||
switch_io_event_hook_waitfor_write *hook, *ptr;
|
||||
|
||||
assert(waitfor_write != NULL);
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook)))) {
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) {
|
||||
hook->waitfor_write = waitfor_write;
|
||||
if (!session->event_hooks.waitfor_write) {
|
||||
session->event_hooks.waitfor_write = hook;
|
||||
|
@ -1528,7 +1528,7 @@ SWITCH_DECLARE(switch_status) switch_core_session_add_event_hook_send_dtmf(switc
|
|||
switch_io_event_hook_send_dtmf *hook, *ptr;
|
||||
|
||||
assert(send_dtmf != NULL);
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook)))) {
|
||||
if ((hook = switch_core_session_alloc(session, sizeof(*hook))) != 0) {
|
||||
hook->send_dtmf = send_dtmf;
|
||||
if (!session->event_hooks.send_dtmf) {
|
||||
session->event_hooks.send_dtmf = hook;
|
||||
|
@ -1591,15 +1591,15 @@ static void switch_core_standard_on_ring(switch_core_session *session)
|
|||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Standard RING %s\n", switch_channel_get_name(session->channel));
|
||||
|
||||
if (!(caller_profile = switch_channel_get_caller_profile(session->channel))) {
|
||||
if ((caller_profile = switch_channel_get_caller_profile(session->channel)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't get profile!\n");
|
||||
switch_channel_set_state(session->channel, CS_HANGUP);
|
||||
} else {
|
||||
if (!(dialplan_interface = switch_loadable_module_get_dialplan_interface(caller_profile->dialplan))) {
|
||||
if ((dialplan_interface = switch_loadable_module_get_dialplan_interface(caller_profile->dialplan)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Can't get dialplan [%s]!\n", caller_profile->dialplan);
|
||||
switch_channel_set_state(session->channel, CS_HANGUP);
|
||||
} else {
|
||||
if ((extension = dialplan_interface->hunt_function(session))) {
|
||||
if ((extension = dialplan_interface->hunt_function(session)) != 0) {
|
||||
switch_channel_set_caller_extension(session->channel, extension);
|
||||
}
|
||||
}
|
||||
|
@ -1613,7 +1613,7 @@ static void switch_core_standard_on_execute(switch_core_session *session)
|
|||
|
||||
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Standard EXECUTE\n");
|
||||
if (!(extension = switch_channel_get_caller_extension(session->channel))) {
|
||||
if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "No Extension!\n");
|
||||
switch_channel_set_state(session->channel, CS_HANGUP);
|
||||
return;
|
||||
|
@ -1623,9 +1623,9 @@ static void switch_core_standard_on_execute(switch_core_session *session)
|
|||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Execute %s(%s)\n",
|
||||
extension->current_application->application_name,
|
||||
extension->current_application->application_data);
|
||||
if (!
|
||||
if (
|
||||
(application_interface =
|
||||
switch_loadable_module_get_application_interface(extension->current_application->application_name))) {
|
||||
switch_loadable_module_get_application_interface(extension->current_application->application_name)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Invalid Application %s\n",
|
||||
extension->current_application->application_name);
|
||||
switch_channel_set_state(session->channel, CS_HANGUP);
|
||||
|
@ -1733,7 +1733,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
(driver_state_handler->on_hangup &&
|
||||
driver_state_handler->on_hangup(session) == SWITCH_STATUS_SUCCESS &&
|
||||
midstate == switch_channel_get_state(session->channel))) {
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++))) {
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_hangup ||
|
||||
(application_state_handler->on_hangup &&
|
||||
application_state_handler->on_hangup(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1746,7 +1746,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
}
|
||||
}
|
||||
index = 0;
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++))) {
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_hangup ||
|
||||
(application_state_handler->on_hangup &&
|
||||
application_state_handler->on_hangup(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1772,7 +1772,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
(driver_state_handler->on_init &&
|
||||
driver_state_handler->on_init(session) == SWITCH_STATUS_SUCCESS &&
|
||||
midstate == switch_channel_get_state(session->channel))) {
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++))) {
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_init ||
|
||||
(application_state_handler->on_init &&
|
||||
application_state_handler->on_init(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1785,7 +1785,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
}
|
||||
}
|
||||
index = 0;
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++))) {
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_init ||
|
||||
(application_state_handler->on_init &&
|
||||
application_state_handler->on_init(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1808,7 +1808,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
(driver_state_handler->on_ring &&
|
||||
driver_state_handler->on_ring(session) == SWITCH_STATUS_SUCCESS &&
|
||||
midstate == switch_channel_get_state(session->channel))) {
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++))) {
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_ring ||
|
||||
(application_state_handler->on_ring &&
|
||||
application_state_handler->on_ring(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1821,7 +1821,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
}
|
||||
}
|
||||
index = 0;
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++))) {
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_ring ||
|
||||
(application_state_handler->on_ring &&
|
||||
application_state_handler->on_ring(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1844,7 +1844,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
(driver_state_handler->on_execute &&
|
||||
driver_state_handler->on_execute(session) == SWITCH_STATUS_SUCCESS &&
|
||||
midstate == switch_channel_get_state(session->channel))) {
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++))) {
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_execute ||
|
||||
(application_state_handler->on_execute &&
|
||||
application_state_handler->on_execute(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1857,7 +1857,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
}
|
||||
}
|
||||
index = 0;
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++))) {
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_execute ||
|
||||
(application_state_handler->on_execute &&
|
||||
application_state_handler->on_execute(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1880,7 +1880,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
(driver_state_handler->on_loopback &&
|
||||
driver_state_handler->on_loopback(session) == SWITCH_STATUS_SUCCESS &&
|
||||
midstate == switch_channel_get_state(session->channel))) {
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++))) {
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_loopback ||
|
||||
(application_state_handler->on_loopback &&
|
||||
application_state_handler->on_loopback(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1893,7 +1893,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
}
|
||||
}
|
||||
index = 0;
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++))) {
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_loopback ||
|
||||
(application_state_handler->on_loopback &&
|
||||
application_state_handler->on_loopback(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1917,7 +1917,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
driver_state_handler->on_transmit(session) == SWITCH_STATUS_SUCCESS &&
|
||||
midstate == switch_channel_get_state(session->channel))) {
|
||||
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++))) {
|
||||
while((application_state_handler = switch_channel_get_state_handler(session->channel, index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_transmit ||
|
||||
(application_state_handler->on_transmit &&
|
||||
application_state_handler->on_transmit(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1930,7 +1930,7 @@ SWITCH_DECLARE(void) switch_core_session_run(switch_core_session *session)
|
|||
}
|
||||
}
|
||||
index = 0;
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++))) {
|
||||
while(proceed && (application_state_handler = switch_core_get_state_handler(index++)) != 0) {
|
||||
if (!application_state_handler || !application_state_handler->on_transmit ||
|
||||
(application_state_handler->on_transmit &&
|
||||
application_state_handler->on_transmit(session) == SWITCH_STATUS_SUCCESS &&
|
||||
|
@ -1977,7 +1977,7 @@ SWITCH_DECLARE(void) switch_core_session_destroy(switch_core_session **session)
|
|||
|
||||
SWITCH_DECLARE(switch_status) switch_core_hash_init(switch_hash **hash, switch_memory_pool *pool)
|
||||
{
|
||||
if ((*hash = apr_hash_make(pool))) {
|
||||
if ((*hash = apr_hash_make(pool)) != 0) {
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
return SWITCH_STATUS_GENERR;
|
||||
|
@ -2042,7 +2042,7 @@ SWITCH_DECLARE(void) switch_core_launch_thread(switch_thread_start_t func, void
|
|||
switch_threadattr_create(&thd_attr, pool);
|
||||
switch_threadattr_detach_set(thd_attr, 1);
|
||||
|
||||
if (!(ts = switch_core_alloc(pool, sizeof(*ts)))) {
|
||||
if ((ts = switch_core_alloc(pool, sizeof(*ts))) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Could not allocate memory\n");
|
||||
} else {
|
||||
if (mypool) {
|
||||
|
@ -2107,7 +2107,7 @@ SWITCH_DECLARE(void *) switch_core_alloc(switch_memory_pool *pool, size_t memory
|
|||
void *ptr = NULL;
|
||||
assert(pool != NULL);
|
||||
|
||||
if ((ptr = apr_palloc(pool, memory))) {
|
||||
if ((ptr = apr_palloc(pool, memory)) != 0) {
|
||||
memset(ptr, 0, memory);
|
||||
}
|
||||
return ptr;
|
||||
|
@ -2129,7 +2129,7 @@ SWITCH_DECLARE(switch_core_session *) switch_core_session_request(const switch_e
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (!(session = switch_core_alloc(usepool, sizeof(switch_core_session)))) {
|
||||
if ((session = switch_core_alloc(usepool, sizeof(switch_core_session))) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Could not allocate session\n");
|
||||
apr_pool_destroy(usepool);
|
||||
return NULL;
|
||||
|
@ -2173,7 +2173,7 @@ SWITCH_DECLARE(switch_core_session *) switch_core_session_request_by_name(char *
|
|||
{
|
||||
const switch_endpoint_interface *endpoint_interface;
|
||||
|
||||
if (!(endpoint_interface = switch_loadable_module_get_endpoint_interface(endpoint_name))) {
|
||||
if ((endpoint_interface = switch_loadable_module_get_endpoint_interface(endpoint_name)) == 0) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Could not locate channel type %s\n", endpoint_name);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2226,7 +2226,7 @@ SWITCH_DECLARE(switch_status) switch_core_init(void)
|
|||
assert(runtime.memory_pool != NULL);
|
||||
|
||||
/* Activate SQL database */
|
||||
if (!(runtime.db = switch_core_db_handle())) {
|
||||
if ((runtime.db = switch_core_db_handle()) == 0 ) {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Error Opening DB!\n");
|
||||
} else {
|
||||
switch_console_printf(SWITCH_CHANNEL_CONSOLE, "Opening DB\n");
|
||||
|
|
|
@ -122,12 +122,12 @@ static int switch_events_match(switch_event *event, switch_event_node *node)
|
|||
if (event->subclass && node->subclass) {
|
||||
if (!strncasecmp(node->subclass->name, "file:", 5)) {
|
||||
char *file_header;
|
||||
if ((file_header = switch_event_get_header(event, "file"))) {
|
||||
if ((file_header = switch_event_get_header(event, "file")) != 0) {
|
||||
match = strstr(node->subclass->name + 5, file_header) ? 1 : 0;
|
||||
}
|
||||
} else if (!strncasecmp(node->subclass->name, "func:", 5)) {
|
||||
char *func_header;
|
||||
if ((func_header = switch_event_get_header(event, "function"))) {
|
||||
if ((func_header = switch_event_get_header(event, "function")) != 0) {
|
||||
match = strstr(node->subclass->name + 5, func_header) ? 1 : 0;
|
||||
}
|
||||
} else {
|
||||
|
@ -221,7 +221,7 @@ SWITCH_DECLARE(switch_status) switch_event_reserve_subclass_detailed(char *owner
|
|||
return SWITCH_STATUS_INUSE;
|
||||
}
|
||||
|
||||
if (!(subclass = switch_core_alloc(RUNTIME_POOL, sizeof(*subclass)))) {
|
||||
if ((subclass = switch_core_alloc(RUNTIME_POOL, sizeof(*subclass))) == 0) {
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
|
||||
|
@ -288,7 +288,7 @@ SWITCH_DECLARE(switch_status) switch_event_create_subclass(switch_event **event,
|
|||
return SWITCH_STATUS_GENERR;
|
||||
}
|
||||
|
||||
if (!(*event = ALLOC(sizeof(switch_event)))) {
|
||||
if ((*event = ALLOC(sizeof(switch_event))) == 0) {
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
#ifdef MALLOC_EVENTS
|
||||
|
@ -333,7 +333,7 @@ SWITCH_DECLARE(switch_status) switch_event_add_header(switch_event *event, switc
|
|||
} else {
|
||||
switch_event_header *header, *hp;
|
||||
|
||||
if (!(header = ALLOC(sizeof(*header)))) {
|
||||
if ((header = ALLOC(sizeof(*header))) == 0) {
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
#ifdef MALLOC_EVENTS
|
||||
|
@ -342,7 +342,7 @@ SWITCH_DECLARE(switch_status) switch_event_add_header(switch_event *event, switc
|
|||
|
||||
header->name = DUP(header_name);
|
||||
header->value = DUP(data);
|
||||
if ((stack = SWITCH_STACK_TOP)) {
|
||||
if (((stack = SWITCH_STACK_TOP)) != 0) {
|
||||
header->next = event->headers;
|
||||
event->headers = header;
|
||||
} else {
|
||||
|
@ -357,9 +357,6 @@ SWITCH_DECLARE(switch_status) switch_event_add_header(switch_event *event, switc
|
|||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
}
|
||||
|
||||
return (ret >= 0) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_GENERR;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -379,9 +376,6 @@ SWITCH_DECLARE(switch_status) switch_event_add_body(switch_event *event, char *f
|
|||
event->body = DUP(data);
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
return (ret >= 0) ? SWITCH_STATUS_SUCCESS : SWITCH_STATUS_GENERR;
|
||||
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_event_destroy(switch_event **event)
|
||||
|
@ -415,7 +409,7 @@ SWITCH_DECLARE(switch_status) switch_event_dup(switch_event **event, switch_even
|
|||
(*event)->bind_user_data = todup->bind_user_data;
|
||||
|
||||
for (hp = todup->headers; hp && hp->next;) {
|
||||
if (!(header = ALLOC(sizeof(*header)))) {
|
||||
if ((header = ALLOC(sizeof(*header))) == 0) {
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
#ifdef MALLOC_EVENTS
|
||||
|
@ -546,8 +540,8 @@ SWITCH_DECLARE(switch_status) switch_event_bind(char *id, switch_event_t event,
|
|||
assert(RUNTIME_POOL != NULL);
|
||||
|
||||
if (subclass_name) {
|
||||
if (!(subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name))) {
|
||||
if (!(subclass = switch_core_alloc(RUNTIME_POOL, sizeof(*subclass)))) {
|
||||
if ((subclass = switch_core_hash_find(CUSTOM_HASH, subclass_name)) == 0) {
|
||||
if ((subclass = switch_core_alloc(RUNTIME_POOL, sizeof(*subclass))) == 0) {
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
} else {
|
||||
subclass->owner = switch_core_strdup(RUNTIME_POOL, id);
|
||||
|
@ -556,7 +550,7 @@ SWITCH_DECLARE(switch_status) switch_event_bind(char *id, switch_event_t event,
|
|||
}
|
||||
}
|
||||
|
||||
if (event <= SWITCH_EVENT_ALL && (event_node = switch_core_alloc(RUNTIME_POOL, sizeof(switch_event_node)))) {
|
||||
if (event <= SWITCH_EVENT_ALL && (event_node = switch_core_alloc(RUNTIME_POOL, sizeof(switch_event_node))) != 0) {
|
||||
switch_mutex_lock(BLOCK);
|
||||
/* <LOCKED> ----------------------------------------------- */
|
||||
event_node->id = switch_core_strdup(RUNTIME_POOL, id);
|
||||
|
|
|
@ -132,7 +132,7 @@ static switch_status switch_loadable_module_load_file(char *filename, switch_mem
|
|||
break;
|
||||
}
|
||||
|
||||
if (!(module = switch_core_permenant_alloc(sizeof(switch_loadable_module)))) {
|
||||
if ((module = switch_core_permenant_alloc(sizeof(switch_loadable_module))) == 0) {
|
||||
err = "Could not allocate memory\n";
|
||||
break;
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ static void process_module_file(char *dir, char *fname)
|
|||
#endif
|
||||
|
||||
|
||||
if (!(file = switch_core_strdup(loadable_modules.pool, fname))) {
|
||||
if ((file = switch_core_strdup(loadable_modules.pool, fname)) == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ SWITCH_DECLARE(switch_status) switch_loadable_module_init()
|
|||
fname = finfo.name;
|
||||
}
|
||||
|
||||
if (!(ptr = (char *) fname)) {
|
||||
if ((ptr = (char *) fname) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -512,7 +512,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(switch_memory_pool
|
|||
switch_codec_interface *codec_interface;
|
||||
|
||||
for (x = 0; x < preflen; x++) {
|
||||
if ((codec_interface = switch_loadable_module_get_codec_interface(prefs[x]))) {
|
||||
if ((codec_interface = switch_loadable_module_get_codec_interface(prefs[x])) != 0 ) {
|
||||
array[i++] = codec_interface;
|
||||
}
|
||||
}
|
||||
|
@ -526,7 +526,7 @@ SWITCH_DECLARE(switch_status) switch_api_execute(char *cmd, char *arg, char *ret
|
|||
switch_status status;
|
||||
switch_event *event;
|
||||
|
||||
if ((api = switch_loadable_module_get_api_interface(cmd))) {
|
||||
if ((api = switch_loadable_module_get_api_interface(cmd)) != 0) {
|
||||
status = api->function(arg, retbuf, len);
|
||||
} else {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
|
|
|
@ -53,7 +53,7 @@ SWITCH_DECLARE(switch_status) switch_resample_create(switch_audio_resampler **ne
|
|||
{
|
||||
switch_audio_resampler *resampler;
|
||||
|
||||
if (!(resampler = switch_core_alloc(pool, sizeof(*resampler)))) {
|
||||
if ((resampler = switch_core_alloc(pool, sizeof(*resampler))) == 0) {
|
||||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ SWITCH_DECLARE(char *) switch_cut_path(char *in)
|
|||
|
||||
for (i = delims; *i; i++) {
|
||||
p = in;
|
||||
while ((p = strchr(p, *i))) {
|
||||
while ((p = strchr(p, *i)) != 0) {
|
||||
ret = ++p;
|
||||
}
|
||||
}
|
||||
|
@ -83,7 +83,7 @@ SWITCH_DECLARE(char *) switch_cut_path(char *in)
|
|||
}
|
||||
|
||||
SWITCH_DECLARE(switch_status) switch_socket_create_pollfd(switch_pollfd_t *poll, switch_socket_t *sock,
|
||||
unsigned int flags, switch_memory_pool *pool)
|
||||
switch_int16_t flags, switch_memory_pool *pool)
|
||||
{
|
||||
switch_pollset_t *pollset;
|
||||
switch_status status;
|
||||
|
|
|
@ -48,7 +48,7 @@
|
|||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
|
@ -132,7 +132,7 @@
|
|||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FREESWITCHCORE_EXPORTS;APR_DECLARE_EXPORT;APU_DECLARE_EXPORT;API_DECLARE_EXPORT;_CRT_SECURE_NO_DEPRECATE;_CRT_NONSTDC_NO_DEPRECATE"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
WarningLevel="4"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue