diff --git a/src/fw-logs/fw-string-formatter.cpp b/src/fw-logs/fw-string-formatter.cpp index 722a25d639..0946ebb385 100644 --- a/src/fw-logs/fw-string-formatter.cpp +++ b/src/fw-logs/fw-string-formatter.cpp @@ -1,11 +1,15 @@ // License: Apache 2.0. See LICENSE file in root directory. -// Copyright(c) 2019 Intel Corporation. All Rights Reserved. +// Copyright(c) 2024 Intel Corporation. All Rights Reserved. + #include "fw-string-formatter.h" #include "fw-logs-formating-options.h" +#include + #include #include #include #include +#include using namespace std; @@ -56,7 +60,15 @@ namespace librealsense st_regular_exp[2] << "\\{\\b(" << i << "):f\\}"; regular_exp[2] = st_regular_exp[2].str(); - st_replacement[2] << params[i]; + // Parse int32_t as 4 raw bytes of float + float tmp = *reinterpret_cast< const float * >( ¶ms[i] ); + if( std::isfinite( tmp ) ) + st_replacement[2] << tmp; + else + { + LOG_ERROR( "Expecting a number, received infinite or NaN" ); + st_replacement[2] << "0x" << hex << setw( 2 ) << setfill( '0' ) << params[i]; + } replacement[2] = st_replacement[2].str(); exp_replace_map[regular_exp[2]] = replacement[2]; diff --git a/src/option.cpp b/src/option.cpp index c27e7cf0d6..800b3b7cfe 100644 --- a/src/option.cpp +++ b/src/option.cpp @@ -108,7 +108,7 @@ void gated_by_value_option::set( float requested_option_value ) auto wanted_gate_value = std::get< 1 >( gate ); auto current_gate_value = gating_option->query(); if( current_gate_value != wanted_gate_value ) - throw std::runtime_error( std::get< 2 >( gate ) ); + throw librealsense::invalid_value_exception( std::get< 2 >( gate ) ); } _proxy->set( requested_option_value );