Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Coverity issues #12210

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/ds/d400/d400-auto-calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1552,8 +1552,8 @@ namespace librealsense

std::shared_ptr<ds_advanced_mode_base> auto_calibrated::change_preset()
{
preset old_preset_values;
rs2_rs400_visual_preset old_preset;
preset old_preset_values{};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remind me the effect of it?
Without it , it will also call the default Ctor no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that this is a real issue, but I preferred to add this and not mark the issue as "not a bug" as I was already changing other issues in this file.

Reading the documentation, this issue is very confusing and have cyclic definitions. As I understand, preset is a struct so it will be "aggregate initialized". Each of its inner structs will be also "aggregate initialized" and the inner most fields "value initialized". Since they are native types they all should be initialized to static_cast( 0 ).

rs2_rs400_visual_preset old_preset = { RS2_RS400_VISUAL_PRESET_DEFAULT };

auto advanced_mode = dynamic_cast<ds_advanced_mode_base*>(this);
if (advanced_mode)
Expand Down Expand Up @@ -1882,7 +1882,7 @@ namespace librealsense
fy = intrin.fy;
}

std::array<float, 4> rec_sides_cur;
std::array< float, 4 > rec_sides_cur{};
rs2_extract_target_dimensions(f, RS2_CALIB_TARGET_ROI_RECT_GAUSSIAN_DOT_VERTICES, rec_sides_cur.data(), 4, &e);
if (e)
throw std::runtime_error("Failed to extract target information\nfrom the captured frames!");
Expand Down
4 changes: 2 additions & 2 deletions src/fw-logs/fw-log-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ namespace librealsense
class fw_log_data
{
public:
fw_log_data(void);
~fw_log_data(void);
fw_log_data();
~fw_log_data();

uint32_t _magic_number;
uint32_t _severity;
Expand Down
2 changes: 1 addition & 1 deletion src/linux/backend-v4l2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@ namespace librealsense
// Get DFU node for MIPI camera
vfd = open(dfu_device_path.c_str(), O_RDONLY | O_NONBLOCK);

if (vfd > 0) {
if (vfd >= 0) {
::close(vfd); // file exists, close file and continue to assign it
info.dfu_device_path = dfu_device_path;
}
Expand Down