-
-
Notifications
You must be signed in to change notification settings - Fork 965
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
Fix some errors uncovered via compiler warnings #7954
Conversation
``` OrcaSlicer/src/libslic3r/calib.cpp:456:17: warning: possibly dangling reference to a temporary [-Wdangling-reference] 456 | const auto &w = bed_ext.size().x(); OrcaSlicer/src/libslic3r/calib.cpp:456:45: note: the temporary was destroyed at the end of the full expression ‘((Eigen::DenseCoeffsBase<Eigen::Matrix<double, 2, 1, 2>, 1>*)(& Slic3r::BoundingBoxBase<PointClass>::size() const [with PointClass = Eigen::Matrix<double, 2, 1, 2>]()))->Eigen::DenseCoeffsBase<Eigen::Matrix<double, 2, 1, 2>, 1>::x()’ 456 | const auto &w = bed_ext.size().x(); ```
in this case I think it actually does not change the semantics it just means that both comparison have to be evaluated.
OrcaSlicer/src/slic3r/GUI/MediaPlayCtrl.cpp:392: warning: multi-character character constant [-Wmultichar] 392 | if (auto n = tunnel.find_first_of('/_'); n != std::string::npos) OrcaSlicer/src/slic3r/GUI/MediaPlayCtrl.cpp: In member function ‘void Slic3r::GUI::MediaPlayCtrl::Stop(const wxString&)’: OrcaSlicer/src/slic3r/GUI/MediaPlayCtrl.cpp:392: warning: overflow in conversion from ‘int’ to ‘char’ changes value from ‘12127’ to ‘95’ [-Woverflow]
Nice! |
@@ -389,7 +389,7 @@ void MediaPlayCtrl::Stop(wxString const &msg) | |||
} | |||
|
|||
auto tunnel = m_url.empty() ? "" : into_u8(wxURI(m_url).GetPath()).substr(1); | |||
if (auto n = tunnel.find_first_of('/_'); n != std::string::npos) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't even know c++ allows this!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I was also surprised this is allowed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks
* fix: tray_exist_bits != tray_exist_bits comparison * fix: title == GetTitle() == title comparison * fix: possibly dangling reference to a temporary ``` OrcaSlicer/src/libslic3r/calib.cpp:456:17: warning: possibly dangling reference to a temporary [-Wdangling-reference] 456 | const auto &w = bed_ext.size().x(); OrcaSlicer/src/libslic3r/calib.cpp:456:45: note: the temporary was destroyed at the end of the full expression ‘((Eigen::DenseCoeffsBase<Eigen::Matrix<double, 2, 1, 2>, 1>*)(& Slic3r::BoundingBoxBase<PointClass>::size() const [with PointClass = Eigen::Matrix<double, 2, 1, 2>]()))->Eigen::DenseCoeffsBase<Eigen::Matrix<double, 2, 1, 2>, 1>::x()’ 456 | const auto &w = bed_ext.size().x(); ``` * fix: mixup of | and || in this case I think it actually does not change the semantics it just means that both comparison have to be evaluated. * fix: multi-character character constants need " OrcaSlicer/src/slic3r/GUI/MediaPlayCtrl.cpp:392: warning: multi-character character constant [-Wmultichar] 392 | if (auto n = tunnel.find_first_of('/_'); n != std::string::npos) OrcaSlicer/src/slic3r/GUI/MediaPlayCtrl.cpp: In member function ‘void Slic3r::GUI::MediaPlayCtrl::Stop(const wxString&)’: OrcaSlicer/src/slic3r/GUI/MediaPlayCtrl.cpp:392: warning: overflow in conversion from ‘int’ to ‘char’ changes value from ‘12127’ to ‘95’ [-Woverflow] * fix: missing paranthesis - skips null check * NFC: Remove this check it can never be false * NFC: fix warning: statement has no effect
Fix some of the compiler warnings I was seeing while compiling the project with gcc 14.2.
Some things uncovered real bugs.