From 471e7ee279d633a7b48e73ece42677574a74ad39 Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Sat, 29 Oct 2016 00:08:42 +0200 Subject: Modernize a few bits and pieces --- src/ConfigParser.cpp | 4 ++-- src/DabMultiplexer.cpp | 2 +- src/DabMux.cpp | 4 ++-- src/ManagementServer.cpp | 2 +- src/MuxElements.cpp | 10 +++++----- src/dabInputZmq.cpp | 4 ++-- 6 files changed, 13 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/ConfigParser.cpp b/src/ConfigParser.cpp index 93e6068..0ba1d78 100644 --- a/src/ConfigParser.cpp +++ b/src/ConfigParser.cpp @@ -393,7 +393,7 @@ void parse_ptree( ptree pt_subchans = pt.get_child("subchannels"); for (ptree::iterator it = pt_subchans.begin(); it != pt_subchans.end(); ++it) { string subchanuid = it->first; - DabSubchannel* subchan = new DabSubchannel(subchanuid); + auto subchan = new DabSubchannel(subchanuid); ensemble->subchannels.push_back(subchan); @@ -466,7 +466,7 @@ void parse_ptree( int packet_datagroup = pt_comp.get("datagroup", false); uint8_t component_type = hexparse(pt_comp.get("type", "0")); - DabComponent* component = new DabComponent(componentuid); + auto component = new DabComponent(componentuid); component->serviceId = service->id; component->subchId = subchannel->id; diff --git a/src/DabMultiplexer.cpp b/src/DabMultiplexer.cpp index c789763..4a3234e 100644 --- a/src/DabMultiplexer.cpp +++ b/src/DabMultiplexer.cpp @@ -773,7 +773,7 @@ void DabMultiplexer::mux_frame(std::vector >& outputs currentFrame++; } -void DabMultiplexer::print_info(void) +void DabMultiplexer::print_info() { // Print settings before starting etiLog.log(info, "--- Multiplex configuration ---"); diff --git a/src/DabMux.cpp b/src/DabMux.cpp index c962818..046b149 100644 --- a/src/DabMux.cpp +++ b/src/DabMux.cpp @@ -188,8 +188,8 @@ int main(int argc, char *argv[]) sa.sa_handler = &signalHandler; const int sigs[] = {SIGHUP, SIGQUIT, SIGINT, SIGTERM}; - for (int i = 0; i < 4; i++) { - if (sigaction(sigs[i], &sa, nullptr) == -1) { + for (int sig : sigs) { + if (sigaction(sig, &sa, nullptr) == -1) { perror("sigaction"); return EXIT_FAILURE; } diff --git a/src/ManagementServer.cpp b/src/ManagementServer.cpp index f946fd0..c44738a 100644 --- a/src/ManagementServer.cpp +++ b/src/ManagementServer.cpp @@ -339,7 +339,7 @@ std::string InputStat::encodeStateJSON() return ss.str(); } -input_state_t InputStat::determineState(void) +input_state_t InputStat::determineState() { boost::mutex::scoped_lock lock(m_mutex); diff --git a/src/MuxElements.cpp b/src/MuxElements.cpp index 773ec17..db59078 100644 --- a/src/MuxElements.cpp +++ b/src/MuxElements.cpp @@ -71,7 +71,7 @@ std::string AnnouncementCluster::tostring() const return ss.str(); } -bool AnnouncementCluster::is_active(void) +bool AnnouncementCluster::is_active() { if (m_deferred_start_time) { @@ -415,7 +415,7 @@ const string DabComponent::get_parameter(const string& parameter) const subchannel_type_t DabService::getType(std::shared_ptr ensemble) const { vector::iterator subchannel; - vector::iterator component = + auto component = getComponent(ensemble->components, id); if (component == ensemble->components.end()) { throw std::runtime_error("No component found for service"); @@ -647,17 +647,17 @@ unsigned short DabSubchannel::getSizeCu() const return 0; } -unsigned short DabSubchannel::getSizeByte(void) const +unsigned short DabSubchannel::getSizeByte() const { return bitrate * 3; } -unsigned short DabSubchannel::getSizeWord(void) const +unsigned short DabSubchannel::getSizeWord() const { return (bitrate * 3) >> 2; } -unsigned short DabSubchannel::getSizeDWord(void) const +unsigned short DabSubchannel::getSizeDWord() const { return (bitrate * 3) >> 3; } diff --git a/src/dabInputZmq.cpp b/src/dabInputZmq.cpp index 1591939..790a961 100644 --- a/src/dabInputZmq.cpp +++ b/src/dabInputZmq.cpp @@ -387,7 +387,7 @@ int DabInputZmqMPEG::readFromSocket(size_t framesize) } else if (m_enable_input) { // copy the input frame blockwise into the frame_buffer - uint8_t* framedata = new uint8_t[framesize]; + auto framedata = new uint8_t[framesize]; memcpy(framedata, data, framesize); m_frame_buffer.push_back(framedata); } @@ -467,7 +467,7 @@ int DabInputZmqAAC::readFromSocket(size_t framesize) for (uint8_t* framestart = data; framestart < &data[5*framesize]; framestart += framesize) { - uint8_t* audioframe = new uint8_t[framesize]; + auto audioframe = new uint8_t[framesize]; memcpy(audioframe, framestart, framesize); m_frame_buffer.push_back(audioframe); } -- cgit v1.2.3