From 1795451255fc3d3ac683a4da43fd2ed3cc4fd461 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Sun, 17 Jun 2007 19:40:35 +0000 Subject: [PATCH] windows build. git-svn-id: http://svn.openzap.org/svn/openzap/trunk@270 a93c3328-9c30-0410-af19-c9cd2b2d52af --- libs/freetdm/src/include/openzap.h | 2 +- libs/freetdm/src/libteletone_detect.c | 38 +++++++++++++-------------- libs/freetdm/src/zap_io.c | 2 +- libs/freetdm/src/zap_isdn.c | 2 +- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/libs/freetdm/src/include/openzap.h b/libs/freetdm/src/include/openzap.h index c95849df43..afbf11fbc9 100644 --- a/libs/freetdm/src/include/openzap.h +++ b/libs/freetdm/src/include/openzap.h @@ -482,7 +482,7 @@ void zap_global_set_logger(zap_logger_t logger); void zap_global_set_default_logger(int level); uint32_t zap_separate_string(char *buf, char delim, char **array, int arraylen); void print_bits(uint8_t *b, int bl, char *buf, int blen, int e, uint8_t ss); -void print_hex_bytes(uint8_t *data, zap_size_t dlen, uint8_t *buf, zap_size_t blen); +void print_hex_bytes(uint8_t *data, zap_size_t dlen, char *buf, zap_size_t blen); ZIO_CODEC_FUNCTION(zio_slin2ulaw); ZIO_CODEC_FUNCTION(zio_ulaw2slin); ZIO_CODEC_FUNCTION(zio_slin2alaw); diff --git a/libs/freetdm/src/libteletone_detect.c b/libs/freetdm/src/libteletone_detect.c index b5ba7e361d..7a3bf0d406 100644 --- a/libs/freetdm/src/libteletone_detect.c +++ b/libs/freetdm/src/libteletone_detect.c @@ -126,11 +126,11 @@ void teletone_goertzel_update(teletone_goertzel_state_t *goertzel_state, for (i = 0; i < samples; i++) { v1 = goertzel_state->v2; goertzel_state->v2 = goertzel_state->v3; - goertzel_state->v3 = goertzel_state->fac*goertzel_state->v2 - v1 + sample_buffer[i]; + goertzel_state->v3 = (float)(goertzel_state->fac*goertzel_state->v2 - v1 + sample_buffer[i]); } } -#define teletone_goertzel_result(gs) ((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac) +#define teletone_goertzel_result(gs) (float)(((gs)->v3 * (gs)->v3 + (gs)->v2 * (gs)->v2 - (gs)->v2 * (gs)->v3 * (gs)->fac)) void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, int sample_rate) { @@ -140,17 +140,17 @@ void teletone_dtmf_detect_init (teletone_dtmf_detect_state_t *dtmf_detect_state, dtmf_detect_state->hit1 = dtmf_detect_state->hit2 = 0; for (i = 0; i < GRID_FACTOR; i++) { - theta = M_TWO_PI*(dtmf_row[i]/(float)sample_rate); - dtmf_detect_row[i].fac = 2.0*cos(theta); + theta = (float)(M_TWO_PI*(dtmf_row[i]/(float)sample_rate)); + dtmf_detect_row[i].fac = (float)(2.0*cos(theta)); - theta = M_TWO_PI*(dtmf_col[i]/(float)sample_rate); - dtmf_detect_col[i].fac = 2.0*cos(theta); + theta = (float)(M_TWO_PI*(dtmf_col[i]/(float)sample_rate)); + dtmf_detect_col[i].fac = (float)(2.0*cos(theta)); - theta = M_TWO_PI*(dtmf_row[i]*2.0/(float)sample_rate); - dtmf_detect_row_2nd[i].fac = 2.0*cos(theta); + theta = (float)(M_TWO_PI*(dtmf_row[i]*2.0/(float)sample_rate)); + dtmf_detect_row_2nd[i].fac = (float)(2.0*cos(theta)); - theta = M_TWO_PI*(dtmf_col[i]*2.0/(float)sample_rate); - dtmf_detect_col_2nd[i].fac = 2.0*cos(theta); + theta = (float)(M_TWO_PI*(dtmf_col[i]*2.0/(float)sample_rate)); + dtmf_detect_col_2nd[i].fac = (float)(2.0*cos(theta)); goertzel_init (&dtmf_detect_state->row_out[i], &dtmf_detect_row[i]); goertzel_init (&dtmf_detect_state->col_out[i], &dtmf_detect_col[i]); @@ -196,8 +196,8 @@ void teletone_multi_tone_init(teletone_multi_tone_t *mt, teletone_tone_map_t *ma break; } mt->tone_count++; - theta = M_TWO_PI*(map->freqs[x]/(float)mt->sample_rate); - mt->tdd[x].fac = 2.0 * cos(theta); + theta = (float)(M_TWO_PI*(map->freqs[x]/(float)mt->sample_rate)); + mt->tdd[x].fac = (float)(2.0 * cos(theta)); goertzel_init (&mt->gs[x], &mt->tdd[x]); goertzel_init (&mt->gs2[x], &mt->tdd[x]); } @@ -230,11 +230,11 @@ int teletone_multi_tone_detect (teletone_multi_tone_t *mt, for(x = 0; x < mt->tone_count; x++) { v1 = mt->gs[x].v2; mt->gs[x].v2 = mt->gs[x].v3; - mt->gs[x].v3 = mt->gs[x].fac * mt->gs[x].v2 - v1 + famp; + mt->gs[x].v3 = (float)(mt->gs[x].fac * mt->gs[x].v2 - v1 + famp); v1 = mt->gs2[x].v2; mt->gs2[x].v2 = mt->gs2[x].v3; - mt->gs2[x].v3 = mt->gs2[x].fac*mt->gs2[x].v2 - v1 + famp; + mt->gs2[x].v3 = (float)(mt->gs2[x].fac*mt->gs2[x].v2 - v1 + famp); } } @@ -245,7 +245,7 @@ int teletone_multi_tone_detect (teletone_multi_tone_t *mt, eng_sum = 0; for(x = 0; x < mt->tone_count; x++) { - eng_all[x] = teletone_goertzel_result (&mt->gs[x]); + eng_all[x] = (float)(teletone_goertzel_result (&mt->gs[x])); eng_sum += eng_all[x]; } @@ -325,19 +325,19 @@ int teletone_dtmf_detect (teletone_dtmf_detect_state_t *dtmf_detect_state, for(x = 0; x < GRID_FACTOR; x++) { v1 = dtmf_detect_state->row_out[x].v2; dtmf_detect_state->row_out[x].v2 = dtmf_detect_state->row_out[x].v3; - dtmf_detect_state->row_out[x].v3 = dtmf_detect_state->row_out[x].fac*dtmf_detect_state->row_out[x].v2 - v1 + famp; + dtmf_detect_state->row_out[x].v3 = (float)(dtmf_detect_state->row_out[x].fac*dtmf_detect_state->row_out[x].v2 - v1 + famp); v1 = dtmf_detect_state->col_out[x].v2; dtmf_detect_state->col_out[x].v2 = dtmf_detect_state->col_out[x].v3; - dtmf_detect_state->col_out[x].v3 = dtmf_detect_state->col_out[x].fac*dtmf_detect_state->col_out[x].v2 - v1 + famp; + dtmf_detect_state->col_out[x].v3 = (float)(dtmf_detect_state->col_out[x].fac*dtmf_detect_state->col_out[x].v2 - v1 + famp); v1 = dtmf_detect_state->col_out2nd[x].v2; dtmf_detect_state->col_out2nd[x].v2 = dtmf_detect_state->col_out2nd[x].v3; - dtmf_detect_state->col_out2nd[x].v3 = dtmf_detect_state->col_out2nd[x].fac*dtmf_detect_state->col_out2nd[x].v2 - v1 + famp; + dtmf_detect_state->col_out2nd[x].v3 = (float)(dtmf_detect_state->col_out2nd[x].fac*dtmf_detect_state->col_out2nd[x].v2 - v1 + famp); v1 = dtmf_detect_state->row_out2nd[x].v2; dtmf_detect_state->row_out2nd[x].v2 = dtmf_detect_state->row_out2nd[x].v3; - dtmf_detect_state->row_out2nd[x].v3 = dtmf_detect_state->row_out2nd[x].fac*dtmf_detect_state->row_out2nd[x].v2 - v1 + famp; + dtmf_detect_state->row_out2nd[x].v3 = (float)(dtmf_detect_state->row_out2nd[x].fac*dtmf_detect_state->row_out2nd[x].v2 - v1 + famp); } } diff --git a/libs/freetdm/src/zap_io.c b/libs/freetdm/src/zap_io.c index 019592ad99..2545e70724 100644 --- a/libs/freetdm/src/zap_io.c +++ b/libs/freetdm/src/zap_io.c @@ -2007,7 +2007,7 @@ int8_t zap_bitstream_get_bit(zap_bitstream_t *bsp) return bit; } -void print_hex_bytes(uint8_t *data, zap_size_t dlen, uint8_t *buf, zap_size_t blen) +void print_hex_bytes(uint8_t *data, zap_size_t dlen, char *buf, zap_size_t blen) { char *bp = buf; uint8_t *byte = data; diff --git a/libs/freetdm/src/zap_isdn.c b/libs/freetdm/src/zap_isdn.c index b6f2d27b20..2424314b1c 100644 --- a/libs/freetdm/src/zap_isdn.c +++ b/libs/freetdm/src/zap_isdn.c @@ -344,7 +344,7 @@ static __inline__ void state_advance(zap_channel_t *zchan) #endif CalledNum.TypNum = 2; CalledNum.NumPlanID = 1; - CalledNum.Size += strlen(zchan->caller_data.ani); + CalledNum.Size = CalledNum.Size + (unsigned char)strlen(zchan->caller_data.ani); gen->CalledNum = Q931AppendIE((L3UCHAR *) gen, (L3UCHAR *) &CalledNum); ptrCalledNum = Q931GetIEPtr(gen->CalledNum, gen->buf); zap_copy_string((char *)ptrCalledNum->Digit, zchan->caller_data.ani, strlen(zchan->caller_data.ani)+1);