Skip to content

Commit d993c57

Browse files
authored
Merge pull request #820 from fridrich/next
Some C++ fixes so that the build is less noisy
2 parents 524cfaf + 47566c6 commit d993c57

File tree

10 files changed

+63
-63
lines changed

10 files changed

+63
-63
lines changed

src/backend/fib-processor.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,14 +457,14 @@ int16_t FIBProcessor::HandleFIG0Extension8(
457457

458458
uint8_t lsFlag = getBits_1(d, lOffset);
459459
if (lsFlag == 1) {
460-
int16_t SCid = getBits(d, lOffset + 4, 12);
460+
/* int16_t SCid = */ getBits(d, lOffset + 4, 12);
461461
lOffset += 16;
462462
// if (findPacketComponent ((SCIds << 4) | SCid) != NULL) {
463463
// std::clog << "fib-processor:" << "packet component bestaat !!\n") << std::endl;
464464
// }
465465
}
466466
else {
467-
int16_t SubChId = getBits_6(d, lOffset + 4);
467+
/* int16_t SubChId = */ getBits_6(d, lOffset + 4);
468468
lOffset += 8;
469469
}
470470

src/input/rtl_tcp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ void CRTL_TCP_Client::networkBufferCopy()
515515

516516
if(getMyTime() - oldTime_us > 500e3) { // 500 ms
517517

518-
float bufferFill = (float) sampleNetworkBuffer.GetRingBufferReadAvailable() / sampleNetworkBuffer.GetBufferSize() * 100;
518+
// float bufferFill = (float) sampleNetworkBuffer.GetRingBufferReadAvailable() / sampleNetworkBuffer.GetBufferSize() * 100;
519519
//std::clog << "RTL_TCP_CLIENT: Network buffer fill level " << bufferFill << "%" << std::endl;
520520

521521
oldTime_us = getMyTime();

src/libs/json.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2994,7 +2994,7 @@ class lexer
29942994
std::string result;
29952995
for (const auto c : token_string)
29962996
{
2997-
if ('\x00' <= c and c <= '\x1F')
2997+
if ('\x00' <= (signed char)c and c <= '\x1F')
29982998
{
29992999
// escape control characters
30003000
std::stringstream ss;

src/various/channels.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ string Channels::getChannelNameAtIndex(int index)
226226

227227
std::string Channels::getChannelForFrequency(int frequency)
228228
{
229-
for (const auto c_f : frequencyMap) {
229+
for (const auto& c_f : frequencyMap) {
230230
if (c_f.second == frequency) {
231231
return c_f.first;
232232
}

src/welle-cli/tests.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ void Tests::test_with_noise_iteration(double stddev)
260260
while (not service_selected) {
261261
this_thread::sleep_for(chrono::seconds(1));
262262

263-
for (const auto s : rx.getServiceList()) {
263+
for (const auto& s : rx.getServiceList()) {
264264
if (rx.playSingleProgramme(tph, dumpFileName, s) == false) {
265265
cerr << "Tune to " << s.serviceLabel.utf8_label() << " failed" << endl;
266266
}
@@ -330,7 +330,7 @@ void Tests::test_multipath(int test_id)
330330
while (not service_selected) {
331331
this_thread::sleep_for(chrono::seconds(1));
332332

333-
for (const auto s : rx.getServiceList()) {
333+
for (const auto& s : rx.getServiceList()) {
334334
if (rx.playSingleProgramme(tph, dumpFileName, s) == false) {
335335
cerr << "Tune to " << s.serviceLabel.utf8_label() << " failed" << endl;
336336
}
@@ -357,12 +357,12 @@ void Tests::test_multipath(int test_id)
357357
fprintf(fd, "fname,ofdmthreshold,with_coarse,num_syncs,num_desyncs,time_to_first_sync,frameerrors,aacerrors,rserrors\n");
358358
}
359359

360-
fprintf(fd, "%s,%s,%d,%zu,%zu,%ld,%d,%d,%d\n",
360+
fprintf(fd, "%s,%s,%d,%zu,%zu,%lld,%d,%d,%d\n",
361361
intf.getFileName().c_str(),
362362
fftPlacementMethodToString(rro.fftPlacementMethod),
363363
rro.disableCoarseCorrector ? 0 : 1,
364364
ri.num_syncs, ri.num_desyncs,
365-
chrono::duration_cast<chrono::milliseconds>(start_time-ri.first_sync_time).count(),
365+
static_cast<long long>(chrono::duration_cast<chrono::milliseconds>(start_time-ri.first_sync_time).count()),
366366
std::accumulate(tph.frameErrorStats.begin(), tph.frameErrorStats.end(), 0),
367367
std::accumulate(tph.aacErrorStats.begin(), tph.aacErrorStats.end(), 0),
368368
std::accumulate(tph.rsErrorStats.begin(), tph.rsErrorStats.end(), 0));

src/welle-cli/webprogrammehandler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ class FlacEncoder : protected FLAC::Encoder::Stream, public IEncoder
8080
return FLAC::Encoder::Stream::process_interleaved(pcm_32.data(), pcm_32.size()/channels);
8181
}
8282

83-
FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t samples, uint32_t current_frame) override
83+
FLAC__StreamEncoderWriteStatus write_callback(const FLAC__byte buffer[], size_t bytes, uint32_t /* samples */, uint32_t /* current_frame */) override
8484
{
8585
if (!streamHeaderInitialised)
8686
{

src/welle-cli/webradiointerface.cpp

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ static const char* http_nocache = "Cache-Control: no-cache\r\n";
109109

110110
static string to_hex(uint32_t value, int width)
111111
{
112-
std::stringstream sidstream;
112+
stringstream sidstream;
113113
sidstream << "0x" <<
114-
std::setfill('0') << std::setw(width) <<
115-
std::hex << value;
114+
setfill('0') << setw(width) <<
115+
hex << value;
116116
return sidstream.str();
117117
}
118118

@@ -191,7 +191,7 @@ void WebRadioInterface::check_decoders_required()
191191
const auto sid = s.serviceId;
192192

193193
try {
194-
const bool is_active = std::find_if(
194+
const bool is_active = find_if(
195195
carousel_services_active.cbegin(),
196196
carousel_services_active.cend(),
197197
[&](const ActiveCarouselService& acs) {
@@ -244,7 +244,7 @@ void WebRadioInterface::check_decoders_required()
244244
phs_changed.notify_all();
245245
}
246246

247-
void WebRadioInterface::retune(const std::string& channel)
247+
void WebRadioInterface::retune(const string& channel)
248248
{
249249
// Ensure two closely occurring retune() calls don't get stuck
250250
unique_lock<mutex> retune_lock(retune_mut);
@@ -423,7 +423,7 @@ static http_request_t parse_http_headers(Socket& s) {
423423
constexpr auto CL = "Content-Length";
424424
if (r.headers.count(CL) == 1) {
425425
try {
426-
const int content_length = std::stoi(r.headers[CL]);
426+
const int content_length = stoi(r.headers[CL]);
427427
if (content_length > 1024 * 1024) {
428428
cerr << "Unreasonable POST Content-Length: " << content_length << endl;
429429
return r;
@@ -503,14 +503,14 @@ bool WebRadioInterface::dispatch_client(Socket&& client)
503503
else {
504504
bool url_handled = false;
505505
const regex regex_slide(R"(^[/]slide[/]([^ ]+))");
506-
std::smatch match_slide;
506+
smatch match_slide;
507507
if (regex_search(req.url, match_slide, regex_slide)) {
508508
success = send_slide(s, match_slide[1]);
509509
url_handled = true;
510510
}
511511

512512
const regex regex_stream(R"(^[/]stream[/]([^ ]+))");
513-
std::smatch match_stream;
513+
smatch match_stream;
514514
if (regex_search(req.url, match_stream, regex_stream)) {
515515
success = send_stream(s, match_stream[1]);
516516
url_handled = true;
@@ -519,7 +519,7 @@ bool WebRadioInterface::dispatch_client(Socket&& client)
519519
if (decode_settings.outputCodec == OutputCodec::MP3)
520520
{
521521
const regex regex_mp3(R"(^[/]mp3[/]([^ ]+))");
522-
std::smatch match_mp3;
522+
smatch match_mp3;
523523
if (regex_search(req.url, match_mp3, regex_mp3)) {
524524
success = send_stream(s, match_mp3[1]);
525525
url_handled = true;
@@ -529,7 +529,7 @@ bool WebRadioInterface::dispatch_client(Socket&& client)
529529
if (decode_settings.outputCodec == OutputCodec::FLAC)
530530
{
531531
const regex regex_flac(R"(^[/]flac[/]([^ ]+))");
532-
std::smatch match_flac;
532+
smatch match_flac;
533533
if (regex_search(req.url, match_flac, regex_flac)) {
534534
success = send_stream(s, match_flac[1]);
535535
url_handled = true;
@@ -568,10 +568,10 @@ bool WebRadioInterface::dispatch_client(Socket&& client)
568568
}
569569

570570
bool WebRadioInterface::send_file(Socket& s,
571-
const std::string& filename,
572-
const std::string& content_type)
571+
const string& filename,
572+
const string& content_type)
573573
{
574-
std::filesystem::path path_name;
574+
filesystem::path path_name;
575575
if (!base_dir.empty())
576576
{
577577
path_name = base_dir;
@@ -790,10 +790,10 @@ bool WebRadioInterface::send_mux_json(Socket& s)
790790
m.timestamp.time_since_epoch());
791791

792792
const auto s = duration_cast<seconds>(ms);
793-
const std::time_t t = s.count();
794-
const std::size_t fractional_seconds = ms.count() % 1000;
793+
const time_t t = s.count();
794+
const size_t fractional_seconds = ms.count() % 1000;
795795

796-
ss << std::ctime(&t) << "." << fractional_seconds;
796+
ss << ctime(&t) << "." << fractional_seconds;
797797

798798
switch (m.level) {
799799
case message_level_t::Information:
@@ -883,21 +883,21 @@ bool WebRadioInterface::send_mux_playlist(Socket& s)
883883
return true;
884884
}
885885

886-
bool WebRadioInterface::send_stream(Socket& s, const std::string& stream)
886+
bool WebRadioInterface::send_stream(Socket& s, const string& stream)
887887
{
888888
unique_lock<mutex> lock(rx_mut);
889889
ASSERT_RX;
890890

891891
for (const auto& srv : rx->getServiceList()) {
892892
if (rx->serviceHasAudioComponent(srv) and
893893
(to_hex(srv.serviceId, 4) == stream or
894-
(uint32_t)std::stoul(stream) == srv.serviceId)) {
894+
(uint32_t)stoul(stream) == srv.serviceId)) {
895895
try {
896896
auto& ph = phs.at(srv.serviceId);
897897

898898
lock.unlock();
899899

900-
std::string http_contenttype;
900+
string http_contenttype;
901901

902902
switch (decode_settings.outputCodec)
903903
{
@@ -941,11 +941,11 @@ bool WebRadioInterface::send_stream(Socket& s, const std::string& stream)
941941
return false;
942942
}
943943

944-
bool WebRadioInterface::send_slide(Socket& s, const std::string& stream)
944+
bool WebRadioInterface::send_slide(Socket& s, const string& stream)
945945
{
946946
for (const auto& wph : phs) {
947947
if (to_hex(wph.first, 4) == stream or
948-
(uint32_t)std::stoul(stream) == wph.first) {
948+
(uint32_t)stoul(stream) == wph.first) {
949949
const auto mot = wph.second.getMOT();
950950

951951
if (mot.data.empty()) {
@@ -973,8 +973,8 @@ bool WebRadioInterface::send_slide(Socket& s, const std::string& stream)
973973
headers << http_nocache;
974974

975975
headers << "Last-Modified: ";
976-
std::time_t t = chrono::system_clock::to_time_t(mot.time);
977-
headers << put_time(std::gmtime(&t), "%a, %d %b %Y %T GMT");
976+
time_t t = chrono::system_clock::to_time_t(mot.time);
977+
headers << put_time(gmtime(&t), "%a, %d %b %Y %T GMT");
978978
headers << "\r\n";
979979

980980
headers << "\r\n";
@@ -1027,7 +1027,7 @@ bool WebRadioInterface::send_impulseresponse(Socket& s)
10271027

10281028
lock_guard<mutex> lock(plotdata_mut);
10291029
vector<float> cir_db(last_CIR.size());
1030-
std::transform(last_CIR.begin(), last_CIR.end(), cir_db.begin(),
1030+
transform(last_CIR.begin(), last_CIR.end(), cir_db.begin(),
10311031
[](float y) { return 10.0f * log10(y); });
10321032

10331033
size_t lengthBytes = cir_db.size() * sizeof(float);
@@ -1078,7 +1078,7 @@ bool WebRadioInterface::send_spectrum(Socket& s)
10781078
if (samples.size() != (size_t)dabparams.T_u)
10791079
return false;
10801080

1081-
std::copy(samples.begin(), samples.end(), spectrumBuffer);
1081+
copy(samples.begin(), samples.end(), spectrumBuffer);
10821082

10831083
// Do FFT to get the spectrum
10841084
spectrum_fft_handler.do_FFT();
@@ -1112,13 +1112,13 @@ bool WebRadioInterface::send_constellation(Socket& s)
11121112
{
11131113
const size_t decim = OfdmDecoder::constellationDecimation;
11141114
const size_t num_iqpoints = (dabparams.L-1) * dabparams.K / decim;
1115-
std::vector<float> phases(num_iqpoints);
1115+
vector<float> phases(num_iqpoints);
11161116

11171117
lock_guard<mutex> lock(plotdata_mut);
11181118
if (last_constellation.size() == num_iqpoints) {
11191119
phases.resize(num_iqpoints);
11201120
for (size_t i = 0; i < num_iqpoints; i++) {
1121-
const float y = 180.0f / (float)M_PI * std::arg(last_constellation[i]);
1121+
const float y = 180.0f / (float)M_PI * arg(last_constellation[i]);
11221122
phases[i] = y;
11231123
}
11241124

@@ -1174,7 +1174,7 @@ bool WebRadioInterface::send_channel(Socket& s)
11741174
return true;
11751175
}
11761176

1177-
bool WebRadioInterface::handle_fft_window_placement_post(Socket& s, const std::string& fft_window_placement)
1177+
bool WebRadioInterface::handle_fft_window_placement_post(Socket& s, const string& fft_window_placement)
11781178
{
11791179
cerr << "POST fft window: " << fft_window_placement << endl;
11801180

@@ -1220,7 +1220,7 @@ bool WebRadioInterface::handle_fft_window_placement_post(Socket& s, const std::s
12201220
return true;
12211221
}
12221222

1223-
bool WebRadioInterface::handle_coarse_corrector_post(Socket& s, const std::string& coarseCorrector)
1223+
bool WebRadioInterface::handle_coarse_corrector_post(Socket& s, const string& coarseCorrector)
12241224
{
12251225
cerr << "POST coarse : " << coarseCorrector << endl;
12261226

@@ -1263,7 +1263,7 @@ bool WebRadioInterface::handle_coarse_corrector_post(Socket& s, const std::strin
12631263
return true;
12641264
}
12651265

1266-
bool WebRadioInterface::handle_channel_post(Socket& s, const std::string& channel)
1266+
bool WebRadioInterface::handle_channel_post(Socket& s, const string& channel)
12671267
{
12681268
cerr << "POST channel: " << channel << endl;
12691269

@@ -1294,7 +1294,7 @@ void WebRadioInterface::handle_phs()
12941294
for (auto& s : serviceList) {
12951295
auto scs = rx->getComponents(s);
12961296

1297-
if (std::find(
1297+
if (find(
12981298
carousel_services_available.cbegin(),
12991299
carousel_services_available.cend(),
13001300
s.serviceId) == carousel_services_available.cend()) {
@@ -1307,12 +1307,12 @@ void WebRadioInterface::handle_phs()
13071307

13081308
if (phs.count(s.serviceId) == 0) {
13091309
WebProgrammeHandler ph(s.serviceId, decode_settings.outputCodec);
1310-
phs.emplace(std::make_pair(s.serviceId, move(ph)));
1310+
phs.emplace(make_pair(s.serviceId, move(ph)));
13111311
}
13121312
}
13131313

13141314
using namespace chrono;
1315-
size_t max_services_in_carousel = std::min(
1315+
size_t max_services_in_carousel = min(
13161316
carousel_services_available.size(),
13171317
(size_t)decode_settings.num_decoders_in_carousel);
13181318

@@ -1554,34 +1554,34 @@ void WebRadioInterface::onFIBDecodeSuccess(bool crcCheckOk, const uint8_t* fib)
15541554
new_fib_block_available.notify_one();
15551555
}
15561556

1557-
void WebRadioInterface::onNewImpulseResponse(std::vector<float>&& data)
1557+
void WebRadioInterface::onNewImpulseResponse(vector<float>&& data)
15581558
{
15591559
lock_guard<mutex> lock(plotdata_mut);
15601560
last_CIR = move(data);
15611561
}
15621562

1563-
void WebRadioInterface::onNewNullSymbol(std::vector<DSPCOMPLEX>&& data)
1563+
void WebRadioInterface::onNewNullSymbol(vector<DSPCOMPLEX>&& data)
15641564
{
15651565
lock_guard<mutex> lock(plotdata_mut);
15661566
last_NULL = move(data);
15671567
}
15681568

1569-
void WebRadioInterface::onConstellationPoints(std::vector<DSPCOMPLEX>&& data)
1569+
void WebRadioInterface::onConstellationPoints(vector<DSPCOMPLEX>&& data)
15701570
{
15711571
lock_guard<mutex> lock(plotdata_mut);
15721572
last_constellation = move(data);
15731573
}
15741574

1575-
void WebRadioInterface::onMessage(message_level_t level, const std::string& text, const std::string& text2)
1575+
void WebRadioInterface::onMessage(message_level_t level, const string& text, const string& text2)
15761576
{
1577-
std::string fullText;
1577+
string fullText;
15781578
if (text2.empty())
15791579
fullText = text;
15801580
else
15811581
fullText = text + text2;
15821582

15831583
lock_guard<mutex> lock(data_mut);
1584-
const auto now = std::chrono::system_clock::now();
1584+
const auto now = chrono::system_clock::now();
15851585
pending_message_t m = { .level = level, .text = fullText, .timestamp = now};
15861586
pending_messages.emplace_back(move(m));
15871587

@@ -1603,7 +1603,7 @@ void WebRadioInterface::onTIIMeasurement(tii_measurement_t&& m)
16031603

16041604
void WebRadioInterface::onInputFailure()
16051605
{
1606-
std::exit(1);
1606+
exit(1);
16071607
}
16081608

16091609
list<tii_measurement_t> WebRadioInterface::getTiiStats()
@@ -1634,7 +1634,7 @@ list<tii_measurement_t> WebRadioInterface::getTiiStats()
16341634
avg.error = error / len;
16351635

16361636
// Calculate the median
1637-
std::nth_element(delays.begin(), delays.begin() + len/2, delays.end());
1637+
nth_element(delays.begin(), delays.begin() + len/2, delays.end());
16381638
avg.delay_samples = delays[len/2];
16391639
}
16401640
else {
@@ -1645,7 +1645,7 @@ list<tii_measurement_t> WebRadioInterface::getTiiStats()
16451645
l.push_back(move(avg));
16461646
}
16471647

1648-
using namespace std::chrono;
1648+
using namespace chrono;
16491649
const auto now = steady_clock::now();
16501650
// Remove a single entry every second to make the flukes
16511651
// disappear

0 commit comments

Comments
 (0)