mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
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:
@@ -33,6 +33,11 @@
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#if defined(HAVE_STDBOOL_H)
|
||||
#include <stdbool.h>
|
||||
#else
|
||||
#include "spandsp/stdbool.h"
|
||||
#endif
|
||||
|
||||
#include "spandsp/telephony.h"
|
||||
#include "spandsp/alloc.h"
|
||||
@@ -47,7 +52,7 @@ static void report_status_change(hdlc_rx_state_t *s, int status)
|
||||
if (s->status_handler)
|
||||
s->status_handler(s->status_user_data, status);
|
||||
else if (s->frame_handler)
|
||||
s->frame_handler(s->frame_user_data, NULL, status, TRUE);
|
||||
s->frame_handler(s->frame_user_data, NULL, status, true);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
@@ -63,7 +68,7 @@ static void rx_special_condition(hdlc_rx_state_t *s, int status)
|
||||
s->len = 0;
|
||||
s->num_bits = 0;
|
||||
s->flags_seen = 0;
|
||||
s->framing_ok_announced = FALSE;
|
||||
s->framing_ok_announced = false;
|
||||
/* Fall through */
|
||||
case SIG_STATUS_TRAINING_IN_PROGRESS:
|
||||
case SIG_STATUS_TRAINING_FAILED:
|
||||
@@ -95,7 +100,7 @@ static __inline__ void octet_set_and_count(hdlc_rx_state_t *s)
|
||||
}
|
||||
else
|
||||
{
|
||||
s->octet_counting_mode = TRUE;
|
||||
s->octet_counting_mode = true;
|
||||
s->octet_count = s->octet_count_report_interval;
|
||||
}
|
||||
}
|
||||
@@ -140,7 +145,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
|
||||
{
|
||||
/* Hit HDLC flag */
|
||||
/* A flag clears octet counting */
|
||||
s->octet_counting_mode = FALSE;
|
||||
s->octet_counting_mode = false;
|
||||
if (s->flags_seen >= s->framing_ok_threshold)
|
||||
{
|
||||
/* We may have a frame, or we may have back to back flags */
|
||||
@@ -156,7 +161,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
|
||||
s->rx_bytes += s->len - s->crc_bytes;
|
||||
s->len -= s->crc_bytes;
|
||||
if (s->frame_handler)
|
||||
s->frame_handler(s->frame_user_data, s->buffer, s->len, TRUE);
|
||||
s->frame_handler(s->frame_user_data, s->buffer, s->len, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -165,7 +170,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
|
||||
{
|
||||
s->len -= s->crc_bytes;
|
||||
if (s->frame_handler)
|
||||
s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
|
||||
s->frame_handler(s->frame_user_data, s->buffer, s->len, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,7 +186,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
|
||||
else
|
||||
s->len = 0;
|
||||
if (s->frame_handler)
|
||||
s->frame_handler(s->frame_user_data, s->buffer, s->len, FALSE);
|
||||
s->frame_handler(s->frame_user_data, s->buffer, s->len, false);
|
||||
}
|
||||
s->rx_length_errors++;
|
||||
}
|
||||
@@ -206,7 +211,7 @@ static void rx_flag_or_abort(hdlc_rx_state_t *s)
|
||||
if (++s->flags_seen >= s->framing_ok_threshold && !s->framing_ok_announced)
|
||||
{
|
||||
report_status_change(s, SIG_STATUS_FRAMING_OK);
|
||||
s->framing_ok_announced = TRUE;
|
||||
s->framing_ok_announced = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -307,8 +312,8 @@ SPAN_DECLARE(void) hdlc_rx_set_octet_counting_report_interval(hdlc_rx_state_t *s
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(hdlc_rx_state_t *) hdlc_rx_init(hdlc_rx_state_t *s,
|
||||
int crc32,
|
||||
int report_bad_frames,
|
||||
bool crc32,
|
||||
bool report_bad_frames,
|
||||
int framing_ok_threshold,
|
||||
hdlc_frame_handler_t handler,
|
||||
void *user_data)
|
||||
@@ -372,7 +377,7 @@ SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t
|
||||
{
|
||||
if (len <= 0)
|
||||
{
|
||||
s->tx_end = TRUE;
|
||||
s->tx_end = true;
|
||||
return 0;
|
||||
}
|
||||
if (s->len + len > s->max_frame_len)
|
||||
@@ -398,7 +403,7 @@ SPAN_DECLARE(int) hdlc_tx_frame(hdlc_tx_state_t *s, const uint8_t *frame, size_t
|
||||
s->len += len;
|
||||
else
|
||||
s->len = len;
|
||||
s->tx_end = FALSE;
|
||||
s->tx_end = false;
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@@ -413,8 +418,8 @@ SPAN_DECLARE(int) hdlc_tx_flags(hdlc_tx_state_t *s, int len)
|
||||
s->flag_octets += -len;
|
||||
else
|
||||
s->flag_octets = len;
|
||||
s->report_flag_underflow = TRUE;
|
||||
s->tx_end = FALSE;
|
||||
s->report_flag_underflow = true;
|
||||
s->tx_end = false;
|
||||
return 0;
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
@@ -453,7 +458,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
|
||||
/* We are in a timed flag section (preamble, inter frame gap, etc.) */
|
||||
if (--s->flag_octets <= 0 && s->report_flag_underflow)
|
||||
{
|
||||
s->report_flag_underflow = FALSE;
|
||||
s->report_flag_underflow = false;
|
||||
if (s->len == 0)
|
||||
{
|
||||
/* The timed flags have finished, there is nothing else queued to go,
|
||||
@@ -509,7 +514,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
|
||||
s->crc = 0xFFFFFFFF;
|
||||
/* Report the underflow now. If there are timed flags still in progress, loading the
|
||||
next frame right now will be harmless. */
|
||||
s->report_flag_underflow = FALSE;
|
||||
s->report_flag_underflow = false;
|
||||
if (s->underflow_handler)
|
||||
s->underflow_handler(s->user_data);
|
||||
/* Make sure we finish off with at least one flag octet, if the underflow report did not result
|
||||
@@ -540,7 +545,7 @@ SPAN_DECLARE_NONSTD(int) hdlc_tx_get_byte(hdlc_tx_state_t *s)
|
||||
/* Untimed idling on flags */
|
||||
if (s->tx_end)
|
||||
{
|
||||
s->tx_end = FALSE;
|
||||
s->tx_end = false;
|
||||
return SIG_STATUS_END_OF_DATA;
|
||||
}
|
||||
return s->idle_octet;
|
||||
@@ -585,9 +590,9 @@ SPAN_DECLARE(void) hdlc_tx_set_max_frame_len(hdlc_tx_state_t *s, size_t max_len)
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
|
||||
SPAN_DECLARE(hdlc_tx_state_t *) hdlc_tx_init(hdlc_tx_state_t *s,
|
||||
int crc32,
|
||||
bool crc32,
|
||||
int inter_frame_flags,
|
||||
int progressive,
|
||||
bool progressive,
|
||||
hdlc_underflow_handler_t handler,
|
||||
void *user_data)
|
||||
{
|
||||
|
Reference in New Issue
Block a user