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

Fixes all warnings about uninitialized member variables in constructors (cppcheck) #305

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

luc-guyot-infomaniak
Copy link
Contributor

@luc-guyot-infomaniak luc-guyot-infomaniak commented Sep 19, 2024

These changes make sure all non initialized member variables detected by cppcheck are initialized in constructors.

The following command was used:

cppcheck src  -isrc/3rdparty --output-file=check.txt --inconclusive --enable=warning --library=Qt --check-level=exhaustive -j6

@luc-guyot-infomaniak luc-guyot-infomaniak marked this pull request as ready for review September 19, 2024 09:26
@luc-guyot-infomaniak luc-guyot-infomaniak requested a review from a team as a code owner September 19, 2024 09:26
@luc-guyot-infomaniak luc-guyot-infomaniak requested review from ChristopheLarchier, herve-er and ClementKunz and removed request for a team and herve-er September 19, 2024 09:39
@herve-er herve-er added the 4.0.0 label Sep 20, 2024
@herve-er herve-er added 3.6.7 and removed 4.0.0 labels Oct 1, 2024
Comment on lines +24 to +26
_time(0), _level(ErrorLevel::Unknown), _syncDbId(0), _exitCode(ExitCode::Unknown), _exitCause(ExitCause::Unknown),
_nodeType(NodeType::Unknown), _conflictType(ConflictType::None), _inconsistencyType(InconsistencyType::None),
_cancelType(CancelType::None) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not giving default values to all those variables in the header file?

Comment on lines +24 to +26
_type(NodeType::Unknown), _newPath(std::nullopt), _localNodeId(std::nullopt), _remoteNodeId(std::nullopt),
_direction(SyncDirection::Unknown), _instruction(SyncFileInstruction::None), _status(SyncFileStatus::Unknown),
_conflict(ConflictType::None), _inconsistency(InconsistencyType::None), _size(0), _dehydrated(false), _confirmed(false),
_timestamp(std::time(0)) {}
_conflict(ConflictType::None), _inconsistency(InconsistencyType::None), _size(0) {}
Copy link
Contributor

Choose a reason for hiding this comment

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

Those variables could be initialized in header file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants