Changed spandsp from using TRUE and FALSE to using C99 true and false. It seems

like the quirks we used to get using those with C++ have gone away.
This commit is contained in:
Steve Underwood
2013-08-08 21:40:28 +08:00
parent bf9809c10c
commit 365fc08719
212 changed files with 3152 additions and 2664 deletions

View File

@@ -41,6 +41,11 @@
#if defined(HAVE_MATH_H)
#include <math.h>
#endif
#if defined(HAVE_STDBOOL_H)
#include <stdbool.h>
#else
#include "spandsp/stdbool.h"
#endif
#include "floating_fudge.h"
#include <assert.h>
#include <tiffio.h>
@@ -215,7 +220,7 @@ static int process_rx_missing(t38_core_state_t *t, void *user_data, int rx_seq_n
t38_terminal_state_t *s;
s = (t38_terminal_state_t *) user_data;
s->t38_fe.rx_data_missing = TRUE;
s->t38_fe.rx_data_missing = true;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -251,7 +256,7 @@ static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indica
&&
(fe->current_rx_type == T30_MODEM_V21 || fe->current_rx_type == T30_MODEM_CNG))
{
hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, true);
}
/*endif*/
fe->timeout_rx_samples = 0;
@@ -304,7 +309,7 @@ static int process_rx_indicator(t38_core_state_t *t, void *user_data, int indica
}
/*endswitch*/
fe->hdlc_rx.len = 0;
fe->rx_data_missing = FALSE;
fe->rx_data_missing = false;
return 0;
}
/*- End of function --------------------------------------------------------*/
@@ -328,7 +333,7 @@ static void process_hdlc_data(t38_terminal_front_end_state_t *fe, const uint8_t
}
else
{
fe->rx_data_missing = TRUE;
fe->rx_data_missing = true;
}
}
/*- End of function --------------------------------------------------------*/
@@ -425,7 +430,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
/* All real HDLC messages in the FAX world start with 0xFF. If this one is not starting
with 0xFF it would appear some octets must have been missed before this one. */
if (len <= 0 || buf[0] != 0xFF)
fe->rx_data_missing = TRUE;
fe->rx_data_missing = true;
/*endif*/
}
/*endif*/
@@ -455,7 +460,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
fe->hdlc_rx.len = 0;
}
/*endif*/
fe->rx_data_missing = FALSE;
fe->rx_data_missing = false;
fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
break;
case T38_FIELD_HDLC_FCS_BAD:
@@ -473,11 +478,11 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
if (fe->hdlc_rx.len > 0)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean");
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, false);
fe->hdlc_rx.len = 0;
}
/*endif*/
fe->rx_data_missing = FALSE;
fe->rx_data_missing = false;
fe->timeout_rx_samples = fe->samples + ms_to_samples(MID_RX_TIMEOUT);
break;
case T38_FIELD_HDLC_FCS_OK_SIG_END:
@@ -499,9 +504,9 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
fe->hdlc_rx.len = 0;
}
/*endif*/
fe->rx_data_missing = FALSE;
fe->rx_data_missing = false;
if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type)
hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, true);
/*endif*/
/* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */
fake_rx_indicator(t, s, T38_IND_NO_SIGNAL);
@@ -521,13 +526,13 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
if (fe->hdlc_rx.len > 0)
{
span_log(&s->logging, SPAN_LOG_FLOW, "Type %s - CRC bad, sig end (%s)\n", (fe->hdlc_rx.len >= 3) ? t30_frametype(fe->hdlc_rx.buf[2]) : "???", (fe->rx_data_missing) ? "missing octets" : "clean");
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, FALSE);
hdlc_accept_frame(s, fe->hdlc_rx.buf, fe->hdlc_rx.len, false);
fe->hdlc_rx.len = 0;
}
/*endif*/
fe->rx_data_missing = FALSE;
fe->rx_data_missing = false;
if (t->current_rx_data_type != data_type || t->current_rx_field_type != field_type)
hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, TRUE);
hdlc_accept_frame(s, NULL, SIG_STATUS_CARRIER_DOWN, true);
/*endif*/
/* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */
fake_rx_indicator(t, s, T38_IND_NO_SIGNAL);
@@ -552,7 +557,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
i.e. they send T38_FIELD_HDLC_FCS_OK, and then T38_FIELD_HDLC_SIG_END when the carrier actually drops.
The other is because the HDLC signal drops unexpectedly - i.e. not just after a final frame. */
fe->hdlc_rx.len = 0;
fe->rx_data_missing = FALSE;
fe->rx_data_missing = false;
front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE);
}
/*endif*/
@@ -563,7 +568,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
if (!fe->rx_signal_present)
{
t30_non_ecm_put_bit(&s->t30, SIG_STATUS_TRAINING_SUCCEEDED);
fe->rx_signal_present = TRUE;
fe->rx_signal_present = true;
}
/*endif*/
if (len > 0)
@@ -585,7 +590,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
if (!fe->rx_signal_present)
{
t30_non_ecm_put_bit(&s->t30, SIG_STATUS_TRAINING_SUCCEEDED);
fe->rx_signal_present = TRUE;
fe->rx_signal_present = true;
}
/*endif*/
bit_reverse(buf2, buf, len);
@@ -599,7 +604,7 @@ static int process_rx_data(t38_core_state_t *t, void *user_data, int data_type,
front_end_status(s, T30_FRONT_END_RECEIVE_COMPLETE);
}
/*endif*/
fe->rx_signal_present = FALSE;
fe->rx_signal_present = false;
/* Treat this like a no signal indicator has occurred, so if the no signal indicator is missing, we are still OK */
fake_rx_indicator(t, s, T38_IND_NO_SIGNAL);
break;
@@ -1149,7 +1154,7 @@ SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples
fe = &s->t38_fe;
if (fe->current_rx_type == T30_MODEM_DONE || fe->current_tx_type == T30_MODEM_DONE)
return TRUE;
return true;
/*endif*/
fe->samples += samples;
@@ -1162,12 +1167,12 @@ SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples
}
/*endif*/
if (fe->timed_step == T38_TIMED_STEP_NONE)
return FALSE;
return false;
/*endif*/
/* Wait until the right time comes along, unless we are working in "no delays" mode, while talking to an
IAF terminal. */
if (fe->us_per_tx_chunk && fe->samples < fe->next_tx_samples)
return FALSE;
return false;
/*endif*/
/* Its time to send something */
delay = 0;
@@ -1198,11 +1203,11 @@ SPAN_DECLARE(int) t38_terminal_send_timeout(t38_terminal_state_t *s, int samples
if (delay < 0)
{
t30_terminate(&s->t30);
return TRUE;
return true;
}
/*endif*/
fe->next_tx_samples += us_to_samples(delay);
return FALSE;
return false;
}
/*- End of function --------------------------------------------------------*/
@@ -1365,7 +1370,7 @@ SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int config)
if ((config & T38_TERMINAL_OPTION_NO_PACING))
{
/* Continuous streaming mode, as used for TPKT over TCP transport */
t38_set_pace_transmission(&s->t38_fe.t38, FALSE);
t38_set_pace_transmission(&s->t38_fe.t38, false);
s->t38_fe.hdlc_tx.extra_bits = 0;
if ((config & T38_TERMINAL_OPTION_NO_INDICATORS))
t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, 0);
@@ -1383,7 +1388,7 @@ SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int config)
else
{
/* Paced streaming mode, as used for UDP transports */
t38_set_pace_transmission(&s->t38_fe.t38, TRUE);
t38_set_pace_transmission(&s->t38_fe.t38, true);
s->t38_fe.hdlc_tx.extra_bits = 0;
if ((config & T38_TERMINAL_OPTION_NO_INDICATORS))
t38_set_redundancy_control(&s->t38_fe.t38, T38_PACKET_CATEGORY_INDICATOR, 0);
@@ -1411,7 +1416,7 @@ SPAN_DECLARE(void) t38_terminal_set_config(t38_terminal_state_t *s, int config)
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_tep)
SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, bool use_tep)
{
if (use_tep)
s->t38_fe.chunking_modes |= T38_CHUNKING_ALLOW_TEP_TIME;
@@ -1422,7 +1427,7 @@ SPAN_DECLARE(void) t38_terminal_set_tep_mode(t38_terminal_state_t *s, int use_te
}
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, int remove)
SPAN_DECLARE(void) t38_terminal_set_fill_bit_removal(t38_terminal_state_t *s, bool remove)
{
if (remove)
s->t38_fe.iaf |= T30_IAF_MODE_NO_FILL_BITS;
@@ -1452,7 +1457,7 @@ static int t38_terminal_t38_fe_restart(t38_terminal_state_t *t)
s = &t->t38_fe;
t38_core_restart(&s->t38);
s->rx_signal_present = FALSE;
s->rx_signal_present = false;
s->timed_step = T38_TIMED_STEP_NONE;
//s->iaf = T30_IAF_MODE_T37 | T30_IAF_MODE_T38;
s->iaf = T30_IAF_MODE_T38;
@@ -1483,7 +1488,7 @@ static int t38_terminal_t38_fe_init(t38_terminal_state_t *t,
tx_packet_user_data);
t38_set_fastest_image_data_rate(&s->t38, 14400);
s->rx_signal_present = FALSE;
s->rx_signal_present = false;
s->timed_step = T38_TIMED_STEP_NONE;
s->queued_timed_step = T38_TIMED_STEP_NONE;
//s->iaf = T30_IAF_MODE_T37 | T30_IAF_MODE_T38;
@@ -1507,7 +1512,7 @@ SPAN_DECLARE(logging_state_t *) t38_terminal_get_logging_state(t38_terminal_stat
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(int) t38_terminal_restart(t38_terminal_state_t *s,
int calling_party)
bool calling_party)
{
t38_terminal_t38_fe_restart(s);
t30_restart(&s->t30);
@@ -1516,7 +1521,7 @@ SPAN_DECLARE(int) t38_terminal_restart(t38_terminal_state_t *s,
/*- End of function --------------------------------------------------------*/
SPAN_DECLARE(t38_terminal_state_t *) t38_terminal_init(t38_terminal_state_t *s,
int calling_party,
bool calling_party,
t38_tx_packet_handler_t tx_packet_handler,
void *tx_packet_user_data)
{