From eaf5a70246e2786bd02c257e26946eb07d58c090 Mon Sep 17 00:00:00 2001 From: Andrey Volk Date: Wed, 17 Mar 2021 01:15:42 +0300 Subject: [PATCH] [Unit-tests] Fix build issues in switch_eavesdrop.c test file. --- tests/unit/switch_eavesdrop.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/tests/unit/switch_eavesdrop.c b/tests/unit/switch_eavesdrop.c index 867ad7a6bc..18c293f833 100644 --- a/tests/unit/switch_eavesdrop.c +++ b/tests/unit/switch_eavesdrop.c @@ -1,20 +1,15 @@ -#include #include #include -static switch_memory_pool_t *pool = NULL; - static switch_status_t test_detect_long_tone_in_file(const char *filepath, int rate, int freq, int ptime) { teletone_multi_tone_t mt; teletone_tone_map_t map; int16_t data[SWITCH_RECOMMENDED_BUFFER_SIZE] = { 0 }; - size_t len = (rate * ptime / 1000) /*packet len in samples */ * 8; /*length of chunk that must contain tone*/ - size_t fin = 0; + switch_size_t len = (rate * ptime / 1000) /*packet len in samples */ * 8; /*length of chunk that must contain tone*/ + switch_size_t fin = 0; switch_status_t status; switch_file_handle_t fh = { 0 }; uint8_t fail = 0, gaps = 0, audio = 0; - uint32_t pos = 0; - size_t full_len = 0; status = switch_core_file_open(&fh, filepath, 1, rate, SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL); if (status != SWITCH_STATUS_SUCCESS) { @@ -34,7 +29,7 @@ static switch_status_t test_detect_long_tone_in_file(const char *filepath, int r /*skip silence at the beginning of the file, 1 second max. */ if (!teletone_multi_tone_detect(&mt, data, len)) { if ((fin > rate && !audio) || gaps > 30) { - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many gaps in audio or no tone detected 1st second. [%u][%d]\n", fin, gaps); + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Too many gaps in audio or no tone detected 1st second. [%" SWITCH_SIZE_T_FMT "][%d]\n", fin, gaps); fail = 1; break; } @@ -85,9 +80,9 @@ FST_SUITE_BEGIN(switch_eavesdrop) switch_call_cause_t cause; switch_stream_handle_t stream = { 0 }; char eavesdrop_command[256] = { 0 }; - char rec_path[256]; + char rec_path[1024]; char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; - char eaves_dialstr[256] = { 0 }; + char eaves_dialstr[512] = { 0 }; switch_uuid_str(rec_uuid, sizeof(rec_uuid)); @@ -160,9 +155,9 @@ FST_SUITE_BEGIN(switch_eavesdrop) switch_call_cause_t cause; switch_stream_handle_t stream = { 0 }; char eavesdrop_command[256] = { 0 }; - char rec_path[256]; + char rec_path[1024]; char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; - char eaves_dialstr[256] = { 0 }; + char eaves_dialstr[512] = { 0 }; switch_uuid_str(rec_uuid, sizeof(rec_uuid)); @@ -235,9 +230,9 @@ FST_SUITE_BEGIN(switch_eavesdrop) switch_call_cause_t cause; switch_stream_handle_t stream = { 0 }; char eavesdrop_command[256] = { 0 }; - char rec_path[256]; + char rec_path[1024]; char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; - char eaves_dialstr[256] = { 0 }; + char eaves_dialstr[512] = { 0 }; switch_uuid_str(rec_uuid, sizeof(rec_uuid)); @@ -310,9 +305,9 @@ FST_SUITE_BEGIN(switch_eavesdrop) switch_call_cause_t cause; switch_stream_handle_t stream = { 0 }; char eavesdrop_command[256] = { 0 }; - char rec_path[256]; + char rec_path[1024]; char rec_uuid[SWITCH_UUID_FORMATTED_LENGTH + 1] = { 0 }; - char eaves_dialstr[256] = { 0 }; + char eaves_dialstr[512] = { 0 }; switch_uuid_str(rec_uuid, sizeof(rec_uuid));