diff options
author | Ron Economos <w6rz@comcast.net> | 2019-01-11 01:09:48 -0800 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2019-01-11 17:08:40 -0800 |
commit | 2826fd096e3e157d9f488d058ff85c5b68e06b3e (patch) | |
tree | 142eed0f7f11e8c6f2a7c711dd7566c0f008cea6 /gr-dtv | |
parent | 307fa0cbd06b00746752e5fa0e37c083fb00740f (diff) |
dtv: Fix gcc8 -Wclass-memaccess warnings/errors.
Diffstat (limited to 'gr-dtv')
-rw-r--r-- | gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc | 7 | ||||
-rw-r--r-- | gr-dtv/lib/dvbt2/dvbt2_framemapper_cc_impl.cc | 5 | ||||
-rw-r--r-- | gr-dtv/lib/dvbt2/dvbt2_p1insertion_cc_impl.cc | 5 | ||||
-rw-r--r-- | gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc | 19 |
4 files changed, 20 insertions, 16 deletions
diff --git a/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc b/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc index c82c4ebd2b..bdf1574104 100644 --- a/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc +++ b/gr-dtv/lib/dvbt/dvbt_reference_signals_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2015,2016,2018 Free Software Foundation, Inc. + * Copyright 2015,2016,2018,2019 Free Software Foundation, Inc. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,6 +27,7 @@ #include <gnuradio/expj.h> #include <gnuradio/math.h> #include <complex> +#include <algorithm> namespace gr { namespace dtv { @@ -273,7 +274,7 @@ namespace gr { delete [] d_wk; throw std::bad_alloc(); } - memset(d_prev_tps_symbol, 0, d_tps_carriers_size * sizeof(gr_complex)); + std::fill_n(d_prev_tps_symbol, d_tps_carriers_size, 0); d_tps_symbol = new (std::nothrow) gr_complex[d_tps_carriers_size]; if (d_tps_symbol == NULL) { @@ -289,7 +290,7 @@ namespace gr { delete [] d_wk; throw std::bad_alloc(); } - memset(d_tps_symbol, 0, d_tps_carriers_size * sizeof(gr_complex)); + std::fill_n(d_tps_symbol, d_tps_carriers_size, 0); // Init receive TPS data vector for (int i = 0; i < d_symbols_per_frame; i++) { diff --git a/gr-dtv/lib/dvbt2/dvbt2_framemapper_cc_impl.cc b/gr-dtv/lib/dvbt2/dvbt2_framemapper_cc_impl.cc index 9ab5f73cc2..2ddf0dd647 100644 --- a/gr-dtv/lib/dvbt2/dvbt2_framemapper_cc_impl.cc +++ b/gr-dtv/lib/dvbt2/dvbt2_framemapper_cc_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2015-2017 Free Software Foundation, Inc. + * Copyright 2015-2017,2019 Free Software Foundation, Inc. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,6 +24,7 @@ #include <gnuradio/io_signature.h> #include "dvbt2_framemapper_cc_impl.h" +#include <algorithm> namespace gr { namespace dtv { @@ -1608,7 +1609,7 @@ namespace gr { { int sr = 0x4A80; int num = mapped_items - stream_items - 1840 - (N_post / eta_mod) - (N_FC - C_FC); - memset(&dummy_randomize[0], 0, sizeof(gr_complex) * num); + std::fill_n(&dummy_randomize[0], num, 0); for (int i = 0; i < num; i++) { int b = ((sr) ^ (sr >> 1)) & 1; dummy_randomize[i] = (b ? -1.0 : 1.0); diff --git a/gr-dtv/lib/dvbt2/dvbt2_p1insertion_cc_impl.cc b/gr-dtv/lib/dvbt2/dvbt2_p1insertion_cc_impl.cc index 9a2a41b395..5c4e68c4a3 100644 --- a/gr-dtv/lib/dvbt2/dvbt2_p1insertion_cc_impl.cc +++ b/gr-dtv/lib/dvbt2/dvbt2_p1insertion_cc_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2015 Free Software Foundation, Inc. + * Copyright 2015,2019 Free Software Foundation, Inc. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -25,6 +25,7 @@ #include <gnuradio/io_signature.h> #include "dvbt2_p1insertion_cc_impl.h" #include <stdio.h> +#include <algorithm> namespace gr { namespace dtv { @@ -132,7 +133,7 @@ namespace gr { for (int i = 0; i < 384; i++) { dbpsk_modulation_sequence[i] = dbpsk_modulation_sequence[i + 1] * p1_randomize[i]; } - memset(&p1_freq[0], 0, sizeof(gr_complex) * 1024); + std::fill_n(&p1_freq[0], 1024, 0); for (int i = 0; i < 384; i++) { p1_freq[p1_active_carriers[i] + 86] = float(dbpsk_modulation_sequence[i]); } diff --git a/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc b/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc index f804936a57..8d2e20775d 100644 --- a/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc +++ b/gr-dtv/lib/dvbt2/dvbt2_paprtr_cc_impl.cc @@ -1,6 +1,6 @@ /* -*- c++ -*- */ /* - * Copyright 2015-2018 Free Software Foundation, Inc. + * Copyright 2015-2019 Free Software Foundation, Inc. * * This is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +26,7 @@ #include <gnuradio/io_signature.h> #include <gnuradio/math.h> #include <volk/volk.h> +#include <algorithm> /* An early exit from the iteration loop is a very effective optimization */ /* Change this line to #undef for validation testing with BBC V&V streams */ @@ -698,7 +699,7 @@ namespace gr { valid = FALSE; if (j < N_P2) { index = 0; - memset(&ones_freq[index], 0, sizeof(gr_complex) * left_nulls); + std::fill_n(&ones_freq[index], left_nulls, 0); index = left_nulls; for (int n = 0; n < C_PS; n++) { if (p2_carrier_map[n] == P2PAPR_CARRIER) { @@ -708,13 +709,13 @@ namespace gr { ones_freq[index++] = zero; } } - memset(&ones_freq[index], 0, sizeof(gr_complex) * right_nulls); + std::fill_n(&ones_freq[index], right_nulls, 0); papr_map = p2_papr_map; valid = TRUE; } else if (j == (num_symbols - L_FC) && (papr_mode == PAPR_TR || papr_mode == PAPR_BOTH)) { index = 0; - memset(&ones_freq[index], 0, sizeof(gr_complex) * left_nulls); + std::fill_n(&ones_freq[index], left_nulls, 0); index = left_nulls; for (int n = 0; n < C_PS; n++) { if (fc_carrier_map[n] == TRPAPR_CARRIER) { @@ -724,13 +725,13 @@ namespace gr { ones_freq[index++] = zero; } } - memset(&ones_freq[index], 0, sizeof(gr_complex) * right_nulls); + std::fill_n(&ones_freq[index], right_nulls, 0); papr_map = p2_papr_map; valid = TRUE; } else if (papr_mode == PAPR_TR || papr_mode == PAPR_BOTH) { index = 0; - memset(&ones_freq[index], 0, sizeof(gr_complex) * left_nulls); + std::fill_n(&ones_freq[index], left_nulls, 0); index = left_nulls; for (int n = 0; n < C_PS; n++) { if (data_carrier_map[n] == TRPAPR_CARRIER) { @@ -740,7 +741,7 @@ namespace gr { ones_freq[index++] = zero; } } - memset(&ones_freq[index], 0, sizeof(gr_complex) * right_nulls); + std::fill_n(&ones_freq[index], right_nulls, 0); papr_map = tr_papr_map; valid = TRUE; } @@ -751,8 +752,8 @@ namespace gr { papr_fft->execute(); memcpy(ones_time, papr_fft->get_outbuf(), sizeof(gr_complex) * papr_fft_size); volk_32fc_s32fc_multiply_32fc(ones_time, ones_time, normalization, papr_fft_size); - memset(&r[0], 0, sizeof(gr_complex) * N_TR); - memset(&c[0], 0, sizeof(gr_complex) * papr_fft_size); + std::fill_n(&r[0], N_TR, 0); + std::fill_n(&c[0], papr_fft_size, 0); for (int k = 1; k <= num_iterations; k++) { y = 0.0; volk_32f_x2_add_32f((float*)ctemp, (float*)in, (float*)c, papr_fft_size * 2); |