From: Soeren Apel Date: Sun, 21 Oct 2018 19:22:01 +0000 (+0200) Subject: Fix clazy warnings regarding range-for references X-Git-Url: http://git.code-monkey.de/?p=pulseview.git;a=commitdiff_plain;h=f4ab4b5c657e5613caba82feaa81a8a400e4f331 Fix clazy warnings regarding range-for references The warnings that are fixed are of this type: warning: Missing reference in range-for with non trivial type (std::__cxx11::string) [-Wclazy-range-loop] --- diff --git a/main.cpp b/main.cpp index 4bd6388..455d7af 100644 --- a/main.cpp +++ b/main.cpp @@ -316,7 +316,7 @@ int main(int argc, char *argv[]) if (open_files.empty()) w.add_default_session(); else - for (string open_file : open_files) + for (string& open_file : open_files) w.add_session_with_file(open_file, open_file_format); #ifdef ENABLE_SIGNALS diff --git a/pv/application.cpp b/pv/application.cpp index f588fa3..5a6e28a 100644 --- a/pv/application.cpp +++ b/pv/application.cpp @@ -127,17 +127,17 @@ void Application::collect_version_info(shared_ptr context) #endif // Device drivers - for (auto entry : context->drivers()) + for (auto& entry : context->drivers()) driver_list_.emplace_back(QString::fromUtf8(entry.first.c_str()), QString::fromUtf8(entry.second->long_name().c_str())); // Input formats - for (auto entry : context->input_formats()) + for (auto& entry : context->input_formats()) input_format_list_.emplace_back(QString::fromUtf8(entry.first.c_str()), QString::fromUtf8(entry.second->description().c_str())); // Output formats - for (auto entry : context->output_formats()) + for (auto& entry : context->output_formats()) output_format_list_.emplace_back(QString::fromUtf8(entry.first.c_str()), QString::fromUtf8(entry.second->description().c_str())); @@ -159,35 +159,35 @@ void Application::print_version_info() cout << PV_TITLE << " " << PV_VERSION_STRING << endl; cout << endl << "Libraries and features:" << endl; - for (pair &entry : version_info_) + for (pair& entry : version_info_) cout << " " << entry.first.toStdString() << " " << entry.second.toStdString() << endl; cout << endl << "Firmware search paths:" << endl; - for (QString &entry : fw_path_list_) + for (QString& entry : fw_path_list_) cout << " " << entry.toStdString() << endl; cout << endl << "Protocol decoder search paths:" << endl; - for (QString &entry : pd_path_list_) + for (QString& entry : pd_path_list_) cout << " " << entry.toStdString() << endl; cout << endl << "Supported hardware drivers:" << endl; - for (pair &entry : driver_list_) + for (pair& entry : driver_list_) cout << " " << entry.first.leftJustified(21, ' ').toStdString() << entry.second.toStdString() << endl; cout << endl << "Supported input formats:" << endl; - for (pair &entry : input_format_list_) + for (pair& entry : input_format_list_) cout << " " << entry.first.leftJustified(21, ' ').toStdString() << entry.second.toStdString() << endl; cout << endl << "Supported output formats:" << endl; - for (pair &entry : output_format_list_) + for (pair& entry : output_format_list_) cout << " " << entry.first.leftJustified(21, ' ').toStdString() << entry.second.toStdString() << endl; #ifdef ENABLE_DECODE cout << endl << "Supported protocol decoders:" << endl; - for (pair &entry : pd_list_) + for (pair& entry : pd_list_) cout << " " << entry.first.leftJustified(21, ' ').toStdString() << entry.second.toStdString() << endl; #endif diff --git a/pv/binding/inputoutput.cpp b/pv/binding/inputoutput.cpp index 0d9b2d0..f9a061c 100644 --- a/pv/binding/inputoutput.cpp +++ b/pv/binding/inputoutput.cpp @@ -59,7 +59,7 @@ namespace binding { InputOutput::InputOutput( const map> &options) { - for (pair> o : options) { + for (const pair>& o : options) { const shared_ptr