Fix windows build

git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@908 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Moises Silva 2009-11-26 16:01:55 +00:00
parent 2ea4c03e81
commit c6e7eaac83
4 changed files with 22 additions and 17 deletions

View File

@ -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_spans[ZAP_MAX_PHYSICAL_SPANS_PER_LOGICAL_SPAN];
zap_span_t *boost_span = NULL; zap_span_t *boost_span = NULL;
unsigned boosti = 0; unsigned boosti = 0;
unsigned int i = 0;
memset(boost_spans, 0, sizeof(boost_spans)); memset(boost_spans, 0, sizeof(boost_spans));
memset(&globals, 0, sizeof(globals)); 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 /* 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 */ * of needing all spans to be configured before starting them */
unsigned i = 0;
for ( ; i < boosti; i++) { for ( ; i < boosti; i++) {
boost_span = boost_spans[i]; boost_span = boost_spans[i];
zap_log(ZAP_LOG_DEBUG, "Starting boost span %d\n", boost_span->span_id); zap_log(ZAP_LOG_DEBUG, "Starting boost span %d\n", boost_span->span_id);

View File

@ -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; chan->native_codec = chan->effective_codec = ZAP_CODEC_ULAW;
} }
err = sangoma_tdm_get_hw_dtmf(chan->sockfd, &tdm_api); //err = sangoma_tdm_get_hw_dtmf(chan->sockfd, &tdm_api);
if (err > 0) { //if (err > 0) {
err = sangoma_tdm_enable_dtmf_events(chan->sockfd, &tdm_api); err = sangoma_tdm_enable_dtmf_events(chan->sockfd, &tdm_api);
if (err == 0) { if (err == 0) {
zap_channel_set_feature(chan, ZAP_CHANNEL_FEATURE_DTMF_DETECT); zap_channel_set_feature(chan, ZAP_CHANNEL_FEATURE_DTMF_DETECT);
dtmf = "hardware"; dtmf = "hardware";
} }
} //}
} }
#if 0 #if 0

View File

@ -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); void *ptr = malloc(size);
pool = NULL; /* fix warning */
zap_assert(ptr != NULL, NULL, "Out of memory"); zap_assert(ptr != NULL, NULL, "Out of memory");
return ptr; 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); void *ptr = calloc(elements, size);
pool = NULL;
zap_assert(ptr != NULL, NULL, "Out of memory"); zap_assert(ptr != NULL, NULL, "Out of memory");
return ptr; 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); free(ptr);
} }
OZ_DECLARE_DATA zap_memory_handler_t g_zap_mem_handler = OZ_DECLARE_DATA zap_memory_handler_t g_zap_mem_handler =
{ {
.pool = NULL, /*.pool =*/ NULL,
.malloc = zap_std_malloc, /*.malloc =*/ zap_std_malloc,
.calloc = zap_std_calloc, /*.calloc =*/ zap_std_calloc,
.free = zap_std_free /*.free =*/ zap_std_free
}; };
OZ_DECLARE_DATA zap_crash_policy_t g_zap_crash_policy = ZAP_CRASH_NEVER; 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) 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) { if (zchan->token_count) {
for(i = 0; i < zchan->token_count; i++) { for(i = 0; i < zchan->token_count; i++) {

View File

@ -274,19 +274,20 @@ failed:
OZ_DECLARE(zap_status_t) zap_condition_wait(zap_condition_t *condition, int ms) 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 #ifdef WIN32
DWORD res = 0; 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) { switch (res) {
case WAIT_ABANDONED: case WAIT_ABANDONED:
case WAIT_TIMEOUT: case WAIT_TIMEOUT:
return ZAP_TIMEOUT; return ZAP_TIMEOUT;
case WAIT_FAILED: case WAIT_FAILED:
return ZAP_FAIL; return ZAP_FAIL;
defaul: default:
zap_log(ZAP_LOG_ERROR, "Error waiting for openzap condition event\n"); zap_log(ZAP_LOG_ERROR, "Error waiting for openzap condition event (WaitForSingleObject returned %d)\n", res);
return ZAP_FAIL;
} }
#else #else
int res = 0; int res = 0;