diff options
-rw-r--r-- | src/Buffer.cpp | 43 | ||||
-rw-r--r-- | src/Buffer.h | 10 | ||||
-rw-r--r-- | src/ConvEncoder.cpp | 1 | ||||
-rw-r--r-- | src/DabMod.cpp | 5 | ||||
-rw-r--r-- | src/FIRFilter.cpp | 3 | ||||
-rw-r--r-- | src/FicSource.cpp | 1 | ||||
-rw-r--r-- | src/Flowgraph.cpp | 1 | ||||
-rw-r--r-- | src/FrameMultiplexer.cpp | 1 | ||||
-rw-r--r-- | src/FrequencyInterleaver.cpp | 1 | ||||
-rw-r--r-- | src/GainControl.cpp | 12 | ||||
-rw-r--r-- | src/GainControl.h | 2 | ||||
-rw-r--r-- | src/MemlessPoly.cpp | 5 | ||||
-rw-r--r-- | src/OfdmGenerator.cpp | 12 | ||||
-rw-r--r-- | src/OutputUHD.cpp | 10 | ||||
-rw-r--r-- | src/OutputUHD.h | 2 | ||||
-rw-r--r-- | src/PrbsGenerator.cpp | 7 | ||||
-rw-r--r-- | src/PuncturingEncoder.cpp | 1 | ||||
-rw-r--r-- | src/RemoteControl.cpp | 18 | ||||
-rw-r--r-- | src/Resampler.cpp | 3 | ||||
-rw-r--r-- | src/Socket.h | 1 | ||||
-rw-r--r-- | src/SubchannelSource.cpp | 1 | ||||
-rw-r--r-- | src/TII.cpp | 6 | ||||
-rw-r--r-- | src/TimeInterleaver.cpp | 1 | ||||
-rw-r--r-- | src/TimestampDecoder.cpp | 6 |
24 files changed, 80 insertions, 73 deletions
diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 6b14561..9df834a 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -28,17 +28,17 @@ #include "Buffer.h" #include "PcDebug.h" +#include <string> #include <stdlib.h> #include <string.h> - Buffer::Buffer(size_t len, const void *data) { PDEBUG("Buffer::Buffer(%zu, %p)\n", len, data); - this->len = 0; - this->size = 0; - this->data = NULL; + m_len = 0; + m_size = 0; + m_data = NULL; setData(data, len); } @@ -46,23 +46,23 @@ Buffer::Buffer(const std::vector<uint8_t> &vec) { PDEBUG("Buffer::Buffer(vector [%zu])\n", vec.size()); - this->len = 0; - this->size = 0; - this->data = NULL; + m_len = 0; + m_size = 0; + m_data = NULL; setData(vec.data(), vec.size()); } Buffer::~Buffer() { - PDEBUG("Buffer::~Buffer() len=%zu, data=%p\n", len, data); - free(data); + PDEBUG("Buffer::~Buffer() len=%zu, data=%p\n", m_len, m_data); + free(m_data); } Buffer &Buffer::operator=(const Buffer ©) { - setData(copy.data, copy.len); + setData(copy.m_data, copy.m_len); return *this; } @@ -74,29 +74,30 @@ Buffer &Buffer::operator=(const std::vector<uint8_t> ©) Buffer &Buffer::operator+=(const Buffer ©) { - appendData(copy.data, copy.len); + appendData(copy.m_data, copy.m_len); return *this; } void Buffer::setLength(size_t len) { - if (len > size) { - void *tmp = data; + if (len > m_size) { + void *tmp = m_data; /* Align to 32-byte boundary for AVX. */ - const int ret = posix_memalign(&data, 32, len); + const int ret = posix_memalign(&m_data, 32, len); if (ret != 0) { - throw std::runtime_error("memory allocation failed: " + std::to_string(ret)); + throw std::runtime_error("memory allocation failed: " + + std::to_string(ret)); } if (tmp != NULL) { - memcpy(data, tmp, this->len); + memcpy(m_data, tmp, m_len); free(tmp); } - size = len; + m_size = len; } - this->len = len; + m_len = len; } @@ -109,10 +110,10 @@ void Buffer::setData(const void *data, size_t len) void Buffer::appendData(const void *data, size_t len) { - size_t offset = this->len; - setLength(this->len + len); + size_t offset = m_len; + setLength(m_len + len); if (data != NULL) { - memcpy((char*)this->data + offset, data, len); + memcpy((char*)m_data + offset, data, len); } } diff --git a/src/Buffer.h b/src/Buffer.h index 8c5c768..60a7d50 100644 --- a/src/Buffer.h +++ b/src/Buffer.h @@ -43,15 +43,15 @@ class Buffer { protected: /* Current length of the data in the Buffer */ - size_t len; + size_t m_len; /* Allocated size of the Buffer */ - size_t size; + size_t m_size; /* Pointer to the data. Memory allocation is entirely * handled by setLength. */ - void *data; + void *m_data; public: using sptr = std::shared_ptr<Buffer>; @@ -77,7 +77,7 @@ class Buffer { void appendData(const void *data, size_t len); Buffer &operator+=(const Buffer ©); - size_t getLength() const { return len; } - void *getData() const { return data; } + size_t getLength() const { return m_len; } + void *getData() const { return m_data; } }; diff --git a/src/ConvEncoder.cpp b/src/ConvEncoder.cpp index 06b2e85..074898f 100644 --- a/src/ConvEncoder.cpp +++ b/src/ConvEncoder.cpp @@ -25,6 +25,7 @@ #include <stdlib.h> #include <stdio.h> #include <stdexcept> +#include <string> const static uint8_t PARITY[] = { diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 1625a82..0ac7d4f 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -445,7 +445,7 @@ int launch_modulator(int argc, char* argv[]) } } #if defined(HAVE_ZEROMQ) - else if (auto in = dynamic_pointer_cast<InputZeroMQReader>(inputReader)) { + else if (dynamic_pointer_cast<InputZeroMQReader>(inputReader)) { run_again = true; // Create a new input reader auto inputZeroMQReader = make_shared<InputZeroMQReader>(); @@ -453,7 +453,8 @@ int launch_modulator(int argc, char* argv[]) inputReader = inputZeroMQReader; } #endif - else if (auto in = dynamic_pointer_cast<InputTcpReader>(inputReader)) { + else if (dynamic_pointer_cast<InputTcpReader>(inputReader)) { + // Create a new input reader auto inputTcpReader = make_shared<InputTcpReader>(); inputTcpReader->Open(mod_settings.inputName); inputReader = inputTcpReader; diff --git a/src/FIRFilter.cpp b/src/FIRFilter.cpp index 4296822..1450b1e 100644 --- a/src/FIRFilter.cpp +++ b/src/FIRFilter.cpp @@ -306,9 +306,6 @@ int FIRFilter::internal_process(Buffer* const dataIn, Buffer* dataOut) void FIRFilter::set_parameter(const string& parameter, const string& value) { - stringstream ss(value); - ss.exceptions ( stringstream::failbit | stringstream::badbit ); - if (parameter == "ntaps") { throw ParameterError("Parameter 'ntaps' is read-only"); } diff --git a/src/FicSource.cpp b/src/FicSource.cpp index 92932ec..04197db 100644 --- a/src/FicSource.cpp +++ b/src/FicSource.cpp @@ -28,6 +28,7 @@ #include "PcDebug.h" #include <stdexcept> +#include <string> #include <sys/types.h> #include <stdlib.h> #include <string.h> diff --git a/src/Flowgraph.cpp b/src/Flowgraph.cpp index 4870534..465ef41 100644 --- a/src/Flowgraph.cpp +++ b/src/Flowgraph.cpp @@ -26,6 +26,7 @@ #include "Flowgraph.h" #include "PcDebug.h" +#include <string> #include <memory> #include <algorithm> #include <sstream> diff --git a/src/FrameMultiplexer.cpp b/src/FrameMultiplexer.cpp index 1cfaadd..4cee0b2 100644 --- a/src/FrameMultiplexer.cpp +++ b/src/FrameMultiplexer.cpp @@ -28,6 +28,7 @@ #include "PcDebug.h" #include <stdio.h> +#include <string> #include <stdexcept> #include <complex> #include <memory> diff --git a/src/FrequencyInterleaver.cpp b/src/FrequencyInterleaver.cpp index bd5042c..e76d525 100644 --- a/src/FrequencyInterleaver.cpp +++ b/src/FrequencyInterleaver.cpp @@ -24,6 +24,7 @@ #include <stdio.h> #include <stdexcept> +#include <string> #include <stdlib.h> #include <complex> diff --git a/src/GainControl.cpp b/src/GainControl.cpp index 2a91b12..f44aa68 100644 --- a/src/GainControl.cpp +++ b/src/GainControl.cpp @@ -46,7 +46,7 @@ using namespace std; static float var_variance; GainControl::GainControl(size_t framesize, - GainMode mode, + GainMode gainMode, float digGain, float normalise, float varVariance) : @@ -60,10 +60,10 @@ GainControl::GainControl(size_t framesize, m_digGain(digGain), m_normalise(normalise), m_var_variance_rc(varVariance), - m_gainmode(mode), + m_gainmode(gainMode), m_mutex() { - PDEBUG("GainControl::GainControl(%zu, %zu) @ %p\n", framesize, (size_t)mode, this); + PDEBUG("GainControl::GainControl(%zu, %zu) @ %p\n", framesize, (size_t)m_gainMode, this); /* register the parameters that can be remote controlled */ RC_ADD_PARAMETER(digital, "Digital Gain"); @@ -532,10 +532,10 @@ void GainControl::set_parameter(const string& parameter, const string& value) } } else { - stringstream ss; - ss << "Parameter '" << parameter + stringstream ss_err; + ss_err << "Parameter '" << parameter << "' is not exported by controllable " << get_rc_name(); - throw ParameterError(ss.str()); + throw ParameterError(ss_err.str()); } } diff --git a/src/GainControl.h b/src/GainControl.h index 44c9fa9..e9eaa8c 100644 --- a/src/GainControl.h +++ b/src/GainControl.h @@ -51,7 +51,7 @@ class GainControl : public PipelinedModCodec, public RemoteControllable { public: GainControl(size_t framesize, - GainMode mode, + GainMode gainMode, float digGain, float normalise, float varVariance); diff --git a/src/MemlessPoly.cpp b/src/MemlessPoly.cpp index f223d34..ae097c9 100644 --- a/src/MemlessPoly.cpp +++ b/src/MemlessPoly.cpp @@ -38,7 +38,7 @@ #include <stdio.h> #include <stdexcept> - +#include <string> #include <future> #include <array> #include <iostream> @@ -370,9 +370,6 @@ int MemlessPoly::internal_process(Buffer* const dataIn, Buffer* dataOut) void MemlessPoly::set_parameter(const string& parameter, const string& value) { - stringstream ss(value); - ss.exceptions ( stringstream::failbit | stringstream::badbit ); - if (parameter == "ncoefs") { throw ParameterError("Parameter 'ncoefs' is read-only"); } diff --git a/src/OfdmGenerator.cpp b/src/OfdmGenerator.cpp index a6609a3..915d568 100644 --- a/src/OfdmGenerator.cpp +++ b/src/OfdmGenerator.cpp @@ -230,9 +230,9 @@ int OfdmGenerator::process(Buffer* const dataIn, Buffer* dataOut) */ double sum_iq = 0; double sum_delta = 0; - for (size_t i = 0; i < mySpacing; i++) { - sum_iq += (double)std::norm(before_cfr[i]); - sum_delta += (double)std::norm(symbol[i] - before_cfr[i]); + for (size_t j = 0; j < mySpacing; j++) { + sum_iq += (double)std::norm(before_cfr[j]); + sum_delta += (double)std::norm(symbol[j] - before_cfr[j]); } // Clamp to 90dB, otherwise the MER average is going to be inf @@ -362,10 +362,10 @@ void OfdmGenerator::set_parameter(const std::string& parameter, throw ParameterError("Parameter 'clip_stats' is read-only"); } else { - stringstream ss; - ss << "Parameter '" << parameter + stringstream ss_err; + ss_err << "Parameter '" << parameter << "' is not exported by controllable " << get_rc_name(); - throw ParameterError(ss.str()); + throw ParameterError(ss_err.str()); } } diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp index e2616a6..b533075 100644 --- a/src/OutputUHD.cpp +++ b/src/OutputUHD.cpp @@ -472,7 +472,7 @@ int OutputUHD::process(Buffer* dataIn) myUsrp, myConf.dpdFeedbackServerPort, myConf.sampleRate); } - size_t num_frames = frames.push_wait_if_full(frame, + size_t num_frames = m_frames.push_wait_if_full(frame, FRAMES_MAX_SIZE); etiLog.log(trace, "UHD,push %zu", num_frames); } @@ -686,7 +686,7 @@ void OutputUHD::workerthread() struct UHDWorkerFrameData frame; etiLog.log(trace, "UHD,wait"); - frames.wait_and_pop(frame, pop_prebuffering); + m_frames.wait_and_pop(frame, pop_prebuffering); etiLog.log(trace, "UHD,pop"); handle_frame(&frame); @@ -989,10 +989,10 @@ void OutputUHD::set_parameter(const string& parameter, const string& value) throw ParameterError("Parameter " + parameter + " is read-only."); } else { - stringstream ss; - ss << "Parameter '" << parameter + stringstream ss_err; + ss_err << "Parameter '" << parameter << "' is not exported by controllable " << get_rc_name(); - throw ParameterError(ss.str()); + throw ParameterError(ss_err.str()); } } diff --git a/src/OutputUHD.h b/src/OutputUHD.h index 0630480..9213183 100644 --- a/src/OutputUHD.h +++ b/src/OutputUHD.h @@ -211,7 +211,7 @@ class OutputUHD: public ModOutput, public RemoteControllable { bool sync_and_ts_valid = false; - ThreadsafeQueue<UHDWorkerFrameData> frames; + ThreadsafeQueue<UHDWorkerFrameData> m_frames; // Returns true if we want to verify loss of refclk bool refclk_loss_needs_check(void) const; diff --git a/src/PrbsGenerator.cpp b/src/PrbsGenerator.cpp index 69d6af4..b159bd3 100644 --- a/src/PrbsGenerator.cpp +++ b/src/PrbsGenerator.cpp @@ -22,9 +22,10 @@ #include "PrbsGenerator.h" #include "PcDebug.h" +#include <stdexcept> +#include <string> #include <stdio.h> #include <stdlib.h> -#include <stdexcept> PrbsGenerator::PrbsGenerator(size_t framesize, uint32_t polynomial, @@ -178,8 +179,8 @@ int PrbsGenerator::process( throw std::runtime_error("PrbsGenerator::process " "input size is not equal to output size!\n"); } - for (size_t i = 0; i < dataOut[0]->getLength(); ++i) { - out[i] ^= in[i]; + for (size_t j = 0; j < dataOut[0]->getLength(); ++j) { + out[j] ^= in[j]; } } diff --git a/src/PuncturingEncoder.cpp b/src/PuncturingEncoder.cpp index 9bd9004..de4319b 100644 --- a/src/PuncturingEncoder.cpp +++ b/src/PuncturingEncoder.cpp @@ -27,6 +27,7 @@ #include "PuncturingEncoder.h" #include "PcDebug.h" +#include <string> #include <stdio.h> #include <stdexcept> #include <stdint.h> diff --git a/src/RemoteControl.cpp b/src/RemoteControl.cpp index ceae942..a050278 100644 --- a/src/RemoteControl.cpp +++ b/src/RemoteControl.cpp @@ -422,11 +422,11 @@ void RemoteControllerZmq::process() std::string msg_s = ss.str(); - zmq::message_t msg(ss.str().size()); - memcpy ((void*) msg.data(), msg_s.data(), msg_s.size()); + zmq::message_t zmsg(ss.str().size()); + memcpy ((void*) zmsg.data(), msg_s.data(), msg_s.size()); int flag = (--cohort_size > 0) ? ZMQ_SNDMORE : 0; - repSocket.send(msg, flag); + repSocket.send(zmsg, flag); } } else if (msg.size() == 2 && command == "show") { @@ -437,11 +437,11 @@ void RemoteControllerZmq::process() for (auto ¶m_val : r) { std::stringstream ss; ss << param_val[0] << ": " << param_val[1] << endl; - zmq::message_t msg(ss.str().size()); - memcpy(msg.data(), ss.str().data(), ss.str().size()); + zmq::message_t zmsg(ss.str().size()); + memcpy(zmsg.data(), ss.str().data(), ss.str().size()); int flag = (--r_size > 0) ? ZMQ_SNDMORE : 0; - repSocket.send(msg, flag); + repSocket.send(zmsg, flag); } } catch (ParameterError &e) { @@ -454,9 +454,9 @@ void RemoteControllerZmq::process() try { std::string value = rcs.get_param(module, parameter); - zmq::message_t msg(value.size()); - memcpy ((void*) msg.data(), value.data(), value.size()); - repSocket.send(msg, 0); + zmq::message_t zmsg(value.size()); + memcpy ((void*) zmsg.data(), value.data(), value.size()); + repSocket.send(zmsg, 0); } catch (ParameterError &err) { send_fail_reply(repSocket, err.what()); diff --git a/src/Resampler.cpp b/src/Resampler.cpp index 2be753e..42951c5 100644 --- a/src/Resampler.cpp +++ b/src/Resampler.cpp @@ -27,10 +27,11 @@ #include "Resampler.h" #include "PcDebug.h" +#include <string> +#include <stdexcept> #include <stdlib.h> #include <sys/types.h> #include <string.h> -#include <stdexcept> #include <assert.h> #define FFT_REAL(x) x[0] diff --git a/src/Socket.h b/src/Socket.h index f6a023d..39554ca 100644 --- a/src/Socket.h +++ b/src/Socket.h @@ -37,6 +37,7 @@ DESCRIPTION: #include <unistd.h> #include <cstdint> #include <stdexcept> +#include <string> #include <sys/socket.h> #include <netinet/ip.h> #include <errno.h> diff --git a/src/SubchannelSource.cpp b/src/SubchannelSource.cpp index 2a8dc37..b4d6750 100644 --- a/src/SubchannelSource.cpp +++ b/src/SubchannelSource.cpp @@ -28,6 +28,7 @@ #include "PcDebug.h" #include "Log.h" +#include <string> #include <stdexcept> #include <sys/types.h> #include <stdlib.h> diff --git a/src/TII.cpp b/src/TII.cpp index a30d7f6..af64c9f 100644 --- a/src/TII.cpp +++ b/src/TII.cpp @@ -350,10 +350,10 @@ void TII::set_parameter(const std::string& parameter, const std::string& value) ss >> m_conf.old_variant; } else { - stringstream ss; - ss << "Parameter '" << parameter << + stringstream ss_err; + ss_err << "Parameter '" << parameter << "' is not exported by controllable " << get_rc_name(); - throw ParameterError(ss.str()); + throw ParameterError(ss_err.str()); } } diff --git a/src/TimeInterleaver.cpp b/src/TimeInterleaver.cpp index 3bf6339..7e19af8 100644 --- a/src/TimeInterleaver.cpp +++ b/src/TimeInterleaver.cpp @@ -23,6 +23,7 @@ #include "PcDebug.h" #include <vector> +#include <string> #include <stdint.h> diff --git a/src/TimestampDecoder.cpp b/src/TimestampDecoder.cpp index ddd3fb7..26deb60 100644 --- a/src/TimestampDecoder.cpp +++ b/src/TimestampDecoder.cpp @@ -228,10 +228,10 @@ void TimestampDecoder::set_parameter( throw ParameterError("timestamp is read-only"); } else { - stringstream ss; - ss << "Parameter '" << parameter + stringstream ss_err; + ss_err << "Parameter '" << parameter << "' is not exported by controllable " << get_rc_name(); - throw ParameterError(ss.str()); + throw ParameterError(ss_err.str()); } } |