Skip to content

Commit

Permalink
Fix PR#12652 comments
Browse files Browse the repository at this point in the history
  • Loading branch information
OhadMeir committed Feb 12, 2024
1 parent c151827 commit 615e36f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
12 changes: 10 additions & 2 deletions src/fw-logs/fw-string-formatter.cpp
Original file line number Diff line number Diff line change
@@ -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 <rsutils/easylogging/easyloggingpp.h>

#include <regex>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <cmath>

using namespace std;

Expand Down Expand Up @@ -56,7 +60,11 @@ namespace librealsense

st_regular_exp[2] << "\\{\\b(" << i << "):f\\}";
regular_exp[2] = st_regular_exp[2].str();
st_replacement[2] << *reinterpret_cast< const float * >( &params[i] ); // Parse as 4 raw bytes of float
// Parse int32_t as 4 raw bytes of float
float tmp = *reinterpret_cast< const float * >( &params[i] );
if( ! std::isfinite( tmp ) )
LOG_ERROR( "Expecting a number, received infinite or NaN" );
st_replacement[2] << tmp;
replacement[2] = st_replacement[2].str();
exp_replace_map[regular_exp[2]] = replacement[2];

Expand Down
2 changes: 1 addition & 1 deletion src/option.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand Down

0 comments on commit 615e36f

Please sign in to comment.