From 436e79bef535c0de7f2787b3203b3096f216d246 Mon Sep 17 00:00:00 2001 From: Eran Date: Tue, 12 Mar 2024 09:02:51 +0200 Subject: [PATCH] fix coverity issues --- src/rs.cpp | 2 +- third-party/realdds/src/dds-option.cpp | 2 +- tools/fw-update/rs-fw-update.cpp | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rs.cpp b/src/rs.cpp index 382410b34cd..f24753145f0 100644 --- a/src/rs.cpp +++ b/src/rs.cpp @@ -1417,7 +1417,7 @@ HANDLE_EXCEPTIONS_AND_RETURN(nullptr, options, option, value) static void populate_options_list( rs2_options_list * updated_options_list, options_watcher::options_and_values const & updated_options ) { - for( auto id_value : updated_options ) + for( auto & id_value : updated_options ) { options_watcher::option_and_value const & option_and_value = id_value.second; updated_options_list->list.push_back( diff --git a/third-party/realdds/src/dds-option.cpp b/third-party/realdds/src/dds-option.cpp index e27415bae17..bcf6eecc07d 100644 --- a/third-party/realdds/src/dds-option.cpp +++ b/third-party/realdds/src/dds-option.cpp @@ -239,7 +239,7 @@ bool type_from_value( std::string & type, json const & j, json const & j2, Rest. static std::string parse_type( json const & j, size_t size, dds_option::option_properties & props ) { - for( auto p : props ) + for( auto & p : props ) { switch( p.length() ) { diff --git a/tools/fw-update/rs-fw-update.cpp b/tools/fw-update/rs-fw-update.cpp index 4e397e786f1..ae8098f9672 100644 --- a/tools/fw-update/rs-fw-update.cpp +++ b/tools/fw-update/rs-fw-update.cpp @@ -601,6 +601,11 @@ try return EXIT_SUCCESS; } +catch( const std::exception & e ) +{ + std::cerr << "-F- Unexpected exception: " << e.what() << std::endl; + return EXIT_FAILURE; +} catch (const rs2::error & e) { std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n " << e.what() << std::endl;