From c8edec53d81bba3220c61af6649819ce243d0e5c Mon Sep 17 00:00:00 2001 From: Steve Glass Date: Sun, 27 Sep 2015 16:14:33 +1000 Subject: [PATCH] Changes to silence compiler warnings on OSX --- lib/flow_control/burst_fnr_filter_impl.cc | 2 +- .../burst_sdcch_subslot_filter_impl.cc | 15 +++++++++++++-- .../burst_sdcch_subslot_filter_impl.h | 10 ---------- .../burst_sdcch_subslot_splitter_impl.cc | 17 ++++++++++++++--- .../burst_sdcch_subslot_splitter_impl.h | 10 ---------- lib/receiver/clock_offset_control_impl.cc | 4 ++-- lib/receiver/sch.c | 2 +- 7 files changed, 31 insertions(+), 29 deletions(-) diff --git a/lib/flow_control/burst_fnr_filter_impl.cc b/lib/flow_control/burst_fnr_filter_impl.cc index 1aa6f5b..e665acf 100644 --- a/lib/flow_control/burst_fnr_filter_impl.cc +++ b/lib/flow_control/burst_fnr_filter_impl.cc @@ -70,7 +70,7 @@ namespace gr { unsigned int frame_nr = be32toh(header->frame_number); if ((d_mode == FILTER_LESS_OR_EQUAL && frame_nr <= d_framenr) - || d_mode == FILTER_GREATER_OR_EQUAL && frame_nr >= d_framenr) + || (d_mode == FILTER_GREATER_OR_EQUAL && frame_nr >= d_framenr)) { message_port_pub(pmt::mp("out"), msg); } diff --git a/lib/flow_control/burst_sdcch_subslot_filter_impl.cc b/lib/flow_control/burst_sdcch_subslot_filter_impl.cc index 9f27fcd..3ff2e8f 100644 --- a/lib/flow_control/burst_sdcch_subslot_filter_impl.cc +++ b/lib/flow_control/burst_sdcch_subslot_filter_impl.cc @@ -64,6 +64,17 @@ namespace gr { void burst_sdcch_subslot_filter_impl::process_burst(pmt::pmt_t msg) { + // hardcoded subslots of the channels, both SDCCH and the associated SACCH + // -1 means that the particular position in the frame is not SDCCH + static const int8_t subslots_sdcch4[102] = { + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1 + }; + static const int8_t subslots_sdcch8[102] = { + 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1,-1, + 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,-1,-1,-1 + }; + pmt::pmt_t header_plus_burst = pmt::cdr(msg); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst); @@ -74,11 +85,11 @@ namespace gr { if (d_mode == SS_FILTER_SDCCH8) { - subslot = d_subslots_sdcch8[fn_mod102]; + subslot = subslots_sdcch8[fn_mod102]; } else if (d_mode == SS_FILTER_SDCCH4) { - subslot = d_subslots_sdcch4[fn_mod102]; + subslot = subslots_sdcch4[fn_mod102]; } if ((subslot == -1) || (d_mode == SS_FILTER_SDCCH4 && subslot > 3)) diff --git a/lib/flow_control/burst_sdcch_subslot_filter_impl.h b/lib/flow_control/burst_sdcch_subslot_filter_impl.h index 05038d7..40a603e 100644 --- a/lib/flow_control/burst_sdcch_subslot_filter_impl.h +++ b/lib/flow_control/burst_sdcch_subslot_filter_impl.h @@ -31,16 +31,6 @@ namespace gr { class burst_sdcch_subslot_filter_impl : public burst_sdcch_subslot_filter { private: - // hardcoded subslots of the channels, both SDCCH and the associated SACCH - // -1 means that the particular position in the frame is not SDCCH - const int8_t d_subslots_sdcch4[102] = { - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1 - }; - const int8_t d_subslots_sdcch8[102] = { - 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1,-1, - 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,-1,-1,-1 - }; subslot_filter_mode d_mode; unsigned int d_subslot; public: diff --git a/lib/flow_control/burst_sdcch_subslot_splitter_impl.cc b/lib/flow_control/burst_sdcch_subslot_splitter_impl.cc index 260fe11..0a2a3be 100644 --- a/lib/flow_control/burst_sdcch_subslot_splitter_impl.cc +++ b/lib/flow_control/burst_sdcch_subslot_splitter_impl.cc @@ -74,6 +74,17 @@ namespace gr { void burst_sdcch_subslot_splitter_impl::process_burst(pmt::pmt_t msg) { + // hardcoded subslots of the channels, both SDCCH and the associated SACCH + // -1 means that the particular position in the frame is not SDCCH + static const int8_t subslots_sdcch4[102] = { + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1, + -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1 + }; + static const int8_t subslots_sdcch8[102] = { + 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1,-1, + 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,-1,-1,-1 + }; + pmt::pmt_t header_plus_burst = pmt::cdr(msg); gsmtap_hdr * header = (gsmtap_hdr *)pmt::blob_data(header_plus_burst); @@ -81,14 +92,14 @@ namespace gr { uint32_t fn_mod102 = frame_nr % 102; int8_t subslot; - + if (d_mode == SPLITTER_SDCCH8) { - subslot = d_subslots_sdcch8[fn_mod102]; + subslot = subslots_sdcch8[fn_mod102]; } else if (d_mode == SPLITTER_SDCCH4) { - subslot = d_subslots_sdcch4[fn_mod102]; + subslot = subslots_sdcch4[fn_mod102]; } if ((subslot == -1) || (d_mode == SPLITTER_SDCCH4 && subslot > 3)) diff --git a/lib/flow_control/burst_sdcch_subslot_splitter_impl.h b/lib/flow_control/burst_sdcch_subslot_splitter_impl.h index 58aff96..b8eaaea 100644 --- a/lib/flow_control/burst_sdcch_subslot_splitter_impl.h +++ b/lib/flow_control/burst_sdcch_subslot_splitter_impl.h @@ -31,16 +31,6 @@ namespace gr { class burst_sdcch_subslot_splitter_impl : public burst_sdcch_subslot_splitter { private: - // hardcoded subslots of the channels, both SDCCH and the associated SACCH - // -1 means that the particular position in the frame is not SDCCH - const int8_t d_subslots_sdcch4[102] = { - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1, - -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, 0, 0, 0, 0, 1, 1, 1, 1,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1, 2, 2, 2, 2, 3, 3, 3, 3,-1 - }; - const int8_t d_subslots_sdcch8[102] = { - 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3,-1,-1,-1, - 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7,-1,-1,-1 - }; splitter_mode d_mode; public: burst_sdcch_subslot_splitter_impl(splitter_mode mode); diff --git a/lib/receiver/clock_offset_control_impl.cc b/lib/receiver/clock_offset_control_impl.cc index a590a6d..43a9b8e 100644 --- a/lib/receiver/clock_offset_control_impl.cc +++ b/lib/receiver/clock_offset_control_impl.cc @@ -103,7 +103,7 @@ void clock_offset_control_impl::process_measurement(pmt::pmt_t msg) float ppm = -freq_offset/d_fc*1.0e6; std::string state = pmt::symbol_to_string(pmt::tuple_ref(msg,2)); d_last_state = state; - if(abs(ppm) > 100) //safeguard against flawed measurements + if(std::abs(ppm) > 100.0) //safeguard against flawed measurements { ppm=0; reset(); @@ -132,7 +132,7 @@ void clock_offset_control_impl::process_measurement(pmt::pmt_t msg) if(d_counter == 5) { d_counter = 0; - if(abs(d_last_ppm_estimate-d_ppm_estimate) > 0.1) + if(std::abs(d_last_ppm_estimate-d_ppm_estimate) > 0.1) { pmt::pmt_t msg_ppm = pmt::from_double(ppm); message_port_pub(pmt::intern("ppm"), msg_ppm); diff --git a/lib/receiver/sch.c b/lib/receiver/sch.c index 2e7de44..3273237 100644 --- a/lib/receiver/sch.c +++ b/lib/receiver/sch.c @@ -261,7 +261,7 @@ int decode_sch(const unsigned char *buf, int * t1_o, int * t2_o, int * t3_o, int memcpy(data + SCH_DATA_LEN, buf + SCH_DATA_LEN + N_SYNC_BITS, SCH_DATA_LEN); // Viterbi decode - if (errors = conv_decode(data, decoded_data)) { + if ((errors = conv_decode(data, decoded_data))) { // fprintf(stderr, "error: sch: conv_decode (%d)\n", errors); //DEBUGF("ERR: conv_decode %d\n", errors); //return errors;