diff options
author | Marcus Müller <mmueller@gnuradio.org> | 2019-08-17 20:32:20 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2019-08-22 15:05:58 +0200 |
commit | b08d13aed2a7e7ffdee09833bb24db8ce92dce66 (patch) | |
tree | 4846eebe25b48c615cbe07d2a9f4e79d5e8ff72d /gr-digital/lib | |
parent | c6cb3bbc35153a9635d69eddab0d252f7441b854 (diff) |
clang-tidy in gnuradio-runtime: use empty() instead of size()!=0
Diffstat (limited to 'gr-digital/lib')
-rw-r--r-- | gr-digital/lib/constellation.cc | 4 | ||||
-rw-r--r-- | gr-digital/lib/costas_loop_cc_impl.cc | 2 | ||||
-rw-r--r-- | gr-digital/lib/hdlc_framer_pb_impl.cc | 2 | ||||
-rw-r--r-- | gr-digital/lib/msk_timing_recovery_cc_impl.cc | 2 | ||||
-rw-r--r-- | gr-digital/lib/ofdm_chanest_vcvc_impl.cc | 8 | ||||
-rw-r--r-- | gr-digital/lib/ofdm_equalizer_base.cc | 4 | ||||
-rw-r--r-- | gr-digital/lib/pfb_clock_sync_ccf_impl.cc | 4 | ||||
-rw-r--r-- | gr-digital/lib/pfb_clock_sync_fff_impl.cc | 2 |
8 files changed, 14 insertions, 14 deletions
diff --git a/gr-digital/lib/constellation.cc b/gr-digital/lib/constellation.cc index 2734a3e83e..3caafaa992 100644 --- a/gr-digital/lib/constellation.cc +++ b/gr-digital/lib/constellation.cc @@ -69,7 +69,7 @@ constellation::constellation(std::vector<gr_complex> constell, d_constellation[i] = d_constellation[i] * d_scalefactor; } } - if (pre_diff_code.size() == 0) + if (pre_diff_code.empty()) d_apply_pre_diff_code = false; else if (pre_diff_code.size() != constsize) throw std::runtime_error( @@ -307,7 +307,7 @@ void constellation::set_soft_dec_lut(const std::vector<std::vector<float>>& soft d_lut_scale = powf(2.0, static_cast<float>(precision)); } -bool constellation::has_soft_dec_lut() { return d_soft_dec_lut.size() > 0; } +bool constellation::has_soft_dec_lut() { return !d_soft_dec_lut.empty(); } std::vector<std::vector<float>> constellation::soft_dec_lut() { return d_soft_dec_lut; } diff --git a/gr-digital/lib/costas_loop_cc_impl.cc b/gr-digital/lib/costas_loop_cc_impl.cc index 23ab7fc36e..c3b30834eb 100644 --- a/gr-digital/lib/costas_loop_cc_impl.cc +++ b/gr-digital/lib/costas_loop_cc_impl.cc @@ -180,7 +180,7 @@ int costas_loop_cc_impl::work(int noutput_items, pmt::intern("phase_est")); for (int i = 0; i < noutput_items; i++) { - if (tags.size() > 0) { + if (!tags.empty()) { if (tags[0].offset - nitems_read(0) == (size_t)i) { d_phase = (float)pmt::to_double(tags[0].value); tags.erase(tags.begin()); diff --git a/gr-digital/lib/hdlc_framer_pb_impl.cc b/gr-digital/lib/hdlc_framer_pb_impl.cc index 13d80e9b85..c6439ff72a 100644 --- a/gr-digital/lib/hdlc_framer_pb_impl.cc +++ b/gr-digital/lib/hdlc_framer_pb_impl.cc @@ -114,7 +114,7 @@ int hdlc_framer_pb_impl::work(int noutput_items, // partial packets., but if we're to preserve tag boundaries // this is much, much simpler. int oidx = 0; - while (d_leftovers.size() > 0) { + while (!d_leftovers.empty()) { if ((size_t)noutput_items < (oidx + d_leftovers[0].size())) return oidx; memcpy(out + oidx, &d_leftovers[0][0], d_leftovers[0].size()); diff --git a/gr-digital/lib/msk_timing_recovery_cc_impl.cc b/gr-digital/lib/msk_timing_recovery_cc_impl.cc index 1e4db9a6f3..5e2442bcaa 100644 --- a/gr-digital/lib/msk_timing_recovery_cc_impl.cc +++ b/gr-digital/lib/msk_timing_recovery_cc_impl.cc @@ -133,7 +133,7 @@ int msk_timing_recovery_cc_impl::general_work(int noutput_items, while (oidx < noutput_items && iidx < ninp) { // check to see if there's a tag to reset the timing estimate - if (tags.size() > 0) { + if (!tags.empty()) { int offset = tags[0].offset - nitems_read(0); if ((offset >= iidx) && (offset < (iidx + d_sps))) { float center = (float)pmt::to_double(tags[0].value); diff --git a/gr-digital/lib/ofdm_chanest_vcvc_impl.cc b/gr-digital/lib/ofdm_chanest_vcvc_impl.cc index ea991990a7..1f368a40e5 100644 --- a/gr-digital/lib/ofdm_chanest_vcvc_impl.cc +++ b/gr-digital/lib/ofdm_chanest_vcvc_impl.cc @@ -60,8 +60,8 @@ ofdm_chanest_vcvc_impl::ofdm_chanest_vcvc_impl( d_n_data_syms(n_data_symbols), d_n_sync_syms(1), d_eq_noise_red_len(eq_noise_red_len), - d_ref_sym((sync_symbol2.size() && !force_one_sync_symbol) ? sync_symbol2 - : sync_symbol1), + d_ref_sym((!sync_symbol2.empty() && !force_one_sync_symbol) ? sync_symbol2 + : sync_symbol1), d_corr_v(sync_symbol2), d_known_symbol_diffs(0, 0), d_new_symbol_diffs(0, 0), @@ -84,7 +84,7 @@ ofdm_chanest_vcvc_impl::ofdm_chanest_vcvc_impl( } // Sanity checks - if (sync_symbol2.size()) { + if (!sync_symbol2.empty()) { if (sync_symbol1.size() != sync_symbol2.size()) { throw std::invalid_argument("sync symbols must have equal length."); } @@ -149,7 +149,7 @@ int ofdm_chanest_vcvc_impl::get_carr_offset(const gr_complex* sync_sym1, const gr_complex* sync_sym2) { int carr_offset = 0; - if (d_corr_v.size()) { + if (!d_corr_v.empty()) { // Use Schmidl & Cox method float Bg_max = 0; // g here is 2g in the paper diff --git a/gr-digital/lib/ofdm_equalizer_base.cc b/gr-digital/lib/ofdm_equalizer_base.cc index 024a3bb29e..3764e4f9ec 100644 --- a/gr-digital/lib/ofdm_equalizer_base.cc +++ b/gr-digital/lib/ofdm_equalizer_base.cc @@ -57,7 +57,7 @@ ofdm_equalizer_1d_pilots::ofdm_equalizer_1d_pilots( if (input_is_shifted) { fft_shift_width = fft_len / 2; } - if (!occupied_carriers.size()) { + if (occupied_carriers.empty()) { std::fill(d_occupied_carriers.begin(), d_occupied_carriers.end(), true); } else { for (unsigned i = 0; i < occupied_carriers.size(); i++) { @@ -73,7 +73,7 @@ ofdm_equalizer_1d_pilots::ofdm_equalizer_1d_pilots( } } } - if (pilot_carriers.size()) { + if (!pilot_carriers.empty()) { for (unsigned i = 0; i < pilot_carriers.size(); i++) { if (pilot_carriers[i].size() != pilot_symbols[i].size()) { throw std::invalid_argument("pilot carriers and -symbols do not match."); diff --git a/gr-digital/lib/pfb_clock_sync_ccf_impl.cc b/gr-digital/lib/pfb_clock_sync_ccf_impl.cc index 5962eca761..851a593bea 100644 --- a/gr-digital/lib/pfb_clock_sync_ccf_impl.cc +++ b/gr-digital/lib/pfb_clock_sync_ccf_impl.cc @@ -68,7 +68,7 @@ pfb_clock_sync_ccf_impl::pfb_clock_sync_ccf_impl(double sps, d_error(0), d_out_idx(0) { - if (taps.size() == 0) + if (taps.empty()) throw std::runtime_error("pfb_clock_sync_ccf: please specify a filter.\n"); // Let scheduler adjust our relative_rate. @@ -382,7 +382,7 @@ int pfb_clock_sync_ccf_impl::general_work(int noutput_items, // produce output as long as we can and there are enough input samples while (i < noutput_items) { - if (tags.size() > 0) { + if (!tags.empty()) { size_t offset = tags[0].offset - nitems_read(0); if ((offset >= (size_t)count) && (offset < (size_t)(count + d_sps))) { float center = (float)pmt::to_double(tags[0].value); diff --git a/gr-digital/lib/pfb_clock_sync_fff_impl.cc b/gr-digital/lib/pfb_clock_sync_fff_impl.cc index dbfadf2ed7..75973b84a0 100644 --- a/gr-digital/lib/pfb_clock_sync_fff_impl.cc +++ b/gr-digital/lib/pfb_clock_sync_fff_impl.cc @@ -65,7 +65,7 @@ pfb_clock_sync_fff_impl::pfb_clock_sync_fff_impl(double sps, d_error(0), d_out_idx(0) { - if (taps.size() == 0) + if (taps.empty()) throw std::runtime_error("pfb_clock_sync_fff: please specify a filter.\n"); // Let scheduler adjust our relative_rate. |