diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ee0dcb2df..a02d2c130 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,14 +9,33 @@ file(GLOB SOURCE_LIST # Make an automatic library - will be static or dynamic based on user setting add_library(btstack_core ${SOURCE_LIST} ${HEADER_LIST}) -target_compile_options(btstack_core PRIVATE - $<$,$>: - -Wunused-variable -Wswitch-default -Werror> - $<$: - -Wall -Wextra -Wunused-but-set-variable -Wunused-variable -Wswitch-default -Werror> - $<$: +set(WARNING_FLAGS + $<$,$>: + -Wall -Wextra -fno-common -Wshadow -Wformat=2 -Wdouble-promotion -Wunused-variable -Wswitch-default -Werror + -Wunused-parameter -Wnull-dereference -Wsign-compare -Wsign-compare -Wunused -Wmissing-format-attribute> + $<$: + -Wall -Wextra -fno-common -Wshadow -Wformat=2 -Wformat-truncation -Wdouble-promotion -Wunused-but-set-variable + -Wunused-variable -Wswitch-default -Werror + -Wunused-parameter -Wnull-dereference -Wsign-compare -Wsign-compare -Wunused -Wmissing-format-attribute> + $<$: /WX /W4>) +set( DEFAULT_C_LEVEL c_std_99 ) + +add_subdirectory( ble ) +add_subdirectory( classic ) +add_subdirectory( mesh ) + +target_compile_options( btstack_core PRIVATE ${WARNING_FLAGS} ) +target_compile_options( ble PRIVATE ${WARNING_FLAGS} ) +target_compile_options( classic PRIVATE ${WARNING_FLAGS} ) +target_compile_options( mesh PRIVATE ${WARNING_FLAGS} ) + +target_compile_features( btstack_core PRIVATE ${DEFAULT_C_LEVEL} ) +target_compile_features( ble PRIVATE ${DEFAULT_C_LEVEL} ) +target_compile_features( classic PRIVATE ${DEFAULT_C_LEVEL} ) +target_compile_features( mesh PRIVATE ${DEFAULT_C_LEVEL} ) + target_link_libraries( btstack_core PRIVATE btstack_config ) target_link_libraries( btstack_core PRIVATE rijndael ) target_link_libraries( btstack_core PRIVATE uecc ) @@ -27,11 +46,6 @@ target_link_libraries( btstack_core PUBLIC classic ) # We need this directory, and users of our library will need it too target_include_directories( btstack_core PUBLIC . ) -target_compile_features( btstack_core PRIVATE c_std_99 ) - -add_subdirectory( ble ) -add_subdirectory( classic ) -add_subdirectory( mesh ) # IDEs should put the headers in a nice place source_group( diff --git a/src/ble/att_server.c b/src/ble/att_server.c index 0ffb9e20d..a40bccff3 100644 --- a/src/ble/att_server.c +++ b/src/ble/att_server.c @@ -486,6 +486,7 @@ static void att_server_event_packet_handler (uint8_t packet_type, uint16_t chann static uint8_t att_server_send_prepared(const att_server_t *att_server, const att_connection_t *att_connection, uint8_t *buffer, uint16_t size) { + UNUSED(buffer); uint8_t status = ERROR_CODE_SUCCESS; switch (att_server->bearer_type) { case ATT_BEARER_UNENHANCED_LE: @@ -1639,4 +1640,4 @@ uint8_t att_server_eatt_init(uint8_t num_eatt_bearers, uint8_t * storage_buffer, return 0; } -#endif \ No newline at end of file +#endif diff --git a/src/ble/sm.c b/src/ble/sm.c index 571729443..64b38981a 100644 --- a/src/ble/sm.c +++ b/src/ble/sm.c @@ -1554,7 +1554,7 @@ static int sm_le_device_db_index_lookup(bd_addr_type_t address_type, bd_addr_t a le_device_db_info(i, &db_address_type, db_address, NULL); // skip unused entries if (address_type == BD_ADDR_TYPE_UNKNOWN) continue; - if ((address_type == db_address_type) && (memcmp(address, db_address, 6) == 0)){ + if ((address_type == (unsigned int)db_address_type) && (memcmp(address, db_address, 6) == 0)){ return i; } } diff --git a/src/classic/btstack_cvsd_plc.c b/src/classic/btstack_cvsd_plc.c index 2d842f14e..ed437692c 100644 --- a/src/classic/btstack_cvsd_plc.c +++ b/src/classic/btstack_cvsd_plc.c @@ -61,8 +61,8 @@ static float rcos[CVSD_OLAL] = { 0.99148655f,0.92510857f, - 0.80131732f,0.63683150f, - 0.45386582f,0.27713082f, + 0.80131732f,0.63683150f, + 0.45386582f,0.27713082f, 0.13049554f,0.03376389f}; float btstack_cvsd_plc_rcos(int index){ @@ -78,7 +78,7 @@ static float sqrt3(const float x){ float x; } u; u.x = x; - u.i = (1<<29) + (u.i >> 1) - (1<<22); + u.i = (1<<29) + (u.i >> 1) - (1<<22); // Two Babylonian Steps (simplified from:) // u.x = 0.5f * (u.x + x/u.x); @@ -110,15 +110,15 @@ static float btstack_cvsd_plc_cross_correlation(BTSTACK_CVSD_PLC_SAMPLE_FORMAT * } int btstack_cvsd_plc_pattern_match(BTSTACK_CVSD_PLC_SAMPLE_FORMAT *y){ - float maxCn = -999999.0; // large negative number + float maxCn = -999999.f; // large negative number int bestmatch = 0; float Cn; int n; for (n=0;nmaxCn){ bestmatch=n; - maxCn = Cn; + maxCn = Cn; } } return bestmatch; @@ -127,10 +127,10 @@ int btstack_cvsd_plc_pattern_match(BTSTACK_CVSD_PLC_SAMPLE_FORMAT *y){ float btstack_cvsd_plc_amplitude_match(btstack_cvsd_plc_state_t *plc_state, uint16_t num_samples, BTSTACK_CVSD_PLC_SAMPLE_FORMAT *y, BTSTACK_CVSD_PLC_SAMPLE_FORMAT bestmatch){ UNUSED(plc_state); int i; - float sumx = 0; + float sumx = 0.f; float sumy = 0.000001f; float sf; - + for (i=0;i1.0) sf=1.0f; + if (sf>1.f) sf=1.f; return sf; } BTSTACK_CVSD_PLC_SAMPLE_FORMAT btstack_cvsd_plc_crop_sample(float val){ float croped_val = val; - if (croped_val > 32767.0) croped_val= 32767.0; - if (croped_val < -32768.0) croped_val=-32768.0; + if (croped_val > 32767.f) croped_val= 32767.f; + if (croped_val < -32768.f) croped_val=-32768.f; return (BTSTACK_CVSD_PLC_SAMPLE_FORMAT) croped_val; } @@ -196,7 +196,7 @@ static FILE * open_octave_file(btstack_cvsd_plc_state_t *plc_state, octave_frame octave_base_name, plc_state->frame_count, octave_frame_type2str(octave_frame_type)); oct_file_name[sizeof(oct_file_name) - 1] = 0; - + FILE * oct_file = fopen(oct_file_name, "wb"); if (oct_file == NULL){ printf("OCTAVE: could not open file %s\n", oct_file_name); @@ -211,13 +211,13 @@ static void octave_fprintf_plot_history_frame(btstack_cvsd_plc_state_t *plc_stat char hist_name[10]; snprintf(hist_name, sizeof(hist_name), "hist%d", plc_state->nbf); hist_name[sizeof(hist_name) - 1] = 0; - + octave_fprintf_array_int16(oct_file, hist_name, CVSD_LHIST, plc_state->hist); fprintf(oct_file, "y = [min(%s):1000:max(%s)];\n", hist_name, hist_name); fprintf(oct_file, "x = zeros(1, size(y,2));\n"); fprintf(oct_file, "b = [0: %d];\n", CVSD_LHIST+CVSD_FS+CVSD_RT+CVSD_OLAL); - + int pos = CVSD_FS; fprintf(oct_file, "shift_x = x + %d;\n", pos); @@ -233,48 +233,48 @@ static void octave_fprintf_plot_history_frame(btstack_cvsd_plc_state_t *plc_stat fprintf(oct_file, "lhist_rt_x = x + %d;\n", pos); fprintf(oct_file, "pattern_window_x = x + %d;\n", CVSD_LHIST - CVSD_M); - + fprintf(oct_file, "hf = figure();\n"); snprintf(title, sizeof(title), "PLC %s frame %d", octave_frame_type2str(octave_frame_type), frame_nr); title[sizeof(title) - 1] = 0; - + fprintf(oct_file, "hold on;\n"); fprintf(oct_file, "h1 = plot(%s); \n", hist_name); - - fprintf(oct_file, "title(\"%s\");\n", title); - - fprintf(oct_file, "plot(lhist_x, y, 'k'); \n"); - fprintf(oct_file, "text(max(lhist_x) - 10, max(y)+1000, 'lhist'); \n"); + + fprintf(oct_file, "title(\"%s\");\n", title); + + fprintf(oct_file, "plot(lhist_x, y, 'k'); \n"); + fprintf(oct_file, "text(max(lhist_x) - 10, max(y)+1000, 'lhist'); \n"); fprintf(oct_file, "plot(lhist_olal1_x, y, 'k'); \n"); - fprintf(oct_file, "text(max(lhist_olal1_x) - 10, max(y)+1000, 'OLAL'); \n"); + fprintf(oct_file, "text(max(lhist_olal1_x) - 10, max(y)+1000, 'OLAL'); \n"); fprintf(oct_file, "plot(lhist_fs_x, y, 'k'); \n"); - fprintf(oct_file, "text(max(lhist_fs_x) - 10, max(y)+1000, 'FS'); \n"); + fprintf(oct_file, "text(max(lhist_fs_x) - 10, max(y)+1000, 'FS'); \n"); fprintf(oct_file, "plot(lhist_olal2_x, y, 'k'); \n"); - fprintf(oct_file, "text(max(lhist_olal2_x) - 10, max(y)+1000, 'OLAL'); \n"); + fprintf(oct_file, "text(max(lhist_olal2_x) - 10, max(y)+1000, 'OLAL'); \n"); fprintf(oct_file, "plot(lhist_rt_x, y, 'k');\n"); - fprintf(oct_file, "text(max(lhist_rt_x) - 10, max(y)+1000, 'RT'); \n"); + fprintf(oct_file, "text(max(lhist_rt_x) - 10, max(y)+1000, 'RT'); \n"); if (octave_frame_type == OCTAVE_FRAME_TYPE_GOOD) return; int x0 = plc_state->bestlag; int x1 = plc_state->bestlag + CVSD_M - 1; fprintf(oct_file, "plot(b(%d:%d), %s(%d:%d), 'rd'); \n", x0, x1, hist_name, x0, x1); - fprintf(oct_file, "text(%d - 10, -10, 'bestlag'); \n", x0); + fprintf(oct_file, "text(%d - 10, -10, 'bestlag'); \n", x0); x0 = plc_state->bestlag + CVSD_M ; x1 = plc_state->bestlag + CVSD_M + CVSD_FS - 1; fprintf(oct_file, "plot(b(%d:%d), %s(%d:%d), 'kd'); \n", x0, x1, hist_name, x0, x1); - + x0 = CVSD_LHIST - CVSD_M; x1 = CVSD_LHIST - 1; fprintf(oct_file, "plot(b(%d:%d), %s(%d:%d), 'rd'); \n", x0, x1, hist_name, x0, x1); fprintf(oct_file, "plot(pattern_window_x, y, 'g'); \n"); - fprintf(oct_file, "text(max(pattern_window_x) - 10, max(y)+1000, 'M'); \n"); + fprintf(oct_file, "text(max(pattern_window_x) - 10, max(y)+1000, 'M'); \n"); } static void octave_fprintf_plot_output(btstack_cvsd_plc_state_t *plc_state, FILE * oct_file){ @@ -317,7 +317,7 @@ void btstack_cvsd_plc_bad_frame(btstack_cvsd_plc_state_t *plc_state, uint16_t nu int i; float sf = 1; plc_state->nbf++; - + if (plc_state->max_consecutive_bad_frames_nr < plc_state->nbf){ plc_state->max_consecutive_bad_frames_nr = plc_state->nbf; } @@ -330,26 +330,26 @@ void btstack_cvsd_plc_bad_frame(btstack_cvsd_plc_state_t *plc_state, uint16_t nu #ifdef OCTAVE_OUTPUT FILE * oct_file = open_octave_file(plc_state, OCTAVE_FRAME_TYPE_BAD); if (oct_file){ - octave_fprintf_plot_history_frame(plc_state, oct_file, plc_state->frame_count); + octave_fprintf_plot_history_frame(plc_state, oct_file, plc_state->frame_count); } #endif if (plc_state->nbf==1){ // the replication begins after the template match - plc_state->bestlag += CVSD_M; - + plc_state->bestlag += CVSD_M; + // Compute Scale Factor to Match Amplitude of Substitution Packet to that of Preceding Packet sf = btstack_cvsd_plc_amplitude_match(plc_state, num_samples, plc_state->hist, plc_state->bestlag); for (i=0; ihist[plc_state->bestlag+i]; plc_state->hist[CVSD_LHIST+i] = btstack_cvsd_plc_crop_sample(val); } - + for (i=CVSD_OLAL; ihist[plc_state->bestlag+i]; + val = sf*plc_state->hist[plc_state->bestlag+i]; plc_state->hist[CVSD_LHIST+i] = btstack_cvsd_plc_crop_sample(val); } - + for (i=num_samples; i<(num_samples+CVSD_OLAL); i++){ float left = sf*plc_state->hist[plc_state->bestlag+i]; float right = plc_state->hist[plc_state->bestlag+i]; @@ -369,7 +369,7 @@ void btstack_cvsd_plc_bad_frame(btstack_cvsd_plc_state_t *plc_state, uint16_t nu for (i=0; ihist[CVSD_LHIST+i]; } - + // shift the history buffer for (i=0; i<(CVSD_LHIST+CVSD_RT+CVSD_OLAL); i++){ plc_state->hist[i] = plc_state->hist[i+num_samples]; @@ -399,7 +399,7 @@ void btstack_cvsd_plc_good_frame(btstack_cvsd_plc_state_t *plc_state, uint16_t n for (i=0;ihist[CVSD_LHIST+i]; } - + for (i=CVSD_RT;i<(CVSD_RT+CVSD_OLAL);i++){ float left = plc_state->hist[CVSD_LHIST+i]; float right = in[i]; @@ -498,7 +498,7 @@ void btstack_cvsd_plc_process_data(btstack_cvsd_plc_state_t * plc_state, bool is plc_state->good_frames_nr++; if (plc_state->good_frames_nr == 1){ log_info("First good frame at index %d\n", plc_state->frame_count-1); - } + } plc_state->good_samples += num_samples; } } @@ -507,5 +507,5 @@ void btstack_cvsd_dump_statistics(btstack_cvsd_plc_state_t * state){ log_info("Good frames: %d\n", state->good_frames_nr); log_info("Bad frames: %d\n", state->bad_frames_nr); log_info("Zero frames: %d\n", state->zero_frames_nr); - log_info("Max Consecutive bad frames: %d\n", state->max_consecutive_bad_frames_nr); + log_info("Max Consecutive bad frames: %d\n", state->max_consecutive_bad_frames_nr); } diff --git a/src/classic/btstack_sbc_plc.c b/src/classic/btstack_sbc_plc.c index 53dc139c5..d2cc6cd3d 100644 --- a/src/classic/btstack_sbc_plc.c +++ b/src/classic/btstack_sbc_plc.c @@ -69,8 +69,8 @@ static uint8_t indices0[] = { /* Raised COSine table for OLA */ static float rcos[SBC_OLAL] = { 0.99148655f,0.96623611f,0.92510857f,0.86950446f, - 0.80131732f,0.72286918f,0.63683150f,0.54613418f, - 0.45386582f,0.36316850f,0.27713082f,0.19868268f, + 0.80131732f,0.72286918f,0.63683150f,0.54613418f, + 0.45386582f,0.36316850f,0.27713082f,0.19868268f, 0.13049554f,0.07489143f,0.03376389f,0.00851345f }; @@ -82,7 +82,7 @@ static float sqrt3(const float x){ float x; } u; u.x = x; - u.i = (1<<29) + (u.i >> 1) - (1<<22); + u.i = (1<<29) + (u.i >> 1) - (1<<22); // Two Babylonian Steps (simplified from:) // u.x = 0.5f * (u.x + x/u.x); @@ -119,10 +119,10 @@ static int PatternMatch(SAMPLE_FORMAT *y){ float Cn; int n; for (n=0;nmaxCn){ bestmatch=n; - maxCn = Cn; + maxCn = Cn; } } return bestmatch; @@ -133,7 +133,7 @@ static float AmplitudeMatch(SAMPLE_FORMAT *y, SAMPLE_FORMAT bestmatch) { float sumx = 0; float sumy = 0.000001f; float sf; - + for (i=0;i 32767.0) croped_val= 32767.0; - if (croped_val < -32768.0) croped_val=-32768.0; + if (croped_val > 32767.f) croped_val= 32767.f; + if (croped_val < -32768.f) croped_val=-32768.f; return (SAMPLE_FORMAT) croped_val; } @@ -159,7 +159,7 @@ uint8_t * btstack_sbc_plc_zero_signal_frame(void){ void btstack_sbc_plc_init(btstack_sbc_plc_state_t *plc_state){ plc_state->nbf=0; plc_state->bestlag=0; - memset(plc_state->hist,0,sizeof(plc_state->hist)); + memset(plc_state->hist,0,sizeof(plc_state->hist)); } #ifdef OCTAVE_OUTPUT @@ -205,7 +205,7 @@ static FILE * open_octave_file(btstack_sbc_plc_state_t *plc_state, octave_frame_ octave_base_name, plc_state->frame_count, octave_frame_type2str(octave_frame_type)); oct_file_name[sizeof(oct_file_name) - 1] = 0; - + FILE * oct_file = fopen(oct_file_name, "wb"); if (oct_file == NULL){ printf("OCTAVE: could not open file %s\n", oct_file_name); @@ -220,13 +220,13 @@ static void octave_fprintf_plot_history_frame(btstack_sbc_plc_state_t *plc_state char hist_name[10]; snprintf(hist_name, sizeof(hist_name), "hist%d", plc_state->nbf); hist_name[sizeof(hist_name) - 1] = 0; - + octave_fprintf_array_int16(oct_file, hist_name, SBC_LHIST, plc_state->hist); fprintf(oct_file, "y = [min(%s):1000:max(%s)];\n", hist_name, hist_name); fprintf(oct_file, "x = zeros(1, size(y,2));\n"); fprintf(oct_file, "b = [0: %d];\n", SBC_LHIST+SBC_FS+SBC_RT+SBC_OLAL); - + int pos = SBC_FS; fprintf(oct_file, "shift_x = x + %d;\n", pos); @@ -242,48 +242,48 @@ static void octave_fprintf_plot_history_frame(btstack_sbc_plc_state_t *plc_state fprintf(oct_file, "lhist_rt_x = x + %d;\n", pos); fprintf(oct_file, "pattern_window_x = x + %d;\n", SBC_LHIST - SBC_M); - + fprintf(oct_file, "hf = figure();\n"); snprintf(title, sizeof(title), "PLC %s frame %d", octave_frame_type2str(octave_frame_type), frame_nr); title[sizeof(title) - 1] = 0; - + fprintf(oct_file, "hold on;\n"); fprintf(oct_file, "h1 = plot(%s); \n", hist_name); - - fprintf(oct_file, "title(\"%s\");\n", title); - - fprintf(oct_file, "plot(lhist_x, y, 'k'); \n"); - fprintf(oct_file, "text(max(lhist_x) - 10, max(y)+1000, 'lhist'); \n"); + + fprintf(oct_file, "title(\"%s\");\n", title); + + fprintf(oct_file, "plot(lhist_x, y, 'k'); \n"); + fprintf(oct_file, "text(max(lhist_x) - 10, max(y)+1000, 'lhist'); \n"); fprintf(oct_file, "plot(lhist_olal1_x, y, 'k'); \n"); - fprintf(oct_file, "text(max(lhist_olal1_x) - 10, max(y)+1000, 'OLAL'); \n"); + fprintf(oct_file, "text(max(lhist_olal1_x) - 10, max(y)+1000, 'OLAL'); \n"); fprintf(oct_file, "plot(lhist_fs_x, y, 'k'); \n"); - fprintf(oct_file, "text(max(lhist_fs_x) - 10, max(y)+1000, 'FS'); \n"); + fprintf(oct_file, "text(max(lhist_fs_x) - 10, max(y)+1000, 'FS'); \n"); fprintf(oct_file, "plot(lhist_olal2_x, y, 'k'); \n"); - fprintf(oct_file, "text(max(lhist_olal2_x) - 10, max(y)+1000, 'OLAL'); \n"); + fprintf(oct_file, "text(max(lhist_olal2_x) - 10, max(y)+1000, 'OLAL'); \n"); fprintf(oct_file, "plot(lhist_rt_x, y, 'k');\n"); - fprintf(oct_file, "text(max(lhist_rt_x) - 10, max(y)+1000, 'RT'); \n"); + fprintf(oct_file, "text(max(lhist_rt_x) - 10, max(y)+1000, 'RT'); \n"); if (octave_frame_type == OCTAVE_FRAME_TYPE_GOOD) return; int x0 = plc_state->bestlag; int x1 = plc_state->bestlag + SBC_M - 1; fprintf(oct_file, "plot(b(%d:%d), %s(%d:%d), 'rd'); \n", x0, x1, hist_name, x0, x1); - fprintf(oct_file, "text(%d - 10, -10, 'bestlag'); \n", x0); + fprintf(oct_file, "text(%d - 10, -10, 'bestlag'); \n", x0); x0 = plc_state->bestlag + SBC_M ; x1 = plc_state->bestlag + SBC_M + SBC_FS - 1; fprintf(oct_file, "plot(b(%d:%d), %s(%d:%d), 'kd'); \n", x0, x1, hist_name, x0, x1); - + x0 = SBC_LHIST - SBC_M; x1 = SBC_LHIST - 1; fprintf(oct_file, "plot(b(%d:%d), %s(%d:%d), 'rd'); \n", x0, x1, hist_name, x0, x1); fprintf(oct_file, "plot(pattern_window_x, y, 'g'); \n"); - fprintf(oct_file, "text(max(pattern_window_x) - 10, max(y)+1000, 'M'); \n"); + fprintf(oct_file, "text(max(pattern_window_x) - 10, max(y)+1000, 'M'); \n"); } static void octave_fprintf_plot_output(btstack_sbc_plc_state_t *plc_state, FILE * oct_file){ @@ -327,14 +327,14 @@ void btstack_sbc_plc_bad_frame(btstack_sbc_plc_state_t *plc_state, SAMPLE_FORMAT int i; float sf = 1; - plc_state->nbf++; + plc_state->nbf++; plc_state->bad_frames_nr++; plc_state->frame_count++; if (plc_state->max_consecutive_bad_frames_nr < plc_state->nbf){ plc_state->max_consecutive_bad_frames_nr = plc_state->nbf; } - + if (plc_state->nbf==1){ // printf("first bad frame\n"); // Perform pattern matching to find where to replicate @@ -344,14 +344,14 @@ void btstack_sbc_plc_bad_frame(btstack_sbc_plc_state_t *plc_state, SAMPLE_FORMAT #ifdef OCTAVE_OUTPUT FILE * oct_file = open_octave_file(plc_state, OCTAVE_FRAME_TYPE_BAD); if (oct_file){ - octave_fprintf_plot_history_frame(plc_state, oct_file, plc_state->frame_count); + octave_fprintf_plot_history_frame(plc_state, oct_file, plc_state->frame_count); } #endif if (plc_state->nbf==1){ // the replication begins after the template match - plc_state->bestlag += SBC_M; - + plc_state->bestlag += SBC_M; + // Compute Scale Factor to Match Amplitude of Substitution Packet to that of Preceding Packet sf = AmplitudeMatch(plc_state->hist, plc_state->bestlag); // printf("sf Apmlitude Match %f, new data %d, bestlag+M %d\n", sf, ZIRbuf[0], plc_state->hist[plc_state->bestlag]); @@ -362,12 +362,12 @@ void btstack_sbc_plc_bad_frame(btstack_sbc_plc_state_t *plc_state, SAMPLE_FORMAT // val = sf*plc_state->hist[plc_state->bestlag+i]; plc_state->hist[SBC_LHIST+i] = crop_sample(val); } - + for (i=SBC_OLAL; ihist[plc_state->bestlag+i]; + val = sf*plc_state->hist[plc_state->bestlag+i]; plc_state->hist[SBC_LHIST+i] = crop_sample(val); } - + for (i=SBC_FS; i<(SBC_FS+SBC_OLAL); i++){ float left = sf*plc_state->hist[plc_state->bestlag+i]; float right = plc_state->hist[plc_state->bestlag+i]; @@ -387,7 +387,7 @@ void btstack_sbc_plc_bad_frame(btstack_sbc_plc_state_t *plc_state, SAMPLE_FORMAT for (i=0; ihist[SBC_LHIST+i]; } - + // shift the history buffer for (i=0; i<(SBC_LHIST+SBC_RT+SBC_OLAL); i++){ plc_state->hist[i] = plc_state->hist[i+SBC_FS]; @@ -421,10 +421,10 @@ void btstack_sbc_plc_good_frame(btstack_sbc_plc_state_t *plc_state, SAMPLE_FORMA for (i=0;ihist[SBC_LHIST+i]; } - + for (i = SBC_RT;i<(SBC_RT+SBC_OLAL);i++){ float left = plc_state->hist[SBC_LHIST+i]; - float right = in[i]; + float right = in[i]; val = (left*rcos[i-SBC_RT]) + (right*rcos[SBC_OLAL+SBC_RT-1-i]); out[i] = crop_sample(val); } @@ -455,5 +455,5 @@ void btstack_sbc_plc_good_frame(btstack_sbc_plc_state_t *plc_state, SAMPLE_FORMA void btstack_sbc_dump_statistics(btstack_sbc_plc_state_t * state){ log_info("Good frames: %d\n", state->good_frames_nr); log_info("Bad frames: %d\n", state->bad_frames_nr); - log_info("Max Consecutive bad frames: %d\n", state->max_consecutive_bad_frames_nr); + log_info("Max Consecutive bad frames: %d\n", state->max_consecutive_bad_frames_nr); } diff --git a/src/classic/hfp.c b/src/classic/hfp.c index 3fde13836..1b9b0db24 100644 --- a/src/classic/hfp.c +++ b/src/classic/hfp.c @@ -2216,6 +2216,7 @@ void hfp_bcm_write_i2spcm_interface_param(hfp_connection_t * hfp_connection){ #endif void hfp_prepare_for_sco(hfp_connection_t * hfp_connection){ + UNUSED(hfp_connection); #ifdef ENABLE_CC256X_ASSISTED_HFP hfp_connection->cc256x_send_write_codec_config = true; if (hfp_connection->negotiated_codec == HFP_CODEC_MSBC){ diff --git a/src/classic/sdp_util.c b/src/classic/sdp_util.c index 220193965..043af780a 100644 --- a/src/classic/sdp_util.c +++ b/src/classic/sdp_util.c @@ -672,8 +672,8 @@ bool sdp_record_matches_service_search_pattern(uint8_t *record, uint8_t *service // context { indent } #ifdef ENABLE_SDP_DES_DUMP static int de_traversal_dump_data(uint8_t * element, de_type_t de_type, de_size_t de_size, void *my_context){ - int indent = *(int*) my_context; - int i; + unsigned int indent = *(unsigned int*) my_context; + unsigned int i; for (i=0; i= 0x20 && c <= 0x7f) ? c : '.'); } printf("'\n"); @@ -727,7 +727,7 @@ static int de_traversal_dump_data(uint8_t * element, de_type_t de_type, de_size_ void de_dump_data_element(const uint8_t * record){ #ifdef ENABLE_SDP_DES_DUMP - int indent = 0; + unsigned int indent = 0; // hack to get root DES, too. de_type_t type = de_get_element_type(record); de_size_t size = de_get_size_type(record); diff --git a/src/mesh/mesh_configuration_client.c b/src/mesh/mesh_configuration_client.c index 3dd90a1f2..635713b3c 100644 --- a/src/mesh/mesh_configuration_client.c +++ b/src/mesh/mesh_configuration_client.c @@ -1528,7 +1528,7 @@ static void mesh_configuration_client_network_transmit_handler(mesh_model_t *mes mesh_access_message_processed(pdu); } -const static mesh_operation_t mesh_configuration_client_model_operations[] = { +static const mesh_operation_t mesh_configuration_client_model_operations[] = { { MESH_FOUNDATION_OPERATION_BEACON_STATUS, 1, mesh_configuration_client_beacon_status_handler }, { MESH_FOUNDATION_OPERATION_COMPOSITION_DATA_STATUS, 10, mesh_configuration_client_composition_data_status_handler }, { MESH_FOUNDATION_OPERATION_DEFAULT_TTL_STATUS, 1, mesh_configuration_client_default_ttl_handler }, diff --git a/src/mesh/mesh_configuration_server.c b/src/mesh/mesh_configuration_server.c index 3674081ae..c14607f1a 100644 --- a/src/mesh/mesh_configuration_server.c +++ b/src/mesh/mesh_configuration_server.c @@ -2219,7 +2219,7 @@ static void config_node_identity_set_handler(mesh_model_t *mesh_model, mesh_pdu_ // -const static mesh_operation_t mesh_configuration_server_model_operations[] = { +static const mesh_operation_t mesh_configuration_server_model_operations[] = { { MESH_FOUNDATION_OPERATION_APPKEY_ADD, 19, config_appkey_add_handler }, { MESH_FOUNDATION_OPERATION_APPKEY_DELETE, 3, config_appkey_delete_handler }, { MESH_FOUNDATION_OPERATION_APPKEY_GET, 2, config_appkey_get_handler }, diff --git a/src/mesh/mesh_generic_default_transition_time_client.c b/src/mesh/mesh_generic_default_transition_time_client.c index 1574e342f..7201029a6 100644 --- a/src/mesh/mesh_generic_default_transition_time_client.c +++ b/src/mesh/mesh_generic_default_transition_time_client.c @@ -139,7 +139,7 @@ static void generic_default_transition_time_status_handler(mesh_model_t *mesh_mo mesh_access_message_processed(pdu); } -const static mesh_operation_t mesh_generic_default_transition_time_model_operations[] = { +static const mesh_operation_t mesh_generic_default_transition_time_model_operations[] = { { MESH_GENERIC_DEFAULT_TRANSITION_TIME_STATUS, 0, generic_default_transition_time_status_handler }, { 0, 0, NULL } }; diff --git a/src/mesh/mesh_generic_default_transition_time_server.c b/src/mesh/mesh_generic_default_transition_time_server.c index 086a378bd..f9e5bb28b 100644 --- a/src/mesh/mesh_generic_default_transition_time_server.c +++ b/src/mesh/mesh_generic_default_transition_time_server.c @@ -121,7 +121,7 @@ static void generic_default_transition_time_set_unacknowledged_handler(mesh_mode } // Generic On Off Message -const static mesh_operation_t mesh_generic_default_transition_time_model_operations[] = { +static const mesh_operation_t mesh_generic_default_transition_time_model_operations[] = { { MESH_GENERIC_DEFAULT_TRANSITION_TIME_GET, 0, generic_default_transition_time_get_handler }, { MESH_GENERIC_DEFAULT_TRANSITION_TIME_SET, 1, generic_default_transition_time_set_handler }, { MESH_GENERIC_DEFAULT_TRANSITION_TIME_SET_UNACKNOWLEDGED, 1, generic_default_transition_time_set_unacknowledged_handler }, diff --git a/src/mesh/mesh_generic_level_client.c b/src/mesh/mesh_generic_level_client.c index 46176ecf6..53d3c6b53 100644 --- a/src/mesh/mesh_generic_level_client.c +++ b/src/mesh/mesh_generic_level_client.c @@ -250,7 +250,7 @@ static void generic_level_status_handler(mesh_model_t *mesh_model, mesh_pdu_t * mesh_access_message_processed(pdu); } -const static mesh_operation_t mesh_generic_level_model_operations[] = { +static const mesh_operation_t mesh_generic_level_model_operations[] = { { MESH_GENERIC_LEVEL_STATUS, 0, generic_level_status_handler }, { 0, 0, NULL } }; diff --git a/src/mesh/mesh_generic_level_server.c b/src/mesh/mesh_generic_level_server.c index 3051c399b..54222f5d8 100644 --- a/src/mesh/mesh_generic_level_server.c +++ b/src/mesh/mesh_generic_level_server.c @@ -344,7 +344,7 @@ static void generic_move_set_unacknowledged_handler(mesh_model_t *generic_level_ } // Generic On Off Message -const static mesh_operation_t mesh_generic_level_model_operations[] = { +static const mesh_operation_t mesh_generic_level_model_operations[] = { { MESH_GENERIC_LEVEL_GET, 0, generic_level_get_handler }, { MESH_GENERIC_LEVEL_SET, 3, generic_level_set_handler }, { MESH_GENERIC_LEVEL_SET_UNACKNOWLEDGED, 3, generic_level_set_unacknowledged_handler }, diff --git a/src/mesh/mesh_generic_on_off_client.c b/src/mesh/mesh_generic_on_off_client.c index 3fb73d2f2..5cb61a4cc 100644 --- a/src/mesh/mesh_generic_on_off_client.c +++ b/src/mesh/mesh_generic_on_off_client.c @@ -171,7 +171,7 @@ static void generic_on_off_status_handler(mesh_model_t *mesh_model, mesh_pdu_t * mesh_access_message_processed(pdu); } -const static mesh_operation_t mesh_generic_on_off_model_operations[] = { +static const mesh_operation_t mesh_generic_on_off_model_operations[] = { { MESH_GENERIC_ON_OFF_STATUS, 0, generic_on_off_status_handler }, { 0, 0, NULL } }; diff --git a/src/mesh/mesh_generic_on_off_server.c b/src/mesh/mesh_generic_on_off_server.c index bcfb38ad0..342912234 100644 --- a/src/mesh/mesh_generic_on_off_server.c +++ b/src/mesh/mesh_generic_on_off_server.c @@ -198,7 +198,7 @@ static void generic_on_off_set_unacknowledged_handler(mesh_model_t *generic_on_o } // Generic On Off Message -const static mesh_operation_t mesh_generic_on_off_model_operations[] = { +static const mesh_operation_t mesh_generic_on_off_model_operations[] = { { MESH_GENERIC_ON_OFF_GET, 0, generic_on_off_get_handler }, { MESH_GENERIC_ON_OFF_SET, 2, generic_on_off_set_handler }, { MESH_GENERIC_ON_OFF_SET_UNACKNOWLEDGED, 2, generic_on_off_set_unacknowledged_handler }, diff --git a/src/mesh/mesh_health_server.c b/src/mesh/mesh_health_server.c index 492689e80..f606f08ef 100644 --- a/src/mesh/mesh_health_server.c +++ b/src/mesh/mesh_health_server.c @@ -327,7 +327,7 @@ static mesh_pdu_t * mesh_health_server_publish_state_fn(struct mesh_model * mesh } // Health Message -const static mesh_operation_t mesh_health_model_operations[] = { +static const mesh_operation_t mesh_health_model_operations[] = { { MESH_FOUNDATION_OPERATION_HEALTH_FAULT_GET, 2, health_fault_get_handler }, { MESH_FOUNDATION_OPERATION_HEALTH_FAULT_CLEAR, 2, health_fault_clear_handler }, { MESH_FOUNDATION_OPERATION_HEALTH_FAULT_CLEAR_UNACKNOWLEDGED, 2, health_fault_clear_unacknowledged_handler },