Cppcheck cleanup - #11397
Conversation
4502d27 to
8a362bf
Compare
025341b to
decb545
Compare
| k &= stbi__bmask[n]; | ||
| j->code_bits -= n; | ||
| return k + (stbi__jbias[n] & ~sgn); | ||
| return k + (stbi__jbias[n] & (sgn - 1)); |
There was a problem hiding this comment.
Nice trick using -1 instead of ~
There was a problem hiding this comment.
this is fixed issue in original source
nothings/stb@0260135
OhadMeir
left a comment
There was a problem hiding this comment.
Nice work.
Getting rid of the cppcheck errors is helpful and the code logic is not always easy to follow...
decb545 to
be54117
Compare
|
We left with E danglingLifetime third-party/rsutils/include/rsutils/concurrency/concurrency.h+54 Non-local variable '_queue' will use object that points to local variable 'q'. E danglingLifetime third-party/rsutils/include/rsutils/concurrency/concurrency.h+55 Non-local variable '_queue' will use object that points to local variable 'q'.` |
| dev.as<rs2::auto_calibrated_device>().reset_to_factory_calibration(); | ||
| _calibration = dev.as<rs2::auto_calibrated_device>().get_calibration_table(); | ||
| _original = _calibration; | ||
| table = (librealsense::ds::coefficients_table*)_calibration.data(); |
There was a problem hiding this comment.
Please avoid the c-style casting, and use cpp style (static_cast or reinterpret_cast)
| dev.as<rs2::auto_calibrated_device>().set_calibration_table(_calibration); | ||
| dev.as<rs2::auto_calibrated_device>().write_calibration(); | ||
| _original = _calibration; | ||
| orig_table = (librealsense::ds::coefficients_table*)_original.data(); |
| std::string& error_message) | ||
| { | ||
| option_model option; | ||
| option_model option = {}; |
There was a problem hiding this comment.
Why is it better than before?
There was a problem hiding this comment.
According to Ohad research looks like this zeros all native members
|
|
||
| if (host_assistance == host_assistance_type::no_assistance || host_assistance == host_assistance_type::assistance_start) | ||
| _hw_monitor->send(command{ ds::AUTO_CALIB, focal_length_calib_begin, fl_step_count, fy_scan_range, p4 }); | ||
| _hw_monitor->send(command{ ds::AUTO_CALIB, focal_length_calib_begin, (uint32_t)fl_step_count, (uint32_t)fy_scan_range, p4 }); |
There was a problem hiding this comment.
please use static_cast here
| if (host_assistance == host_assistance_type::no_assistance || host_assistance == host_assistance_type::assistance_start) | ||
| { | ||
| _hw_monitor->send(command{ ds::AUTO_CALIB, py_rx_plus_fl_calib_begin, speed_fl, 0, p4 }); | ||
| _hw_monitor->send(command{ ds::AUTO_CALIB, py_rx_plus_fl_calib_begin, (uint32_t)speed_fl, 0, p4 }); |
| { | ||
| LOG_OCC_WARN("run_tare_calibration interactive control (2) with parameters: depth = " << depth); | ||
| _hw_monitor->send(command{ ds::AUTO_CALIB, interactive_scan_control, 2, depth }); | ||
| _hw_monitor->send(command{ ds::AUTO_CALIB, interactive_scan_control, 2, (uint32_t)depth }); |
| check_tare_params(speed, scan_parameter, data_sampling, average_step_count, step_count, accuracy); | ||
|
|
||
| auto param2 = (int)ground_truth_mm * 100; | ||
| auto param2 = (uint32_t)ground_truth_mm * 100; |
| } | ||
|
|
||
| _hw_monitor->send(command{ AMCSET, _type, (int)value }); | ||
| _hw_monitor->send(command{ AMCSET, (uint32_t)_type, (uint32_t)value }); |
| _type, | ||
| l500_command::get_default, | ||
| (int)query_sensor_mode( *_resolution ) }, | ||
| (uint32_t)query_sensor_mode( *_resolution ) }, |
d6f1184 to
f7b7913
Compare
E shiftTooManyBitsSigned third-party/stb_image.h+1647 Shifting signed 32-bit value by 31 bits is undefined behaviour Use an equivalent formulation that has sgn=0 or 1, not 0 or -1. This avoids right-shifting signed values, at least in this place. Fixes issue realsenseai#1061. nothings/stb@0260135 Signed-off-by: Dmitry Perchanov <dmitry.perchanov@intel.com>
E uninitvar src/l500/l500-color.cpp+265 Uninitialized variable: intrinsics.model Signed-off-by: Dmitry Perchanov <dmitry.perchanov@intel.com>
E uninitvar common/model-views.cpp+554 Uninitialized variables: option.unset_value, option.have_unset_value, option.read_only, option.edit_mode Signed-off-by: Dmitry Perchanov <dmitry.perchanov@intel.com>
cppcheck: E integerOverflow src/l500/l500-depth.cpp+322 Signed integer overflow for expression 'baseline_address+4'. E integerOverflow src/l500/l500-device.cpp+321 Signed integer overflow for expression 'ivcam2::REGISTER_CLOCK_0+4'. l500: l500-options: msvc fix for narrowing conversion Signed-off-by: Dmitry Perchanov <dmitry.perchanov@intel.com>
E invalidContainer common/calibration-model.cpp+350 Using pointer to member variable '_calibration' that may be invalid. E invalidContainer common/calibration-model.cpp+350 Using pointer to member variable '_original' that may be invalid. Signed-off-by: Dmitry Perchanov <dmitry.perchanov@intel.com>
Signed-off-by: Dmitry Perchanov <dmitry.perchanov@intel.com>
| table = (librealsense::ds::coefficients_table*)_calibration.data(); | ||
| orig_table = (librealsense::ds::coefficients_table*)_original.data(); | ||
| table = reinterpret_cast<librealsense::ds::coefficients_table*>(_calibration.data()); | ||
| orig_table = reinterpret_cast<librealsense::ds::coefficients_table*> (_original.data()); |
There was a problem hiding this comment.
Please run formatting on changed lines
1cac4f7 to
de67617
Compare
| // 5. Restore the current value | ||
| auto current = query_current( query_sensor_mode( *_resolution ) ); | ||
| _hw_monitor->send( command{ AMCSET, _type, -1 } ); | ||
| _hw_monitor->send( command{ AMCSET, _type, static_cast< uint32_t >( -1 ) } ); |
There was a problem hiding this comment.
This will result to UINT_MAX as input (not -1) - is it ok here?
Fix CppCheck errors: