diff --git a/libs/freetdm/mod_openzap/mod_openzap.c b/libs/freetdm/mod_openzap/mod_openzap.c index defdc25a8a..53546e23ec 100644 --- a/libs/freetdm/mod_openzap/mod_openzap.c +++ b/libs/freetdm/mod_openzap/mod_openzap.c @@ -1844,6 +1844,7 @@ static switch_status_t load_config(void) zap_span_t *boost_spans[ZAP_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN]; zap_span_t *boost_span = NULL; unsigned boosti = 0; + unsigned int i = 0; memset(boost_spans, 0, sizeof(boost_spans)); memset(&globals, 0, sizeof(globals)); @@ -2558,7 +2559,6 @@ static switch_status_t load_config(void) /* start all boost spans now that we're done configuring. Unfortunately at this point boost modules have the limitation * of needing all spans to be configured before starting them */ - unsigned i = 0; for ( ; i < boosti; i++) { boost_span = boost_spans[i]; zap_log(ZAP_LOG_DEBUG, "Starting boost span %d\n", boost_span->span_id); diff --git a/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c b/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c index f239d59f8c..5e69cf4356 100644 --- a/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c +++ b/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.c @@ -271,14 +271,14 @@ static unsigned wp_open_range(zap_span_t *span, unsigned spanno, unsigned start, chan->native_codec = chan->effective_codec = ZAP_CODEC_ULAW; } - err = sangoma_tdm_get_hw_dtmf(chan->sockfd, &tdm_api); - if (err > 0) { + //err = sangoma_tdm_get_hw_dtmf(chan->sockfd, &tdm_api); + //if (err > 0) { err = sangoma_tdm_enable_dtmf_events(chan->sockfd, &tdm_api); if (err == 0) { zap_channel_set_feature(chan, ZAP_CHANNEL_FEATURE_DTMF_DETECT); dtmf = "hardware"; } - } + //} } #if 0 diff --git a/libs/freetdm/src/zap_io.c b/libs/freetdm/src/zap_io.c index f4627ea7fe..b048d7a11b 100644 --- a/libs/freetdm/src/zap_io.c +++ b/libs/freetdm/src/zap_io.c @@ -181,31 +181,35 @@ static void default_logger(const char *file, const char *func, int line, int lev } -static inline void *zap_std_malloc(void *pool, zap_size_t size) +static __inline__ void *zap_std_malloc(void *pool, zap_size_t size) { void *ptr = malloc(size); + pool = NULL; /* fix warning */ zap_assert(ptr != NULL, NULL, "Out of memory"); return ptr; } -static inline void *zap_std_calloc(void *pool, zap_size_t elements, zap_size_t size) +static __inline__ void *zap_std_calloc(void *pool, zap_size_t elements, zap_size_t size) { void *ptr = calloc(elements, size); + pool = NULL; zap_assert(ptr != NULL, NULL, "Out of memory"); return ptr; } -static inline void zap_std_free(void *pool, void *ptr) +static __inline__ void zap_std_free(void *pool, void *ptr) { + pool = NULL; + zap_assert(ptr != NULL, , "Attempted to free null pointer"); free(ptr); } OZ_DECLARE_DATA zap_memory_handler_t g_zap_mem_handler = { - .pool = NULL, - .malloc = zap_std_malloc, - .calloc = zap_std_calloc, - .free = zap_std_free + /*.pool =*/ NULL, + /*.malloc =*/ zap_std_malloc, + /*.calloc =*/ zap_std_calloc, + /*.free =*/ zap_std_free }; OZ_DECLARE_DATA zap_crash_policy_t g_zap_crash_policy = ZAP_CRASH_NEVER; @@ -762,7 +766,7 @@ OZ_DECLARE(void) zap_channel_rotate_tokens(zap_channel_t *zchan) OZ_DECLARE(void) zap_channel_replace_token(zap_channel_t *zchan, const char *old_token, const char *new_token) { - int i; + unsigned int i; if (zchan->token_count) { for(i = 0; i < zchan->token_count; i++) { diff --git a/libs/freetdm/src/zap_threadmutex.c b/libs/freetdm/src/zap_threadmutex.c index e0744158a7..0661decfd7 100644 --- a/libs/freetdm/src/zap_threadmutex.c +++ b/libs/freetdm/src/zap_threadmutex.c @@ -274,19 +274,20 @@ failed: OZ_DECLARE(zap_status_t) zap_condition_wait(zap_condition_t *condition, int ms) { - zap_assert(condition != NULL, ZAP_FAIL, "Condition is null!\n"); #ifdef WIN32 DWORD res = 0; - res = WaitForSingleObject(condition->condition, waitms > 0 ? waitms : INFINITE); +#endif + zap_assert(condition != NULL, ZAP_FAIL, "Condition is null!\n"); +#ifdef WIN32 + res = WaitForSingleObject(condition->condition, ms > 0 ? ms : INFINITE); switch (res) { case WAIT_ABANDONED: case WAIT_TIMEOUT: return ZAP_TIMEOUT; case WAIT_FAILED: return ZAP_FAIL; - defaul: - zap_log(ZAP_LOG_ERROR, "Error waiting for openzap condition event\n"); - return ZAP_FAIL; + default: + zap_log(ZAP_LOG_ERROR, "Error waiting for openzap condition event (WaitForSingleObject returned %d)\n", res); } #else int res = 0;